Classical Energies Learn to Reason 1,000x Faster than Looped Models

Energy Reasons Faster

Symbol colors. A color marks a symbol's role, the same on every post and deck. Roles in this post:state what descent changescouplings the weights between unitstruth the true answernegatives the fake answers training pushes up

A red ball rolls fast down a hillside drawn as one black line, with three short lines behind it to show its speed.

Looped models are a popular new way to make neural networks reason. But they are slow to train, and they use millions of parameters to solve simple logic puzzles. We show that a small energy from the 1980s, with learned weights, solves the same puzzles after 42 milliseconds of training, uses 282× fewer operations to reason, and never stops at a wrong answer.

Train ≥1,000× faster
Schematic energy landscape for training, drawn as a surface with a well. A green arrow pulls down the point at the bottom of the well, labelled: pull down, solution's energy. Six orange arrows push up points around the well, labelled: push up, negative samples. Below the landscape, two Sudoku-Extreme boards: the solved training puzzle, and a stack of copies of it, each with one wrong cell. On the top copy the wrong cell has an orange frame, and the digits of its row, column and box that now conflict with it are marked in a lighter orange.
Reason with ≥282× less compute
Schematic energy landscape for reasoning, drawn as a surface with a well. Four blue paths, labelled noisy descent, start at random points. One path descends into the well and stops where it meets a small dashed green ring near the bottom of the well, labelled stopping threshold, at a green point labelled solved. Below the landscape, Sudoku-Extreme boards: a stack labelled random walker, clues clamped, with a random guess in every blank cell, and the solved board.

CRAM trains at least 1,000× faster than looped models, and reasons with at least 282× less compute. Training directly lowers the energy of solved puzzles while raising the energy of incorrect solutions or "negative samples". Reasoning keeps the clues of a new puzzle clamped and runs several chains from random guesses, noisily lowering the energy one cell at a time, until the energy of one chain reaches a stopping threshold fitted to the training solutions. The boards are real Sudoku-Extreme puzzles.

Looping Is an Emerging Form of Reasoning

A looped model applies one network, or one block of layers, many times in a row. Give it a Sudoku puzzle with empty cells, and each pass through the block refines its guess at the filled board. The block reuses its weights on every pass, so a looped model is a recurrent network in depth.

The idea of “looping” is not new: recurrent relational networks solved Sudoku by repeated message passing [RRN], and Universal Transformers apply one transformer layer many times [UT]. 2025 kicked off the new wave of looped models, with the Hierarchical Reasoning Model (HRM) [HRM] and the Tiny Recursive Model (TRM) [TRM] made looping popular. With a few million parameters, they learn Sudoku-Extreme and mazes from examples, which large feedforward transformers generally fail to do. Many variants followed [GRAM, EqR, FRM, TRMP, EBR, FPRM].

Looping works, but it has three problems.

Why looped models succeed is also unclear [ARC Prize, Ren and Liu].

Looping Is Slow to Train

The main cost of training is backpropagation through time (BPTT). BPTT runs the loop forward, 16 or more passes, compares the last output with the answer, and sends the gradient back through every pass. The update then changes the whole trajectory, so that the next time the model sees the puzzle, its output is a little closer to the answer. Every training step pays for the whole reasoning trajectory twice: once forward and once backward. The figure below shows the four stages.

How can energy-based models be trained?
  1. Looped models learn by backpropagation through time (BPTT). BPTT runs the inference steps, measures the error between the output and the answer, and corrects a portion of the entire path accordingly. Large energy-based reasoners ((cite)) are trained the same way, through their descent.

  2. Energy landscapes can be shaped directly. So long as we know what "real-looking" solution is and what a "fake-looking" solution is, we can shape an energy landscape: low-energy for real data, high-energy for fake data. This lets you train with no backpropagation through any path. The figure above shows how CRAM does this.

Looping Looks Like Energy Descent

Write one pass of a looped model as an update of its state x\state{\boldsymbol{x}}:

x(t+1)=x(t)+fθ(x(t))\state{\boldsymbol{x}}^{(t+1)} = \state{\boldsymbol{x}}^{(t)} + \boldsymbol{f}_{\coupling{\boldsymbol{\theta}}}\big(\state{\boldsymbol{x}}^{(t)}\big)

The learned network fθ\boldsymbol{f}_{\coupling{\boldsymbol{\theta}}} can be anything. Now constrain it to be the negative gradient of a learned scalar function EθE_{\coupling{\boldsymbol{\theta}}}, the energy, with a step size η\eta:

