NCPU: Towards Cell-Inspired Spatial Computing

Iliya Zhechev, Piotr WalasarXiv 2026

TL;DR

Conway’s Game of Life can compute anything, provided a patient human painstakingly builds logic gates out of gliders by hand. This paper asks the inverse question: can a grid of identical cells learn a single, purely local rule via gradient descent to compute exact digital logic from scratch? By training Neural Cellular Automata (NCAs) on basic arithmetic, the authors discover that self-organizing cells don't just memorize answers—they spontaneously reinvent the ripple-carry wavefront used in silicon chips.

What Problem Does This Paper Address?

Cellular Automata (CAs) are grids of cells that update their states based only on their immediate neighbors. Neural Cellular Automata (NCAs) swap out hand-crafted rules for a tiny neural network shared identically by every cell. Historically, NCAs have been used for fuzzy, organic tasks like regenerating pixel-art lizards or classifying shapes, where local errors barely register.

Exact digital logic is a much harsher proving ground: a single flipped bit ruins the calculation, and an output bit on one side of a grid might depend on a chain reaction of carries starting far away on the other side. The authors explore whether a standard NCA—acting as a spatial "Neural Cellular Processing Unit" (NCPU)—can route signals across empty space and perform exact binary logic and arithmetic without global wiring or supervision of its internal steps.

Methods

The NCPU operates on a 2D grid where every cell holds 16 channels of values in $[-1, 1]$. Rather than encoding a bit in a single fragile pixel, each bit is represented as a circular cluster of cells (radius 4): $+1$ for logical high, $-1$ for low. Input bit clusters sit on the left of the grid (held constant in a read-only channel), and output targets sit on the right.

Spatial layouts for 4-bit adders comparing single-column and two-column operand arrangements.

At each timestep, every cell looks at a small local patch ($5\times5$ or $7\times7$ using Sobel filters) and updates its state asynchronously (50% fire rate per step). The authors train one model per task using a masked MSE loss that only checks the output discs during rollout frames—everything that happens in the empty middle ground is entirely up to the cells.

Crucially, they make one key tweak to the classic NCA recipe: they disable "alive masking." Normally, NCAs zero out inactive cells to keep patterns from exploding into empty space. Here, disabling it is essential; otherwise, the mask kills off the faint, intermediate cells needed to carry signals from inputs to outputs.

Datasets

Rather than external datasets, the models are trained and evaluated on synthetic binary truth tables generated uniformly at random for each specific digital circuit:

  • Single gates & small circuits: AND, OR, NAND, NOR, XOR, XNOR, 3-input Majority, and Half-adder.
  • Ripple-carry adders: 4-bit (256 total input pairs) and 8-bit (65,536 total input pairs) addition with carry-out.
  • Preliminary 8-bit ALU: Conditioned on a 3-bit opcode (supporting ADD, SUB, AND, OR, XOR, NOT, and bit-rotations) plus carry-in and condition flags.

Key Insights and Ideas

  • Emergent Ripple-Carry Waves: Without any temporal hints in the loss function, the 8-bit adder discovers sequential ripple-carry addition. Inspecting hidden channels reveals a physical wavefront starting at the least-significant bit and sweeping upward at ~3.5 timesteps per bit, holding higher bits neutral until the carry arrives. Silencing a single specific hidden channel leaves carry-free sums intact (88–90% accuracy) while completely breaking multi-bit carries (0–18%).
  • The $K=3$ Magic Number for Generalization: Adders trained on at least 3-bit numbers generalize nearly perfectly when tested on wider 8-bit numbers on the same grid. Adders trained on 2-bit numbers degrade steadily. Why? Two bits only have a start (LSB) and an end (MSB); $K=3$ is the smallest width with a middle bit, forcing the local rule to learn how to pass a carry through an intermediate stage.
  • Spatial Layout Dictates Learnability: Placing corresponding bits of operands $A$ and $B$ side-by-side in two columns (cols2) instead of stacked in one long column (cols1) speeds up 4-bit training by $2.6\times$—and makes the difference between 100% convergence and total failure on 8-bit addition.
Fig. 5: Length generalization results. Left: accuracy (%) for each training ceiling K and test bit width. Right: success (top) and failure (bottom) for a K=3 model on 8-bit input.

Key Results

  • Convergence & Exactness: Across 10 random seeds, 100% of logic gate and two-column adder models reach 100% batch accuracy. Linearly separable gates converge in $<55$ steps; XOR takes ~85; the 8-bit adder takes ~5,142 steps. In exhaustive testing over all 65,536 input pairs, trained 8-bit adders make at most 6 or 7 errors (99.99% exact).
  • Length Extrapolation: Models trained on $K \ge 3$ bits achieve $\ge 98\%$ bit accuracy when evaluated zero-shot on widths up to 8 bits.
  • Preliminary 8-bit ALU: In a single 600,000-step run, the ALU achieves 99.7% mean accuracy on the main 8-bit result byte across all eight operations, and 86.3% on branch-taken flags, though it fails to learn arithmetic carry-out under opcode conditioning (hovering near the 50% chance baseline for ADD/SUB).

Limitations and Future Work

  • Ephemeral Answers: The models compute the right sum within their trained time window (steps 64–128), but do not hold it as a stable attractor. Left running to 1,024 steps, the answers dissolve.
  • Compute & ALU Bottlenecks: One separate model is trained per circuit, and the ALU was limited to a single non-converged seed that struggled to sustain carry waves alongside opcode routing.

Future work aims to train stable fixed-point outputs that persist indefinitely, conduct multi-seed ALU evaluations, and explore richer perception kernels or dedicated carry channels.

Summary updated

Abstract

Simple cellular automata (CAs) can be computationally universal, but their rules are designed by hand. We train Neural Cellular Automata (NCAs), which learn a local update rule by gradient descent, to compute exact digital logic. Bits are encoded as clusters of cells on a 2D grid, and a result reaches the output only by propagating through intermediate cells. One model is trained per task: logic gates, 4- and 8-bit ripple-carry adders, and a preliminary 8-bit arithmetic logic unit (ALU). All gate and adder models reach 100% bit correctness in 10 of 10 seeds, and exhaustive tests over all input pairs find at most 1 error in 256 (4-bit) and 7 in 65,536 (8-bit). Adders trained on operands of up to 3 bits generalize to 8 bits. The adders propagate the carry as a wave, with a delay of about 3.5 steps per bit of the carry chain. Outputs are correct only within the trained rollout length.
BibTeX
@misc{zhechev2026ncpu,
  author = {Iliya Zhechev and Piotr Walas},
  title = {{NCPU: Towards Cell-Inspired Spatial Computing}},
  year = {2026},
  eprint = {2611.32750},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.32750},
}
Figure