Manuscript Offprint
arXiv:2610.085182D Spatial Reasoning with Adaptive Neural Cellular Automata
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
ABSTRACT
Many modern learning approaches are still struggling with spatial reasoning tasks, i.e. they lack the ability to utilize geometric information of perceived entities and their spatial relation to each other to solve problems. We introduce a novel Adaptive Neural Cellular Automata (aNCA) architecture which replaces the static and spatially invariant perception of standard NCAs by learnable, spatially variant and data-adaptive perceptive fields. We show that this conceptual change enables NCAs to iteratively reason over 2D spatial relations on grid-like data structures (e.g. images). Empirical results on public benchmarks show state of the art comprehensible results with high generalization abilities for solving image based puzzles like Sudoku or finding the shortest path in a maze.
The implementation and all experimental setups are openly accessible as an extension to the NCAtorch framework at https://github.com/mspitzna/NCAtorch.
1 Introduction
Spatial reasoning is the ability to mentally visualize, manipulate, and functionally relate 2D and 3D objects, as well as to understand the relationships between parts, positions, and movements of one or more objects in physical space. It is a key cognitive skill used for navigation, problem-solving, engineering, and designing [1, 2]. Despite its high practical impact, spatial reasoning skills are generally still underdeveloped in most current learning models [3, 1].
In contrast to the recently emerging work on “World Models” [4], which try to learn to model complex relations in a top-down fashion, we are following a bottom-up approach which tries to isolate spatial reasoning problems in controlled environments. The focus of our proposed method lies on the also open sub-problem of spatial reasoning on 2D grid structures with a fixed x, y-coordinate system, for which we introduce a novel architecture based on Neural Cellular Automata [5]. Following the DISE [2] schematic of spatial reasoning taxonomies, our proposed aNCA architecture is specifically targeting 2D Extrinsic-Static problems, that assess the relationships between multiple objects in a fixed scene (like finding the shortest path in 2D mazes [6]) and Extrinsic-Dynamic reasoning tasks, that involve reasoning about the changing spatial relationships between multiple objects (like solving Sudoku [7]).
The key contributions of this paper can be summarized as follows:
• We are the first to apply the concept of learnable CA to spatial reasoning tasks, introducing Adaptive Neural Cellular Automata (aNCA). For this purpose we move from the space- and time-invariant update rules in traditional NCA to a more powerful and flexible input-dependent, space- and time-variant regime, and show that this significantly boosts spatial reasoning performance
-
The inherent recursive nature of aNCA enables us to learn very small, yet competitive and highly generalizable models that are able to infer diverse solutions to ambiguous problems. Visualizing the learned perceptive fields allows us to make the reasoning of spatial relations interpretable.
-
aNCA results surpass current state-of-the-art 2D spatial reasoning methods on various public benchmarks, including Sudoku, image-based Sudoku and maze shortest-path finding.
Cognitive Frameworks and Taxonomies. To diagnose these systematic failures, recent literature has adopted cognitively grounded taxonomies. The DISE framework [2] categorizes spatial tasks into a matrix based on Intrinsic vs. Extrinsic properties and Static vs. Dynamic environments. While models are proficient in static settings, they exhibit a high failure rate in tasks requiring dynamic mental simulation, primarily due to deficits in “spatial working memory” and an inability to apply basic geometric axioms.
Architectural Inductive Biases. Traditional architectures often lack the structure for relational reasoning. To address this, Relation Networks (RNs) were introduced to explicitly compute pairwise relations between all objects in a set [8]. For more complex scenes, Scene Graph Neural Networks (SGNNs) represent environments as structured graphs where nodes denote objects and edges represent their relationships, utilizing message-passing to propagate context [9, 10]. More recently, mechanisms for Vision Transformers (ViTs), such as Context-Aware Gating (CAG) in the Spatial Decay Transformer (SDT), inject data-dependent spatial decay into self-attention to selectively focus on semantically relevant regions while maintaining a locality bias [11, 12].
General Spatial Benchmarking. No generally accepted closed-form definition reduces spatial reasoning ability to a single numerical score. Evaluation therefore relies on proxy problems that isolate particular spatial capabilities; designing such benchmarks is itself an active field of research, and their results provide task-specific rather than universal measures [2]. Benchmarking spatial reasoning abilities has transitioned from early synthetic 2D/3D datasets like CLEVR [13] and GQA [14] to complex 3D and multi-hop scenarios. Benchmarks such as StepGame [15] and SpartQA [16] test multi-step logical inference in text and vision. For 3D awareness, 3DSRBench [17] and Ego3D-Bench evaluate robustness across varying camera viewpoints, while SITE [18] and OmniSpatial [19] provide comprehensive evaluations across diverse spatial factors including figural and environmental scales. SpatiaLQA emphasizes “spatial logical reasoning” within open-vocabulary indoor environments [20].
Spatial Reasoning on 2D (Grid) Data. While most of the previous benchmarks focus on spatial reasoning in 3D scenes (or 3D→2D projections of these), there is a growing body of recent works that focus on pure 2D spatial reasoning: e.g. [7] introduced spatial reasoning with SRN Diffusion Models which operate on images. Another line of work proposed to solve 2D reasoning with Hierarchical Reasoning Models (HRM) [6], an approach which has recently been extended by ItrSA++ [21] and TRM [22].
Benchmarks for 2D Spatial Reasoning. 2D tasks not only provide simpler spatial reasoning problems which allows the study of novel approaches more easily, but also have several practically relevant benchmark applications like solving Sudoku on images of handwritten digits [7], finding the shortest path in a maze [6] or finding spatially local solutions with global constraints [7].
We compare aNCA with state-of-the-art SRM [7], HRM [6], and TRM [22] on the tasks introduced in section 3.
2 Neural Cellular Automata
Originating from the seminal work of John von Neumann [23], Cellular Automata (CA) are discrete computational systems studied since the 1940s. Typically, a CA is defined on a regular, finite grid G composed of discrete cells. At each time step t, every cell i maintains a discrete state . The system's evolution is governed by the synchronous application of a rule set R across all cells, where the subsequent state is derived from the local neighborhood such that [24]. This process is illustrated in Figure 1.
CAs gained significant prominence in the 1970s via Conway's "Game of Life" [25], a 2D CA utilizing binary states and neighborhood rules. CAs have proven effective in modeling diverse phenomena in biology [26, 27, 28], chemistry [29], and physics [30, 31]. Furthermore, their status as a universal model of computation was confirmed by the proof of Turing Completeness [32] for specific configurations. These developments