x(t+1)=x(t)−η ∇xEθ(x(t))(1)\state{\boldsymbol{x}}^{(t+1)} = \state{\boldsymbol{x}}^{(t)} - \eta\,\nabla_{\state{\boldsymbol{x}}} E_{\coupling{\boldsymbol{\theta}}}\big(\state{\boldsymbol{x}}^{(t)}\big) \tag{1}

The loop is now gradient descent on the energy. The energy gives one number to every candidate board: low for a board that satisfies the rules, high for a board that breaks many of them. An unsolved puzzle starts high on this landscape, the solution sits at the bottom of a well, and reasoning is the walk down. For a small enough step size, each step lowers the energy, so the loop settles at a fixed point by construction. The figure below compares the two.

From looping to energy
  1. Looped model

    A looped model a step. Inference or "reasoning" is a sequence of steps that get closer to a desired output. Nothing constrains the path those steps take, and it does not need to settle.

  2. Descent on an energy

    An energy-based model learns a landscape. Inference or "reasoning" paths are searches for low-energy states on that landcsape. Reasoning is complete when no step lowers the energy further.

Learn the Energy Directly

Looped models already borrow the properties of an energy, one at a time. Some train their loop to converge to attractors or fixed points [EqR, FPRM, Attractor Models], which descent on an energy gives for free. Others learn when to stop with a separate halting network [ACT, PonderNet, HRM, TRM]. Others put an energy on top of a deep network and descend it [IREM, IRED, EBT, AKOrN, EBR]. Each of these adds a head, a loss or a module to the looped network, and the network still trains by BPTT.

Hypothesis: an explicit energy enables rapid training and efficient reasoning.

We test this with a small energy that has no network inside it. We call it Compact Reasoning Associative Memory (CRAM). On Sudoku-Extreme and Maze-Unique, compared with seven looped models:

CRAM’s Energy Is a Sum of Costs

A puzzle has MM answer variables, called cells, and each cell takes one of CC values. A 9×9 Sudoku has M=81M = 81 cells with C=9C = 9 digits each. A maze has one cell per square, which is on or off the path (C=2C = 2). CRAM keeps a belief pi\state{\boldsymbol{p}_i} for each cell ii: a softmax distribution over the cell’s CC values. Its energy is a sum of costs on cells and on pairs of cells:

E(p)=β−1∑ipi⊤log⁡pi⏟negative entropy+12∑i≠jpi⊤Kij pj⏟pair costs+∑ibi⊤pi⏟input costs(2)E(\state{\boldsymbol{p}}) = \underbrace{\beta^{-1}\sum_i \state{\boldsymbol{p}_i}^{\top}\log\state{\boldsymbol{p}_i}}_{\text{negative entropy}} + \underbrace{\frac{1}{2}\sum_{i\neq j}\state{\boldsymbol{p}_i}^{\top}\coupling{\boldsymbol{K}_{ij}}\,\state{\boldsymbol{p}_j}}_{\text{pair costs}} + \underbrace{\sum_i \coupling{\boldsymbol{b}_i}^{\top}\state{\boldsymbol{p}_i}}_{\text{input costs}} \tag{2}

The colors follow one rule through the post: blue symbols change during reasoning, and orange symbols are learned.

That an energy like this solves Sudoku is not new. It is a small change to the energy that Hopfield and Tank used in 1985 to solve the travelling salesman problem [Hopfield and Tank], written in the mean-field form of Peterson and Söderberg [Peterson and Söderberg]. In 2008, Hopfield set the weights of such an energy by hand to solve Sudoku [Hopfield (Sudoku)]. What is new is that CRAM learns its weights from solved puzzles, and is never told the rules.

Other work learns pairwise costs for Sudoku from solved puzzles too, with likelihood objectives close to ours [Brouard et al., Defresne et al.]. Those methods pass the learned costs to an exact combinatorial solver. CRAM instead reasons by descent on its own energy, as a looped model does, which lets us compare it with looped models step for step.

The name comes from associative memory. As in an Amari–Hopfield network [Amari, Hopfield], CRAM’s weights memorize associations, here between pairs of cell values that may appear together. Descent then completes a partial pattern: a puzzle given with only its clues. CRAM’s energy is a special case of the energies of modern Hopfield networks [Dense AM, AM tutorial].

Training Lowers the Energy of Correct Solutions

An energy defines a probability for every board, P∝e−EP \propto e^{-E}, the Boltzmann distribution. Training minimizes the negative log-likelihood (NLL) of the training solutions y\truth{\boldsymbol{y}} [Boltzmann machine, LeCun et al.]:

