Neural cellular automata / a hands-on prototype

Signals
take time.

One tiny rule, shared by every cell. What changes when a neighbor’s signal arrives late? Compare the same starting field with instant communication and distance-dependent memory. Then teach a small neural network the rule yourself.

Reference rule (handwritten)TICK 000 · PAUSED

Current neighbors

01 / baseline

Every active ring reads the field now.

READ S(t)Mean activation 0

Traveling signals

02 / delayed

Farther rings read progressively older fields.

READ S(t − d)Mean activation 0
−1 +1 · color = cell stateMean absolute difference: 0.0000Active radius: 1

Both panels use the same radius schedule.

Set to 0: both panels match exactly. Settings changes reset the clock.

A filled disk at +1; radius 5 starts with 81 cells. Compare the growing front over ticks 10–40. The random seed affects islands only.

Same seed + settings + rule = same run.

Look inside one update

How old is the news?

At t = 0, calculate S(1). These are the source times used by the next delayed update.

Each ring is a square perimeter: distance d is the larger of the horizontal and vertical offsets. All cells on the active rings are averaged together; larger rings contain more neighbors.

24 parameters / trained on your device

A little rule that learns.

Fit a 2 → 8 → 1 neural network to examples of the handwritten reference rule. The same learned weights then update every cell in both fields.

Ready. No training has happened yet.
One-cell reference · next state after one update
SelfNeighbor meanReferenceStudent (untrained)

Same input pair, two rules. Differences here can accumulate over many ticks. The reference is a handwritten formula supplying the training targets; the student is an approximation.

1,024 synthetic training pairs · 256 held-out pairs · Adam · 300 full-batch steps. This fits one-step updates, not a target image or a language model. Training restarts from the same initialization each time.

The exact experiment

Space, time, and a shared rule

mᵢ(t) = mean of Sⱼ(t − dᵢⱼ × delay)
Sᵢ(t+1) = clamp(Sᵢ(t) + f(Sᵢ(t), mᵢ(t)), −1, 1)

One clock, no turn-taking

The displayed field is S(t), starting at S(0). Each tick reads only complete saved fields and writes a separate next field. A nearby cell updated earlier in the loop cannot affect another cell in that same tick. The cell’s own state always comes from S(t).

Before the seed, silence

For every negative time, S(t) = 0. With delay 1, ring d reads S(t−d). A signal placed in S(0) first enters a distance-d update when t=d; its effect appears in S(d+1). The extra tick is the update itself. Delay 0 reads S(t), including at the first update.

The edges join up

The 48 × 48 grid wraps horizontally and vertically (a torus). Neighborhoods use wrapped offsets. Fixed mode uses radius R immediately. Expansion uses r(t) = min(R, t+1), starting at radius 1. Expansion is an independent neighborhood schedule, not a different definition of travel time.

What is learned?

A neural rule, a modest task

The reference rule supplies the training targets

Its residual update is 0.22(m−s) + 0.12s(1−s²): neighbors encourage mixing, while local growth pushes values toward positive or negative saturation. Initial fields and colors are also designed, not learned.

The student really adjusts its weights

The student uses eight tanh hidden units, a linear output, and no biases: 24 weights in total. Gradient descent with Adam minimizes mean squared error against the reference rule’s residual on random (self, neighbor-mean) pairs in [−1,1]². A separate seeded sample reports held-out error. No biases means an all-zero input stays exactly zero.

Learning the rule is not learning the whole future

The network does not train through multiple simulation ticks or learn how to compensate for delay. Small one-step errors can accumulate. Changing the signal history changes the dynamics, so the delayed system is not mathematically equivalent to an ordinary current-neighbor cellular automaton. Clamping guarantees bounded states, not correct long-term behavior.

Try a controlled comparison

Choose Positive pulse with seed radius 5 and neighborhood radius 3. Step once: at delay 1 the delayed panel has no received seed signal yet. Then run to ticks 10–40: the activated patch spreads, with the delayed front trailing the baseline. The panel counts cells at state ≥ 0.1 using the same fixed threshold in both fields. Train the student and repeat; its front differs because training fits only one-step updates. Set delay to 0 to check exact agreement. A radius-0 seed is a one-cell diagnostic that fades almost to zero; it is not the recommended propagation example. This is a growing patch, not a sustained oscillating wave: eventually a positive seed can fill the periodic grid with near-uniform activation.