Claude Can't Solve a Maze. It Wrote a Transformer That Solves Every One

4 min read

Ask Claude Opus 5.5 to find the shortest path through a hard maze and it gets it right 26% of the time. Ask it to build a small transformer that solves mazes instead, and the transformer it writes solves every single one. That result comes from a team at MBZUAI, published on November 23, 2026. The numbers feel backwards.

The project is called Looped Weight-Space Programming. The idea is simple to state and strange to believe. A trained transformer is just a program stored as matrices. If you know the program you want, you can write those matrices yourself and skip training completely.

The team gave Claude one job in a Claude Code session: write every weight of a small transformer by hand. No training, no gradient descent, no data. Claude wrote a single block of 19,936 weights. The block runs in a loop. Each pass moves a shortest-path search one step further, so the transformer keeps feeding the maze back through the same block until the path is complete.

The test is Maze-Hard, a benchmark of 30 by 30 mazes with shortest paths longer than 110 steps. The written transformer solves 100% of the test mazes. Claude itself solves 26% when asked directly. The strongest trained model the team cites, Energy-Based Reasoners, trains 1.8 million weights on 1,160 PFLOPs of compute and reaches 94.1%. Claude wrote its transformer in 39 minutes for about $19 in API tokens.

Maze-Hard: test mazes solved
Written transformer100% solvedBest trained model (EBR)94.1% solvedClaude Opus 5.5 direct26% solved
Data from the sources listed below.

Here is the part that made me stop. The team took the same architecture Claude wrote, reset it to random weights, and trained it on the same 1,000 training mazes. Every run solved 0% of the test mazes. Gradient descent could not find the weights that Claude wrote down. The solution exists. Training just never walks to it.

The loop is the trick that makes this scale. Older attempts at writing weights needed one block per step of the computation. One block that repeats means a bigger problem needs more passes, not more weights. The same 19,936 weights solve 100% of mazes at 60 by 60 and 100 by 100. With a cap of 1,000 weights, a fresh Claude session wrote a version with only 928 weights that still solves every maze.

This is not a one-off maze trick. The team used the same approach on eight more tasks. A Sudoku transformer solved all 141,040 test puzzles. A Tower of Hanoi transformer with 3,686 weights looped 2 million times and played all 1,048,575 moves of the 20-disk puzzle without a single mistake. On GraphWalks, the written transformer scores 100% against 66.8% for Claude Opus 5.5 itself.

The wider trend is moving fast. On November 2, 2026, researchers at MIT CSAIL published Sparks of Weight-Space Programming, showing GPT-6 Astra editing model weights directly and writing a 1.5-million-weight Go network from scratch. Other groups are now replicating the work with Claude. Some ask whether these hand-written models count as real models at all. I think that misses the point. Every number inside it has a job Claude chose, and you can watch the search spread across the maze one loop at a time. A trained model hides its method across millions of numbers. This one shows its work.

None of this replaces training. The method only works when you already know the algorithm. But for problems you do understand, writing the answer into weights is now cheaper than training a model to find it, and you can actually read the result. That flips the usual story. The model is not the thing that learned the algorithm. The model is the algorithm, written down.

Try this

The weights, code, and prompts are public in the project repo, MIT licensed. Running a written transformer needs only Python 3 and numpy:

bash
git clone https://github.com/mbzuai-oryx/LoopedWSP.git
cd LoopedWSP/weights
python run.py maze --random 30
python run.py hanoi 10

Each command prints the answer and checks it. Try changing the maze size in the first command and watch the same 19,936 weights handle a bigger maze.

Sources