2026-11-26 15:40 UTC

MBZUAI researchers report Claude-written looped transformers solving algorithmic benchmarks

state: significantheat: lowuncertainty: mediumrelevance: highweight-space-programming llm-written-transformers looped-transformers algorithmic-reasoningAbdelrahman ElsayedAhmed HeaklAbdelrahman ShakerFahad KhanSalman KhanClaude

What is this?

MBZUAI Oryx researchers Abdelrahman Elsayed, Ahmed Heakl, Abdelrahman Shaker, Fahad Khan and Salman Khan report “Looped Weight-Space Programming,” a first-party research post published November 23, 2026. They used Claude Opus 5.5 in Claude Code to analytically write transformer weights—without gradient training—for algorithmic tasks. In the maze demonstration, a 19,936-weight transformer reuses one block in a loop to propagate shortest-path information; the authors report 100% on Maze-Hard’s test set, compared with 99.8% for the strongest cited trained model. The post also reports results on other tasks, including Tower of Hanoi through 20 disks, and releases code, weights and demos under an MIT license. These are author-reported results; the supplied evidence includes no independent replication. The Hacker News item is a pointer to the researchers’ post, not separate validation.

Why it matters

The release’s potential significance is unchanged: it shows a research path for executing known algorithms with inspectable, LLM-written weights, not evidence of general-purpose reasoning or a replacement for trained models.

Current assessment

MBZUAI Oryx researchers’ November 23, 2026 first-party post describes looped weight-space programming: Claude Opus 5.5 analytically specified transformer weights without gradient training, using a shared block repeatedly for longer computations. The authors report 100% on Maze-Hard with a 19,936-weight model, compared with 99.8% for their strongest cited trained comparator, and results on other algorithmic tasks including Tower of Hanoi through 20 disks; they say code, weights, and demos are MIT-licensed. These remain author-reported results, with no independent replication or adoption in the supplied evidence. A later Show HN item about a 115-nonzero-weight maze-solving network is not substantiated here and does not validate the MBZUAI result. The work is significant as a demonstration of programming known algorithms into compact, inspectable models, not evidence of open-ended reasoning or a replacement for training. Generalization, task-specific construction, inference cost, and scalability remain open questions. Attention has cooled.

Measured heat

now 0 pts/hpeak 18 pts/hcomments 0/hpeers p30momentum: steady2 platformsage 98h
points/hour across evidence · reading as of 2026-11-27 02:23:58.509736+11:00 · deterministic, not a model opinion

How the heat travelled

11-22 13:00⭐ origin echo-reconstructedThis is the original research-blog post, not an intermediary: it is explicitly labeled “Research blog,” lists the authors, and its canonical
Abdelrahman Elsayed, Ahmed Heakl, Abdelrahman Shaker, Fahad Khan, Salman Khan, and Claude Opus 5.5 on blog (echo) · attributed from hn.story.50616328
—
11-23 18:08first on hacker news · published · +29.1hLooped Weight-Space Programming: LLM-Written Transformers
ahmedheaklwsp
—
11-23 18:08amplified on hacker newshn.story.50616328
ahmedheaklwsp
peak 1 · 0 comments · 26% of case engagement
11-25 11:10amplified on hacker news 👑hn.story.50641004
eigenBasis
peak 2 · 0 comments · 51% of case engagement
11-26 14:27amplified on hacker newshn.story.50655673
arashmh
peak 1 · 0 comments · 26% of case engagement
11-23 18:21our radar first saw it · +29.4hdiscovery anchor: hn.story.50616328—
pace: p41 vs 2105 stories at the 96h mark (now 98h old) — ahead of adobe-max-ai-agents-creative-tools-mcp (1.5x), behind 42loop-agent-operated-product-experiment (0.8x)

Evidence (4) — ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnLooped Weight-Space Programming: LLM-Written Transformers
Retrieved article excerpt

Open article · Retrieved 2026-11-23T18:22:49.438371+00:00

> What I cannot create, I do not understand.

**Richard Feynman**, written on his blackboard at Caltech, 1988