JNLL=Ey[−log⁡P(y)]\mathcal{J}_{\mathrm{NLL}} = \mathbb{E}_{\truth{\boldsymbol{y}}}\big[-\log P(\truth{\boldsymbol{y}})\big]

Its gradient has two terms:

∇θJNLL=Ey[∇θE(y)]−Ep−∼P[∇θE(p−)]\nabla_{\coupling{\boldsymbol{\theta}}}\mathcal{J}_{\mathrm{NLL}} = \mathbb{E}_{\truth{\boldsymbol{y}}}\big[\nabla_{\coupling{\boldsymbol{\theta}}} E(\truth{\boldsymbol{y}})\big] - \mathbb{E}_{\negative{\boldsymbol{p}^-}\sim P}\big[\nabla_{\coupling{\boldsymbol{\theta}}} E(\negative{\boldsymbol{p}^-})\big]

The first term lowers the energy of the real solutions. The second raises the energy of boards p−\negative{\boldsymbol{p}^-} sampled from the model, so the boards that the model wrongly favors are pushed up hardest [Du and Mordatch]. When the model puts all its probability on the solutions, the two terms cancel.

This objective has one large advantage over BPTT: no gradient goes through inference. The samples are held fixed, so there is no reasoning trajectory to backpropagate through. The figure below plays the objective on a line of 41 possible boards, with the second term computed exactly.

training step 0
Energy Ereal solution yfake solutions p−
Training shapes the energy of every board. Along the horizontal axis lie the possible Sudoku boards; one is the real solution (green), and every other board is a fake solution (grey). The blue curve is the energy of each board. Each training step lowers the energy of the real solution and raises the energy of each fake one in proportion to its probability under the model, until the real solution sits at the bottom of a well.

The cost is in the second term. A real puzzle has far too many boards to sum over, and drawing samples from the model takes a long Markov chain. Most training methods for energies differ in how they avoid this.

Pseudolikelihood: Fast Contrastive Training

CRAM uses pseudolikelihood [Besag]. It replaces the samples from the model with the solution changed at one cell:

JPL=Eθ(y)⏟lower energy on data+1∣F∣∑i∈Flog⁡∑aexp⁡[−Eθ(pi←a−)]⏟raise energy on one-cell changes(3)\mathcal{J}_{\mathrm{PL}} = \underbrace{E_{\coupling{\boldsymbol{\theta}}}(\truth{\boldsymbol{y}})}_{\text{lower energy on data}} + \underbrace{\frac{1}{|\mathcal{F}|}\sum_{i\in\mathcal{F}}\log\sum_{a}\exp\big[-E_{\coupling{\boldsymbol{\theta}}}(\negative{\boldsymbol{p}^-_{i\leftarrow a}})\big]}_{\text{raise energy on one-cell changes}} \tag{3}

Here F\mathcal{F} is the set of free cells, and pi←a−\negative{\boldsymbol{p}^-_{i\leftarrow a}} is the solution with cell ii set to value aa. If a free Sudoku cell holds a 5 in the solution, the loss compares the energy of the solution with the energies of the eight boards where that cell holds another digit. For each cell, this is a softmax cross-entropy over its values. It needs only the costs that touch that cell, and nothing is sampled. An L1 penalty sets a cost to zero where the examples show no constraint, so the learned energy is sparse.

The video below shows pseudolikelihood on a real Sudoku-Extreme solution. The solution’s energy is pulled down, the energies of its one-cell changes are pushed up, and a well forms around the solution.

Pseudolikelihood shapes the energy around a solution. Green: a Sudoku-Extreme solution, whose energy is pulled down. Orange: the solution with one cell changed, whose energy is pushed up.

Pseudolikelihood has a cost of its own. It shapes only the bottom of each well and its rim. It never trains the energy between wells, or far from any solution. So the search at inference needs noise to find the wells, which the next section describes. On these four tasks, pseudolikelihood trains an energy as good as the one that contrastive divergence trains, and much faster (below). Harder problems will likely need some sampling from the model.

Reasoning Minimizes the Energy

At inference, the clues stay fixed and the free cells descend the energy. As in Hopfield networks, each cell has a state xi\state{\boldsymbol{x}_i}, and its belief is the softmax of that state at temperature TT:

xi←xi−η ∇piE(p),pi=softmax⁡(xi/T)\state{\boldsymbol{x}_i} \leftarrow \state{\boldsymbol{x}_i} - \eta\,\nabla_{\state{\boldsymbol{p}_i}} E(\state{\boldsymbol{p}}), \quad \state{\boldsymbol{p}_i} = \operatorname{softmax}\big(\state{\boldsymbol{x}_i} / T\big)

