← Projects

Replicating “Reasoning with Neural Cellular Automata”

Joris Viaud

Paper replication · Updated

TL;DR: The authors' published weights, run through our code, come close to their results (all mazes, 62% of Sudoku grids with one attempt, 79% of Maze-Hard against the paper's 87%), so the gaps between our trainings and the paper come mostly from training. On mazes the paper's main claim holds: a 10,420-parameter model trained on 9×9 mazes solves almost every test maze up to 59×59; at 201×201 the paper's recipe fails one training run in three, while the authors' own setup, with a ring of walls around each maze, solves 97.5% over two runs. On Sudoku, the recipe of the authors' public code beats the one written in the paper: 35% of the test grids with one attempt after 20K steps, against 8% for the paper's recipe at 20K and 26% at 50K (paper: 66% after 150K steps). Three ingredients that the paper does not mention decide whether the model learns at all; the rest of the gap is most likely the paper's longer training. On Maze-Hard, with half the paper's training, it solves 65% of the test mazes with one attempt on A* targets and 77% on BFS targets (paper: 87% and 95%), and BFS beats A* as in the paper. A rewritten training engine trains the same models 1.1 to 4.3 times faster on the same laptop, with accuracy within the spread between runs, which brings Sudoku at the paper's budget from about 24 hours per run to under 6.

Goal

Reasoning with Neural Cellular Automata (Etcheverry et al., Google Paradigms of Intelligence, 2026) trains neural cellular automata (NCAs) to solve mazes, Sudoku and ARC-AGI-1 puzzles. An NCA is a grid of identical cells: at every step, each cell reads its eight neighbours and updates its own state with the same small neural network. The paper's central claim is that such a grid, trained on small boards and short runs, keeps working on boards far larger and runs far longer.

This project re-implements the paper from scratch in Python and reruns its experiments on one consumer GPU. It checks whether the paper's numbers come out approximately and whether its explanations hold: generalisation to larger boards, the role of each training ingredient, and the gains from running several attempts in parallel at test time. How NCAs work, and why each ingredient is there, is explained with animations in the companion blog post.

After the first results, the authors published their code and trained weights. Their code does not train exactly as the paper says, so a recipe search compared the two and ran their weights through our code; its verdict is in Paper, public code, our choice.

Along the way, three kinds of notes mark where the replication went beyond copying the paper: optimizations of the computation, open questions the replication raised, and possible extensions of the paper.

A small NCA solving a 17×17 mazeA small NCA solving a 17×17 maze
What the model does, shown with the small NCA trained for the blog post, which has the same architecture. Walls are dark, the two endpoints orange; each free cell turns blue as it decides it lies on the path between them. No cell ever sees more than its 3×3 neighbourhood.

Setup

  • Hardware: a laptop RTX 4060 with 8 GB of memory. The paper trained Sudoku-Extreme for 22 hours on a TPU7x and Visual Sudoku for three days on 64 TPUs, so any experiment that does not fit is scaled down, and each change is logged in the repository's docs/DEVIATIONS.md.
  • Scope: Maze-OOD and Maze-Hard, and Sudoku-OOD at a third of the paper's training (paper recipe) or less than a seventh (public recipe, 20K steps). Sudoku-Extreme and the pruning it tests are not run (over the budget). ARC-AGI-1 and Visual Sudoku are left out: even with the faster engine below, one ARC model at the paper's budget projects to 52 days on a cloud L4 GPU, and Visual Sudoku to 31 days with an assumed batch of one.
  • Repetitions: every experiment of the main table is trained three times with different random seeds; numbers are the mean and standard deviation over the runs. The recipe search confirms its maze winners on two or three new runs, on test mazes it never used.
  • Data: the paper's official datasets. In both benchmarks the test set is harder than the training set (out of distribution): larger mazes, Sudoku grids with fewer givens.
  • Mazes: the paper's exact settings and architecture (10,420 parameters; 5,000 training steps, batch 64, runs of 100 steps). One training takes 14 minutes, the whole maze phase 6 h 30 of GPU time. A first run used a perception layer with more weights (11,824 parameters); a code review found the mismatch, and it was rerun and archived.
  • Sudoku: the paper's model (159,760 parameters), trained for 50K steps instead of 150K, in half precision (bf16), batch 256: 8 h 10 per run, 24 h 30 for the three. The public-code recipe was then trained for 20K steps, two runs.