Figure 1: Sketch of a basic 1D Cellular Automaton with three discrete states and seven update rules , which operate on the sum over a 3-cell neighborhood . a) shows the inference of complex patterns from an initial state by the rules visualized in b) over time.
underpinned Stephen Wolfram’s “A New Kind Of Science” [33], which posited that complex scientific problems might be better characterized by simple recursive programs like CAs than with differential equations.
Traditional CA models, such as those discussed in [33], [25], and [23], utilize manually defined rule sets. While these rules can be enumerated combinatorially for a given state space S and neighborhood size , the search space expands exponentially; for instance, a binary 2D CA with a neighborhood already permits possible rules. To address this complexity, [5] proposed learning rules from data, introducing Neural Cellular Automata (NCA). In this framework, handcrafted rules are replaced by an artificial neural network with learnable parameters . The update step is expressed as:
Since is applied identically to every position (spatial invariance), [5] utilized “nested” Convolutional Neural Networks (CNNs) [35] for efficient implementation. Here, convolutional filters function as learnable local rules over kernel-defined neighborhoods. This architecture is depicted in Figure 2. While [36] established the theoretical equivalence between CA and such CNNs, most NCA models depart from tradition by employing continuous vector-valued states rather than discrete ones.
Initial work by [5] demonstrated robust self-organization and classification using single-layer convolutional NCAs. This has since expanded into more expressive architectures: [37] applied larger CNNs for segmentation, [38] introduced attention-based variants and [39] real-time dynamic texture synthesis using NCAs. Furthermore, NCAs have been integrated with GANs [40], VARs [41], and diffusion models [42] for generative tasks, while [43] extended the paradigm to graph-structured data. Due to their inherent spatial structure, NCAs intuitively appear to be well suited for (2D) spatial reasoning tasks. However, to the best of our knowledge, this has never been attempted before.

Figure 2: Sketch of a basic CNN implementation [34] of a 2D NCA with a 3D state space. The perception module processes the cell state using one of several configurable perception options. The update module processes the perceived features to compute state updates. Stochastic updates are applied before updating the visible and hidden channels to form the new cell state for the next iteration. The sample pool is used after one batch of images is processed to retain and reuse evolved states for subsequent training iterations.
2.1 NCA Perception Modules
Building on eq. (1), we follow the notation from [34] and factor the learnable update rule into two distinct sub-modules: a perception module and an update module , and re-formulate the NCA iteration as:
The perception module determines how each cell reads information from its neighborhood and therefore controls the effective receptive field and communication structure of the automaton, while the update module transforms the perceived features into the state increment applied to the cell. In our implementation, the cell state is first concatenated channel-wise with the task condition and, when enabled, fixed positional embeddings. The resulting tensor is processed by one or more perception branches operating in parallel; their outputs are concatenated and passed to a shared convolutional update network that predicts the state increment. Because we keep , the cell-state structure, and the training protocol fixed across experiments, any difference in task performance can be attributed to the inductive bias of . Figure 2 illustrates how these components interact within a single NCA step. In the remainder of this section we describe three perception variants: standard convolution (e.g. or ), dilated convolution and a Sudoku-specific constraint-aligned variant that combines row, column, and -box convolutions.
Standard convolution. Our baseline perception is a single learnable convolution layer with 128 kernels and leaky-ReLU activation and circular padding, following the original formulation of [5]. Each cell's receptive field is therefore limited to its immediate neighbors per step, and longer-range dependencies must be built up recurrently.
Dilated Convolutions. We propose dilated convolutions [44] as an NCA perception module for spatial reasoning tasks requiring long-range communication. A dilated kernel with rate samples a grid region at no extra parameter cost, directly enlarging the per-step receptive field. In the NCA setting, fewer iterations are needed to propagate information across the grid, which is a particularly effective inductive bias for tasks where constraints span the entire grid.
Manually Constraint-Aligned Convolutions. For tasks whose constraint structure is known a priori, we propose to integrate that structure manually into the perception module itself rather than asking the NCA to discover it over many iterations. For Sudoku in particular, every valid solution must satisfy three constraint families, one per row, column, and box, each of which spans an entire "unit" of the grid. We therefore combine three parallel perception branches whose kernels match the shapes of these units: a row convolution, a column convolution, and a structured box perception that aggregates the other cells in each box.
2.2 Training NCA
Following [34], we train the NCA by unrolling the update rule for a randomly sampled number of steps and comparing the resulting state to the target output under a task-specific objective. For conditional tasks such as Sudoku and maze solving, each cell is initialized from the puzzle input and conditioned on the same input throughout the rollout, so that the observable evidence remains available at every step. Gradients are backpropagated through the full unrolled trajectory. To further encourage temporal stability, we adopt the sample pool strategy of [5]: a fraction of each mini-batch is initialized from previously evolved states drawn from a fixed-size buffer rather than from fresh seeds, and the newly evolved states are written back into the pool after each training step. This persistent-state regime exposes

Figure 3: The four 2D spatial reasoning tasks evaluated in this work. Each column shows the input (top) and target (bottom).
the update rule to intermediate configurations far from the initial seed and discourages it from collapsing or diverging on longer rollouts, which is essential for tasks that require many iterations to propagate information across the grid. Full hyperparameter details for each task are listed in sections A.3.1, A.5.1 and A.6.1 in the Appendix.
3 Spatial Reasoning with NCA
To the best of our knowledge, we are the first to propose the use of NCAs for (2D) spatial reasoning tasks. We cast each spatial reasoning task as a recurrent computation on a 2D grid G, solved by the NCA defined in eq. (1). All tasks share the same architecture, optimizer, and sample-pool training regime: we unroll for steps, optimize with AdamW under gradient clipping, and concatenate the condition channel-wise into the cell state at every step. Because high-difficulty Sudoku puzzles admit many valid completions, path-finding admits shortest-path ties, and the color-balance task has no per-pixel supervision, we use constraint-based objectives that reward any valid output. The four tasks, illustrated in fig. 3, use established benchmarks from prior work.
Sudoku. We use the one-million-puzzle dataset of [7], generating puzzles on the fly by masking cells at a configurable difficulty; a held-out set of solutions is never seen during training. Each cell carries visible digit channels and the condition marks clue cells. The objective exploits the puzzle's constraint structure: letting be the softmax probability of digit at cell , we penalize the squared deviation of per-digit unit sums from one across all rows, columns, and boxes, rewarding any structurally valid completion independently of which specific digits the NCA commits to. Training hyperparameters, loss details, and computational cost are provided in section A.3.
MNIST Sudoku. We reuse the same solutions and split, rendering each cell as a handwritten glyph drawn from MNIST to give a image where each tile is blank or carries a digit. The condition is a binary pixel mask over given cells. End-to-end NCA training exposed a trade-off: rollouts either produced crisp MNIST glyphs without satisfying Sudoku constraints, or satisfied constraints while letting glyphs drift. We therefore train a separate Sudoku codec (fig. 4): a frozen encoder maps a pixel Sudoku to a digit-logit grid and a frozen decoder renders a board back to pixels via a conditional VAE with a style latent. The NCA operates entirely in board latent space under the same constraint objective as the array variant, with per-digit probabilities supplied by a frozen MNIST-CNN applied to the decoded tiles rather than read from raw digit channels. Codec architecture, training details, and an isolation evaluation of encoder and decoder accuracy are provided in section A.4.
Maze solving. We use the maze dataset of [6] (1K train, 1K test), with shortest-path targets. The condition encodes walls, start, and goal. The target is a binary shortest-path mask. Since walls are trivially predictable from the condition, the loss is restricted to non-wall cells and combines a Dice term (handling path/non-path imbalance), a BCE term (encouraging binary commitment), and a normalized length penalty . Training hyperparameters and loss details are provided in section A.5.
Global color balance. We adapt the global-constraint task of [7] to black-and-white pixels. Starting from a randomly biased binary image, the NCA must fill an unconditioned grid to realize a prescribed black/white ratio (e.g. 50/50),

