Ask Claude Opus 5.5 to solve a hard maze and it will fail most of the time. Ask it to build a machine that solves mazes, and it writes every weight of that machine by hand — and the machine gets every maze right. That is the result researchers at MBZUAI published on Monday, November 23: a transformer with 19,936 weights, set by Claude in a Claude Code session, with no gradient training anywhere in the process. On Maze-Hard, a benchmark of 30×30 mazes whose shortest paths run longer than 110 steps, it solves 100% of the test mazes. Claude answering the same mazes in text solves 26%.

The work is called looped weight-space programming, and it arrived as a blog post, not a paper — with the weights, code and prompts all released under the MIT license. It took 39 minutes and about $19 of Claude API tokens. The same weights also solve larger mazes they were never checked on — every one of 50 mazes at 60×60 and 40 at 100×100. It is a striking demonstration, and a narrow one: the trick only works when you already know the algorithm you want the network to run.

What Claude actually built#

The transformer is almost comically small by 2026 standards: a single block, 19,936 weights, no training. Claude made each cell of the maze one token, so a 30×30 maze becomes 900 tokens, and gave every cell a memory of 35 numbers, each with a meaning Claude decided before setting a single weight. Some record what the cell is and where it sits; others track the search: distance from the goal, next step, and whether it lies on the path.

The block has four attention heads, one per direction. Each loop, every cell reads its neighbours and updates its numbers. A wave of distances spreads outward from the goal, one cell per loop; once it reaches the start cell, a path grows back toward the goal, one cell per loop. On the first test maze, the wave arrives at loop 111 and the path is complete at loop 222. Because every number has an assigned meaning, the computation is readable: you can watch the search spread, loop by loop. Remove any one attention head and the wave reaches only about 8% of the cells it should, and no mazes get solved. A version capped at 1,000 weights still scored 100% — the smallest used 928.

Diagram of the maze transformer’s single block: four attention heads read the four neighbouring cells and 86 MLP neurons run the search, looping 1,800 times
Figure: MBZUAI, MIT license — the maze transformer’s one block: four attention heads read the four neighbours, 86 MLP neurons run the search, and the block loops 1,800 times.

Why the loop is the trick#

Writing weights by hand is not new. Compilers like Tracr already turn short programs into transformer weights, and MIT CSAIL showed this year that a frontier model can edit weights directly, without training. But earlier LLM-written transformers had a scaling problem: every step of a computation needed its own block, so a harder problem meant a far bigger transformer — and a far bigger bill, since the model has to write every one of those extra weights.

The loop fixes that. One block does one step of the search, and the transformer runs that block again and again, for as many steps as the problem needs. A bigger maze needs more passes, not more weights. That is why the same 19,936 weights handle a 100×100 maze, and why the approach stretches to problems with chains of reasoning thousands of steps long.

Written vs. trained: the scoreboard#

Every trained model here was built with gradient descent on a H200 GPU, some over tens of hours. The written transformer needed 39 minutes of Claude’s time:

ModelMaze-Hard testCost
Written by Claude (19,936 weights)100%~$19, 39 min
EBR (trained, 1.8M weights)93.5%$11 GPU time
FPRM (trained)92.6%$106 GPU time
Looped Flows (trained)92.2%$284 GPU time
TRM (trained)91.6%$41 GPU time
HRM (trained)81.7%$46 GPU time
Standard transformer (trained)45.8%$41 GPU time
Same architecture, trained from random weights0%—

The closest trained rival, LDT, reaches 99.8% — but with about 90 times as many weights. And the last row is the one the authors linger on: when they reset Claude’s transformer to random weights and trained the same architecture on the same 1,000 training mazes, every run solved 0% of the test mazes. Gradient descent, in their runs, never finds these weights at all.

Editorial illustration of a single transformer block looping over a maze grid, spreading a wave of values one cell further each pass
Illustration: AI Frontier Post — one block, looped: each pass moves the search one step further.

Beyond mazes#

Mazes are the headline, but the team ran the same recipe on nine tasks, and the written transformer scored 100% on every one. On Sudoku-Extreme it solved all 141,040 test puzzles. On the Tower of Hanoi, a 3,686-weight block looped more than two million times to play all 1,048,575 moves of the 20-disk puzzle without a single mistake — where Claude 3.7 Sonnet and DeepSeek-R1 drop to zero by 11 disks. On GraphWalks, million-token prompts scored 100%, against 66.8% for Claude itself. Several BIG-Bench tasks came out at 100% too, where the best models the team could find scored between 33% and 81%. Claude wrote all of them in 18 sessions, each costing between about $1 and $37 at list prices.

The pattern is consistent: wherever the task is a long chain of exact steps, the model that writes one step into weights and loops it beats the model that tries to carry the whole chain in its head. The team tried hard to get Claude to solve mazes directly, and the best prompt got it from 26% to 50%, and no higher. Writing the transformer is a different kind of task: Claude does not have to run the search, only design one step and set weights to match.

What it doesn’t mean#

The limits matter as much as the scores. This only works when you already know the algorithm. Claude is writing down a shortest-path search humans worked out decades ago, in a form a transformer can execute. Nothing here is a path to a general model, and the authors do not claim otherwise.

There are also the usual caveats. This is a blog post, not a peer-reviewed paper, and no independent group has reproduced the results yet. The test set was run once, at the end, and everything needed to check the work is public. One fairness note the authors make themselves: each of their from-scratch training runs used about 5 PFLOPs, far less compute than the trained models they compare against, so the result shows gradient descent did not find these weights under the settings tested — not that the weights cannot be learned.

What to watch#

First, reproduction: whether other groups run the public weights and get the same 100%, and whether the approach holds up on tasks where the algorithm is less cleanly known in advance. Second, the authors’ own next steps: composing these hand-written modules into a single transformer for many tasks, and using written weights as a starting point for training. Third, interpretability: a transformer whose every number means something is a test case for the tools that try to read trained models.

The post spread across Reddit within hours — the numbers are that clean: 19,936 weights, 39 minutes, $19, 100%. Training is not going anywhere. But for one class of problems, the best model in the world right now was not trained at all. It was written.

Sources: MBZUAI, “Looped Weight-Space Programming: LLM-Written Transformers for Long Algorithmic Reasoning” (published November 23, 2026); GitHub, mbzuai-oryx/LoopedWSP; DEV Community, “Looped Weight-Space Programming Explained”; Reddit, r/artificial