Implementation

The whole model fits in one function. At every step, each cell reads its 3×3 neighbourhood, the same small network proposes an update, and only the cells that fire this step apply it (simplified; the header names the file of the full code in the repository):

src/nca/model.py
def step(self, x, given, clamp, fire_mask, noise=None):
    xp = pad(x, self.cfg.padding)             # walls, or wrap-around borders for Sudoku
    dx = self.update(self.perceive(xp))       # one small MLP shared by every cell
    x = x + fire_mask * dx                    # asynchronous: non-firing cells keep their state
    if noise is not None:
        x = x + noise                         # perturbation, during training only
    x = self.normalize(x)                     # each channel group back to unit norm
    return self.apply_clamp(x, given, clamp)  # the puzzle's own cells never change

Training runs long rollouts without storing all of them. Each batch mixes fresh puzzles with states saved from earlier iterations, the gradient flows through a window of steps only, and the weights change once the rollout is over (simplified):

src/nca/train.py
for it in range(steps):
    idx, batch = pool.sample(batch_size, seed_ratio)  # fresh puzzles + replayed states
    x = perturb(batch)                                # swapped puzzles, damaged patches
    c0 = rng.integers(0, N - Nc + 1)                  # the Nc steps that get a gradient
    for t in range(N):
        fire, noise = model.sample_fire_mask(x), sample_noise(x)
        if c0 <= t < c0 + Nc:
            x = model.step(x, given, clamp, fire, noise)
            loss = loss + step_loss(model, x, targets)
            if t == c0 + Nc - 1:
                (loss / Nc).backward()                # free the window's activations now
                x = x.detach()
        else:
            with torch.no_grad():
                x = model.step(x, given, clamp, fire, noise)
    opt.step()                                        # one set of weights for the whole rollout
    pool.write_back(idx, x)                           # final states return to the pool

Results

Test-time attempts: the paper runs K copies of the grid in parallel from different random starts and keeps the one whose cells are most confident. K = 1 is a single attempt. The table below uses the recipe written in the paper, three runs per row; the authors' public recipe and their own weights are compared in Paper, public code, our choice.

BenchmarkPaperOur budgetPaper recipe here (mean ± std, 3 runs)
Mazes 13×13, 300 steps100%paper settings100.0 ± 0.0%
Mazes 59×59, 2,000 steps100%paper settings98.3 ± 1.7%
Mazes 201×201, 13,000 steps100%paper settings85.7 ± 10.8% (runs: 100, 83, 74)
Sudoku, K = 166.1%50K training steps instead of 150K26.0 ± 6.8%
Sudoku, best of K98.5% (K = 2048)K = 12867.0 ± 8.4%
Maze-Hard 30×30, K = 186.6%10K training steps instead of 20K65.4 ± 4.1%
Maze-Hard 30×30, best of K89.2% (K = 128)K = 6470.3 ± 2.9%
Maze-Hard, BFS targets, K = 194.7%10K training steps instead of 20K77.0 ± 3.9%
Maze-Hard, BFS targets, best of K96.2% (K = 128)K = 6480.4 ± 4.3%
Sudoku-Extreme75.6% (K = 1)not run (over the budget)
ARC-AGI-1, Visual Sudoku48.8% (2 attempts), 87.8%left out

Mazes: 100 test mazes per size. Maze-Hard: the 1,000 official test mazes, 200 steps. Sudoku: the 1,000 official test grids, 256 steps. Every row comes from the original training code; the optimised engine's own results are under "Making the training cheaper".

What was reproduced, and what was left aside

