Neural Cellular Automata (NCA)
Neural cellular automata (NCA) apply one small learned rule in every cell of a grid, so patterns grow, repair damage, and segment images locally.
Neural cellular automata (NCA) are deep learning models in which a grid of cells repeatedly updates itself with one shared, learned local rule. Each cell stores a vector of numbers and sees only its immediate neighbors, yet after many updates the grid as a whole can grow an image from a single seed, regrow parts that are cut away, synthesize a texture, or label every pixel of a scan. Alexander Mordvintsev, Ettore Randazzo, Eyvind Niklasson, and Michael Levin popularized the approach in the February 2020 Distill article Growing Neural Cellular Automata, which trained a rule with about 8,000 parameters to grow and maintain an emoji.
How Neural Cellular Automata Work#
A cell usually corresponds to a pixel, or to a voxel in 3D. In the growing NCA, its state has 16 channels: red, green, blue, an alpha channel that marks living cells, and 12 hidden channels the cells use to coordinate. At each step, every cell perceives its 3 x 3 neighborhood through fixed filters, its own values plus horizontal and vertical Sobel gradients of every channel, giving a 48-number perception vector. A small neural network, the same in every cell, turns that vector into an update that is added to the cell's state. Updates fire at random, each cell with probability 0.5 per step, so the rule cannot rely on a global clock, and cells with no living cell in their 3 x 3 neighborhood are reset to zero. Written as a convolution for perception and two 1 x 1 convolutions for the rule, one update step runs on the whole grid at once:
import torch
import torch.nn.functional as F
from torch import nn
torch.manual_seed(0)
start = torch.rand(1, 16, 33, 33, requires_grad=True) # 16 channels per cell: RGBA plus 12 hidden
# Fixed perception: each channel's value plus its Sobel x and y gradients
sobel = torch.tensor([[-1.0, 0, 1], [-2, 0, 2], [-1, 0, 1]]) / 8
identity = F.pad(torch.ones(1, 1), (1, 1, 1, 1))
kernels = torch.stack([identity, sobel, sobel.T]).repeat(16, 1, 1).unsqueeze(1)
# Learned rule: the same 48 -> 128 -> 16 network runs in every cell as 1x1 convolutions
rule = nn.Sequential(nn.Conv2d(48, 128, 1), nn.ReLU(), nn.Conv2d(128, 16, 1))
print(f"Update rule: {sum(p.numel() for p in rule.parameters())} parameters")
state = start
for step in range(8):
perception = F.conv2d(state, kernels, padding=1, groups=16)
fire = torch.rand(1, 1, 33, 33) < 0.5 # each cell updates at random half the time
state = state + rule(perception) * fire
# Which starting cells can influence the center cell after 8 steps?
state[0, :, 16, 16].sum().backward()
influence = start.grad[0].abs().sum(dim=0) > 0
rows, cols = influence.any(dim=1).sum().item(), influence.any(dim=0).sum().item()
print(f"After 8 steps the center cell depends on a {rows} x {cols} patch")It prints Update rule: 8336 parameters, matching the original growing NCA, and After 8 steps the center cell depends on a 15 x 14 patch. Information moves at most one cell per step, so 8 steps of 3 x 3 neighborhoods allow at most a 17 x 17 patch, and cells that skipped a random update did not pass information along that step. Iteration is how the receptive field grows. Ultralytics YOLO26 widens its view by downsampling instead: five stride-2 convolutions turn a 640 x 640 image into a 20 x 20 grid on its coarsest detection scale in one forward pass, where an NCA with 3 x 3 neighborhoods needs 320 steps to carry a signal from the center of a 640-cell-wide grid to its edge.
How NCA Learn Growth and Regeneration#
Training unrolls the rule for dozens of steps from a seed, compares the final grid with the target image using a loss function, and runs backpropagation through every step, the same backpropagation through time used for recurrent networks. The final layer of the rule starts at zero, so training starts from an update that changes nothing.
A rule trained only to reach the target at one moment often lets the pattern decay or overgrow afterward. The growing NCA fixed this with a pool of 1,024 states: each training batch is drawn from the pool, its worst-scoring sample is replaced with a fresh seed, and the results are written back, so the rule learns to keep an already grown pattern stable. Erasing random circles in some samples before each training step teaches regeneration, because the surviving cells must regrow what is missing.
Applications in Graphics and Vision#
Texture synthesis is a common use. In the 2021 Distill article on self-organizing textures, cells evolve into a pattern whose feature map statistics in a pretrained image network match a reference image, the same appearance loss used in neural style transfer. Houdini's neural cellular automata tools bring this into production graphics, generating tileable patterns with per-cell control over rotation, scale, and which cells keep updating.
NCA can also compute. In self-classifying MNIST digits, each pixel of a handwritten digit is a cell, and the cells agree on the digit's class by exchanging messages, an unusual form of image classification that keeps working as the digit is redrawn. In medical image analysis, Med-NCA applies the same local rule to image segmentation, where cells read an MRI scan and evolve a pixel-level mask of the hippocampus or prostate; the model is 500 times smaller than a U-Net, scores 2% to 3% higher Dice, and runs on edge AI hardware as modest as a Raspberry Pi.
Related Concepts and Limitations#
NCA extend classical cellular automata such as Conway's Game of Life by learning the transition rule instead of writing it by hand. They also resemble recurrent neural networks, since the same computation repeatedly updates a persistent state, with the difference that the state is spread across locally interacting cells. A small rule does not make inference cheap: distant cells coordinate only after many steps, larger grids multiply the work, and training stores activations for every unrolled step, a memory cost that gradient checkpointing trades for recomputation.
Orientation is another weakness. The Sobel filters fix horizontal and vertical directions, so rotating a grown pattern disrupts its later evolution. Isotropic NCA remove this dependence by making each cell's perception independent of the grid's orientation.










