---
title: "Claude Hand-Writes a Transformer's Weights, Solves Every Maze"
url: https://ailately.com/articles/claude-hand-writes-transformer-weights
publisher: "AiLately"
author: "Kelly Dennis"
editor: "Axel"
published: 2026-11-24T07:22:59-05:00
section: "Research"
people: ["Ahmed Heakl","Salman Khan","Claude Shannon","Mark VandeWettering"]
companies: ["MBZUAI","Anthropic"]
canonical: https://ailately.com/articles/claude-hand-writes-transformer-weights
---

# 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.

Claude Opus 5.5 tried to solve a set of hard mazes on its own. It got only 26 percent right [1]. 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 $19 [1][2]. 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 one [2].

The design loops one small block over and over. Each pass pushes a maze search one step further toward the goal [3].

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 maze [2].

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

> Chart: 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

Researchers also built a smaller version, trimmed to just 928 weights. The trimmed version still solved every test maze [2]. 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 fewer [1].

> Chart: 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

## 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 wrote [4].

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-authors [3].

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

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 error [7].

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 path [2]. 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 percent [2].

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 algorithm [3].

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. 8 [5]. 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 itself [6].

## 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 training [2].
- 100 percent: its written transformer's score on Maze-Hard's test mazes, against 26 percent when Claude solved them directly [1][2].
- 928 weights: a trimmed-down version of the transformer still solved every test maze [2].
- 99.8 percent: LDT, a trained rival, needed 1,800,000 weights to match that score, 90 times more than Claude's full written version [1].
- 39 minutes and about $19: that is what the Claude Code session spent in time and API cost to write the transformer [1][2].
- 0 percent: gradient descent topped out there, training the same architecture from random weights on the same 1,000 mazes [2].
- 63 stars: GitHub's count on the repository as of Nov. 24, a day after it posted [2].

## 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

---

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

Corrections: editor@ailately.com.