Paper claimStatusWhy
Trained on 9×9 mazes, the model solves 13×13 and 59×59 mazesReproducedpaper settings; 100% and 98.3%
... and 201×201 mazesReproduced with the authors' setup97.5% over two runs with their public recipe and ring of walls; the paper's recipe leaves one run in three below 75% (85.7 ± 10.8%)
Our code runs the authors' published weightsClose to the papermazes 100% at every size; Sudoku 62.4% with one attempt on validation grids (paper 66.1% on test); Maze-Hard 79.1% (paper 86.6%)
Replay, perturbations and asynchrony each helpTrend partly reproducedmeasured on 13×13 mazes only; the paper's failure without replay is on larger mazes, not tested here
Adaptive firing saves cell updatesReproduced under an interpretationonly if fixed cells count as confident; the rule as written saves nothing (1.07×)
Adaptive firing repairs damage fasterNot reproducedone run in three recovers, and it needs more steps
Test-time noise gives a small gainTrend reproducedSudoku: +0.8 to +1 point at the paper's noise level; no effect on mazes
Sudoku-OOD: more steps and more attempts raise accuracyTrend reproducedpublic recipe, 20K steps: 34.8% with one attempt and 64.6% with 128; paper recipe, 50K steps: 26.0% and 67.0% (paper: 66.1%, and 98.5% with 2,048, after 150K steps)
Maze-Hard, and BFS targets beat A* targetsTrend reproducedhalf the paper's training: 65% and 77% against 87% and 95%
Sudoku ablations, fixed against self-attentionNot runstopped at 5K steps with every variant at 0%; at least 20K steps per variant, about 50 hours
Sudoku-ExtremeNot runover the 25-hour limit set per experiment: about 45 hours with the original code, evaluations included, even at a reduced 30K-step budget
Niche-capped diversity pruningNot runit is measured on Sudoku-Extreme
ARC-AGI-1, Visual SudokuLeft out52 and 31 days of a cloud GPU per model
Comparisons with TRM, HRM, PTRM and other baselinesLeft outthe replication covers the NCA; the blog post quotes the paper's numbers

What remains of the gaps on Sudoku-OOD and Maze-Hard is most likely the reduced training (20K steps of the public recipe against 150K on Sudoku, 10K against 20K on Maze-Hard) and the smaller number of attempts. That is a hypothesis, not a result: no run at the paper's budget was made. The full list, with every number, is in the repository's README.

Mazes

Maze size and depth scaling in the replicationMaze size and depth scaling in the replication
Mazes. Left: fraction of test mazes solved exactly by maze size, with the run length growing with size (200 mazes per size up to 59×59, 100 at 201×201 with 13,000 steps); the vertical axis starts at 60%. Right: on 201×201 mazes, the fraction solved as the run goes on. Thin lines are the three training runs, the thick line their mean.

Generalisation holds, but depends on the training run at the largest size. A model that only saw 9×9 mazes and 100-step runs solves 99.5% to 100% of the test mazes at every size up to 37×37, and 98.3% at 59×59. At 201×201, 22 times the training width, one run solves all 100 test mazes like the paper, the other two 83% and 74%. Their curves level off well before the end, so more steps would help little, and their failures are not near-misses: with 97.5% and 98.7% of the cells right on average, hundreds of cells are wrong on a 201×201 board. With three runs, this spread is the result. The recipe search found where it comes from: with the authors' exact setup, both runs solve 97% to 98% of fresh 201×201 mazes (below).

Training variant, 13×13 mazes, 500 test mazesK = 1best of 8
Full recipe100.0%100.0%
Without the replay pool96.1 ± 4.3%99.5 ± 0.8%
Without training perturbations (noise, damage)99.3 ± 0.7%98.3 ± 2.4%
Synchronous updates (every cell fires every step)99.9 ± 0.1%100.0%

Replay and perturbations matter in different ways. The replay pool trains the model on states left over from earlier runs, so it learns to keep a solution in place over long runs. Without it, the model is the weakest of the variants with one attempt (96.1%, and 90.2% for the worst run); with 8 attempts the model recovers to 99.5%, because its failures depend on the random start and the confidence picks a good attempt. Without perturbations, the opposite happens: more attempts make it worse (98.3%, 95.0% for the worst run), because wrong attempts can be confidently wrong. This is the calibration role the paper gives to perturbations. Synchronous updates change nothing at this size. These ablations are evaluated on 13×13 mazes only: the paper's failure without replay is on larger mazes, which were not tested here.