With step size η=1\eta = 1 and one cell at a time, the update is exact, and it is one looped layer:

xi←−∑jKˉij pj−bi,Kˉij=12(Kij+Kji⊤)(4)\state{\boldsymbol{x}_i} \leftarrow -\sum\nolimits_{j} \coupling{\bar{\boldsymbol{K}}_{ij}}\,\state{\boldsymbol{p}_j} - \coupling{\boldsymbol{b}_i}, \qquad \coupling{\bar{\boldsymbol{K}}_{ij}} = \tfrac{1}{2}\big(\coupling{\boldsymbol{K}_{ij}} + \coupling{\boldsymbol{K}_{ji}}^{\top}\big) \tag{4}

So CRAM is itself a looped model, whose layer is fixed by its energy.

Deterministic descent tends to stop in a spurious local minimum, the regions that pseudolikelihood never trained. So CRAM runs a noisy focused Gibbs search [Hopfield and Tank, Geman and Geman]. Each move picks a cell whose local energy is high, computes its state with the update, and samples the cell’s value from its belief. Because the value is sampled, a move can go uphill and leave a local minimum. On Sudoku-Extreme, four search chains run in parallel from random boards.

The energy also says when to stop. After training, we measure the energies of the training solutions. The search stops at the first board whose energy is at most the highest of them. This threshold is one number, read off the trained energy; no separate network learns it.

Each move is a fixed, small amount of arithmetic, so we can count the FLOPs of a search exactly and compare them with the FLOPs of a looped model.

Four Reasoning Benchmarks

We test on four benchmarks that are standard for looped models (the table below).

The four benchmarks. Sudoku-Extreme is from HRM [HRM], Maze-Unique from EqR [EqR], and N-Queens and graph colouring from GRAM [GRAM].

Benchmark The task Answers per puzzle
Sudoku-Extreme hard 9×9 Sudoku one
Maze-Unique the one path through a 30×30 maze one
N-Queens (8×8, 10×10) place queens so that no queen attacks another, given some queens many
Graph colouring (8, 10 nodes) colour each node so that no edge joins two nodes of one colour many

Sudoku-Extreme and Maze-Unique have one answer per puzzle, so the score is the share of puzzles solved. N-Queens and graph colouring have many answers per puzzle, so a second question is how many different answers a model finds.

The figure below runs the trained CRAM weights for each task in your browser. Press Play to watch each search lower its energy until it stops, or click a puzzle to replay it.

A still: one search per task, run with this figure’s code. Enable JavaScript to run the models here.

Sudoku-Extreme
739216485451837296682945371896423157524761938173589642245698713367154829918372564
Solved after 9,303 updates
per chain, 4 chains
Maze-Unique
Solved after 290 updates
N-Queens 8×8
Solved after 218 updates
first of 4 chains to stop
Graph colouring 10
1222322223
Solved after 63 updates
first of 4 chains to stop
Energy of active searchIt stops when a chain’s energy reaches the fitted threshold.020406002000400060008000update stepenergystopping thresholdEnergy of active search020406005000update stepenergystopping threshold
See Maze-Hard ↓

Trained CRAM models running live in your browser. CRAM energy, trained separately from observed puzzle solutions for each task, solves all four kinds of puzzles by minimizing its energy one cell at a time. Feel free to shuffle different puzzle examples. The playback is not in real time: it is slowed down about 10× for Sudoku, about 5,000× for Maze-Unique, and more than 10,000× for N-Queens and graph colouring.

Seven Looped Baselines

We compare CRAM with seven looped models from 2025 and 2026.

EBR is the closest to CRAM, and it is the reason this work exists: it shows that energy helps looped reasoning, but it trains a large network by BPTT. We retrain each model with its authors’ code and recipe on one H200 GPU, and score it with its published inference setting.

More Accurate, 1,000× Faster to Train

CRAM solves 99.996% of the 412,786 Sudoku-Extreme test puzzles and all 1,000 Maze-Unique test mazes (the table below). The most accurate looped model, TRMP, solves 99.87% and 99.23%. HRM, the model that started this line of work, solves 54.6% and 40.0%.

CRAM trains in 42 ms on Sudoku-Extreme and 132 ms on Maze-Unique, with 7.7 thousand and 18 parameters. The looped models train for 1.2 to 23 hours. Some looped models have faster hand-tuned variants, so we state the speed-up as at least 1,000×.