Deep learning models normally get their weights from training. Once a transformer is trained, though, it is nothing more than a program written in matrices. If you know the program you want, you can skip training and write the matrices yourself. People have done this by hand for small problems ([related work](https://mbzuai-oryx.github.io/LoopedWSP/#related)). Compilers such as [Tracr](https://arxiv.org/abs/2301.05062) go further, turning short programs into transformer weights automatically. Recently, [Weight-Space Programming](https://rikiyat.github.io/blog/weight-space-programming/) (Takehi, Teoh, Zhang and Khattab, MIT CSAIL) showed that a frontier LLM can edit a model's weights directly, without any training. Other groups have gone further and had LLMs set every weight of a tiny transformer, but only for toy tasks ([Singh](https://csinva.io/weight-space-programming-autoresearch/analyze/toy_examples/report.html), [AdderBoard](https://github.com/anadim/AdderBoard)). In those transformers, every step of a computation takes a separate block. Scaling one up to a hard problem would mean a far bigger transformer and a far bigger Claude bill, since Claude would have to write every one of those extra weights.

We wanted to know whether LLM-written weights hold up on problems that need long chains of reasoning. Our main test is [Maze-Hard](https://huggingface.co/datasets/sapientinc/maze-30x30-hard-1k), a benchmark of 30×30 mazes whose shortest paths run longer than 110 steps. Frontier LLMs struggle with it. For example, when Claude Opus 5.5 is asked for the shortest path, it solves only 26% of the test mazes it is given [[1](https://arxiv.org/abs/2605.08605)]. So instead of asking Claude to solve the mazes, we asked it to write a looped transformer that solves them, setting every weight by hand.

The transformer has a single block with 19,936 weights. This block runs in a loop. Each forward 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. With enough passes, it solves 100% of the test mazes. That is more than the newest looped models trained for this benchmark reach. Energy-Based Reasoners (EBR) [[2](https://arxiv.org/abs/2611.08977)], one of the strongest of them, trains 1.8 million weights on 1,160 PFLOPs of compute and solves 94.1%.

That loop is what this post adds to earlier work on writing weights. With it, one block can run thousands to millions of steps, so the number of weights does not grow with problem size. We call this approach *looped weight-space programming*.

**Figure 2. The transformer at work.** The transformer Claude wrote, solving the first test maze of Maze-Hard. In every loop, a wave of distances spreads one cell further from the goal G, shaded light to dark. Once it visits the start cell S, after 111 loops, the path grows from S back to G, one cell per loop, and the maze is solved after 222 loops. Every frame is the transformer's output. [Run it in your browser.](https://mbzuai-oryx.github.io/LoopedWSP/demo/maze.html)

Claude itself struggles to carry out a search of more than a hundred steps in text, even when we spell the algorithm out ([section 3](https://mbzuai-oryx.github.io/LoopedWSP/#maze-claude)). Yet it can write a single step of that search into weights, leaving the loop to repeat the step for as long as the maze requires. Programmers rely on the same trick whenever they write code for arithmetic they could not do in their heads. Language models gain from it too. On math word problems, they get more answers right when they write a short program that does the arithmetic than when they do the arithmetic in text [[3](https://arxiv.org/abs/2211.10435), [4](https://arxiv.org/abs/2211.12588)].

Writing the weights by hand also makes the transformer easy to read. A trained model spreads its algorithm across millions of numbers, so recovering that algorithm takes substantial analysis. A whole study was needed, for example, to show that a small transformer trained on modular addition computes it with sines, cosines and trigonometric identities [[5](https://arxiv.org/abs/2301.05217)]. The constructed transformer has explicitly assigned state variables and operations. Claude decided what every number inside it stands for before it set a single weight, so we can read those numbers after any loop and watch the search spread across the maze ([section 6](https://mbzuai-oryx.github.io/LoopedWSP/#interp)).

Test mazes solved against time, on a log scale from 10 minutes to 55 hours. The orange line is the transformer Claude wrote, with no gradient training. A big star at 39 minutes marks the final weights, held at 100% from there on. Below it are the models trained by gradient descent on one H200 GPU. EBR reaches 93.5% after 2.2 hours, FPRM 92.6% after 21 hours, Looped Flows 92.2% after 55 hours and TRM 91.6% after 8 hours. HRM reaches 81.7% but falls to 0% at two checkpoints, a standard transformer reaches 46%, and the same architecture as Claude's transformer stays at 0%, drawn as a dashed line. A pale shaded area covers the best score any trained model had reached by each point in time, and a double arrow labeled +6.5% marks the gap between 100% and the best trained model. The legend gives each model's final score and cost, $19 of Claude tokens for the written transformer and between $11 and $284 of GPU time for the trained models.

Test mazes solved against time, on a log scale from 10 minutes to 55 hours. The orange line is the transformer Claude wrote, with no gradient training. A big star at 39 minutes marks the final weights, held at 100% from there on. Below it are the models trained by gradient descent on one H200 GPU. EBR reaches 93.5% after 2.2 hours, FPRM 92.6% after 21 hours, Looped Flows 92.2% after 55 hours and TRM 91.6% after 8 hours. HRM reaches 81.7% but falls to 0% at two checkpoints, a standard transformer reaches 46%, and the same architecture as Claude's transformer stays at 0%, drawn as a dashed line. A pale shaded area covers the best score any trained model had reached by each point in time, and a double arrow labeled +6.5% marks the gap between 100% and the best trained model. The legend gives each model's final score and cost, $19 of Claude tokens for the written transformer and between $11 and $284 of GPU time for the trained models.

**Figure 3. Written weights versus gradient descent.** The star is the transformer Claude wrote, ready 39 minutes after Claude received the task. Claude chose it using the training mazes alone and ran it on the test mazes once. It needs no gradient training. Every line below it is a model trained by gradient descent on one H200 GPU, and the shaded area is the best score any of them had reached by each point in time. The trained looped models are EBR [[2](https://arxiv.org/abs/2611.08977)], FPRM [[6](https://arxiv.org/abs/2606.18206)], Looped Flows [[7](https://arxiv.org/abs/2609.11801)] and TRM [[8](https://arxiv.org/abs/2510.04871)] and HRM. A maze counts as solved when the answer is any shortest path. These curves are our runs, while Figure 8 lists the published scores. Writing the weights cost about $19 at Claude API list prices, while the training runs cost between $11 and $284 of GPU time, at a cloud price of $5.13 per H200-hour.

The goal is not just to replace conventional algorithms with transformers. It is to understand whether algorithmic reasoning can be explicitly programmed into neural networks rather than acquired through gradient-based training. This gives us interpretable solutions to difficult reasoning tasks, helps separate optimization failures from architectural limitations, and opens the possibility of combining learned representations with reliable algorithmic computation.

We hope these hand-written transformers help advance research on looped models, by showing how much a single small block can compute when it runs in a loop and by giving training methods concrete solutions to aim for. Since every number inside them is known, they can also serve as test cases for interpretability tools. The weights and two in-browser demos are [public](https://github.com/mbzuai-oryx/LoopedWSP).

## 1. How the maze transformer works

In a Claude Code session, Claude designed every weight itself, filling in the weight matrices with code, and we ran it on the test mazes only once, at the end ([appendix A](https://mbzuai-oryx.github.io/LoopedWSP/#prompts) gives its task description). Claude made each cell of the maze one token, so a 30×30 maze becomes 900 tokens. It gave each cell a memory of 35 numbers, which the transformer carries from one loop to the next. Claude decided what each of these numbers stands for. A few of them record what the cell is (a wall, the start cell or the goal) and where it sits in the grid. Other numbers track the search. They hold the cell's distance from the goal, which neighbor is its next step and whether it lies on the path. The remaining 20 numbers serve as scratch space for whatever the cell reads from its neighbors. The transformer's single block has four attention heads, each with a single job. One lets every cell read the cell below it, while the other three read the cell to its left, to its right and above it. Claude then set every weight so that each loop updates these numbers the way it intended.

The math

Cell \(c\), at row \(r\_c\) and column \(c\_c\), starts as the sum of three table rows. They put \(1\), \(r\_c\), \(c\_c\) and \(r\_c^2 + c\_c^2\) into its first four numbers and its type into the next three.

The head that looks in direction \(\delta = (\delta\_r, \delta\_c)\), one of \((1,0)\), \((0,-1)\), \((0,1)\) and \((-1,0)\), scores every cell \(n\) by

\[ \frac{q\_c \cdot k\_n}{\sqrt{8}} \;=\; -100\,\big[(r\_n - r\_c - \delta\_r)^2 + (c\_n - c\_c - \delta\_c)^2\big] \;+\; \mathrm{const}(c). \]

The neighbor at \(c + \delta\) scores 100 more than any other cell, so the softmax puts a weight of \(1 - O(e^{-100})\) on it. The head copies five of that neighbor's numbers into five scratch numbers of \(c\). These are its three count numbers \(m\_0, m\_1, m\_2\), its path flag and a binary number that is 1 when it points back at \(c\).

With this layout, each pass through the block performs one step of a standard shortest-path search.

Diagram of the maze transformer's one block, read from left to right. A bar shows a cell's memory of 35 numbers, grouped by meaning. They are a constant 1, where the cell is (row, column, r² + c²), what it is (wall, start or goal), its distance to the goal modulo 3, the next step, whether it is on the path, and 20 numbers copied from the neighbors each loop, 5 from each. Four attention heads, one per neighbor, each copy that neighbor's distance and path flag and whether it points at this cell. The neurons are grouped by job into wave (6 neurons), pointer (24), pointer clear (8), chain (8) and clean-up (40), and the wave, pointer and chain neurons work in pairs that give 0 or 1. At the end, each cell writes a wall, an open cell, the start, the goal or a path cell, and the distance, pointer and copied numbers play no part in it. An arrow from the output back to the input marks the 1,800 loops.


**Figure 4. The maze block.** The maze transformer's one block, read from its weights. After the last loop, every cell's distance, pointer and path flag match those of a standard shortest-path search on all 1,000 training mazes.

**A wave from the goal.** The goal starts at distance 0. On every loop, each open cell that has not been visited yet but borders a visited cell takes that neighbor's distance plus one. The visited area therefore spreads outward from the goal one step per loop.

The math

Write \(m\_k(c) \in \{0, 1\}\) for the binary number that is 1 when the count of cell \(c\) is \(k\), and \(\mathcal{N}(c)\) for i
ahmedheaklwsp10
🟧 echo.blog ⭐This is the original research-blog post, not an intermediary: it is explicitly labeled “Research blog,” lists the authors, and its canonicalAbdelrahman Elsayed, Ahmed Heakl, Abdelrahman Shaker, Fahad Khan, Salman Khan, and Claude Opus 5.5——
🟧 hnWriting Neural Networks by HandeigenBasis20
🟧 hnShow HN: Claude wrote the 115 nonzero weights of a maze-solving net, no trainingarashmh10

Interpretation history

Decision trace