Compact Reasoning Associative Memory
Benjamin Hoover, Hugh Blayney and James C. R. Whittington
Emerging Form of Reasoning: Looping
Looping is Slow to Train
Culprit: BackProp Through Time (BPTT)
How can energy-based models be trained?
-
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.
- Roll out
- Compare
- Backpropagate
- Update
-
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
- Roll out
- Compare
- Backpropagate
- Update
Looping Looks Like Energy Descent
- Roll out
- Compare
- Backpropagate
- Update
Explicit energy enables rapid training and efficient reasoning.
HYPOTHESIS
CRAM
Compact Reasoning Associative Memory
CRAM Beats Looped Models
- >1,000× faster training
- >280× fewer ops, same accuracy
- No loss in accuracy
CRAM’s Energy Is a Sum of Costs
- pi∈RC the belief of cell i
- Kij∈RC×C learned cost of each pair of values
- bi∈RC learned cost of each value
Weights memorize associations between valid cells
Train Low Energy at Correct Solutions
- y real solution: lower its energy
- p− negative samples from the model: raise their energy
- θ learnable parameters
No gradient goes through inference
But sampling is expensive
Train Low Energy at Correct Solutions
Fast Contrastive Training: Pseudolikelihood
- pi←a− generated negative sample: cell i set to value a
- F set of free cells
Reasoning Minimizes This Energy
- xi the state of cell i, and pi its belief
- T temperature, η step size
Noisily sampled with Focused Gibbs
xi←−∑jKˉijpj−biStep size η=1, one cell at a time
Kˉij=21(Kij+Kji⊤)
Cells with high local energy change first
Four Reasoning Benchmarks
A still: one search per task, run with this figure’s code. Enable JavaScript to run the models here.
per chain, 4 chains
first of 4 chains to stop
first of 4 chains to stop
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
- HRM Hierarchical Reasoning Model 2025
- TRM Tiny Recursive Model 2025
- GRAM Generative Recursive Reasoning 2026
- EqR Equilibrium Reasoners 2026
- FRM Flow Reasoning Models 2026
- TRMP Tiny Recursive Message Passing 2026
- EBR Energy-Based Reasoners 2026
Each retrained with its authors’ code and recipe
More Accurate, 1000× Faster to Train
| Model | Sudoku-Extreme | Maze-Unique | ||||||
|---|---|---|---|---|---|---|---|---|
| Solved (%) | Params | flop / puzzle | Fit time | Solved (%) | Params | flop / puzzle | Fit time | |
| HRM | 54.62±4.18 | 27.0M | 2.20 × 1011 | 1.2 h | 39.97±33.90 | 27.0M | 3.01 × 1012 | 7.1 h |
| TRM | 85.73±0.74 | 5.0M | 4.11 × 1011 | 2.5 h | 92.23±13.37 | 6.8M | 3.84 × 1012 | 15.6 h |
| GRAM | 96.10† | 9.1M | 8.51 × 1012 | 3.2 h | 98.63±1.31 | 10.9M | 8.00 × 1013 | 23.2 h |
| EqR | 99.49±0.14 | 5.0M | 2.11 × 1014 | 2.0 h | 93.00† | 263.8K | 1.16 × 1014 | 7.2 h |
| FRM | 99.13±0.29 | 7.0M | 3.91 × 1012 | 2.9 h | 97.27±2.80 | 8.0M | 4.70 × 1012 | 9.7 h |
| TRMP | 99.87±0.08 | 32.8K | 4.57 × 1012 | 9.0 h | 99.23±0.31 | 60.7K | 1.80 × 1013 | 7.6 h |
| EBR | 99.85±0.05 | 1.8M | 3.37 × 1011 | 2.8 h | 89.80±6.35 | 1.8M | 1.93 × 1013 | 2.0 h |
| CRAM | 100.00±0.00 | 7.7K | 2.02 × 109 | 0.04 s | 100.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.
N-Queens and Graph Colouring: Seconds, Not Hours
| Model | N | N-Queens 8×8 | N-Queens 10×10 | Graph colouring 8 | Graph colouring 10 | Params | Fit time | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Solved (%) | Cov@20 | Solved (%) | Cov@20 | Conflicts | Cov@20 | Conflicts | Cov@20 | ||||
| HRM | — | 84.41 | 58.8 | 37.80† | 10.7 | 139.7 | 20.6 | 182.7 | 6.2 | 27.3M | ≥ 41 min |
| TRM | — | 67.39 | 51.4 | 17.50† | 3.3 | 118.0 | 21.8 | 169.0 | 6.9 | 6.8M | ≥ 54 min |
| GRAM | 1 | 99.44 | — | 88.91 | — | 3.3 | — | 52.7 | — | 10.9M | ≥ 53 min |
| 20 | 100.00 | 97.9 | 99.98 | 92.9 | 3.3 | 87.9 | 52.7 | 37.8 | |||
| EBR | 1 | 100.00 | — | 99.31 | — | 0.0 | — | 0.3 | — | 7.1M | ≥ 3.2 h |
| 20 | 99.95 | 98.1 | 99.99 | 92.5 | 2.7 | 88.9 | 0.7 | 54.8 | |||
| CRAM | 1 | 99.95 | — | 99.45 | — | 0.0 | — | 0.3 | — | ≤ 869 | ≤ 6.8 s |
| 20 | 100.00 | 97.9 | 99.99 | 93.6 | 0.0 | 88.9 | 0.0 | 52.6 | |||
| (hand-set) | 1 | 100.00 | — | 99.99 | — | 0.0 | — | 0.0 | — | ≤ 2 | — |
| 20 | 100.00 | 98.4 | 100.00 | 95.5 | 0.0 | 90.6 | 0.0 | 55.2 | |||
Same Accuracy With 282× Fewer Operations
Each looped model's best, and what CRAM needs for the same accuracy
| Model | Best solved | Gflop per puzzle | CRAM's Gflop at same accuracy |
|---|---|---|---|
| EBR | 99.86% | 542 | 1.92 (282× fewer) |
| TRM | 89.72% | 823 | 1.14 (722× fewer) |
| HRM | 57.10% | 441 | 0.46 (958× fewer) |
| TRMP | 99.87% | 4,734 | 1.92 (2,467× fewer) |
| FRM | 99.42% | 7,810 | 1.59 (4,900× fewer) |
| GRAM | 94.74% | 17,020 | 1.32 (12,894× fewer) |
| EqR | 99.49% | 210,600 | 1.65 (127,869× fewer) |
Energy Enables Adaptable Compute
CRAM Never Stops at a Wrong Answer
| Wrong stops (%) | ||
|---|---|---|
| Stopping rule | Sudoku | Maze |
| HRM halting head | 0.62 | 0.16 |
| TRM halting head | 2.37 | 3.54 |
| EqR halting head | 1.61 | 1.06 |
| TRMP halting head | 0.05 | 0.73 |
| EBR gradient-norm stop | 0.21 | –* |
| CRAM energy threshold | 0.00 | 0.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.
Local Training Is Fastest
512 Sudoku-Extreme dev puzzles. Line: mean of 20 runs. Shading: 25th–75th percentile (thin where runs agree). Dot: mean first reaches 99%.
CRAM has Data Efficient Training
10,000 Sudoku-Extreme test puzzles. Line: median of 6 training runs per method. Small dots: single runs.
Hand-Set Weights Solve Every Benchmark
- Sudoku-Extreme: 1 weight
- Maze-Unique: 3 weights
- N-Queens: 2 weights
- Graph colouring: 1 weight
A high score shows only that a model learned a few pairwise rules
Weights Learn Rules of Puzzle
What’s Next?
Maze-Hard Has Loops
-
Maze-Unique: one unique path
-
Maze-Hard: many paths
- We need the shortest that obeys preferences
Add a Layer of Hidden Neurons
1. Hidden neurons settle, one per open cell
Ez(z)=∑i[2mzi2−21∑j∈N(i)zizj]−zG2. Answers relax, linked through the settled z⋆
xi←−∑j(Kˉij−Lij(z⋆)diag(0,1))pj−bi+11 learned parameters: 29 total
One Hidden Layer Solves Maze-Hard
A still: one search, run with this figure’s code. Enable JavaScript to run the model here.
phase 2 took 112 steps
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.
Learning Latent Variables is an Open Problem
ARC: new hidden rule for every task
General reasoning needs to learn meaningful latents
Copy the input into each of its colored cells
Every colored cell falls to the bottom
Red grows yellow corners, blue an orange cross
Energies Learn to Reason, 1000× Faster
- >1,000× faster training than looped models
- 282× fewer operations at the same accuracy
- Never stops at a wrong answer
- Rules you can read from the weights
- ⚠️Sudoku and Maze benchmarks are too easy⚠️
Explicit energy is an extremely promising direction for reasoning
bhoov.com/research/cram