Figure 4: Latent pixel Sudoku pipeline. The encoder maps the initial handwritten Sudoku image into a grid of digit logits, the NCA iterates in this latent board space under the Sudoku constraint loss until a valid completion emerges, and the decoder renders the final board back to pixels. Freezing and decouples perception from reasoning and allows different NCA variants to be evaluated within the same image-space pipeline.
with no per-pixel supervision. The objective combines a count term pushing the global color mean toward the target ratio and a saturation term that zeroes only at fully committed pixel values. Training hyperparameters and loss details are provided in section A.6.
4 Adaptive Neural Cellular Automata (aNCA)
We propose Adaptive Neural Cellular Automata (aNCA), which extend the reasoning abilities from learned space- and time-invariant update rules of traditional NCA to a more powerful and flexible input-dependent, space- and time-variant regime. We achieve this significant change in NCA capabilities through a multi-head perception module based on DCNv2 deformable convolutions [45, 46], which instantiates the NCA framework of eq. (2) as perception module and allows the effective neighborhood N to adapt across grid positions and NCA steps. Figure 5 illustrates the architecture: fig. 5a contrasts the fixed sampling patterns of the perception variants above against the adaptive sampling of the proposed deformable perception, fig. 5b shows the full single-step aNCA computation graph. The deformable perception module is formalized below.

