Skip to content
Technology
ResearchAnalysis

Claude Hand-Writes a Transformer's Weights, Solves Every Maze

Researchers at MBZUAI say Claude hand-set a transformer's weights and matched a trained model's maze score using 90 times fewer weights.

Edited by Axel5 min read · 1,149 words · 7 sources
The wooden Theseus maze-solving mouse built by Claude and Betty Shannon in 1950, on its maze board
“A researcher asked Claude to solve a hard maze and watched it get three in four wrong, then asked it to write a program that could, and the program it wrote by hand got every single one right. Can a model build, by hand, a program that succeeds where the model itself failed?”

Claude Opus 5.5 tried to solve a set of hard mazes on its own. It got only 26 percent right1. Researchers at the Mohamed bin Zayed University of Artificial Intelligence tried something else. They asked Claude to write, by hand, a tiny program that could solve mazes instead.

That program got every maze right, and the team calls the method looped weight-space programming. Claude set every one of 19,936 weights inside a small transformer by hand. It skipped training entirely.

Inside Claude Code, the session ran 39 minutes and cost about $1912. That work produced a transformer that solved 100 percent of the test mazes in Maze-Hard, a benchmark of 30-by-30 grids.

What Claude actually wrote

A transformer is the kind of network behind most chatbots today. It usually learns its weights, the numbers that decide what each piece does. Training does that work, by feeding the system huge piles of examples.

This time, Claude skipped training and set the numbers itself. It decided what each weight should mean. Then it set the value directly, the way a programmer writes a formula instead of guessing at one2.

The design loops one small block over and over. Each pass pushes a maze search one step further toward the goal3.

That loop explains why it works on mazes bigger than the ones Claude designed it for. Claude checked its transformer on mazes up to 45 by 45. The same weights, unchanged, also solved every 60-by-60 and 100-by-100 maze2.

Aerial view of a green hedge maze at Valeč Castle in the Czech Republic
Maze-Hard, the benchmark Claude's written transformer solved, tests grids with the same kind of walls, a start and a goal as a garden hedge maze like this one at Valeč Castle.Jiří Sedláček / Wikimedia Commons, CC BY-SA 4.0

Claude's written transformer solved 100 percent of the test mazes. Working the same mazes directly, on its own, Claude managed only 26 percent1.

Claude's hand-written transformer solves 100 percent of mazes, up from 26 percent

Share of Maze-Hard's 30-by-30 test mazes solved, by method, as reported Nov. 23, 2026

Each column is one way of solving the maze: Claude working alone, a transformer trained by gradient descent, and the transformer Claude wrote by hand.

Data through Nov. 23, 2026.

Sources: DEV Community [1]; GitHub (mbzuai-oryx/LoopedWSP) [2]. Chart by Kelly Dennis.

The numbers behind this chart
ItemValue
Claude alone26%
LDT, trained99.8%
Written by Claude100%

Researchers also built a smaller version, trimmed to just 928 weights. The trimmed version still solved every test maze2. A trained model called LDT reached 99.8 percent on the same benchmark. It needed 1,800,000 weights to get there.

The full written transformer came within two tenths of that score. It used 90 times fewer weights. The smallest version used almost 1,900 times fewer1.

Claude's smallest written transformer matches a trained model with 1,900 times fewer weights

Weight count (log scale) against share of Maze-Hard test mazes solved, three models reported Nov. 23, 2026

Each point is one model. Its left-right position is how many weights it has, spaced by powers of ten, and its height is the share of test mazes it solved.

Data through Nov. 23, 2026.

Sources: DEV Community [1]; GitHub (mbzuai-oryx/LoopedWSP) [2]. Chart by Kelly Dennis.

The numbers behind this chart
NameWeightsMazes solved (%)
LDT, trained1,800,00099.8%
Full written transformer19,936100%
Smallest transformer928100%

Who built it, and why a maze

