neural-cellular-automaton

where neural networks meet cellular automata in self-organizing computational structures

A learned rule, not a lookup table

A classical cellular automaton maps each neighbourhood to a next state through a fixed table. A neural cellular automaton replaces that table with a small network shared by every cell. Here each cell reads the binary states of its eight Moore neighbours, runs them through a stack of dense layers, and thresholds the first output channel to decide whether it lives or dies. From this purely local rule, iterated across the toroidal grid, global texture grows and shifts.

an(l)=ϕ ⁣(bn+iai(l1)wni(l)),s=1[a0(L)>0.5]a^{(l)}_n = \phi\!\left(b_n + \sum_i a^{(l-1)}_i\, w^{(l)}_{n i}\right), \qquad s' = \mathbb{1}\big[a^{(L)}_0 > 0.5\big]

Local learning, no global target

Unlike the trained Growing-NCA of Mordvintsev and colleagues, this grid is not optimised by backpropagation to draw a target image. Its weights drift through a local Hebbian rule, strengthening connections between co-active units, optionally perturbed by a random mutation mask. Order, where it appears, is emergent rather than fitted. The reported fitness readouts (complexity, stability, oscillation, diversity) describe the grid; they do not steer it.

The only stochastic ingredients are the random initial weights and the mutation mask. Between a fixed neighbourhood and fixed weights, the update is fully deterministic, which is exactly what the calibration panel pins down.

Generating model

claude opus 4.8August 2025·first cut. a grid of cells, each running a small feedforward network over its eight Moore neighbours, with a hard alive threshold, local Hebbian plasticity, optional mutation, and four descriptive fitness readouts. the deterministic forward-pass core (affine, activation, threshold, complexity density) is factored out as pure functions and pinned by a five-case calibration suite.

Calibration

These cases pin the deterministic forward-pass core against hand-computed values. Each predicted number is produced by the same activation, layer, and threshold functions the live grid uses, so the suite tests the running arithmetic rather than restating constants.

Assumptions

Model changelog

v1.0August 2025
  • per-cell network: nine Moore-neighbour states feed a stack of dense layers (bias plus weighted sum, then a chosen nonlinearity); the first output channel thresholded at 0.5 sets the next discrete state.
  • activation choices: sigmoid, tanh, ReLU, and leaky ReLU, shared verbatim between the live class and the calibration suite.
  • local plasticity: a Hebbian rule (rate times output times input) with weight clipping, plus an optional random mutation mask on weights and biases.
  • toroidal Moore neighbourhood with wrap-around indexing, so every cell has exactly eight neighbours and no boundary.
  • descriptive fitness readouts (complexity, stability, oscillation, diversity) reported live as densities, not optimisation targets.
  • pure deterministic core (activate, denseLayer, forwardPass, stateFromOutput, complexityDensity) extracted so the update arithmetic can be hand-checked.
  • calibration: five hand-computed cases (sigmoid midpoint, tanh identity, ReLU clipping, alive threshold, complexity density) reproduce at zero error.