Adaptive firing saves updates only once fixed cells can rest. By default each cell updates with probability 0.8 at each step; the paper lowers this to 0.4 for cells that are confident of their answer. Written as in the paper, the rule never counts walls and endpoints as confident, although they make up 64% of a maze, so it saves nothing: 1.07× the cell updates of uniform firing to solve 95% of the 201×201 mazes. Counting those fixed cells as confident gives 0.72× the updates for 1.41× the steps, against the paper's 0.71× and 1.29×. These ratios are over two runs, since the third stops at 90% under every rule, and they count cell updates rather than measured GPU time.

The faster repair after damage is not reproduced. In the paper, when part of a solved maze is erased, adaptive firing repairs it in 0.94× the steps and 0.52× the updates of uniform firing. The only run of ours that recovers to 95% needs 1.30× the steps and 0.66× the updates counted from the start, as in the paper's figure, or 1.54× and 0.77× counted from the damage.

Test-time noise, which the paper finds slightly helpful, changes nothing on mazes at any level from 0 to 1.

Sudoku

Sudoku width scaling and difficulty in the replicationSudoku width scaling and difficulty in the replication
Sudoku, 1,000 official test grids, 256 steps. Left: fraction solved exactly when K attempts run in parallel and the most confident one is kept; thin lines are the three training runs, diamonds the paper's values. Right: fraction solved by number of empty cells, with one attempt and with 128, mean of three runs.

More attempts help as in the paper; the level is lower. With the paper's recipe and 50K steps, our models solve 26% of the test grids where the paper's solve 66%. Each doubling of the number of attempts adds 4 to 8 points, up to 67% at K = 128, and the curve has not flattened. The confidence comes close to an oracle: keeping the most confident attempt solves within one point as many grids, on average, as checking every attempt against the answer.

The gap is on the hardest grids, and it comes mostly from training. With 128 attempts, grids with up to 51 empty cells are solved 96% to 99% of the time, and grids with 62 or more empty cells less than 15% of the time. Depth is not the limit, since accuracy stops improving after about 200 steps. The three runs were still improving at 50K steps, while the paper trains for 150K, and the first exact solutions only appear after 10,000 to 15,000 steps. Part of it is the recipe: at the same 20K steps the authors' public recipe solves 34.8% with one attempt against 8.0% for the paper's, and more in 20K steps than the paper's recipe in 50K (26.0%). The rest, about 31 points, is most likely the length (below). A late code review found that our normalisation also touched cells that did not fire; retraining one run with the paper's behaviour changed nothing measurable (33.6% → 32.7% with one attempt, 76.8% → 78.6% with 128). At the paper's noise level, test-time noise adds 0.8 points with one attempt and 1.0 with 128; across a sweep of noise levels on 500 grids, it adds 2 to 4 points with one attempt and nothing with 16.

The training ablations and the comparison of fixed attention with self-attention were not run on Sudoku. Cut to 5,000 steps to fit the budget, every variant, the full recipe included, stayed at 0%, so they were stopped; a fair comparison needs at least 20,000 steps per variant, about 50 hours.

Maze-Hard

Maze-Hard in the replicationMaze-Hard in the replication
Maze-Hard, 1,000 official test mazes (30×30), 200 steps, A* targets in blue and BFS targets in orange. Left: fraction solved exactly when K attempts run in parallel and the most confident one is kept; thin lines are the three training runs, the thick line their mean, diamonds the paper's values and squares the optimised engine's A* runs; the vertical axis starts at 35%. Right: fraction solved with one attempt as the run goes on.