Ahmed Heakl, one of the paper's researchers, announced the work on X on Nov. 23. "We asked Claude Opus 5.5 to solve hard mazes. It got only 26% right. Then we asked it to write a transformer that solves them, setting every weight directly. It took just 39 minutes and $19. No training," Heakl wrote4.

Ahmed Heakl@ahmedmm72234641

Today we introduce Looped Weight-Space Programming! 🚀

We asked Claude Opus 5.5 to solve hard mazes. It got only 26% right.

Then we asked it to write a transformer that solves them, setting every weight directly.

It took just 39 minutes and $19. No training.

The model it… pic.twitter.com/gkZhuBcWv1

A chart from Heakl's thread comparing Claude's written transformer to trained models on Maze-Hard
Open on X (opens a new tab)

Ahmed Heakl announced the result on X on Nov. 23, the same day MBZUAI posted the paper and code.Post by Ahmed Heakl (@ahmedmm72234641) on X, Nov. 23, 2026

Salman Khan, a senior author at MBZUAI, worked with Heakl on the project. Abdelrahman Elsayed, Abdelrahman Shaker and Fahad Khan joined them too. The project page lists Claude Opus 5.5 itself as a co-author. It credits the model with equal contribution alongside its human co-authors3.

MBZUAI's campus sits in Masdar City, outside Abu Dhabi, built by the government to train the AI researchers the United Arab Emirates wants3.

The MBZUAI Knowledge Center and other campus buildings at Masdar City, Abu Dhabi
MBZUAI's campus sits at Masdar City outside Abu Dhabi, where Heakl, Khan and their co-authors wrote the Looped Weight-Space Programming paper.NNegm / Wikimedia Commons, CC BY-SA 4.0

A different Claude solved a maze this way long before this one. In 1950, the Bell Labs engineer Claude Shannon built Theseus, a wooden mouse that found its way through a maze. A program wired in advance guided it, apart from trial and error7.

Mazes made a clean test. The rules stay simple and complete: a start, a goal, walls, one shortest path. Claude could name what each weight should track before it ever set a number.

A weight might mark whether a cell sits on a wall or the path2. The team says that order, meaning first and weights second, is what let the method work at all.

The case this proves too much

A control the team ran supplies the strongest evidence. Claude's weights worked by design, beyond what luck alone could explain. Researchers took the identical small architecture.

Gradient descent trained it from random weights, the normal way networks learn, on the same 1,000 mazes Claude studied. Every run of that training stayed at 0 percent2.

The 0 percent control matters, but it also marks the limit. MBZUAI's own project page says the method suits tasks with a known algorithm far better than open-ended ones. Reading the written weights back out depends on already knowing that algorithm3.

Mark VandeWettering, a longtime programmer, reviewed a related paper on LLMs that write and edit network weights outside normal training. He warned that the wider trend gets oversold. "My short answer is that the results appear to be real, but the hype is considerably larger than the thing itself," VandeWettering wrote on his blog on Nov. 85. He was reviewing a different project, Sparks of Weight-Space Programming from MIT CSAIL, a separate effort from the MBZUAI maze work.

His caution still lands on the same question. A clean demo in a young field proves itself on the one task its authors built it to show. Whether it predicts more stays open.

The Hacker News post sharing the maze result drew two points and one comment in its first day. That is a small, early reception. It leaves the bigger claim mostly untested outside the paper itself6.

What to do

Judge this result by what task it solved, apart from its headline. The task matters more than the demo. A team facing a well-defined, rule-bound problem, say a router, scheduler or verification check, now has reason to ask a real question. Can a model write a short program for that task directly, ahead of collecting training data?

A rival lab could try looped weight-space programming on messier rules than a maze's. Such a test, harder than this one, would show how far the method reaches.