ModelSudoku-ExtremeMaze-Unique
Solved (%) Params flop / puzzle Fit timeSolved (%) Params flop / puzzle Fit time
HRM54.62±4.18 27.0M 2.20 × 1011 1.2 h39.97±33.90 27.0M 3.01 × 1012 7.1 h
TRM85.73±0.74 5.0M 4.11 × 1011 2.5 h92.23±13.37 6.8M 3.84 × 1012 15.6 h
GRAM96.10† 9.1M 8.51 × 1012 3.2 h98.63±1.31 10.9M 8.00 × 1013 23.2 h
EqR99.49±0.14 5.0M 2.11 × 1014 2.0 h93.00† 263.8K 1.16 × 1014 7.2 h
FRM99.13±0.29 7.0M 3.91 × 1012 2.9 h97.27±2.80 8.0M 4.70 × 1012 9.7 h
TRMP99.87±0.08 32.8K 4.57 × 1012 9.0 h99.23±0.31 60.7K 1.80 × 1013 7.6 h
EBR99.85±0.05 1.8M 3.37 × 1011 2.8 h89.80±6.35 1.8M 1.93 × 1013 2.0 h
CRAM100.00±0.00 7.7K 2.02 × 109 0.04 s100.00±0.00 18 8.37 × 105 0.13 s
(hand-set)‡100.00±0.00 1 1.08 × 108 —100.00±0.00 3 8.37 × 105 —

Solved: mean ± SD over three training runs. Params: nonzero parameters. flop / puzzle: mean inference operations per puzzle, every search chain and failed search included. Fit time: one run on one H200. † Published accuracy, shown where our reproduction scored lower. ‡ Weights set by hand from the task's rules; Params counts unique nonzero values.

CRAM is more accurate than every looped model on both tasks, and trains at least 1,000× faster. Each looped model is retrained with its authors’ code and recipe and scored with its published inference setting. Solved: mean and standard deviation over three training runs. Params: nonzero parameters. A dagger marks a published accuracy, shown where our reproduction scored lower. The gray row has weights set by hand from the rules (below). CRAM’s fit time is the median of seven complete fits after a first fit in the same process; each looped model’s is one run in a fresh process.

To make the gap concrete: TRM trains on Sudoku-Extreme for 2 hours and 32 minutes on one H200. In that time, CRAM trains 215,056 times.

CRAM trains 215,000 times in the time TRM trains once. The clock runs at real time for the first second, then speeds up.

N-Queens and Graph Colouring: Seconds, Not Hours

On N-Queens and graph colouring, a model can draw several answers for each puzzle. We score two things (the table below): whether the kept answer is valid, and Cov@20, the share of each puzzle’s solutions that 20 samples find.

CRAM’s answers are valid: with 20 samples, it solves 100% and 99.99% of the N-Queens puzzles, and its graph colourings have no conflicts. Its coverage is within a few points of EBR, the strongest looped model here, on every task. CRAM has at most 869 parameters and trains in at most 6.8 seconds; EBR has 7.1 million parameters and trains for at least 3.2 hours.

ModelNN-Queens 8×8N-Queens 10×10Graph colouring 8Graph colouring 10ParamsFit time
Solved (%)Cov@20Solved (%)Cov@20ConflictsCov@20ConflictsCov@20
HRM—84.4158.837.80†10.7139.720.6182.76.227.3M≥ 41 min
TRM—67.3951.417.50†3.3118.021.8169.06.96.8M≥ 54 min
GRAM199.44—88.91—3.3—52.7—10.9M≥ 53 min
20100.0097.999.9892.93.387.952.737.8
EBR1100.00—99.31—0.0—0.3—7.1M≥ 3.2 h
2099.9598.199.9992.52.788.90.754.8
CRAM199.95—99.45—0.0—0.3—≤ 869≤ 6.8 s
20100.0097.999.9993.60.088.90.052.6
(hand-set)1100.00—99.99—0.0—0.0—≤ 2—
20100.0098.4100.0095.50.090.60.055.2

On N-Queens and graph colouring, CRAM is as accurate and as diverse as the best looped model, and trains in seconds. N = 1 keeps one sample; N = 20 keeps the best of 20 (the majority vote for GRAM, the lowest energy for EBR and CRAM). HRM and TRM are deterministic, so they have one row. Solved: test puzzles whose kept answer is valid (%). Conflicts: edges whose two nodes have the same colour, summed over the test graphs; lower is better. Cov@20: the share of each puzzle’s solutions that 20 samples find (%). Bold: the best learned value of each column. Test sets from GRAM; mean over three training runs.

Same Accuracy with 282× Fewer Operations