Two thirds of the hard mazes, with half the training. Maze-Hard asks for the shortest path through 30×30 mazes, with the path found by A* as the target. Three runs trained for 10,000 steps instead of the paper's 20,000, about two hours each on the laptop. With one attempt they solve 65.4 ± 4.1% of the 1,000 test mazes (64.9%, 60.7% and 70.7% per run), against the paper's 86.6%. More attempts help less than on Sudoku: the most confident of 64 attempts solves 70.3 ± 2.9%, while 77.6% of the mazes have at least one right attempt, so here the confidence misses some correct answers. With one attempt, 86.5% of the predicted paths join the start to the goal, and 72.7% are as short as the A* path: some solutions are a different shortest path from the one A* picked. Test-time noise changes nothing (64.5% with one attempt, 70.2% with 64). The three runs of the optimised engine, trained on the same recipe, give 62.7 ± 3.0% and 68.0 ± 2.0%, within the spread between runs. The authors' published weights solve 79.1% of the same mazes with one attempt in our code, so most of the gap is in training, most likely the halved training budget; this is untested, since no run at the paper's 20K steps was made, and the public-code recipe was not trained at ours.

BFS targets do better, as in the paper. The paper also trains on breadth-first-search targets and scores higher with them. With the same recipe and the corrected targets (see below), our three runs solve 77.0 ± 3.9% of the test mazes with one attempt (79.1%, 71.5% and 80.3% per run) and 80.4 ± 4.3% with the most confident of 64, against the paper's 94.7% and 96.2% with 128. BFS beats A* by 11.6 points with one attempt and 10.1 with 64, where the paper finds 8.1 and 7.0. With 64 attempts, 84.4% of the mazes have at least one right answer, and test-time noise again changes nothing. Both target types stay 16 to 21 points under the paper, with half its training.

Paper, public code, our choice

The paper and the authors' public JAX code do not train the same way, and neither tells the whole story. Rather than copy one of them, every difference became a switch in our code, and a recipe search, from 21 to 24 October, measured them. Recipes were compared on held-out grids and mazes, and for mazes the winner was confirmed on new training runs and on 100 fresh test mazes per size that neither the selection nor the tables above had used.

First, the evaluation. The authors' published weights, loaded into our model, match their own forward pass (to 2×10⁻⁷ on mazes and 2×10⁻⁴ on Sudoku over 60 steps), and our evaluation scripts give them results close to the paper's: 100% of the 13×13, 59×59 and 201×201 test mazes, 62.4% of 500 Sudoku validation grids with one attempt and 91.2% with 128 (paper: 66.1% with one attempt on the test grids), and 79.1% of the Maze-Hard test mazes (paper: 86.6%). The model and the evaluation hold up, so the gaps between our trainings and the paper come mostly from training; the remaining 7.5 points on Maze-Hard, with their own weights, are not explained, and that smaller part may sit in our model or our evaluation.

BenchmarkPaperTheir weights in our codePaper recipe herePublic recipe here
Mazes 201×201, 100 fresh mazes, K = 1100%100% (Table 1 mazes)83.3 ± 23.6% (runs 3, 4, 5: 50, 100, 100)97.5 ± 0.5% (runs 1, 2: 98, 97)
Mazes 59×59, 100 fresh mazes, K = 1100%100% (Table 1 mazes)96.7 ± 4.7%100.0 ± 0.0%
Sudoku, K = 166.1%62.4% (validation grids)26.0 ± 6.8% (50K steps), 8.0 ± 6.0% (20K, 2 runs)34.8 ± 2.0% (20K steps, 2 runs)
Sudoku, best of 12898.5% (K = 2048)91.2% (validation grids)67.0 ± 8.4% (50K), 24.5 ± 19.6% (20K)64.6 ± 0.2% (20K)
Maze-Hard, A* targets, K = 186.6%79.1%65.4 ± 4.1% (10K steps)not trained at this budget

Sudoku: the 1,000 official test grids, except for the authors' weights, evaluated on 500 validation grids. Maze-Hard: the 1,000 official test mazes.

The recipe searchThe recipe search
Left: 201×201 mazes, the share of 100 fresh test mazes solved by each training run, for the paper's recipe, the public recipe with a wall border, and the authors' exact setup with its ring of walls; the bar is the mean. Right: Sudoku, the share of the 1,000 test grids solved when the most confident of K attempts is kept; thin lines are the runs, the dotted line the authors' weights on validation grids, diamonds the paper.

The search ended on these choices:

