Writing

What is a hierarchical reasoning model?

What is a hierarchical reasoning model, and why is it interesting?

Short answer

A hierarchical reasoning model is a neural architecture that solves search-like problems by iteratively refining an answer rather than by being deep. Two small modules, a high-level and a low-level one, run at different time scales and repeatedly apply the same four layers, so a model of roughly eight layers can solve puzzles that would normally demand a far deeper network. It also learns when to stop, which lets it spend more computation at inference than it ever saw in training.

Why the architecture got attention

Almost all machine learning research now points at large language models. HRM does not, which is most of why it stood out: it is a genuinely different idea about how a network can arrive at an answer, and it arrives at it by thinking longer rather than by being bigger.

The word attached to it is reasoning, and that word is usually a warning sign on a paper. Search is the better description. HRM is good at problems where you cannot look at the input and infer the answer in one pass, and instead have to explore a space of possibilities and back out of dead ends. Sudoku is the example the paper uses and the one the implementation below solves.

It is four layers, applied repeatedly

The usual way to make a network handle a harder problem is to stack more layers. HRM does the opposite. It has two modules of four layers each, and it runs them over the same state again and again, letting each pass refine the last.

That works because a search is the same small operation repeated. You do not need a hundred independently-weighted layers to backtrack a hundred times; you need one procedure and the patience to run it. The layers happen to be transformers here, and that is an implementation detail rather than the idea.

The two modules are a high-level and a low-level one, and they run at different speeds. The low-level module updates often. Every so many steps the high-level module updates and rewrites the low-level module's state, which knocks it out of wherever it had settled and gives it somewhere new to converge to. The split is loosely biological: different parts of a brain also run at different frequencies.

The first trick: two time scales beat backpropagation through time

Apply one block of layers a hundred times and the obvious way to train it is backpropagation through time. That has a known failure: the gradient is strongest at the earliest steps and gets noisy or vanishes later, so the optimiser finds weights where the hidden state converges almost immediately and then stops changing.

The practical result is that a model you apply a hundred times is really only doing about ten passes of work. The rest is running without moving. It is also expensive, because you have to keep the whole history of every rollout in memory.

The two time scales are what avoid this. The low-level module reaches a local equilibrium, the high-level module shifts it, and the low-level module converges again somewhere else. The iteration keeps doing work instead of settling.

The second trick: throw the history away

The stranger idea, and the one worth sitting with, is that if the model is going to converge to a fixed point anyway, you do not need backpropagation through time at all. You can take the gradient from only the final application of the two modules and treat every step before it as a constant.

That sounds like it should not work. Take the maths seriously and it does: the one-step gradient is a good enough approximation of the true one to train the network to a good solution. It is also dramatically cheaper, because nothing has to remember the rollout.

The third piece: it decides when to stop

HRM carries an adaptive computation time head that uses Q-learning to predict when it has solved the problem. At inference the model runs until it believes it is done rather than for a fixed number of passes.

This is the part with the most interesting consequence. Because the architecture generalises the procedure rather than memorising a depth, you can train on easier problems and then spend more iterations at inference on harder ones. The model solves things at test time that it never saw during training, by thinking for longer.

What it looks like when you run it

The walkthrough trains a Sudoku model in MLX, which runs on an Apple machine, with a JAX reimplementation for NVIDIA GPUs, Linux and Windows. It is small enough to train yourself.

On a hard board it usually finishes in three to five segments. On extreme boards it fails some of the time, and in the video it takes four attempts before one lands, filling all fifty-six empty squares in five segments and correctly halting when it was done. That failure rate is worth stating plainly: it is a faithful implementation rather than a finished one, and parity with the paper's extreme dataset is still outstanding work.

Bring Tanmay to your stage.

Send the date and tell him who is in the room. Availability comes back first.

Book Tanmay