Each method has a setting that limits its inference compute: reasoning steps, restarts, sampled trajectories, rollouts or, for CRAM, search moves. Sweeping that setting gives each method’s accuracy at each compute budget (the figure below).

The looped models spend between 101010^{10} and 2×10142\times 10^{14} FLOPs per Sudoku-Extreme puzzle. CRAM solves 99.997% with about 2×1092\times 10^{9} on average. It matches EBR’s top accuracy (99.86%) with 1.9×1091.9\times 10^{9} FLOPs per puzzle, against EBR’s 5.4×10115.4\times 10^{11}: 282× fewer. Against EqR, the ratio is 128,000×.

stops early fixed compute
top 2%9899100CRAMEBRTRMPFRMEqR020406080100CRAMEBRTRMFRMHRMGRAMTRMPEqR282×fewer operations0.010.11101001,00010,000100,0001,000,000Gflop per puzzle (mean, log scale)puzzles solved (%)
Each looped model's best, and what CRAM needs for the same accuracy
ModelBest solvedGflop per puzzleCRAM's Gflop at same accuracy
EBR99.86%5421.92 (282× fewer)
TRM89.72%8231.14 (722× fewer)
HRM57.10%4410.46 (958× fewer)
TRMP99.87%4,7341.92 (2,467× fewer)
FRM99.42%7,8101.59 (4,900× fewer)
GRAM94.74%17,0201.32 (12,894× fewer)
EqR99.49%210,6001.65 (127,869× fewer)

CRAM matches each looped model’s best accuracy with at least 282× fewer floating-point operations. Each curve shows one method’s most accurate setting at each compute budget, on 10,000 Sudoku-Extreme test puzzles: the mean over three training runs, with bars from the lowest to the highest run. The upper panel zooms into the top 2%. The flop counts include the whole search, every search chain included. Hover over a point for its numbers.

The Energy Lets Compute Follow Difficulty

A good reasoner spends more effort on harder problems. CRAM does this without a halting network: its search stops at the first board below the energy threshold, and a hard puzzle takes longer to get there. Across the dataset’s difficulty ratings, CRAM’s median compute grows 22× from the easiest bin to the hardest, and its accuracy stays at 100% (the figure below).

FRM spends the same compute on every puzzle, and its accuracy falls on the hardest ones. EBR has an early-stopping rule, but its compute barely changes with difficulty, and its accuracy dips on the hardest bin.

CRAMEBRFRM
10710910111013FLOPs per puzzle96979899100solved (%)012–34–78–1516–3132–6364+difficulty rating of the puzzle (dataset)

CRAM’s compute grows with the difficulty of a puzzle, and its accuracy does not fall. The 10,000 Sudoku-Extreme test puzzles of the compute figure, binned by the dataset’s difficulty rating. Top: median FLOPs per puzzle (log scale), with a band from the 10th to the 90th percentile for the methods whose compute varies. Bottom: puzzles solved, median over three training runs, with a band over the runs. EBR and FRM are at their most accurate settings.

CRAM Never Stops at a Wrong Answer

A stopping rule is only useful if it is right when it stops. The halting rules of HRM, TRM, EqR, TRMP and EBR each stop at an incorrect board on 0.05% to 3.54% of the puzzles that they stop on (the table below). CRAM’s energy threshold never does. CRAM misses a puzzle only when its search reaches its compute budget before any board passes the threshold; that is where its 0.004% of unsolved Sudoku-Extreme puzzles come from.

Only CRAM never stops at a wrong answer. Each looped model runs one rollout in its halting mode. Wrong stops: puzzles on which the rule stopped at an incorrect board, as a share of the puzzles it stopped on (%). Full test sets, pooled over three training runs.

Wrong stops (%)
Stopping ruleSudokuMaze
HRM halting head0.620.16
TRM halting head2.373.54
EqR halting head1.611.06
TRMP halting head0.050.73
EBR gradient-norm stop0.21–*
CRAM energy threshold0.000.00

* EBR’s gradient-norm stop does not work on Maze-Unique: its gradient norm stays near 2 even at correct mazes, so EBR’s published maze protocol runs a fixed number of segments.

Training Without Unrolling Is Fastest

Is CRAM fast because of its energy, or because of pseudolikelihood? We train the same energy five ways (the figure below).

Every method can train this energy, but the objectives that never unroll the loop are faster by orders of magnitude.

PseudolikelihoodMin. probability flowOne-step BPTTContrastive divergenceFull BPTT
025507510099%development puzzles solved (%)10 ms100 ms1 s10 s100 straining time on one H200 (log scale)