PointPaperPublic codeOur choiceMeasured
Sudoku recipecosine learning-rate decay, plain update, initialisation not givenupdate kept tangent to each normalised state; learning rate from 10× the peak down to the peak, then constant; their initialisationpublic code34.8% against 8.0% with one attempt at 20K steps; without any one of the three, 0% at 10K
Optimiser betasnot given (we used 0.999)0.95public code0.999 learns faster at first and ends 6 to 9 points lower with 128 attempts at 20K (validation grids)
Maze data9×9 cells11×11: a ring of walls around each mazethe ring97.5% against 83.3% at 201×201, fresh mazes
Maze borderwallswrap-aroundwrap-around, on the ringwithout the ring, wrapping joins corridors on opposite edges: 85, 53 and 20% at 13, 59 and 201
Weight averagenot givenconstant from step 0public codeno effect beyond the variation between runs
Maze-Hard recipeas writtenpublic codepaper (unchanged)not compared at the same budget

Sudoku: the public recipe wins. At the same 20K steps, it solves 34.8 ± 2.0% of the test grids with one attempt and 64.6 ± 0.2% with 128, against 8.0 ± 6.0% and 24.5 ± 19.6% for the paper's recipe. With one attempt it beats in 20K steps what the paper's recipe reached in 50K (26.0%), and it is far more even from run to run. Three ingredients the paper does not mention decide whether the model learns at all: taking any one of them out of the public recipe leaves 0% after 10K steps. The first one changes a single line of the cell update: the update loses its component along the current state, so a step turns each normalised group of channels instead of stretching it (simplified):

src/nca/model.py
def project_tangent(self, dx, x):
    xg, dg = groups(x), groups(dx)                       # channel groups of unit norm
    return dg - (dg * xg).sum(dim=2, keepdim=True) * xg  # remove the radial part of dx

x = x + self.project_tangent(fire_mask * dx, x)          # instead of x + fire_mask * dx

The other two are the learning-rate schedule and the initialisation. Our betas of 0.999 only help the start. The rest of the gap with one attempt, 34.8% against the paper's 66.1%, is most likely the paper's 150K training steps; with many attempts, the paper also keeps the best of 2,048 instead of 128. The 150K-step run was not made.

Mazes: only the authors' exact setup is reliable at 201×201. The public code turns each 9×9 maze into an 11×11 grid with a ring of walls around it, and wraps the borders around. Without the ring, the wrap joins corridors on opposite edges, and the public recipe falls to 20% at 201×201. With a wall border instead, it does worse than the paper's recipe on new runs: 69%, 4% and 68% (mean 47.0%), against 50%, 100% and 100% (83.3%). Without the ring, no recipe is reliable: at this size the spread between runs is as large as the difference between recipes. With the ring, both runs solve 97% and 98% of the fresh mazes. It is the default now, with the caveat that it rests on two runs, not three; the main table keeps the paper's recipe.

Maze-Hard: not settled. Our runs have half the paper's 20K training steps, and the public recipe was not trained at our budget. The authors' weights reach 79.1% in our code, against the paper's 86.6%, so most of our gap is in training.

Three false leads on the way. The first comparison of the public recipe fell to 20% at 201×201 and pointed at wrap-around borders; the cause was the missing ring of walls, and the authors' weights confirm it, with 100% at every size with the ring and 0% without. A constant weight average then seemed to lift 201×201 from 71% to 96.5%; two trainings of the same recipe already diverge on a GPU, and keeping both averages and the raw weights of the same training runs showed no rule: on one run the warm-up average solved 42% of the 201×201 mazes, the constant one 19% and the raw weights 2%; on the two others both averages solved 100%. Finally, betas of 0.999 looked like a clear gain at 10K steps and were worse at 20K. Each would have been caught on the first day by running the authors' weights through our code before training anything.

Improvements: cutting the training cost

Training is the bottleneck of this replication: at the speed of the original code, Maze-Hard and the full Sudoku budget would occupy the laptop for days. So the training loop was rewritten as a second engine that keeps the model, the data, the losses and the checkpoint format, and changes only how a step is executed. Each change was checked against the reference at the same precision (cell states, loss and gradients within fixed tolerances that were never loosened) before being timed.