By the numbers

  • 19,936 weights: Claude set every one by hand for the full maze-solving transformer, skipping training2.
  • 100 percent: its written transformer's score on Maze-Hard's test mazes, against 26 percent when Claude solved them directly12.
  • 928 weights: a trimmed-down version of the transformer still solved every test maze2.
  • 99.8 percent: LDT, a trained rival, needed 1,800,000 weights to match that score, 90 times more than Claude's full written version1.
  • 39 minutes and about $19: that is what the Claude Code session spent in time and API cost to write the transformer12.
  • 0 percent: gradient descent topped out there, training the same architecture from random weights on the same 1,000 mazes2.
  • 63 stars: GitHub's count on the repository as of Nov. 24, a day after it posted2.

What to watch

Watch one thing first. MBZUAI or another lab could try this method on a messier task. Picture reading sensor noise, or planning around other people's choices, tasks whose rules stay open-ended.

An independent rerun matters too. Picture a fresh set of mazes, kept apart from Claude's design process. That run would test the method harder than bigger mazes of the same kind. Either test would tell a reader whether this is a new way to build small, checkable programs, or just a maze-shaped exception.

Sources

  1. jamilxt, "Looped Weight-Space Programming Explained: Claude Wrote a 19,936-Weight Transformer That Solves Every Maze," DEV Community, Nov. 23, 2026, https://dev.to/jamilxt/looped-weight-space-programming-explained-claude-wrote-a-19936-weight-transformer-that-solves-519m
  2. Abdelrahman Elsayed, Ahmed Heakl, Abdelrahman Shaker, Fahad Khan, Salman Khan and Claude Opus 5.5, "Looped Weight-Space Programming: LLM-Written Transformers for Long Algorithmic Reasoning," GitHub, Nov. 23, 2026, https://github.com/mbzuai-oryx/LoopedWSP
  3. Abdelrahman Elsayed, Ahmed Heakl, Abdelrahman Shaker, Fahad Khan and Salman Khan, "Looped Weight-Space Programming," mbzuai-oryx.github.io, Nov. 23, 2026, https://mbzuai-oryx.github.io/LoopedWSP/
  4. Ahmed Heakl (@ahmedmm72234641), "Today we introduce Looped Weight-Space Programming!," X, Nov. 23, 2026, https://x.com/ahmedmm72234641/status/2124869402634129901
  5. Mark VandeWettering, "A Skeptical Look at Weight-Space Programming," brainwagon.org, Nov. 8, 2026, https://brainwagon.org/blog/2026-11-08-a-skeptical-look-at-weight-space-programming.html
  6. turtleyacht and others, "Looped Weight-Space Programming: use AI to set model weights," Hacker News, Nov. 23, 2026, https://news.ycombinator.com/item?id=50625905
  7. Nickknack00, "Theseus (1950), Betty and Claude Shannon, MIT Museum," Wikimedia Commons, https://commons.wikimedia.org/wiki/File:Theseus_(1950),_Betty_and_Claude_Shannon,_MIT_Museum.jpg

Header photo: Nickknack00 / Wikimedia Commons, CC BY 4.0

Cite this piece

Kelly Dennis, "Claude Hand-Writes a Transformer's Weights, Solves Every Maze," Ai Lately, Nov 24, 2026, https://ailately.com/articles/claude-hand-writes-transformer-weights

Tags: Claude Opus 5.5 · MBZUAI · transformers · weight-space programming · Anthropic

Related, lately

More

Keyboard

j k
Move through a list
Enter
Open the selected piece
/
Search, and browse the columns
g then r
Right Now
g then a
Articles
g then s
The Signal
g then o
Opinion
g then b
Analysis
g then p
People
?
This sheet
Esc
Close

AI Right Now is free with an account.The Citation Audit is free with an account.Skills are free with an account.Tutorials are free with an account.You have read your 3 free articles.

Every article and comic, AI Right Now, the Citation Audit, Skills and Tutorials.

Join Ai Lately for free

Join with Google or your email. Already a member? Sign in

Press anywhere else for the home page.