Local objectives train the same energy fastest. Mean solve rate on 512 Sudoku-Extreme development puzzles over 20 training runs per method, against training time on one H200 (log scale), with a band from the 25th to the 75th percentile of the runs. A filled circle marks where the mean first reaches 99%. Times include fitting the stopping threshold and exclude each run’s one-time start-up.

CRAM Learns from Few Puzzles

An energy with few parameters should also need few examples. We train each method on a growing number of unique Sudoku-Extreme puzzles, each with 99 symmetric variants, as the looped models are trained (the figure below). CRAM solves 98.9% of 10,000 test puzzles after 30 unique training puzzles. EBR needs 700 to reach 98%. TRM does best with fewer than 10 puzzles, but improves much more slowly after that.

CRAMEBRFRMTRM
025507510098%Test Puzzles Solved (%)1101001k10k100kUnique Training Puzzles (+99 augmentations each)

CRAM learns Sudoku-Extreme from about 30 unique puzzles. Puzzles solved out of 10,000 Sudoku-Extreme test puzzles, against the number of unique training puzzles (log scale), each with 99 augmentations. Line: median of six training runs per method. Small dots: single runs.

Hand-Set Weights Solve Every Benchmark

These results come with a warning. All four benchmarks belong to a category of logic puzzles that CRAM’s pairwise energy can represent exactly, as Hopfield and Tank showed for such problems in 1985. If you know the rules, you can set CRAM’s weights by hand. With the same search, a hand-set CRAM energy solves every test puzzle of all four benchmarks, with very few unique weight values:

On Sudoku, the hand-set energy even uses up to 19× fewer FLOPs than the learned one. So a high score on these benchmarks shows only that a model has learned a few pairwise rules between answer cells. It does not show that a method will scale to harder reasoning.

The Weights Are the Rules of the Puzzle

Because the energy is this small, we can read what CRAM learned (the figure below).

On Sudoku, CRAM is told no rules. In every training run, it learns a positive cost on two equal digits in exactly the 810 pairs of cells that share a row, column or box, and leaves every other cost at zero. Those are the rules of Sudoku.

On Maze-Unique, the learned weights form a 3×3 window around each cell. A cell on the path costs +1.24, and each neighbour on the path at its side lowers that cost by 1.00. So a cell with only one neighbour on the path, a dead end, costs energy and switches off. This is dead-end filling [Pullen], a local rule that solves every maze without loops. Pseudolikelihood finds nearly the hand-set values.

Left: a 9 by 9 grid of Sudoku cells around one cell i; short red diagonal lines, one per pair of equal digits, appear only in the cells of i's row, column and box. Right: a 3 by 3 window of maze weights: the cell's own on-state costs +1.24, its four side neighbours on the path each lower it by 1.00, and the corners are near zero.

CRAM’s learned weights are the rules of the puzzle. Left: the learned cost Kij\coupling{\boldsymbol{K}_{ij}} between one Sudoku cell ii and every other cell jj, digit by digit; it is nonzero only between equal digits in the same row, column or box. Right: the Maze-Unique weights around one cell: a cell on the path costs energy unless neighbours at its sides are also on the path, so dead ends switch off.

Maze-Hard Needs Hidden Neurons

Where does a pairwise energy stop working? Maze-Hard [HRM] is a maze benchmark on which no published looped model reaches 90%. In Maze-Unique, one path joins the start S to the goal G. In Maze-Hard, the mazes have loops, so many paths join them, and the answer is the shortest one; ties go to the path that breadth-first search finds first, with the neighbour order down, left, right, up.

A Maze-Unique maze, with one path from S to G, beside a Maze-Hard maze, which has loops and is labeled with one shortest path

Maze-Unique has one path; Maze-Hard has loops. Each maze is shown with its labeled path in green.

Dead-end filling leaves every loop in place. Which side of a loop to take depends on the distance from each cell to G, and no local window of the maze contains that distance. A pairwise energy over the answer cells alone solves none of 100 development mazes.

So we give CRAM one layer of hidden neurons, one per open cell, whose job is to compute that distance. Their energy has one learned mass m\coupling{m}, a reward for neighbouring outputs that are both large, and a unit input at the goal:

Ez(z)=∑i[m2 zi2−12∑j∈N(i)zi zj]−zGE_z(\state{\boldsymbol{z}}) = \sum\nolimits_i \Big[\tfrac{\coupling{m}}{2}\,\state{z_i}^2 - \tfrac{1}{2}\sum\nolimits_{j \in \mathcal{N}(i)} \state{z_i}\,\state{z_j}\Big] - \state{z_{\mathrm{G}}}