On the laptop, one run at the paper's budgetOriginal codeOptimised engineSpeed-up
Maze-OOD, 5K steps, fp32 → bf1614 min5.4 min2.6×
Maze-Hard A*, 20K steps, fp323.9 h3.5 h1.12×
Sudoku-OOD, 150K steps, bf1624 h5.7 h4.3×
Sudoku-Extreme, 200K steps, batch 128, bf162.8 days (engine's reference path)21 h3.2×

Measured on the laptop RTX 4060 (8 GB): the average time of a training step over three complete training runs per engine (5K steps for Maze-OOD, 10K for Maze-Hard, 50K for Sudoku-OOD), multiplied by the paper's number of steps. Both engines use the same precision, except on Maze-OOD, where the published runs trained in fp32 and the optimised engine in bf16, so part of that gain comes from the precision. Sudoku-Extreme was only benchmarked, not trained, with a batch of 128, which fits in 8 GB, instead of the paper's 800; its baseline is the engine's own reference path, which the original code matched (1.22 s per step) in an earlier, shorter benchmark. Compilation and evaluation are excluded; compilation takes up to a minute.

The same engine was first developed on a cloud NVIDIA L4 with its memory capped at 8 GiB. There, against the engine's own reference path rather than the original code, the gains are 5.8× on Maze-OOD, 1.6× on Maze-Hard (fp32), 3.5× on Sudoku-OOD and 3.4× on Sudoku-Extreme at batch 800. The laptop gains are lower on mazes because the original code is already faster on the laptop than that reference path on the L4.

Speed-ups of the optimised engineSpeed-ups of the optimised engine
Left: one training run at the paper's budget on the laptop RTX 4060, original code against the optimised engine, projected from the average step time of complete training runs (Sudoku-Extreme: from a benchmark of full training steps). Right: one rollout of one grid at test time on a cloud L4 GPU, the engine's reference path against its optimised settings, already compiled. Log scale.

The faster engine learns as well. Three Maze-OOD runs trained with it at the paper's settings take 5.4 minutes each instead of 14, and land within the spread between runs, with one weaker run: 100% at 13×13, 100%, 90% and 100% at 59×59 (published runs: 100%, 99% and 96%), and 100%, 36% and 99% at 201×201 (published: 100%, 83% and 74%). Three Maze-Hard runs take 105 minutes each instead of 117.5 for the original code, 1.12 times faster, and reach the same validation accuracy (62.5% against 63.5% on 128 mazes). On the 1,000 test mazes they solve 62.7 ± 3.0% with one attempt and 68.0 ± 2.0% with the most confident of 64, against 65.4 ± 4.1% and 70.3 ± 2.9% for the original code's runs, within the spread between runs. Three Sudoku-OOD runs take 1.9 hours each instead of 8.2 and do slightly better than the published ones, within the spread between runs: 28.5 ± 3.4% of the test grids with one attempt (published 26.0 ± 6.8%) and 71.0 ± 5.8% with 128 (published 67.0 ± 8.4%).

The gains come from four groups of changes, detailed in the blog post: no round trip to the CPU inside a rollout; blocks of four steps compiled into single GPU programs; custom GPU kernels for the Sudoku perception and for the update network; and, when memory runs short, recomputing parts of the rollout during the backward pass instead of storing them. Evaluation gains more than training, 6 to 12 times on one grid, which makes large numbers of parallel attempts affordable.

Status

  1. Maze-OOD and Sudoku-OOD: done, with a recipe search that compares the paper's recipe, the authors' public code and their published weights. Defaults: the public recipe for Sudoku, the authors' exact setup with its ring of walls for mazes.
  2. Faster training engine: done. On the laptop it trains 1.1 to 4.3 times faster than the original code, with accuracy within the spread between runs on Maze-OOD, Maze-Hard and Sudoku-OOD.
  3. Maze-Hard: done at half the paper's training steps, with A* targets (original code and optimised engine) and BFS targets. Sudoku-Extreme, the pruning it tests and Sudoku at the full budget are not run: they go over the 25-hour limit set per experiment, or were dropped. ARC-AGI-1 and Visual Sudoku are left out of this replication.

This page and the blog post are updated as new results land.