(a) Fixed vs. adaptive perception patterns.
(b) aNCA single-step computation graph.
Figure 5: (a) Comparison of perception sampling patterns: standard , dilated, constraint-aligned, and deformable convolution. (b) One aNCA update step: the perception module predicts offsets and modulations from , which guide the deformable convolution to aggregate features from adaptive grid locations. The update module then produces the next state .
Adaptive Perception via Deformable Convolutions. Unlike dilated convolutions, which fix the neighborhood geometry at initialization, deformable convolutions [45] augment each kernel tap with a learned, position-dependent spatial offset. Rather than committing to a fixed sampling pattern, the model learns which positions each cell should attend to, depending on the current input. This allows it to discover long-range constraint structures from data without explicit apriori modeling of these structures. Concretely, a standard convolution at grid position p reads
where enumerates the fixed kernel positions and are learnable weights. We use the DCNv2 variant [46], which augments each kernel position with both a spatial offset and a learned modulation scalar , each predicted by a separate auxiliary convolution applied to . Its difference from the offset-only DCNv1 variant is detailed in section A.2.1. Fractional positions are resolved by bilinear interpolation:
The modulation scalar allows each kernel position to be suppressed or amplified independently, giving the model additional flexibility beyond the spatial offset alone. We stack deformable branches in parallel as , producing offset and modulation values per cell per step. Different heads can thereby specialize to complementary constraint directions. Because the learned offsets are explicit and inspectable, we can directly audit which spatial relations the NCA has discovered. In Section 5.1 we show that the three heads learn sampling patterns that align with Sudoku's row, column an box constraints, without encoding this explicitly in the architecture.
Our approach significantly differs from the "deformable convolution" implemented in in the NCATorch framework of [34] - there a single deformable convolution based on [45] has been (unsuccessfully) used for generative tasks and is not identical with our formulation (which is based on [46]. In Contrast to [34], our per-tap modulation lets a cell suppress or amplify individual sampling positions rather than only displace them. This allows different heads to specialize to complementary constraint directions, which is critical for spatial reasoning.
5 Empirical Evaluation
5.1 Solving Sudoku on Array Representations
We evaluate on the held-out test split of the SRM Sudoku dataset [7], grouping puzzles by difficulty into Easy (1–27 removed cells), Medium (28–54), and Hard (55–81) buckets. Two metrics are reported per bucket: the Average Solve Rate (ASR), the fraction of test puzzles whose final NCA state is a valid Sudoku completion of the given clues, and the Average Cell Precision (ACP), the fraction of non-clue cells whose predicted digit is consistent with a valid completion. Because high-difficulty puzzles often admit several valid completions, ASR is the primary metric.
Table 1 compares the perception variants at matched cell-state size and network capacity, reporting mean and standard deviation over four training runs each. All variants solve Easy and Medium puzzles near-perfectly, so the evaluation performance is decided on the Hard buckets, where aNCA leads on both metrics while remaining comparable in parameter count. The aNCA performance gain can not be explained by receptive-field size or capacity: i.e. enlarging the fixed kernel beyond does not increase the performance, and variants even perform worse on Hard despite using more parameters then aNCAs. The variant is also markedly unstable across seeds ( on Hard), whereas the smaller fixed kernels are reproducible.
Table 1: Sudoku on the array representation, reported as mean standard deviation over four training runs per perception. Best Hard-bucket ASR/ACP in bold.
| Perception | Easy [1, 27] | Medium [28, 54] | Hard [55, 81] | Param. | |||
|---|---|---|---|---|---|---|---|
| ASR | ACP | ASR | ACP | ASR | ACP | ||
| NCA w. 3x3 Conv. | 100 ± 0 | 100 ± 0 | 86.35 ± 1.00 | 98.85 ± 0.13 | 78.23 ± 1.84 | 98.63 ± 0.10 | 50k |
| NCA w. 5x5 Conv. | 100 ± 0 | 100 ± 0 | 87.47 ± 1.65 | 98.93 ± 0.12 | 75.03 ± 8.38 | 96.27 ± 4.05 | 105k |
| NCA w. 7x7 Conv. | 100 ± 0 | 100 ± 0 | 82.70 ± 1.62 | 98.43 ± 0.21 | 76.95 ± 2.07 | 98.43 ± 0.15 | 189k |
| NCA w. 9x9 Conv. | 100 ± 0 | 100 ± 0 | 71.58 ± 18.82 | 95.88 ± 4.41 | 39.80 ± 37.15 | 84.95 ± 19.71 | 300k |
| NCA w. R/C/B Conv. | 100 ± 0 | 100 ± 0 | 87.38 ± 2.64 | 98.90 ± 0.22 | 78.18 ± 2.81 | 98.58 ± 0.19 | 145k |
| NCA w. Dilated Conv. | 100 ± 0 | 100 ± 0 | 86.98 ± 1.64 | 98.88 ± 0.17 | 77.23 ± 10.43 | 98.48 ± 0.67 | 150k |
| NCA w. DCNv1 | 99.9 ± 0.14 | 100 ± 0 | 75.78 ± 6.93 | 97.75 ± 0.7 | 64.55 ± 10.43 | 97.5 ± 0.58 | 159k |
| aNCA | 100 ± 0 | 100 ± 0 | 89.50 ± 4.66 | 99.08 ± 0.40 | 87.78 ± 6.74 | 99.18 ± 0.46 | 165k |
Visualizing Learned Spatial Relations. A central appeal of the adaptive perception module is that the predicted per-cell offsets are themselves interpretable: for every Sudoku cell position at every timestep, they allow to reconstruct to which other cells the model learned to attend. We exploit this to ask whether the adaptive perception learns Sudoku's row, column, and -box constraint graph from data, despite this is never explicitly modeled. For each test puzzle we run the trained NCA for the standard rollout horizon and record every head's tap offsets at the final step. Fixing one source cell on the board, we then aggregate where the nine taps of each head end up sampling from that cell across held-out testset puzzles. Figure 6 shows the result as one heatmap per head, for two interior source cells ((3, 3) at the intersection of the top-left box with the center box, and (4, 4) at the center of the board).
Dashed rectangles overlay the source cell's row, column, and box, so the reader can directly compare the learned hot cells against Sudoku constraints. Across both positions and all heads, the heat concentrates inside those three rectangles. The heads also specialize, with different deformable convolutions preferring the row, column, or box direction, so that together they cover the full constraint graph of the source. Quantitative alignment scores are reported in table 7.
Deformable sampling reach from source cell (3, 3)

(a) Source cell (3, 3).
Deformable sampling reach from source cell (4, 4)

(b) Source cell (4, 4).
Figure 6: Learned sampling reach of each deformable perception head from two interior source cells (black-bordered squares at grid positions (3, 3) and (4, 4)). Each panel is one head: the heatmap shows the fraction of the head's total sampling weight placed on every cell of the board, aggregated over held-out test puzzles at the final NCA step. Dashed overlays mark the source cell's row (green), column (orange), and box (purple). The learned heat concentrates inside these overlays and the three heads specialize to complementary constraint directions.
5.2 Solving Sudoku on Images
We extend the perception comparison to the image-level Sudoku task, in which each cell is rendered as an MNIST-style digit glyph [7]. The NCA operates in the latent board space defined by the frozen encoder–decoder pipeline of fig. 4. Held-out splits, difficulty buckets, and metrics are reused, with ASR evaluated with a frozen MNIST classification CNN on the decoded pixel image. We further compare against the two image-space Sudoku solvers released with the dataset [7]: a 118M-parameter diffusion model and SRM at the same capacity. Unlike these end-to-end baselines, our pipeline decouples digit recognition from constraint reasoning via the frozen codec. This modularity potentially allows the same reasoner to operate on any object encoding for which a codec maps inputs to the board representation. Codec isolation accuracy is reported in section A.4.3. Table 2 reports the results. aNCA surpass both reference models on every difficulty bucket while using fewer parameters. Among the NCA variants themselves, the ordering matches the array task, with aNCA ahead on Medium and Hard. The parameter column lists the shared codec and the NCA separately. The reported NCAs are the exact checkpoints evaluated in table 1 on the array task.
Table 2: MNIST Sudoku. Results in ASR (Average Solve Rate), reported as mean ± standard deviation over four training runs. Best Hard-bucket ASR in bold. Per-bucket ACP is reported in table 9.
| Method | Easy [1, 27] | Medium [28, 54] | Hard [55, 81] | Param. |
|---|---|---|---|---|
| Diffusion Model | 99.4 | 53.6 | 0.8 | 118M |
| SRM | 99.8 | 75.4 | 51.6 | 118M |
| NCA 3x3 Conv. | Codec + NCA | |||
| NCA 5x5 Conv. | ||||
| NCA 7x7 Conv. | ||||
| NCA 9x9 Conv. | ||||
| NCA R/C/B Conv. | ||||
| NCA Dilated Conv. | ||||
| NCA DCNv1 | ||||
| aNCA |
Predicted Solutions

(a)
Sudoku Seed
Predicted Solutions
(b)
Figure 7: Output diversity of the Sudoku codec. (a) For an underconstrained clue pattern with at least valid completions, repeated stochastic NCA rollouts produce multiple distinct valid solutions. (b) For a puzzle with a unique solution, resampling the decoder style latent preserves the solved board while varying the digit style.
Output Diversity. Highly underconstrained Sudoku puzzles admit many valid completions, so matching the dataset target is neither necessary nor desirable. Sampling the same NCA 1000 times on a puzzle with at least valid completions yields valid completions in 997/1000 rollouts and 303 distinct boards (fig. 7a). For a puzzle with a unique solution, resampling produces identical boards but varied digit stroke styles (fig. 7b).
5.3 Solving Maze Puzzles

(a)
(b)
Figure 8: (a) Maze solving: the model receives walls (black), start (green), and goal (red). Blue cells indicate correct path predictions matching the target; yellow cells are predicted path pixels that deviate from the target. (b) Generalization to unseen Prim-style maze structures.
We evaluate on the mazes described in section 3 and report two graph-level metrics: Valid Path, the fraction of predictions that connect start and goal without crossing walls, and Valid Optimal, the fraction whose path length matches the shortest-path target.
Table 3 shows that purely local perception is insufficient: the NCA almost never forms a complete path. Enlarging the communication radius closes much of this gap, with dilated perception reaching optimality. Adaptive NCAs perform best, producing valid paths for of mazes and optimal paths for , surpassing HRM, ItrSA++ and TRM-Att while using fewer parameters. The R/C/B variant also transfers well despite being designed for Sudoku, but trails deformable perception, suggesting that content-adaptive routing is more useful than a fixed constraint geometry on mazes. Same-resolution transfer to a procedurally distinct maze distribution is reported in section A.5.3.
5.4 Learning to Adhere Global Constraints
The color-balance task tests whether the NCA can satisfy a constraint defined over the entire grid, without local target labels or a conditioning image. We evaluate the output by its absolute color-count error and exact-ratio accuracy, reporting mean and standard deviation across independent training runs in table 4. Table 4 shows that aNCA achieves the highest mean exact-ratio accuracy among the compared models while using substantially fewer parameters than the diffusion and SRM references. The NCA remains competitive and achieves the lowest mean count error. These metrics capture different aspects of performance: exact accuracy measures how often the global constraint is satisfied, whereas mean count error measures the average deviation from the 50/50 balance.
Table 3: Maze solving on grids, reported as mean standard deviation over five training runs. Valid Path checks connectivity and wall avoidance. Valid Optimal additionally requires shortest-path length.
| Method | Source | Valid Path | Valid Optimal | Param. |
|---|---|---|---|---|
| HRM | [6] | -* | 74.5% | 27M |
| ItrSA++ | [21] | -* | 78.6% | 3M |
| TRM-Att | [22] | -* | 85.3% | 7M |
| NCA w. 3x3 Conv. | Ours | 2.54 ± 0.84 | 0.08 ± 0.08 | 50k |
| NCA w. 5x5 Conv. | Ours | 24.78 ± 1.68 | 10.78 ± 1.21 | 105k |
| NCA w. Dilated Conv. | Ours | 74.26 ± 1.07 | 64.30 ± 1.32 | 150k |
| NCA w. R/C/B Conv. | Ours | 93.78 ± 1.99 | 81.26 ± 2.01 | 280k |
| NCA w. DCNv1 | Ours | 86.73 ± 4.58 | 77.48 ± 6.42 | 236k |
| aNCA | Ours | 98.56 ± 0.72 | 94.18 ± 1.14 | 256k |
- indicates metrics not reported in prior work.
Table 4: Global color balance. NCA results are mean ± standard deviation across independent training runs. Imbalance measures absolute color-count error. Accuracy measures exact satisfaction of the 50/50 ratio.
| Perception | Source | Imbalance ↓ | Accuracy ↑ | Param. |
|---|---|---|---|---|
| Diffusion | [7] | 1.27 | 25.0% | 19.7M |
| SRM | [7] | 0.53 | 51.8% | 19.7M |
| NCA w. 3x3 Conv. | Ours | 1.13±0.17 | 26.0%±5% | 48k |
| NCA w. 5x5 Conv. | Ours | 0.07±0.06 | 95.3%±2% | 100k |
| NCA w. DCNv1 | Ours | 1.61±0.59 | 18.7%±11% | 147k |
| aNCA | Ours | 0.1±0.08 | 96.8%±3% | 152k |
These results show that adaptive perception also helps for a spatially uniform objective. In table 4, aNCA with modulated DCNv2 clearly improves exact accuracy over offset-only DCNv1, while gains over the baseline are smaller and within run-to-run variability (also see fig. 10 for qualitative results).
6 Conclusion
We introduced Adaptive Neural Cellular Automata (aNCA), which implement a conceptually novel perception approach to enable NCAs to learn reasoning capabilities. On spatially structured tasks, Sudoku, image-based Sudoku, and maze solving, aNCA sets new state-of-the-art results while using a fraction of the parameters of prior methods. The learned perceptions are directly inspectable, revealing that the model learns task-relevant spatial relations (e.g. Sudoku rows, columns, and boxes) without explicit encoding in the architecture.
Limitations. While aNCA achieves strong results on spatially structured tasks. However, its adaptive perception comes at higher per-step computational cost than fixed-convolution baselines. Detailed resource measurements are provided in section A.3.3. The current architecture targets regular 2D grids. Adapting its learned perception mechanism to irregular graphs, 3D scenes, and variable-resolution inputs is a promising direction for future work.
AI use statement
In this work, we used generative AI tools as a coding assistant and for language editing, to revise and shorten passages of the manuscript that we had drafted ourselves. Generative AI tools were not used to generate research ideas, to design the proposed architecture, to produce or interpret experimental results, or to retrieve or summarize related work. All code was reviewed and tested by the authors, and every reported number was produced by running that code on the checkpoints described in section A.2. We have reviewed all AI-assisted text and take full responsibility for the final content of this work, including all text, claims and artifacts.
Ethics statement
This work studies architectures for 2D spatial reasoning on synthetic and publicly available benchmarks. It involves no human subjects, no personally identifiable information, and no user data. All datasets used are public and were employed within their intended scope: the Sudoku and MNIST-Sudoku data of [7] and the maze dataset of [6]. We release no new dataset. The proposed models are small and were trained on a single consumer GPU, so the computational footprint of this work is modest. We see no direct pathway from puzzle solving to harmful application, although improved spatial reasoning is a general capability whose downstream uses we cannot fully anticipate. The authors declare no conflicts of interest.
Reproducibility statement
All datasets and benchmarks used in this work are publicly available and are cited in section 3. Model and training hyperparameters for each task are given in sections A.3.1, A.5.1 and A.6.1, the exact training objectives in sections A.3.2, A.5.2 and A.6.2, and the encoder-decoder codec used for MNIST Sudoku in sections A.4.1 and A.4.2, together with an isolation evaluation of its accuracy in section A.4.3. Computational cost and hardware are reported in section A.3.3 and section A.2. All reported results are means and standard deviations over multiple independent training runs rather than single runs, with per-seed behavior discussed in section A.3.4. The full source code, including the configuration files reproducing every reported run, will be released upon publication as a plugin for the NCATorch framework of [34].
References
[1] Amita Kamath, Jack Hessel, and Kai-Wei Chang. What's “up” with vision-language models? investigating their struggle with spatial reasoning. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 9161–9175, 2023.
[2] Xinmiao Huang, Qisong He, Zhenglin Huang, Boxuan Wang, Zhuoyun Li, Guangliang Cheng, Yi Dong, and Xiaowei Huang. Spatial-dise: A unified benchmark for evaluating spatial reasoning in vision-language models. arXiv preprint arXiv:2510.13394, 2025.
[3] Boyuan Chen, Zhuo Xu, Sean Kirmani, Brain Ichter, Dorsa Sadigh, Leonidas Guibas, and Fei Xia. Spatialvlm: Endowing vision-language models with spatial reasoning capabilities. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 14455–14465, 2024.
[4] Jingtao Ding, Yunke Zhang, Yu Shang, Yuheng Zhang, Zefang Zong, Jie Feng, Yuan Yuan, Hongyuan Su, Nian Li, Nicholas Sukiennik, et al. Understanding world or predicting future? a comprehensive survey of world models. ACM Computing Surveys, 58(3):1–38, 2025.
[5] Alexander Mordvintsev, Ettore Randazzo, Eyvind Niklasson, and Michael Levin. Growing neural cellular automata. Distill, 2020. https://distill.pub/2020/growing-ca.
[6] Guan Wang, Jin Li, Yuhao Sun, Xing Chen, Changling Liu, Yue Wu, Meng Lu, Sen Song, and Yasin Abbasi Yadkori. Hierarchical reasoning model, 2025.
[7] Christopher Wewer, Bartlomiej Pogodzinski, Bernt Schiele, and Jan Eric Lenssen. Spatial reasoning with denoising models. In International Conference on Machine Learning (ICML), 2025.
[8] Adam Santoro, David Raposo, David G Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Timothy Lillicrap. A simple neural network module for relational reasoning. Advances in neural information processing systems, 30, 2017.
[9] Lizong Zhang, Haojun Yin, Bei Hui, Sijuan Liu, and Wei Zhang. Knowledge-based scene graph generation with visual contextual dependency. Mathematics, 10(14):2525, 2022.
[10] Quang PM Pham, Khoi TN Nguyen, Lan C Ngo, Truong Do, Dezhen Song, and Truong-Son Hy. Tesgnn: Temporal equivariant scene graph neural networks for efficient and robust multi-view 3d scene understanding. arXiv preprint arXiv:2411.10509, 2024.
[11] Yuxin Mao, Zhen Qin, Jinxing Zhou, Bin Fan, Jing Zhang, Yiran Zhong, and Yuchao Dai. Learning spatial decay for vision transformers. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 40, pages 7945–7953, 2026.
[12] Qihang Fan, Huaibo Huang, Mingrui Chen, Hongmin Liu, and Ran He. Rmt: Retentive networks meet vision transformers. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 5641–5651, 2024.
[13] Justin Johnson, Bharath Hariharan, Laurens Van Der Maaten, Li Fei-Fei, C Lawrence Zitnick, and Ross Girshick. Clevr: A diagnostic dataset for compositional language and elementary visual reasoning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2901–2910, 2017.
[14] Drew A Hudson and Christopher D Manning. Gqa: A new dataset for real-world visual reasoning and compositional question answering. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 6700–6709, 2019.
[15] Zhengxiang Shi, Qiang Zhang, and Aldo Lipani. Stepgame: A new benchmark for robust multi-hop spatial reasoning in texts. In Proceedings of the AAAI conference on artificial intelligence, volume 36, pages 11321–11329, 2022.
[16] Roshanak Mirzaee, Hossein Rajaby Faghihi, Qiang Ning, and Parisa Kordjamshidi. Spartqa: A textual question answering benchmark for spatial reasoning. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 4582–4598, 2021.
[17] Wufei Ma, Haoyu Chen, Guofeng Zhang, Yu-Cheng Chou, Jieneng Chen, Celso de Melo, and Alan Yuille. 3dsrbench: A comprehensive 3d spatial reasoning benchmark. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6924–6934, 2025.
[18] Wenqi Wang, Reuben Tan, Pengyue Zhu, Jianwei Yang, Zhengyuan Yang, Lijuan Wang, Andrey Kolobov, Jianfeng Gao, and Boqing Gong. Site: towards spatial intelligence thorough evaluation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9058–9069, 2025.
[19] Mengdi Jia, Zekun Qi, Shaochen Zhang, Wenyao Zhang, Xinqiang Yu, Jiawei He, He Wang, and Li Yi. Omnispatial: Towards comprehensive spatial reasoning benchmark for vision language models. arXiv preprint arXiv:2506.03135, 2025.
[20] Yuechen Xie, Xiaoyan Zhang, Yicheng Shan, Hao Zhu, Rui Tang, Rong Wei, Mingli Song, Yuanyu Wan, and Jie Song. Spatialqa: A benchmark for evaluating spatial logical reasoning in vision-language models. arXiv preprint arXiv:2602.20901, 2026.
[21] Kenji Kubo, Shunsuke Kamiya, Masanori Koyama, Kohei Hayashi, Yusuke Iwasawa, and Yutaka Matsuo. C-voting: Confidence-based test-time voting without explicit energy functions. In The Fourteenth International Conference on Learning Representations, 2026.
[22] Alexia Jolicoeur-Martineau. Less is more: Recursive reasoning with tiny networks, 2025.
[23] John Von Neumann, Arthur Walter Burks, et al. Theory of self-reproducing automata, 1966.
[24] Joel L Schiff. Cellular automata: a discrete view of the world. John Wiley & Sons, 2011.
[25] Martin Gardner. Mathematical games - the fantastic combinations of john conway's new solitaire game "life". Scientific American, 223(4):4, 1970.
[26] Stephen Coombes. The geometry and pigmentation of seashells. Nottingham: Department of Mathematical Sciences, University of Nottingham, 2009.
[27] Y Bouligand. Fibroblasts, morphogenesis and cellular automata. In Disordered Systems and Biological Organization, pages 367–379. Springer, 1986.
[28] Haralampos Hatzikirou, David Basanta, Matthias Simon, Karl Schaller, and Andreas Deutsch. 'go or grow': the key to the emergence of invasion in tumour progression? Mathematical medicine and biology: a journal of the IMA, 29(1):49–65, 2012.
[29] Martin Gerhardt and Heike Schuster. A cellular automaton describing the formation of spatially ordered structures in chemical systems. Physica D: Nonlinear Phenomena, 36(3):209–221, 1989.
[30] Stephen Wolfram. Statistical mechanics of cellular automata. Reviews of modern physics, 55(3):601, 1983.
[31] Magdalena Załuska-Kotur, Hristina Popova, and Vesselin Tonchev. Step bunches, nanowires and other vicinal “creatures”—ehrlich-schwoebel effect by cellular automata. Crystals, 11(9):1135, 2021.
[32] Matthew Cook et al. Universality in elementary cellular automata. Complex systems, 15(1):1–40, 2004.
[33] Stephen Wolfram and M Gad-el Hak. A new kind of science. Appl. Mech. Rev., 56(2):B18–B19, 2003.
[34] Martin Spitznagel and Janis Keuper. A new kind of network? review and reference implementation of neural cellular automata, 2026.
[35] Yann LeCun and Yoshua Bengio. Convolutional networks for images, speech, and time series. The handbook of brain theory and neural networks, 1998.
[36] William Gilpin. Cellular automata as convolutional neural networks. Physical Review E, 100(3):032402, 2019.
[37] Mark Sandler, Andrey Zhmoginov, Liangcheng Luo, Alexander Mordvintsev, Ettore Randazzo, et al. Image segmentation via cellular automata. arXiv preprint arXiv:2008.04965, 2020.
[38] Mattie Tesfaldet, Derek Nowrouzezahrai, and Chris Pal. Attention-based neural cellular automata. Advances in Neural Information Processing Systems, 35:8174–8186, 2022.
[39] Ehsan Pajouheshgar, Yitao Xu, Tong Zhang, and Sabine Süsstrunk. Dynca: Real-time dynamic texture synthesis using neural cellular automata. In 2023 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 20742–20751, 2023.
[40] Maximilian Otte, Quentin Delfosse, Johannes Czech, and Kristian Kersting. Generative adversarial neural cellular automata. arXiv preprint arXiv:2108.04328, 2021.
[41] Rasmus Berg Palm, Miguel González-Duque, Shyam Sudhakaran, and Sebastian Risi. Variational neural cellular automata. arXiv preprint arXiv:2201.12360, 2022.
[42] John Kalkhof, Arlene Kühn, Yannik Frisch, and Anirban Mukhopadhyay. Frequency-time diffusion with neural cellular automata. arXiv preprint arXiv:2401.06291, 2024.
[43] Daniele Grattarola, Lorenzo Livi, and Cesare Alippi. Learning graph cellular automata. Advances in Neural Information Processing Systems, 34:20983–20994, 2021.
[44] Fisher Yu and Vladlen Koltun. Multi-scale context aggregation by dilated convolutions, 2016.
[45] Jifeng Dai, Haozhi Qi, Yuwen Xiong, Yi Li, Guodong Zhang, Han Hu, and Yichen Wei. Deformable convolutional networks, 2017.
[46] Xizhou Zhu, Han Hu, Stephen Lin, and Jifeng Dai. Deformable convnets v2: More deformable, better results. CoRR, abs/1811.11168, 2018.
[47] R. C. Prim. Shortest connection networks and some generalizations. The Bell System Technical Journal, 36(6):1389–1401, 1957.
A Technical appendices and supplementary material
Contents
A.1 Video Material ..... 12
A.2 Implementation Details ..... 13
A.2.1 Difference between DCNv1 and DCNv2 ..... 13
A.3 Sudoku ..... 14
A.3.1 Model and Training Hyperparameters ..... 14
A.3.2 Training Loss ..... 14
A.3.3 Computational Cost ..... 15
A.3.4 Additional Results: Sudoku ..... 15
A.4 MNIST Sudoku ..... 17
A.4.1 Codec Hyperparameters ..... 17
A.4.2 Codec Training Loss ..... 18
A.4.3 Codec Accuracy ..... 18
A.4.4 Additional Results: MNIST Sudoku ..... 19
A.5 Maze ..... 20
A.5.1 Model and Training Hyperparameters ..... 20
A.5.2 Training Loss ..... 20
A.5.3 Additional Results: Mazes ..... 21
A.6 Global Color Balance ..... 22
A.6.1 Model and Training Hyperparameters ..... 22
A.6.2 Training Loss ..... 22
A.6.3 Additional Results: Global Color Balance ..... 23
A.1 Video Material
• 0:00 Sudoku: aNCA Solving (Batch)
• 0:16 Sudoku: aNCA Solving (Hard)
• 0:47 Sudoku: aNCA Output Diversity
• 1:10 Sudoku MNIST: aNCA Solving (Batch)
• 1:47 Sudoku MNIST: aNCA Solving (Hard)
• 2:10 Sudoku MNIST: aNCA Output Diversity (Solutions)
• 2:25 Sudoku MNIST: aNCA Output Diversity (Digit Style)
• 2:42 Sudoku MNIST: aNCA learned spatial relations
• 4:54 Maze 30x30: NCA w. 3x3 Conv.
• 5:07 Maze 30x30: aNCA
• 5:20 Maze DFS 20x20 (OOD): aNCA
• 5:37 Maze Prim 40x40 (OOD): aNCA
• 5:45 Color Balance Task Perception Comparison
A.2 Implementation Details
All models are implemented in PyTorch. Deformable convolutions use torchvision.ops.deform_conv2d, the standard torchvision DCNv2 implementation. All experiments were run on a single NVIDIA RTX 4090. To provide reproducibility, the code will be released upon publication, as a plugin for the NCATorch framework of [34].
A.2.1 Difference between DCNv1 and DCNv2
Both variants predict offsets from the current cell state, yielding two displacement coordinates for each of the kernel taps. DCNv1 then samples only at the displaced positions:
DCNv2 additionally predicts one content-dependent modulation value per tap, requiring a further outputs, and weights every sampled feature before aggregation:
Thus, DCNv1 adapts only where each tap samples, whereas DCNv2 also adapts how strongly each sampled location contributes. In our implementation, , where is produced by a separate modulation convolution. The offset and modulation predictors are zero-initialized, so the module initially behaves like a regular convolution: offsets are zero and modulation values are one.
A.3 Sudoku
A.3.1 Model and Training Hyperparameters
Table 5: Hyperparameters shared across all NCA variants for the Sudoku task. Perception-specific settings (kernel size, dilation, number of deformable heads) vary per variant and are described in section 2.
| Category | Hyperparameter | Value |
|---|---|---|
| NCA state | Cell channels | 24 |
| Positional embeddings | yes | |
| Update network | Architecture | MLP (1×1 Conv), 1 hidden layer, 128 channels |
| Optimization | Optimizer | AdamW |
| Learning rate | ||
| LR schedule | WSD (warmup-stable-decay) | |
| Warmup / stable / decay | 10% / 80% / 10% | |
| Final LR | 0 | |
| Gradient clip norm | 1.0 | |
| Training | Total steps | 100 000 |
| Batch size | 128 | |
| Rollout steps | ||
| Evaluation | Inference rollout steps | 1 500 |
| Digit prediction | argmax over 9 channels (no post-processing) | |
| Sample pool | Pool size | 512 |
| Pool fraction | 0.5 |
A.3.2 Training Loss
Let be the predicted probability of digit at cell . A valid Sudoku completion requires each digit to appear exactly once in every row, column, and box. Denoting the set of all 27 such units as , we penalize squared deviations from the per-unit digit count of one:
An additional cross-entropy term enforces consistency with the given clue cells whose correct digit is :
The total loss is .
A.3.3 Computational Cost
Table 6: Resource usage of the Sudoku NCA variants. Training VRAM is the peak CUDA memory allocated during a representative training step (batch size 128, rollout length 24). Inference VRAM and runtime are measured at batch size 1 with a rollout of 1500 steps on an NVIDIA RTX 4090. Inference time is averaged per puzzle over repeated runs after warm-up.
| Variant | Params | Train VRAM (MB) | Infer VRAM (MB) | Infer ms / puzzle |
|---|---|---|---|---|
| NCA w. 3x3 Conv. | 50k | 303.1 | 0.5 | 159.64 |
| NCA w. 5x5 Conv. | 105k | 311.9 | 0.9 | 166.38 |
| NCA w. R/C/B Conv. | 145k | 610.3 | 1.0 | 251.04 |
| NCA w. Dilated Perc. | 150k | 480.8 | 1.2 | 238.28 |
| aNCA | 165k | 1139.6 | 17.7 | 832.75 |
A.3.4 Additional Results: Sudoku
This section supplements the main array-Sudoku evaluation with further analysis of aNCA's adaptive perception and reproducibility. We visualize the sampling-distance distributions of the deformable heads, quantify their alignment with Sudoku's row, column, and box constraints, and report the variation across independent training seeds.

(a) A
(b) B

(c) C
Figure 9: Learned sampling distance distributions of the three deformable perception heads (A, B, C) at the final NCA step, aggregated over held-out test puzzles. Each plot shows how far each kernel tap reaches from the source cell, revealing that the heads develop complementary routing strategies: some taps remain local while others extend to capture row, column, or box constraints.
Quantitative alignment scores. Table 7 reports, for each deformable head, the mean fraction of total sampling weight landing inside the source cell's row, column, box, and their union (Sudoku-relevant), averaged over all 81 source cells and 10 000 held-out test puzzles at the final rollout step. The random baseline is the expected fraction under uniform sampling. All three heads concentrate of their weight on Sudoku-relevant cells, above the random baseline.
Table 7: Per-head constraint alignment at the final NCA step, averaged over all 81 source cells and 10 000 test puzzles. Union% is the fraction of weight on the source cell's row column box. Random baseline is the expected Union% under uniform sampling (25.9%).
| Head | Row% | Col% | Box% | Union% | Enrichment |
|---|---|---|---|---|---|
| Head 1 | 20.7 | 32.6 | 47.5 | 81.0 | |
| Head 2 | 61.1 | 59.6 | 69.6 | 86.9 | |
| Head 3 | 53.0 | 45.8 | 54.3 | 83.5 | |
| Random baseline | - | - | - | 25.9 |
A.4 MNIST Sudoku
The NCA variants evaluated on MNIST Sudoku are the exact checkpoints trained for the array task (section A.3); no additional NCA training is performed. The pixel-space pipeline wraps these frozen NCA checkpoints with a separately trained encoder–decoder codec, described below.
A.4.1 Codec Hyperparameters
Table 8: Architecture and training hyperparameters for the Sudoku codec. Encoder and decoder are trained independently with AdamW.
| Category | Hyperparameter | Value |
|---|---|---|
| Encoder | Base channels | 32 |
| Hidden dim | 128 | |
| Decoder | Base channels | 64 |
| Hidden dim | 128 | |
| Style latent dim | 8 | |
| Optimization | Optimizer | AdamW |
| Learning rate | ||
| LR schedule | Warmup-cosine (1000 steps) | |
| Total steps | 100 000 | |
| Training | Batch size | 32 |
A.4.2 Codec Training Loss
The decoder is trained in isolation with a composite loss. Let be the rendered image for board with style latent , the target pixel image, and a pixel-space binary mask over occupied (non-blank) cells. The total loss is
with weights .
KL divergence. , the standard VAE term regularising the style posterior.
Pixel L1. , a masked per-pixel reconstruction loss.
Feature L1. Let denote the pooled intermediate features of the frozen digit classifier , and let be the rendered and target cell crops. is a perceptual term encouraging feature-level similarity to the target digit appearance.
Classifier CE. , cross-entropy under the frozen classifier, directly rewarding legible digit rendering.
Total variation. Let . Then encourages smooth, connected strokes.
Ink sparsity. penalises dark pixels outside digit regions.
Binary commitment. penalises intermediate grey values, pushing pixels toward binary black/white.
The encoder is trained separately with a masked cross-entropy loss on the given (clue) cells C:
where is the predicted probability of digit d at cell i and is the ground-truth digit.
A.4.3 Codec Accuracy
We evaluate the encoder and decoder in isolation on 10 000 test puzzles across the full difficulty range to quantify how much of the pipeline error originates from the codec versus the NCA.
Encoder. Running on the input pixel Sudoku and taking the argmax over digit logits yields 99.38% per-cell accuracy on the given (non-blank) cells. The perfect-board rate (the fraction of boards where every given cell is correctly recognized) is 74.58%, meaning roughly one in four boards contains at least one misrecognised clue cell. Despite these imperfect inputs, aNCA maintains strong downstream solving performance (table 9) without additional training, highlighting its ability to operate within noisy encoder conditioning.
Decoder round-trip. We pass the ground-truth one-hot board through , decode the resulting pixel image with , and compare the re-encoded digits to the ground truth. Per-cell accuracy is 100% and the perfect round-trip rate is 100%: the decoder renders digits reliably enough that the encoder always recovers the correct symbol. Decoder errors therefore contribute zero to the pipeline failure rate. ASR is evaluated against ground-truth clue digits, so encoder misrecognitions affect NCA conditioning but not the validity metric.
A.4.4 Additional Results: MNIST Sudoku
This section supplements the main MNIST Sudoku evaluation with complete per-bucket results. In addition to ASR, we report ACP for every NCA perception variant on the Easy, Medium, and Hard splits, using the same frozen codec and array-trained NCA checkpoints as in the main evaluation.
Table 9: Sudoku Images
| Method | Source | Easy [1, 27] | Medium [28, 54] | Hard [55, 81] | Param. | |||
|---|---|---|---|---|---|---|---|---|
| ASR | ACP | ASR | ACP | ASR | ACP | |||
| Related Work | ||||||||
| Diffusion Model | [7] | 99.4% | 53.6% | 0.8% | 118M | |||
| SRM | [7] | 99.8% | 75.4% | 51.6% | 118M | |||
| NCAs | ||||||||
| NCA w. 3x3 Conv. | Ours | 99.40 ± 0.14 | 99.90 ± 0.00 | 80.90 ± 0.90 | 98.33 ± 0.10 | 71.98 ± 1.61 | 98.20 ± 0.08 | 1.1M + 50k |
| NCA w. 5x5 Conv. | Ours | 99.13 ± 0.50 | 99.87 ± 0.06 | 79.97 ± 1.70 | 98.17 ± 0.15 | 69.00 ± 6.63 | 95.77 ± 4.13 | 1.1M + 105k |
| NCA w. 7x7 Conv. | Ours | 98.73 ± 0.10 | 99.83 ± 0.05 | 76.55 ± 1.21 | 97.73 ± 0.17 | 72.30 ± 2.60 | 98.15 ± 0.19 | 1.1M + 189k |
| NCA w. 9x9 Conv. | Ours | 99.30 ± 0.23 | 99.93 ± 0.05 | 66.73 ± 16.99 | 95.18 ± 4.42 | 35.83 ± 33.56 | 84.25 ± 20.15 | 1.1M + 300k |
| NCA w. R/C/B Conv. | Ours | 99.20 ± 0.08 | 99.90 ± 0.00 | 80.38 ± 1.41 | 98.13 ± 0.17 | 71.25 ± 2.61 | 98.13 ± 0.17 | 1.1M + 145k |
| NCA w. Dilated Perc. | Ours | 99.25 ± 0.17 | 99.88 ± 0.05 | 80.78 ± 0.95 | 98.13 ± 0.05 | 70.95 ± 8.39 | 98.05 ± 0.57 | 1.1M + 150k |
| aNCA | Ours | 99.00 ± 0.37 | 99.88 ± 0.05 | 81.90 ± 5.50 | 98.40 ± 0.50 | 82.10 ± 4.89 | 98.85 ± 0.40 | 1.1M + 165k |
indicates metrics not reported in prior work.
A.5 Maze
A.5.1 Model and Training Hyperparameters
Table 10: Hyperparameters shared across all NCA variants for the maze task. Perception-specific settings vary per variant and are described in section 2.
| Category | Hyperparameter | Value |
|---|---|---|
| NCA state | Cell channels | 24 |
| Positional embeddings | no | |
| Fire rate | 0.5 | |
| Update network | Architecture | MLP ( Conv), 1 hidden layer, 128 channels |
| Optimization | Optimizer | AdamW |
| Learning rate | ||
| Weight decay | ||
| LR schedule | WSD (warmup-stable-decay) | |
| Warmup / stable / decay | 10% / 80% / 10% | |
| Gradient clip norm | 1.0 | |
| Training | Total steps | 100 000 |
| Batch size | 64 | |
| Rollout steps | ||
| Evaluation | Inference rollout steps | 100 |
| Path prediction | threshold at 0.5 (no post-processing) | |
| Sample pool | Pool size | 512 |
| Pool fraction | 0.5 |
A.5.2 Training Loss
Let be the predicted path probability at cell , the ground-truth binary path mask, and the set of non-wall cells. Walls are excluded since they are trivially predictable from the condition input. The loss combines three terms. A BCE term encourages binary commitment to path vs. non-path:
A Dice term directly optimizes path-prediction overlap, handling the imbalance between path and non-path cells:
A length penalty penalizes paths that are longer or shorter than the shortest-path target, normalized by the number of free cells:
The total loss is with .
A.5.3 Additional Results: Mazes
This section supplements the main maze evaluation with qualitative rollout trajectories and a quantitative same-resolution distribution-shift experiment. We evaluate the trained aNCA checkpoint, without finetuning, on 1000 unseen Prim-generated mazes and compare its Valid Path and Valid Optimal scores with those on the original Sapient test distribution.
Generalization beyond the training maze distribution. To evaluate whether the trained aNCA learns a reusable path-finding procedure, we run the same checkpoint, without finetuning, on 1000 procedurally generated mazes using randomized Prim-style maze generation [47]. Although these mazes differ from the training distribution in wall density and corridor geometry, the NCA propagates a connected path from start to goal and adapts its rollout to the new layout. It achieves Valid Path and Valid Optimal, showing robust transfer to a new maze distribution at the same grid size. Qualitative examples and the full comparison are shown in fig. 8b.
Table 11: Generalization of the deformable aNCA maze solver to a different maze distribution at the training resolution. The model is trained on Sapient mazes and evaluated without finetuning on 1000 mazes per test distribution. Valid Path checks connectivity and wall avoidance. Valid Optimal additionally requires shortest-path length.
| Test Maze Size | Generator | Valid Path | Valid Optimal |
|---|---|---|---|
| Sapient | 98.56% | 94.18% | |
| Prim | 100% | 100% | |
| Prim | 100% | 99.4% |
A.6 Global Color Balance
A.6.1 Model and Training Hyperparameters
Table 12: Hyperparameters for the global color balance task.
| Category | Hyperparameter | Value |
|---|---|---|
| NCA state | Cell channels | 24 |
| Positional embeddings | no | |
| Fire rate | 0.5 | |
| Update network | Architecture | MLP (1×1 Conv), 1 hidden layer, 128 channels |
| Optimization | Optimizer | AdamW |
| Learning rate | ||
| LR schedule | WSD (warmup-stable-decay) | |
| Warmup / stable / decay | 10% / 80% / 10% | |
| Gradient clip norm | 1.0 | |
| Training | Total steps | 25000 |
| Batch size | 16 | |
| Rollout steps | ||
| Evaluation | Inference rollout steps | 200 |
| Test samples per run | 1000 | |
| Independent training runs | 3 | |
| Sample pool | Pool size | 512 |
| Pool fraction | 0.5 | |
| Loss weights | 1.0 | |
| 0.01 |
A.6.2 Training Loss
Let be the predicted pixel value of cell (where black, white), the total number of pixels, and the target mean corresponding to a prescribed white fraction . The loss combines two terms. A count term pushes the global pixel mean toward the target ratio:
A saturation term pushes each pixel to commit to either or , zeroing only at fully binary values:
The total loss is .
A.6.3 Additional Results: Global Color Balance

Figure 10: Global color balance: the model must satisfy a prescribed black/white ratio without per-pixel supervision.