Reasoning is now two relaxations. First the hidden neurons settle; their settled outputs fall off with distance from G. Then the answer cells relax with the Maze-Unique energy, plus learned links between neighbouring cells whose strength depends on the settled hidden outputs. The model has 29 parameters: Maze-Unique’s 18 and 11 more. It solves 99.9% of the 1,000 Maze-Hard test mazes after less than 30 seconds of training (the table below). In the figure below, press Play to watch the hidden layer settle, then the path.

A still: one search, run with this figure’s code. Enable JavaScript to run the model here.

Maze-Hard
SG
Solved: phase 1 took 128 steps,
phase 2 took 112 steps
Phase 1: hidden relaxation02004000255075100125hidden update stepneurons not settledPhase 1: hidden relaxation0200400050100hidden update stepneurons not settled
Phase 2: visible relaxation−6000−4000−2000020406080100visible update stepenergyPhase 2: visible relaxation−6000−4000−2000050100visible update stepenergy

hidden neurons z (phase 1), darker nearer G visible cells on (phase 2) path at the stop

CRAM, with an added hidden layer of neurons, can solve Maze-Hard. The objective of Maze-Hard is to find the shortest path from start to goal, and if there are multiple shortest paths, to find the one that follows a preferred configuration of turns. The 29 trained weights run in your browser on test mazes. Feel free to shuffle the test maze.

CRAM with a hidden layer solves 99.9% of Maze-Hard with 29 parameters. Exact match to the labeled path on the 1,000 test mazes. Looped models: accuracy published by their authors, parameters and FLOPs counted by us. CRAM: three training runs, each solving 999 of 1,000. FPRM: Fixed-Point Reasoners [FPRM]. NCA: neural cellular automata [NCA].

Model Solved (%) Parameters FLOPs per maze
HRM 74.5 27M 3.0×10123.0\times 10^{12}
TRM 85.3 6.8M 3.8×10123.8\times 10^{12}
FPRM 87.0 6.8M 4.8×10144.8\times 10^{14}
EBR 88.3 1.8M 1.9×10131.9\times 10^{13}
NCA 89.2 41K 2.0×10122.0\times 10^{12}
CRAM with a hidden layer 99.9 29 1.4×1071.4\times 10^{7}

This result needs a plain caveat. We designed this hidden layer because we knew that the answer depends on the distance to the goal. It will not help on a task that has no distance to a goal.

Learning Hidden Variables Is the Open Problem

General reasoning needs hidden quantities that nobody designs in advance. In ARC, the Abstraction and Reasoning Corpus [ARC], every task has a new hidden rule, which a solver must infer from a few examples (the figure below). The rule can depend on how many objects there are, which objects they are, and which of several transformations applies. CRAM’s energy, with one variable per answer cell, cannot represent such rules.

Three ARC tasks, each with its own hidden rule. Each task shows one example and its test; the dashed box marks the answer.

There is a second limit, in training. Pseudolikelihood compares a solution with every one-cell change of it. That is cheap with 9 digits per cell, but not with tens of thousands of values per position, as in language; there, the competitors would have to be sampled.

Learning hidden variables from data, without knowing the task’s design, is the open problem for scaling energies to harder reasoning, and the next step for this line of work.

Energies Learn to Reason, 1,000× Faster

Looped models rebuild the properties of an energy one at a time: fixed points, halting heads and search, each added on top of a network trained by BPTT. An explicit energy gives these properties by construction. On constraint puzzles, CRAM shows what that is worth:

These properties matter beyond puzzles. A model whose answer improves with every loop, and whose energy says when the answer is good, can stop whenever its compute budget runs out and return the best answer so far.

The warning matters as much as the speed-up. Sudoku, mazes, N-Queens and graph colouring are solved with at most three hand-set weight values, so they are too easy to show whether a reasoning method scales. We think explicit energies are a promising direction for learning to reason from data, and that the harder benchmarks, which need learned hidden variables, are where that should be tested next.

Citation

To cite this work, cite the paper on arXiv:

@article{hoover2026cram,
  title         = {Classical Energies Learn to Reason 1,000x Faster than Looped Models},
  author        = {Benjamin Hoover and Hugh Blayney and James C. R. Whittington},
  journal       = {arXiv preprint arXiv:2611.17309},
  year          = {2026},
  eprint        = {2611.17309},
  archivePrefix = {arXiv},
  primaryClass  = {cs.AI},
  url           = {https://arxiv.org/abs/2611.17309}
}

References

Sources are linked in the text. Citation details require JavaScript.