图表:Richard Feynman , written on his blackboard at Caltech, 1988
What I cannot create, I do not understand.
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). Compilers such as Tracr go further, turning short programs into transformer weights automatically. Recently, 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, 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, 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]. 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], 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.
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). 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, 4].
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]. 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).
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.
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 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.
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
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.
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.
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 its four neighbors. Two wave neurons for each \(k\) compute
with the index \(k+1\) taken mod 3. The argument of \(\tau\) is at least \(1.5\) when the cell is not a wall, has no count yet and has a neighbor with count \(k\). Otherwise it is at most \(-0.5\), so \(\tau\) gives 1 or 0. After loop \(t\), the cells with a count are the ones at most \(t\) steps from the goal.
Distance modulo 3. Apart from the position, every number in a cell's memory is binary, either 0 or 1. A cell therefore cannot store its distance to the goal as an ordinary number. Instead, it stores the remainder of that distance divided by 3, using three binary numbers, one for each remainder 0, 1 and 2. For example, a distance of 7 leaves a remainder of 1, so it is stored as 0, 1, 0. This is sufficient for the search. Two visited cells next to each other differ in distance from the goal by one, so the remainder is enough to tell which neighbor is one step closer to the goal. As a result, the transformer's size does not depend on maze size.
Let \(d(c)\) be the length of the shortest path from cell \(c\) to the goal. Every step in the grid changes \(r + c\) by one, so \(d\) has opposite parity on neighboring cells. Two open neighbors \(c\) and \(n\) therefore satisfy \(|d(n) - d(c)| = 1\), and
since the two cases \(d(c) \pm 1\) differ by 2, which is not a multiple of 3. Counting mod 2 would fail, because \(d(c) + 1 \equiv d(c) - 1 \pmod 2\). Three binary numbers per cell are enough however large the maze is.
Pointers. Each cell also has four binary numbers, one for each direction, down, left, right and up. Once a cell is visited, it sets the number for the direction of a neighbor one step closer to the goal to 1 and keeps the other three at 0. We say the cell points to that neighbor. A neighbor is one step closer when its remainder is one less than the cell's, with 2 counting as one less than 0. When several neighbors qualify, it picks the first in the fixed order down, left, right, up.
Each cell has four binary pointer numbers \(p_\delta(c)\), one per direction, taken in the order \(\delta_1, \dots, \delta_4\) = down, left, right, up. They are rewritten in every loop. Eight reset neurons, two per direction, cancel the old value, since \(p - \mathrm{ReLU}(p) + \mathrm{ReLU}(-p) = 0\). At the same time, 24 pointer neurons compute
where \(n_\delta\) is the neighbor in direction \(\delta\). The argument reaches \(1.5\) only when \(n_{\delta_j}\) is one step closer to the goal and no earlier direction is. That is the tie-break.
The path. As soon as the wave visits the start cell, a path grows out of it one cell per loop, following the pointers all the way to the goal. These cells form the answer. On the first test maze, the wave visits the start cell at loop 111. The path then takes another 111 loops to grow, so it is complete at loop 222. A maze therefore needs twice as many loops as its shortest path is long. A shortest path passes through each cell at most once, so twice the number of cells covers any maze. The transformer runs that many loops, 1,800 on a 30×30 maze, 7,200 on a 60×60 maze and 20,000 on a 100×100 maze. Claude checked the transformer on the 1,000 training mazes, all 30×30, and on mazes it generated itself, up to 45×45. We then ran the transformer on 50 mazes of 60×60 and 40 of 100×100, with up to eleven times as many cells, and it solved every one, with the same weights and no retraining. A bigger maze only takes more passes. The block does one step of the search, and one step is all a maze of any size needs.
The start's path flag is 1 from the embedding. A cell joins the path when a neighbor on the path points at it,
where \(p_{-\delta}(n_\delta)\) is the neighbor's pointer back toward \(c\). The readout scores the five characters at every cell,
and writes the highest. A path cell becomes o, while the start cell and the goal keep their letters, because \(3 > 2\).
Every binary number is written through \(\tau(z) = \mathrm{ReLU}(z) - \mathrm{ReLU}(z - 1)\), which is flat at 0 for \(z \le 0\) and flat at 1 for \(z \ge 1\). The arguments above land at \(1.5\) or below \(-0.5\), so an error below \(0.5\) in an argument leaves the output unchanged. The softmax leak of about \(e^{-100}\) per cell sits far inside that margin. Forty clean-up neurons, two per scratch number, then erase what the heads copied,
Let \(D = d(S)\) be the length of the shortest path. The wave gives the start cell a count at loop \(D\). The path then grows one cell per loop along the pointers and reaches the goal at loop \(2D\). A shortest path visits each cell at most once, so \(D < n\) for a maze of \(n\) cells, and the loop count \(R = 2n\) covers every maze of that size.
Extra loops don't undo the answer
Looped models trained by gradient descent can overthink, which means their answers get worse when they run for more loops than they were trained with. Bansal et al. (NeurIPS 2022) showed this on mazes with DeepThinking, a looped convolutional model trained on 9×9 mazes. On 13×13 mazes it peaks at 86% after about 40 loops. If it keeps looping, its accuracy collapses below 1% by loop 82. The maze transformer avoids this by construction. Once the path is complete, every cell already holds its final distance, pointer and path flag, so another loop leaves every number as it is.
We see the same contrast on reasoning chains, puzzles that follow a chain of statements such as x0 = 7 and x1 = x0 + 3 for 1 to 8 steps to find one variable. A looped transformer trained on them by gradient descent solves 69.1% with its usual number of loops, but only 49.2% when it runs four times as many. The chains transformer Claude wrote stays at 100% up to 128 times its usual loops, which is about 1,500 loops on average. Not every trained looped model overthinks, though. Figure 6 shows that HRM and TRM hold their Maze-Hard accuracy at four times the steps they were trained with, although they level off near 82% and 92%.
2. How it compares on Maze-Hard
Maze-Hard comes from the HRM paper (Hierarchical Reasoning Model). It has become a standard test for small models trained to reason by repeating a step many times, such as HRM, TRM (Tiny Recursive Model) and the Lattice Deduction Transformer (LDT). Most of its mazes have several equally short paths, of which the dataset marks one as the answer. Figure 8 uses the LDT paper's scoring, where any shortest path counts.
The written transformer tops the chart. Frontier LLMs trail far behind, with none of the three that Davis et al. tested solving more than 26%. In an earlier version of the same paper, in April 2026, Claude Opus 4.6, DeepSeek V4-Pro and GPT-5.4 solved 0% of the test mazes. The trained looped models do much better, with LDT coming within 0.2 points at 99.8%. Yet LDT needs 90 times as many weights, whereas the written transformer needed no gradient training.
The 19,936 weights are not a minimum. We gave five fresh Claude Code sessions only the task and a cap on the number of weights, of 1K, 5K, 10K, 20K or 40K. All five kept the accuracy at 100%. The smallest needs only 928 weights, 1,900 times fewer than LDT.
3. Why Claude can write the transformer but can't solve the maze
Throughout, Claude is Claude Opus 5.5. When it solves a task itself, it answers in text, and when it writes a transformer, it works in a Claude Code session. As a check, we also had Claude solve 50 mazes in text inside Claude Code, with no tools. It found the shortest path in 38% of them, against 48% through the API with the “told how to search” prompt described below. Perhaps Claude scores low simply because it doesn't approach the maze systematically. To test this, we started from the LDT paper's prompt, in which Claude sees the maze as 30 lines of 30 characters and answers by writing out the same grid with the cells of its path marked. We then changed one thing at a time.
- Told how to search. A paragraph added to the paper's prompt tells Claude to spread out from the goal one step at a time, then walk back from the start cell.
- + one cell per token. Claude reads text in tokens, chunks of a few characters, so in a plain grid one token can cover several cells, such as a run of walls. Here, the cells are separated by spaces, with a dot for each free cell, so that Claude reads each cell as a separate token.
- + answer with the path only. Instead of writing out the whole grid, Claude answers with the list of cells on its path, as (row, column) coordinates from the start cell to the goal.
- + path only, no grid. Claude answers with the path as above. The maze also comes as a list of the (row, column) coordinates of its free cells instead of a grid.
Describing the algorithm lifts Claude from 26% to 48%, but accuracy stays at or below 50%. Tokenization does not explain the gap either, since giving Claude one token per cell made it no better (44% against 48%). These results suggest that execution errors contribute to the low accuracy. Every step along the path has to be right, yet Claude's first wrong step comes a median 35% of the way along it, even when it is told how to search.
Writing the transformer is a different task. Claude does not run the search. It designs one step of it, sets the weights to match and leaves the loop to do the running. We suspect this helps because each design choice can be checked separately, whereas solving the maze directly needs a long chain of steps that must all be right.
Writing the transformer was also cheap. The session that wrote the maze transformer produced 196,771 output tokens and cost about $19 at Claude Opus 5.5's API list prices. That is about as many tokens as Claude spends answering only 14 of the 1,000 test mazes in text. Answering all of them would take 73 times more. Claude had the final weights 39 minutes after it received the task. Claude worked from a task description, which appendix A gives in full. Solving mazes directly, by contrast, cost $0.14 to $0.34 for every maze in our runs, yet found the shortest path in at most half of them. The written transformer pays for itself after about 55 to 134 mazes and needs no API calls after that. Claude wrote all the transformers in this post in 18 sessions. Each session cost between $1.19 and $37.06, with a median of about $4.
| Transformer | Output tokens | Cost (USD) | Build time | Revision rounds |
|---|---|---|---|---|
| Maze-Hard | 196,771 | 18.71 | 39 min | 3 |
| Sudoku-Extreme | 70,647 | 3.16 | 2 h 22 min | 1 |
| Tower of Hanoi | 122,305 | 4.98 | 27 min | – |
| GraphWalks | 86,323 | 4.35 | 1 h 57 min | 2 |
| Web of Lies and Shuffled Objects (BIG-Bench Extra Hard) | 501,182 | 37.06 | 3 h 14 min | 4 |
| Boolean Expressions and Dyck Languages (BIG-Bench Hard) | 155,871 | 6.38 | 50 min | 3 |
| Graph search | 71,081 | 2.55 | 16 min | 3 |
| Strongly connected components (CLRS-30) | 57,423 | 1.97 | 1 h 43 min | 1 |
| Minimum spanning tree with Prim's algorithm (CLRS-30) | 66,901 | 2.69 | 2 h 1 min | 1 |
| Longest common subsequence (CLRS-30) | 39,637 | 1.19 | 12 min | 1 |
| Blocksworld, Mystery Blocksworld and Logistics (PlanBench) | 167,477 | 7.94 | 4 h 47 min | 4 |
| Random 3-SAT, three sets (SATLIB) | 221,477 | 11.08 | 4 h 12 min | 4 |
| Sudoku-Extreme, at most 1,000 loops | 69,179 | 2.69 | 1 h 47 min | 3 |
| Maze-Hard, at most 1,000 weights | 432,979 | 17.56 | 7 h 32 min | 3 |
| Maze-Hard, at most 5,000 weights | 133,120 | 4.95 | 2 h 38 min | 1 |
| Maze-Hard, at most 10,000 weights | 37,143 | 1.61 | 1 h 45 min | 1 |
| Maze-Hard, at most 20,000 weights | 45,197 | 1.65 | 1 h 39 min | 1 |
| Maze-Hard, at most 40,000 weights | 70,061 | 3.72 | 5 h 26 min | 4 |
Table 1. The cost of writing each transformer. The first group holds the transformers of sections 1 to 5, the second the CLRS-30, PlanBench and SATLIB transformers, and the third the transformers written under a limit on loops or weights. Each row counts every API response in the session that wrote the transformer, up to the moment it was ready for the test set, so testing is left out. Costs use Claude Opus 5.5's API list prices of $4 per million input tokens, $20 per million output tokens, $0.20 per million cache reads and $5 per million cache writes. The builds ran on a Claude subscription, so these are list-price equivalents rather than money spent. Most of each cost is cache reads. Build time runs from the task description to the transformer being ready for the test set, with delays on our side removed. For Maze-Hard it is the time to the final weights. It includes the time each builder waited for its runs, which accounts for most of the longer times in the third group. Revision rounds are full runs of the transformer on the training data before the test, capped at 20 per build, or 60 for PlanBench's three domains, while tests of single parts are not counted. The Tower of Hanoi session kept no count of its runs. Its row stops where Checker Jumping, written later in the same session, begins. After the task description, Claude received only fixed messages, such as "continue", the outputs of GPU runs it asked for and rule updates, none of which gave hints.
4. Can training find these transformers?
If a transformer of 20,000 weights can solve every maze, why don't trained models of that size? Perhaps the architecture is the secret, in which case training would find the solution too if it had the same one. So we gave gradient descent the same starting point Claude had. We took the transformer Claude wrote, reset its weights to random, and trained it on the same 1,000 training mazes.
We trained these models:
- The transformer Claude wrote, reset to random weights. As written, without normalization, in 6 runs (3 learning rates × 2 seeds). Then with RMSNorm added, in six versions of 8 hours each: the original size at three learning rates, twice the loops, 2 or 4 blocks per loop, and 4 or 16 times the width, up to 2.8 million weights.
- The same six versions with a curriculum, from 10×10 mazes up to 30×30, with 2,000 more mazes we generated.
- A class-balanced loss, alone and together with supervision of the distance and pointer states after each loop, at three learning rates.
- A plain transformer encoder the size of TRM (8 blocks, width 256, 8 heads, 6.4 million weights, no loop), with a standard recipe on 3,000 mazes.
- TRM itself (6.8 million weights), with its authors' recipe on one GPU.
Every run of Claude's architecture solved 0% of the test mazes. Without normalization, the first six runs broke down within 30 steps. With RMSNorm added, training ran smoothly, yet every transformer learned only to copy the maze back, which already gets 87.4% of cells right because only about one cell in eight is on the path. Versions up to 2.8 million weights, and a curriculum that started from 10×10 mazes, also stayed at 0% after 8 hours each. To do better, a transformer has to mark path cells, which in the written transformer happens only after a chain of a hundred or more steps that each have to be right. Our guess is that gradient descent finds no partial credit along the way.
Two fixes aimed at the copying did not help either. One weighted the loss so that path cells count as much as all other cells. The other also supervised the distance wave and the pointers after every loop. Both stopped the copying, yet none of the 185 checkpoints trained this way solved a single test maze.
A standard transformer [9] does better, though not nearly well enough. We trained a plain transformer encoder the size of TRM (8 blocks, 6.4 million weights, 320× the transformer Claude wrote) on 3,000 mazes for 8 hours on one GPU. It got 94–99% of its training mazes right yet solved only 46% of the test mazes at best, leveling off for its final two hours. TRM [8], a looped model built for this benchmark, reaches 91.6%.
Each of our gradient descent runs used about 5 PFLOPs, 230 to 2,000 times less than the trained models. So these runs show that gradient descent did not find the weights under the settings tested, not that the weights cannot be learned. Claude, meanwhile, simply wrote them, for about $19. The architecture holds a solution that scores 100%, yet training on the same data got nowhere near it.
Running the written transformer is cheap as well. At the 1,800 loops we use by default, it spends 2.2×1011 operations per maze, about 14 times fewer than HRM (3.0×1012) and 17 times fewer than TRM (3.8×1012) at the 16 reasoning steps they were trained with. Just 306 loops solve every test maze, at 3.7×1010.
The six versions in Figure 3 are the transformer Claude wrote at its original size (with 3 learning rates), with twice the loops, with 2 or 4 blocks per loop, and at 4 or 16 times the width, each with normalization added. Since the runs shared one GPU, Figure 3 places each one at its number of updates times its time per update with the GPU to itself.
Small mazes first. We also trained the 6 versions on mazes we generated in the Maze-Hard style, starting at 10×10 and working up to 30×30, then on the 1,000 training mazes plus 2,000 more of 30×30. A run moved up a size once it solved 90% of new mazes of that size, or after 45 minutes. All 111 checkpoints we evaluated on the test mazes sit at 0%.
The standard transformer has width 256 and 8 heads. It has no loop, so one pass fills in all 900 cells. It trained with a standard recipe (AdamW, learning rate 3e-4, batch 64), with nothing tuned, on the 1,000 training mazes plus 2,000 we generated in the same style. It solved 14.8% of the test mazes after 1 hour, 37.0% after 4, 46.3% at its best after 6, and 45.8% at the end. On 200 new mazes of the same style, it leveled off at 45%.
Why not train them longer? Five of the six versions got more updates than the 13,020 TRM needed to reach 84.9%, between 15,210 and 50,370. The sixth got 9,750, more than the 7,812 TRM needed to reach 60.9%. Nor was any of them slowly getting better. The standard transformer got 640,513 updates and was flat for its last two hours.
TRM is a different model, built for mazes, with 6.8M weights. Our 84.9% comes from our run of its recipe on one GPU instead of the authors' eight. The public TRM checkpoint gets 91.6%, still short of 100%.
Generalization beyond the checked sizes
Mazes test whether training can find a solution at all. A second question is whether a solution keeps working as problems grow. We tested this on three simpler tasks where problem size is easy to control. While writing each transformer, Claude could check it only on small inputs, which we call its checking range. We trained standard models on those same sizes, then tested both the written and the trained models on much larger problems.
Graph search. The task is to find the shortest route from point A to point B on a map, or to report that B cannot be reached. A map is a graph whose points, or nodes, are joined by one-way links, and it is full of dead ends and decoys. Claude checked its transformer on maps of up to about 12 points with routes of up to 4 steps. We then tested it on maps of up to about 48 points with routes of 8 to 16 steps, where it reached 100%. Trained models up to 99 times bigger stayed at 0% on those routes, including one that reached 97.4% on the checking range. The written transformer tracks which points it can already reach from A. On every loop, each visited point passes that status along its outgoing links, so a longer route simply takes more loops.
Parity. The question is whether a string of 0s and 1s contains an odd or even number of 1s. Claude checked the written transformer only on strings of up to 20 bits, yet it is correct at every length we tried, up to 4,095 bits. The trained models mastered the checking range but fell to chance (45.5–53.8%) on 21 to 128 bits.
Reasoning chains. Each problem is a set of shuffled statements such as x2 = x1 + 5. x0 = 7. x1 = x0 + 3., followed by a question about one variable. Claude checked the written transformer on chains of up to 8 steps, yet it is correct at 12, 16, 24 and 32 steps, and up to 63 in a harder extra test. The best trained model reached 93.7% within its training lengths but only 3.5% beyond them.
In all three tasks, the trained models do well on training sizes but fail beyond them, whereas the written transformers only need more loops. The written transformers show that size-independent solutions exist in these architectures. Each written transformer still has a size limit, set by its tables, its loop budget and its arithmetic precision rather than by the loop itself. Below that limit, the written transformer's answers are exact at every size we tested (appendix B). The full tables for all three tasks are in appendix C.
5. Far beyond mazes, from Sudoku to a million-move Tower of Hanoi
Mazes are only the beginning. Claude wrote transformers for eight more tasks from well-known benchmarks, most of them tasks where LLMs or trained models struggle. Each one solved every test problem we gave it (Figure 14).
Sudoku-Extreme, solved by guessing and backtracking
The maze transformer has no need to take anything back, because once the wave visits a cell, that cell's distance is final. Hard Sudoku is different, since sometimes the only way forward is to guess. Sudoku-Extreme is the hard Sudoku benchmark from the HRM paper, also used by TRM and LDT. Each puzzle is a 9×9 grid with some digits filled in and a unique solution. Even the newest frontier LLMs solve only 54% to 68% of them. Claude Opus 5.5 solved 54% of the puzzles it was given when asked directly.
The Sudoku transformer Claude wrote applies constraint propagation and backtracking to all 81 cells in parallel. Each cell keeps a list of the digits it could still be. Three attention heads let it read its row, its column and its 3×3 box, so it can cross out digits already taken and spot a digit that has only one place left. When nothing more can be crossed out, the transformer has to guess. It first saves a copy of the whole grid in memory, then guesses a digit for the cell with the fewest options and carries on. Should the guess lead to a contradiction, such as a cell with no digits left, the transformer restores the saved grid, in which that guess is now ruled out. One step of this search takes five blocks, which the transformer runs for 40,000 loops with room for 24 saved grids.
The Sudoku transformer solved every one of the 141,040 test puzzles we ran, including the first 10,000 on which HRM, TRM and Sotaku v2 are evaluated. On those puzzles, the best trained model, Sotaku v2, reaches 98.96%. The cost is compute. Because the transformer runs all 40,000 loops on every puzzle, it does about 50 times more arithmetic per puzzle than TRM, even though half the puzzles are solved within 273 loops and 99% within 3,213. The full comparison, the arithmetic per puzzle and the search's limits are in appendix D. On one H200 it takes about 0.8 seconds per puzzle.
With fewer loops, Claude moved the work into the block. We gave a fresh Claude Code session the same task with at most 1,000 loops, 40 times fewer. It wrote the same kind of solver but stacked 12 copies of its search step into the looped block, so that 1,000 loops give 12,000 steps. That transformer has more weights, 267.9K, but needs a third of the arithmetic per puzzle, and it solved all of the first 10,000 test puzzles.
Tower of Hanoi up to 20 disks
Tower of Hanoi became a famous test of long reasoning after The Illusion of Thinking [10] showed reasoning models collapsing on it. When o3-mini, DeepSeek-R1 and Claude 3.7 Sonnet Thinking wrote out every move without tools, they began to fail at 7 to 8 disks, even when given the solution algorithm. The goal is to move a stack of disks from the first peg to the third, one disk at a time, with no larger disk placed on a smaller one. Each extra disk roughly doubles the number of moves. Twenty disks take 1,048,575 moves. A single wrong move makes the answer wrong.
The Hanoi transformer Claude wrote outputs one move at a time, the way a language model writes text, feeding each move back in as input. Before every move, its attention reads the starting position and every move written so far, which tells it where each disk is now. The rest of the block turns that position into the next move. Because the transformer works out the position from scratch at every move instead of keeping a running tally, errors cannot accumulate. The Hanoi transformer is a single looped block with only 3,686 weights. Checker Jumping, newer models and the transformer's limits are in appendix E.
Writing out the 1,048,575 moves for 20 disks takes the transformer about 9×1013 operations, about 89 million per move, since each move looks back over every earlier one.
GraphWalks, where the question sits in a million-token prompt
GraphWalks is OpenAI's benchmark for very long prompts. Each prompt lists one-way links between nodes, then asks which nodes lie at a distance of N steps from a given node. We used its longest set, 200 problems of 256k to 1M tokens, each up to about 1.75 million characters long.
The GraphWalks transformer works like the maze transformer, with links in place of cells. On every loop, one attention head lets each link check whether a link into its starting node has already been visited, so the visited area grows by one step per loop. At the end, every node at a distance of N steps from the start writes its name into the answer. The transformer scores 100% (F1) on all 200 problems. On the same set, Claude Opus 5.5 scores 66.8%, while Gemini 4 Carbon, the best LLM in Google's published results, reaches 96.2% (appendix F).
BIG-Bench reasoning questions, written in plain English
Claude also wrote transformers for four reasoning tasks from BIG-Bench, where each question is written in plain English. Like an LLM, each transformer reads the question as text and writes its answer as text. Two tasks come from BIG-Bench Hard [11]. Boolean Expressions asks for the value of an expression such as not ( True and False ) or False, and Dyck Languages asks for the brackets that close a sequence such as [ { ( ) <. The other two come from BIG-Bench Extra Hard [12], a much harder version made once frontier models had mastered BIG-Bench Hard. Web of Lies asks who is telling the truth, given a long chain of people's claims about each other. Shuffled Objects asks who holds which object after a long series of swaps.
Each transformer turns its question into something it can loop over. The Boolean transformer simplifies the expression one step per loop, much as you would by hand. The Dyck transformer adds up openers and closers to find how deep each bracket sits, then closes the most recent bracket that is still open, one at a time. In Web of Lies, each person's claim concerns someone else. On every loop, everyone whose subject is already settled works out whether they are telling the truth, so the answers spread along the chain of claims. Shuffled Objects uses a doubling trick from parallel computing. On every loop, each position merges its record of swaps with the record twice as far back, so after only a few loops the last position knows the outcome of all of them.
All four transformers score 100%, both on the 250 official test items of each BIG-Bench Hard task and on all 180 test questions of each Extra Hard task. The Extra Hard results are the more informative ones. There, the best LLM results we found are 81.2% on Web of Lies and 56.9% on Shuffled Objects, the latter achieved by having the model write and run a program. On BIG-Bench Hard, frontier LLMs already score above 90% (Kazemi et al., 2025), so we compare only with small open models and treat the result mainly as proof that the transformers can read text. The full tables and the format tests are in appendix G.
Graph algorithms, SAT and planning
We then took the recipe to three benchmarks of other kinds of algorithms. From CLRS-30, in its text version CLRS-Text, Claude wrote transformers for three algorithms beyond search: strongly connected components, minimum spanning trees with Prim's algorithm, and the longest common subsequence, a dynamic program. From SATLIB came small random 3-SAT formulas, satisfiable and unsatisfiable, which the transformer must decide, giving a satisfying assignment when there is one. From PlanBench came the Blocksworld, Mystery Blocksworld and Logistics planning tasks, where every plan is checked for validity. Each transformer was written by a fresh Claude Code session from a plain description of the task, checked on the training split and run once on the test split.
The test splits hold larger inputs than the training splits. The components transformer is exact on graphs of up to 22 nodes, where the largest training graph had 15, and the subsequence transformer on strings of up to 15, beyond the training maximum of 10. The SAT transformer runs a complete search, one step per loop, and answers only when the search ends. Every assignment it gave satisfies its formula, every "unsatisfiable" is right, and the hardest formula used 808 of its 1,224 loops.
Claude on its own did well on planning but slipped on SAT. It gave 10 assignments that do not satisfy their formula and missed 9 of the 50 unsatisfiable formulas, after a median of 88,309 output tokens on each of those.
6. Weight-space writing is interpretability by construction
Interpretability research usually works backwards. It starts from a trained model and tries to work out what its numbers mean, by probing hidden states, switching parts off and tracing the circuits that connect them [13]. A hand-written transformer works the other way around. Claude chose the meaning of every number first and then set the weights to match, so the explanation is fixed before any weight is set.
For the maze transformer, this makes the usual interpretability questions easy to answer. We can read any cell's distance, pointer and path flag after any loop, which is how Figure 2 and the maze demo show the search as it runs. We can also predict what breaks before we break it. Each attention head carries the wave in one direction, so removing a head should stop the wave from crossing that way. On the 1,000 training mazes, it does. Without any one head, the wave stalls after visiting only 8.2–8.6% of the cells it should, so 0% of the mazes get solved. Finally, we can check the inside of the transformer against the algorithm rather than only its output. 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.
The meanings can also be read back from the weights alone. We gave three fresh Claude Code sessions only the maze transformer's weights and a bare description of its architecture, without the word maze, the task or any example, and asked what it computes and what each of a cell's 35 numbers stands for. Each recovered the whole design, 11 of 11 points on a rubric fixed in advance, in about two minutes, and confirmed it by running the weights against its shortest-path search on random grids. The same transparency makes these transformers test cases for interpretability tools (appendix H).
This readability depends on knowing the algorithm in advance. The transformers are easy to read because Claude knew the algorithm before it wrote them, which suits tasks with a known algorithm better than open-ended ones such as language.
Conclusion
- The approach works beyond mazes. The same recipe gave transformers that solve Sudoku-Extreme, a 20-disk Tower of Hanoi (1,048,575 moves without a mistake), GraphWalks prompts of up to a million tokens and four BIG-Bench reasoning tasks, each on 100% of its test problems. Seven more cover graph algorithms and a dynamic program from CLRS-30, SAT and planning.
- The loop keeps the transformers small. A bigger problem needs more passes, not more weights. This keeps the maze transformer 163 times smaller than it would be without a loop, and lets each transformer work far beyond the sizes Claude checked (section 4).
- Gradient descent did not find these solutions. Trained from random weights on the same 1,000 mazes, the architecture of the maze transformer solved 0% in every run (section 4).
- Every number has a meaning. Claude decided what each number stands for before setting any weight, so we can watch the algorithm run (Figure 2, section 6) and use these transformers as test cases for interpretability tools (appendix H).
More broadly, our results suggest that for algorithmic tasks with a known procedure, what holds small models back is not their size but finding the right weights. An LLM that cannot solve a problem directly may still write a transformer that does.
What's next
We plan to study multitask composition and training initialized from constructed weights. The first is a single transformer for many tasks, in which the modules from this post live side by side while a hand-written router sends each input to the right one. The second is to use hand-written weights as a starting point for training. If training starts from a looped solution that already scores 100%, will it keep the ability to handle bigger inputs, or wash it out?
Citation
If you use this work, please cite it as follows.
@misc{elsayed2026written,
title = {{Looped Weight-Space Programming: LLM-Written Transformers for Long Algorithmic Reasoning}},
author = {Elsayed, Abdelrahman and Heakl, Ahmed and Shaker, Abdelrahman and Khan, Fahad and Khan, Salman and {Claude Opus 5.5}},
year = {2026},
month = nov,
howpublished = {\url{https://mbzuai-oryx.github.io/LoopedWSP/}},
note = {Blog post}
}
The text, figures, animations, code and weights are all released under the MIT license.
Supplementary material
Appendix
The blog post ends above. What follows is for readers who want the details, starting with the prompts Claude received, then the full results for each task and a few extra analyses.
AThe prompts
These are the first messages Claude received in each experiment, as they appear in the prompts folder of our code repository. Only details of our compute setup, such as machine names, accounts, paths and job ids, are removed or made generic. The weights of every transformer are in the same repository, in the weights folder.
Writing the transformers. Each builder received one of these briefs as its first message. The briefs set the task and the rules, such as running the test set once at the end. Several also suggest a first design, which the builder was free to change.
[Shareable version of the brief given to the builder (Claude Opus 5.5). Only details of our compute setup (machine names, accounts, paths, job ids) were removed or made generic; the task, rules and limits are as given.]
You are building a hand-written (no training) looped transformer that solves the Maze-Hard benchmark from the HRM release (30×30 mazes). Work carefully: correctness and rule compliance matter more than speed.
## Setup
- You work in a project folder. Your directories: `src/maze/`, `results/maze/`, `data/maze/`. Do not edit other directories, except appending dated lines to the project log `logs/progress.md`.
## Compute rules (strict)
- Develop and run DEV on a local machine with Python and numpy (no restrictions locally).
- Heavier runs and downloads go to one shared GPU machine (shared with another agent: at most 4 CPUs, modest GPU memory). Never run compute on a cluster login node, do not submit new cluster jobs, and do not use a shared /tmp.
## Hard rules (the project's and the user's)
1. TEST is never used for selection and runs exactly once, for the final model. Before that, you do not read TEST items in any way (no printing, no inspection, no statistics of TEST); the TEST script prints only aggregate numbers.
2. No gradient-based optimisation and no fitting of weights to labels/targets; every tensor is set analytically by formulas (analysis of DEV is fine).
3. Report every run: log each DEV eval call and the TEST run in `logs/progress.md`.
4. Inference is task-agnostic: a generic loop + readout. Python only maps characters to ids, runs embed → R × the same shared block → linear readout, and maps ids back. No maze logic, BFS or path tracing in Python at inference.
- Never look up benchmark answers or test items; never reuse trained weights.
- At most 20 DEV eval calls (a run of the full model on DEV items counts as one; unit tests of single components on hand-made inputs are free). Count and log them.
- If you find a problem with the rules, the data or the setup, stop and report it rather than working around it.
## Written-model constraints (as Exp B/C)
- One shared block (a list of layers is fine, as in Exp C and Sudoku: per layer `h += Attn(h); h += ReLU-MLP(h)`, softmax attention, no norm), an embedding that is a sum of per-field tables (e.g. character id + cell index expanded into coordinates), and a linear per-token readout. d_model ≤ 64, heads ≤ 4 per layer.
- The number of loops R comes from a generic rule (R = n + c with n the input length, or a fixed R_max).
- Fixed-point requirement: for every TEST input the readout must be identical at R_min, 2·R_min and 4·R_min.
- You may port the generic forward to torch (GPU) for speed if numpy is too slow; it must stay generic. If you use float32, verify on DEV that results match float64.
## Data and protocol
- Dataset: the HRM release's Maze-Hard, on Hugging Face as `sapientinc/maze-30x30-hard-1k` (verify the exact repo and file names; HRM's `dataset/build_maze_dataset.py` reads it). Download the files with huggingface_hub. The official train split is DEV (checks only; nothing is trained). The official test split is TEST: run once at the end, scored by exact match of the full output grid, as HRM/TRM do (an item counts only if every cell is right).
- Before writing anything: on DEV, check (a) the format (characters for wall/open/start/goal/path, grid size), (b) that each given solution is a shortest S→G path, and (c) whether shortest paths are unique (count shortest paths with a BFS dynamic program on every DEV maze). If they are not unique, work out the dataset's tie-break rule from DEV (e.g. a move-order preference or BFS parent order) and report it. Save the findings to `results/maze/uniqueness.json` and log them.
## Deliverables
`src/maze/looped.py` (generic forward), `src/maze/weights.py` (every tensor analytic), `src/maze/evaluate.py` (DEV and TEST modes; TEST prints only aggregate numbers), unit tests, `src/maze/EXPLAIN.md` (what every component computes, residual layout table, as in src/sudoku/EXPLAIN.md), `results/maze/dev.json`.
## Stop before TEST
When DEV is done and the fixed-point test passes on DEV, STOP and report back (do not run TEST yet). I will check the model against the rules and then tell you to run TEST once. Your report: the uniqueness/tie-break finding; the architecture (d_model, layers, heads, MLP widths, parameter count total and nonzero); the R rule and R_min; DEV accuracy and fixed-point results; DEV calls used; anything that worried you.
[Shareable version of the brief given to the builder (a headless Claude Code session, Claude Opus 5.5). Only details of our compute setup (machine names, accounts, paths, job ids) were removed or made generic; the task, rules and limits are as given.]
## Your task
Write the weights of a looped transformer that solves Sudoku puzzles from Sudoku-Extreme. Nothing is trained: every
weight is written by code you write.
**Sudoku.** A puzzle is a 9 × 9 grid divided into nine 3 × 3 boxes. Some cells are given a digit from 1 to 9; the rest
are empty.
- A solution fills every empty cell with a digit from 1 to 9, so that every row, every column and every box contains
each of the digits 1 to 9 exactly once.
- The given digits stay as they are.
- Every puzzle here has exactly one solution.
**Input.** Each problem is one text prompt, exactly as a language model receives it:
Solve this Sudoku: <row 1> ... <row 9>
Each row is 9 characters: a digit 1–9 for a given cell, `0` for an empty cell. The rows are joined by single newlines,
and there is no newline after the last row. Every prompt is 108 characters.
**Output.** The completed grid: 9 lines of 9 digits, one row per line, digits only, with no spaces or other characters.
**Scoring:** per puzzle, solved or not (`tools/grader.py`).
- Leading and trailing newlines are removed, and lines starting with three backticks are dropped.
- Each remaining line is stripped of spaces, and the lines are joined.
- The result must equal the solution's 81 digits in row order. Anything else scores 0.
- The TEST score is the fraction of puzzles solved.
**TEST** is puzzles from Sudoku-Extreme's test file, in a fixed order. They are of the same kind as DEV. You never see
TEST. When you say you are done, the orchestrator freezes your files and runs TEST, on the GPU path (`torch32`).
## Data in your folder
- `dev/train_1000.jsonl`: 1,000 puzzles from Sudoku-Extreme's training file. Each line is `{"id", "prompt", "answer"}`,
where `answer` is the solution's 81 digits in row order.
You may analyse the DEV inputs and answers with any code you like, as often as you like.
## The frame (fixed; implemented in `runner/`, described in `runner/README.md`)
Inference is the generic loop: embed → the same block R times → readout.
- **Input.** The network reads exactly the prompt text, character for character. Nothing is removed, added or
reformatted.
- **Tokenizer.** You write it in `tokenizer.py` and declare it. It maps a text string to a sequence of tokens, each a
tuple of non-negative integer fields, each below the size of its embedding table.
- It must work unchanged on any text.
- It must know nothing about Sudoku, grids, rows, columns, boxes or the question format.
- The auditor checks both.
- **Embedding.** The sum of one table per token field.
- **Block.** A fixed list of layers, the same in every loop. Each layer does
`h ← h + Σ_heads softmax(Q Kᵀ/√d_k + mask) V W_O`, then `h ← h + W2 ReLU(W1 h + b1) + b2`.
- The mask is none or causal, per head.
- There is no normalisation.
- The widths and the numbers of layers and heads are yours to choose.
- **Loops.** R comes from a rule you declare that depends only on the number of tokens n (see `runner/README.md`).
- **Readout.** A linear map at every position, then argmax over an output alphabet you declare: a list of strings,
one of which is the empty string.
- Each position writes one alphabet string, or nothing (the empty string).
- The answer is the written strings in position order.
- The harness passes that string to the grader unchanged, with nothing added. Your network must write everything
the grader needs.
- **Arithmetic.** The runner has these paths (`runner/README.md`):
- on this machine, `numpy` (float64) and `numpy32` (float32, following the GPU path as closely as numpy can);
- on the GPU, `torch32` (float32, fused attention, TF32 off).
DEV runs on this machine use `numpy` or `numpy32`, as you choose. DEV runs on the GPU and TEST use `torch32`. The
written answer must be the same on `numpy` and `torch32`.
- **Compute limit.** At most 1 × 10¹⁴ FLOPs per prompt, counted by the runner from your shapes before it runs
(`runner/flops.py`). The runner refuses any prompt over the limit. Peak GPU memory must stay under 30 GB on one
32 GB GPU.
## Rules
1. No training, gradients or fitting weights to data. Every weight is written by your code.
2. Inference is the generic loop above, with no task logic in Python, the tokenizer or the readout. Python only
tokenizes, runs embed → block R times → readout, and joins the written strings. The tokenizer is generic and
declared.
3. **DEV budget: 20 runs.** A run is any evaluation of your network on official DEV problems, on any number of them.
- Running your network on anything built from a DEV problem (a part of one, an edited copy, its grid or its answer)
also counts as a DEV run.
- Runs on inputs you make yourself do not count. Such inputs may reuse the prompt format, but no grid or answer
from the DEV file.
- Run your network on DEV, or on inputs built from DEV, only through `tools/dev_run.py` (`--from-dev` for inputs
built from DEV), which counts each run in `ledger/`. Do not edit the ledger; the auditor checks it against your
transcript.
4. **GPU runs.** This machine has no GPU. For a GPU run, ask the orchestrator:
- give the network folder and either DEV problem ids, or a file of inputs you made (`--own`; the format is in
`tools/dev_run.py`);
- a GPU run holds at most 2 × 10¹⁵ FLOPs counted over all its prompts (for example 20 puzzles at the cap);
- the orchestrator runs `tools/dev_run.py` with those files on the cluster GPUs (backend `torch32`), with the prompts
split across GPUs in parallel;
- it replies with the checker's full output and nothing else.
Each GPU run counts as one of the 20, on DEV or on your own inputs. You have no cluster access yourself.
5. **Time limit:** 12 hours of working time. Time paused by a usage limit doesn't count, and the orchestrator logs each
pause.
6. TEST is never shown to you. Do not look for it or for any other copy of Sudoku-Extreme.
7. **Isolation.**
- Work only inside this folder: do not read, list or look through anything outside it.
- No web or network access of any kind: no web queries, no page fetches, no `curl`, `wget`, `pip`, `ssh`, `git`
remotes, Hugging Face or GitHub.
- Some of this is blocked by your permissions. The rest is a rule, and your transcript is checked afterwards.
8. During the build you will receive only: "continue", how much DEV budget is left, the output of the GPU runs you
ask for, and answers to questions about these rules. Design questions get "that's your call."
9. If you find a problem with the rules, the data or the frame, stop and say so rather than working around it.
## Your folder
- `BRIEF.md`: this brief.
- `build.json`: this build's settings (compute cap, DEV budget, DEV files, GPU-run limits), read by the tools.
- `runner/`: the generic loop.
- `looped.py`: numpy float64 / float32; torch float32 / float64.
- `flops.py`: the compute counter.
- `README.md`: the network format and exactly what the runner computes.
- `dev/`: the DEV file.
- `tools/`:
- `grader.py`: the scoring above.
- `dev_run.py`: runs your network on chosen DEV problems or on your own inputs, scores them, and counts the run.
- `ledger/`: the record of counted runs, written by `tools/dev_run.py`.
- `work/`: yours.
Python 3.13 with numpy is installed.
## What to hand back (in `work/`)
1. A network folder: `network.json`, `weights.npz` and `tokenizer.py`, in the format of `runner/README.md`.
2. `write_weights.py`: the code that writes every weight, run as `python3 -I work/write_weights.py`.
3. `BUILD_NOTE.md`, short:
- what the network computes;
- parameters, total and nonzero;
- the R rule;
- the FLOPs per prompt;
- DEV results and the runs used;
- anything that worried you.
Say "done" when you are done. If you run out of time or DEV budget without a working network, say so and hand back
what you have. That is a valid result.
[Shareable version of the brief given to the builder (Claude Opus 5.5). Only details of our compute setup (machine names, accounts, paths, job ids) were removed or made generic; the task, rules and limits are as given.]
You are building a hand-written (no training) looped transformer that solves Tower of Hanoi as evaluated in Apple's "The Illusion of Thinking" (Shojaee et al., 2025, arXiv:2506.06941). Checker Jumping and Blocks World are stretch goals, only after Hanoi is finished; skip River Crossing. The goal is a frozen model that outputs a complete, valid, optimal move sequence for every N from 1 to 20. Correctness, rule compliance and an honest evaluation matter more than speed.
## Setup
- You work in a project folder. Your directories: `src/puzzles/`, `results/puzzles/`. Do not edit other directories, except appending dated lines to the project log `logs/progress.md`.
- Read for conventions: the hard rules below; `src/sudoku/looped.py`, `src/sudoku/weights.py`, `src/sudoku/EXPLAIN.md` (a previous hand-written looped model: analytic weights, snap() ReLU pairs, attention heads with a large scale s that pick exact positions using a positional table expanded analytically); `src/expC/looped_multi.py` (generic multi-layer looped forward).
## Compute rules (strict)
- Develop and run DEV on a local machine with Python and numpy (no restrictions locally).
- Heavier runs and downloads go to one shared GPU machine (shared with another agent: at most 6 CPUs, at most ~20 GB of a 32 GB GPU). Never run compute on a cluster login node, do not submit new cluster jobs, and do not use a shared /tmp.
## Hard rules
1. No training, no gradient-based optimisation, no fitting of weights to targets: every tensor is set analytically by formulas.
2. Inference is task-agnostic: embedding → R × one shared block (a list of layers is fine; per layer `h += Attn(h); h += ReLU-MLP(h)`, softmax attention; a generic causal mask is allowed) → linear readout, plus generic autoregressive decoding of the move sequence (append the argmax token, continue; stop at an end token). Python only maps tokens to ids and back and runs the generic loop. No Hanoi logic, recursion, counters or move rules in Python at inference. A KV cache is allowed as an exact optimisation of rerunning (verify on DEV that cached and uncached decoding give identical output).
3. Your own tokenizer is allowed (e.g. one token per move (disk, from, to), plus tokens for the prompt and an end token); the mapping from tokens to the paper's answer format must be a fixed, generic detokeniser, documented.
4. R comes from a generic rule (fixed R_max or R = f(input length)). Fixed-point checks where they apply: at every decoding step the readout must be identical at R_min, 2·R_min and 4·R_min (you can run 4·R_min passes once and read out at all three).
5. No parameter limit; prefer the smallest design that works; report total and nonzero parameter counts.
6. DEV = N ≤ 6 only. TEST = N = 7…20 with the frozen model, run once (no changes after it). Log every DEV eval run and the TEST run in `logs/progress.md` (at most 20 DEV eval runs; unit tests of single components on hand-made inputs are free). Report every run.
- Never reuse trained weights. If you hit a problem with the rules or setup, stop and report it.
## Evaluation (as the paper does)
- First read the paper (arXiv 2506.06941, including its appendix) for the exact puzzle setup: disk numbering, peg numbering, initial and goal states, the move format ("moves = [[disk id, from peg, to peg], ...]") and the simulator's validity rules. Write `src/puzzles/hanoi_sim.py`: a simulator, independent of the model, that checks every move is legal (moving the top disk, never onto a smaller disk), the goal is reached, and counts moves. Accuracy for an N = the full sequence is valid and reaches the goal. Also report the exact move count against the optimum 2^N − 1.
- Report accuracy for N = 1–20 (DEV rows N ≤ 6, TEST rows N = 7–20), move counts, decoding steps and wall time.
- Also extract from the paper, with figure/section numbers, the published results for Tower of Hanoi: which models were evaluated, how many samples per N, and each model's collapse point (the N beyond which accuracy goes to 0), plus the paper's token budget. Save them to `results/puzzles/REFERENCES.md` with the citation.
## Design hint (your call)
Decoding N = 20 needs 2^20 − 1 ≈ 1M moves, so per-step cost matters: one token per move, causal attention with a KV cache, a torch/GPU implementation of the same generic forward. One known structure: the optimal sequence alternates between moving the smallest disk cyclically (direction set by the parity of N) and making the only legal move that does not involve the smallest disk. The current position of each disk is where its last move put it (or the start peg), which attention can look up (latest token mentioning disk d), so the configuration is recoverable from the emitted moves alone. The prompt must carry N (and the pegs), as in the paper.
## Deliverables
`src/puzzles/looped.py` (generic forward + decoding), `src/puzzles/weights_hanoi.py` (analytic), `src/puzzles/hanoi_sim.py`, `src/puzzles/evaluate_hanoi.py` (DEV/TEST modes), unit tests, `src/puzzles/EXPLAIN_hanoi.md` (what every component computes, residual layout table), `results/puzzles/hanoi_dev.json`, `results/puzzles/hanoi_test.json`, `results/puzzles/REFERENCES.md`.
## Before TEST
When DEV (N ≤ 6) passes with fixed-point checks, STOP and report back before running TEST: the architecture and parameter counts, tokenizer/detokeniser, R rule and R_min, DEV results, the estimated TEST runtime, and the paper's collapse points. I will check the model against the rules and then tell you to run TEST once.
[Shareable version of the brief given to the builder (a headless Claude Code session, Claude Opus 5.5). Only details of our compute setup (machine names, accounts, paths, job ids) were removed or made generic; the task, rules and limits are as given.]
## Your task
Write the weights of a looped transformer that answers GraphWalks breadth-first-search problems. GraphWalks is
OpenAI's long-context benchmark. Nothing is trained: every weight is written by code you write.
Each problem is one text prompt. It has:
- a fixed instruction block;
- a short worked example;
- a directed graph given as a list of edges, one per line, in the form `<node> -> <node>`;
- an operation.
The operation is either "Perform a BFS from node X and return only the nodes at exactly depth N (not nodes at
intermediate depths)" or "Find the parents of node X". The prompt ends by asking for the answer on the last line, as
`Final Answer: [node1, node2, ...]`, or `Final Answer: []` for the empty set.
**TEST** is 200 BFS problems from GraphWalks' 256k-to-1M-token file. They come from the same file and are the same
sizes as DEV file B, but they ask for BFS, not parents. DEV has BFS problems only up to about 220,000 characters
(file A). No TEST problem is longer than 1,800,000 characters. You never see TEST. When you say you are done, the
orchestrator freezes your files and runs TEST once, on the GPU path (`torch32`).
**Scoring:** per problem, with GraphWalks' official extraction and F1 (`tools/grader.py`).
- Only the last line of the response is read. It must contain `Final Answer:` and a bracketed list.
- The list is split on commas and each item stripped of spaces; that set is compared with the true set by F1.
- Both empty scores 1. A last line without `Final Answer:` or without a bracketed list scores 0.
- The TEST score is the mean F1 over the 200 problems.
## Data in your folder
DEV is GraphWalks problems outside TEST. No DEV problem shares a graph with a TEST problem.
- `dev/A_128k_and_shorter.jsonl`: 750 problems (350 BFS, 400 parents), up to about 220,000 characters.
- `dev/B_256k_to_1M_parents.jsonl`: 200 parents problems, the same sizes as TEST.
Each line is `{"id", "prompt", "answer_nodes", "problem_type"}`. You may analyse DEV inputs and answers with any code
you like, as often as you like.
## The frame (fixed; implemented in `runner/`, described in `runner/README.md`)
Inference is the generic loop: embed → the same block R times → readout.
- **Input.** The network reads exactly the prompt text, character for character, as given in the `prompt` field.
This is the same text a language model gets. Nothing is removed, added or reformatted.
- **Tokenizer.** You write it in `tokenizer.py` and declare it. It maps a text string to a sequence of tokens, each a
tuple of non-negative integer fields, each below the size of its embedding table.
- It must work unchanged on any text.
- It must know nothing about edges, arrows, node IDs or the question format.
- The auditor checks both.
- **Embedding.** The sum of one table per token field.
- **Block.** A fixed list of layers, the same in every loop. Each layer does
`h ← h + Σ_heads softmax(Q Kᵀ/√d_k + mask) V W_O`, then `h ← h + W2 ReLU(W1 h + b1) + b2`.
- The mask is none or causal, per head.
- There is no normalisation.
- The widths and the numbers of layers and heads are yours to choose.
- **Loops.** R comes from a rule you declare that depends only on the number of tokens n (see `runner/README.md`).
- **Readout.** A linear map at every position, then argmax over an output alphabet you declare: a list of strings,
one of which is the empty string.
- Each position writes one alphabet string, or nothing (the empty string).
- The answer is the written strings in position order.
- The harness passes that string to the grader unchanged, with nothing added. Your network must write everything
the grader needs, including `Final Answer: [` and `]`.
- **Arithmetic.** The runner has these paths (`runner/README.md`):
- on this machine, `numpy` (float64) and `numpy32` (float32, following the GPU path as closely as numpy can);
- on the GPU, `torch32` (float32, fused attention, TF32 off).
DEV runs on this machine use `numpy` or `numpy32`, as you choose. DEV runs on the GPU and TEST use `torch32`. The
written answer must be the same on `numpy` and `torch32`.
- **Compute limit.** At most 5 × 10¹⁵ FLOPs per prompt, counted by the runner from your shapes before it runs
(`runner/flops.py`). The runner refuses any prompt over the limit. Peak GPU memory must stay under 30 GB on one
32 GB GPU.
## Rules
1. No training, gradients or fitting weights to data. Every weight is written by your code.
2. Inference is the generic loop above, with no task logic in Python, the tokenizer or the readout. Python only
tokenizes, runs embed → block R times → readout, and joins the written strings. The tokenizer is generic and
declared.
3. **DEV budget: 20 runs.** A run is any evaluation of your network on official DEV problems, on any number of them.
- Running your network on anything built from a DEV problem (a part of one, an edited copy, its graph or its
answer) also counts as a DEV run.
- Runs on inputs you make yourself do not count. Such inputs may reuse the instruction text and the prompt format,
but no graph or answer from the DEV files.
- Run your network on DEV, or on inputs built from DEV, only through `tools/dev_run.py` (`--from-dev` for inputs
built from DEV), which counts each run in `ledger/`. Do not edit the ledger; the auditor checks it against your
transcript.
4. **GPU runs.** This machine has no GPU, so long prompts are slow here. For a GPU run, ask the orchestrator:
- give the network folder and either a DEV file with problem ids, or a file of inputs you made (`--own`; the format
is in `tools/dev_run.py`);
- a GPU run holds at most 5 prompts over 1,000,000 characters (any number of shorter ones);
- the orchestrator runs `tools/dev_run.py` with those files on the cluster GPUs (backend `torch32`), with the prompts
split across GPUs in parallel;
- it replies with the checker's full output and nothing else.
Each GPU run counts as one of the 20, on DEV or on your own inputs. You have no cluster access yourself.
5. **Time limit:** 12 hours of working time. Time paused by a usage limit doesn't count, and the orchestrator logs each
pause.
6. TEST is never shown to you. Do not look for it or for any other copy of GraphWalks.
7. **Isolation.**
- Work only inside this folder: do not read, list or search anything outside it.
- No web or network access of any kind: no search, no page fetches, no `curl`, `wget`, `pip`, `ssh`, `git`
remotes, Hugging Face or GitHub.
- Some of this is blocked by your permissions. The rest is a rule, and your transcript is checked afterwards.
8. During the build you will receive only: "continue", how much DEV budget is left, the output of the GPU runs you
ask for, and answers to questions about these rules. Design questions get "that's your call."
9. If you find a problem with the rules, the data or the frame, stop and say so rather than working around it.
## Your folder
- `BRIEF.md`: this brief.
- `build.json`: this build's settings (compute cap, DEV budget, DEV files, GPU-run limits), read by the tools.
- `runner/`: the generic loop.
- `looped.py`: numpy float64 / float32; torch float32 / float64.
- `flops.py`: the compute counter.
- `README.md`: the network format and exactly what the runner computes.
- `dev/`: the two DEV files.
- `tools/`:
- `grader.py`: the official extraction and F1.
- `dev_run.py`: runs your network on chosen DEV problems or on your own inputs, scores them, and counts the run.
- `ledger/`: the record of counted runs, written by `tools/dev_run.py`.
- `work/`: yours.
Python 3.13 with numpy is installed.
## What to hand back (in `work/`)
1. A network folder: `network.json`, `weights.npz` and `tokenizer.py`, in the format of `runner/README.md`.
2. `write_weights.py`: the code that writes every weight, run as `python3 -I work/write_weights.py`.
3. `BUILD_NOTE.md`, short:
- what the network computes;
- parameters, total and nonzero;
- the R rule;
- the FLOPs per prompt at 1,800,000 characters;
- DEV results and the runs used;
- anything that worried you.
Say "done" when you are done. If you run out of time or DEV budget without a working network, say so and hand back
what you have. That is a valid result.
[Shareable version of the brief given to the builder (Claude Opus 5.5). Only details of our compute setup (machine names, accounts, paths, job ids) were removed or made generic; the task, rules and limits are as given.]
You are building hand-written (no training) looped transformers for two BIG-Bench Hard tasks: boolean_expressions and dyck_languages (multistep_arithmetic_two is a stretch, only after both are done). Work carefully: correctness and rule compliance matter more than speed.
## Setup
- You work in a project folder. Your directories: `src/bbh/`, `results/bbh/` (except `results/bbh/baselines/`, which is mine), `data/bbh/`. Do not edit other directories, except appending dated lines to the project log `logs/progress.md`.
- Read for conventions: the hard rules below; `src/expC/looped_multi.py` (generic multi-layer looped forward, last-token readout), `src/sudoku/looped.py`, `src/sudoku/weights.py`, `src/sudoku/EXPLAIN.md` (a previous hand-written looped model: analytic weights, snap() ReLU pairs, attention heads with scale s=100 that pick exact positions using a positional table expanded analytically into coordinates and their squares), `src/expB/` (written parity / multi-hop models).
## Compute rules (strict)
- Develop and run DEV on a local machine with Python and numpy (no restrictions locally).
- Heavier runs and downloads go to one shared GPU machine (shared with another agent: at most 4 CPUs; only the TEST run and its data download need it). Never run compute on a cluster login node, do not submit new cluster jobs, and do not use a shared /tmp.
## Hard rules (the project's and the user's)
1. TEST is never used for selection and runs exactly once per final model. You must not read TEST items: never open, print or inspect the BBH test data (the HF dataset `lukaemon/bbh`, or `bbh/*.json` in the official BIG-Bench-Hard GitHub repo). The TEST script loads them programmatically and prints only aggregate numbers.
2. No gradient-based optimisation and no fitting of weights to labels/targets; every tensor is set analytically by formulas.
3. Report every run: log each DEV eval call and the TEST run in `logs/progress.md`.
4. Inference is task-agnostic: a generic loop + readout, plus generic autoregressive decoding when an answer has several tokens (append the argmax token and rerun; stop at an end token). Python only maps characters to ids, runs the loop and maps ids back. No parsing, evaluation, bracket matching or stack logic in Python.
- Never look up benchmark answers or test items; never reuse trained weights.
- At most 20 DEV eval calls per task (a run of the full model on DEV items counts as one; unit tests of single components on hand-made inputs are free). Count and log them.
- If you find a problem with the rules, the data or the setup, stop and report it rather than working around it.
## Written-model constraints (as Exp B/C)
- Embedding (a sum of per-field tables: e.g. character id + position expanded analytically), R × one shared block (a list of layers is fine: per layer `h += Attn(h); h += ReLU-MLP(h)`, softmax attention, no norm), linear readout. d_model ≤ 64, heads ≤ 4 per layer. Your own character-level tokenizer is allowed; any fixed detokenisation rule (e.g. how output tokens are joined) must be generic and documented.
- R comes from a generic rule (R = n + c with n the input length, or a fixed R_max).
- Fixed-point requirement: for every TEST input the readout must be identical at R_min, 2·R_min and 4·R_min (at every decoding step).
## DEV and TEST
- DEV: a synthetic generator per task, built ONLY from the task description and the official few-shot examples. Get those from the official BIG-Bench-Hard repo's `cot-prompts/<task>.txt` (github.com/suzgunmirac/BIG-Bench-Hard; it holds the task description and the 3 few-shot examples; do not open anything under `bbh/`), or from lm-eval's bbh fewshot task yaml. Cover every format variation the description and examples show (boolean_expressions: True/False, not/and/or, parentheses, Python precedence not > and > or, the trailing " is", answer "True"/"False"; dyck_languages: the instruction prefix "Complete the rest of the sequence, making sure that the parentheses are closed properly. Input: ", the four bracket types () [] {} <>, space-separated tokens, the answer = the closing brackets space-separated). Make DEV broader and harder than you expect TEST to be (longer, deeper nesting), so the model is not tuned to a narrow slice.
- TEST: the official 250 items per task, loaded from the HF dataset `lukaemon/bbh` (the one lm-eval uses; config = task name, split = test); exact match of your output string against the target (both stripped). Run once at the end.
- Design ideas (your call): boolean_expressions as parallel rewriting to a fixed point (resolve `not L`, `( L )`, `L and L`, `L or L` only where precedence and context allow, marking consumed characters blank; "nearest non-blank neighbour" lookups by attention); dyck_languages via depth computed by neighbour propagation over the loop, then decoding the closer of the most recent unmatched opener at each step (the generated closers are part of the rerun input), ending when the depth returns to 0.
## Deliverables (per task)
`src/bbh/looped.py` (generic forward + generic decoding), `src/bbh/weights_<task>.py` (every tensor analytic), `src/bbh/gen_<task>.py` (DEV generator), `src/bbh/evaluate.py` (DEV and TEST modes; TEST prints only aggregate numbers), unit tests, `src/bbh/EXPLAIN_<task>.md`, `results/bbh/<task>_dev.json`.
## Stop before TEST
When both tasks pass DEV and the fixed-point test on DEV, STOP and report back (do not run TEST yet). I will check the models against the rules and then tell you to run TEST once. Your report, per task: the architecture (d_model, layers, heads, MLP widths, parameter count total and nonzero), tokenizer and detokenisation rule, R rule and R_min, DEV accuracy and fixed-point results, DEV calls used, and anything that worried you.
[Shareable version of the brief given to the builder (Claude Opus 5.5). Only details of our compute setup (machine names, accounts, paths, job ids) were removed or made generic; the task, rules and limits are as given.]
You are building hand-written (no training) looped transformers for BIG-Bench Extra Hard (BBEH; Kazemi et al. 2025, arXiv:2502.19187; github.com/google-deepmind/bbeh): web_of_lies and shuffled_objects first; dyck_languages and word_sorting (modified-alphabet subtask) are stretch goals, only after the first two are done. Correctness, rule compliance and honest evaluation matter more than speed.
## Setup
- You work in a project folder. Your directories: `src/bbeh/`, `results/bbeh/` (REFERENCES.md there is mine; leave it), `data/bbeh/`. Do not edit other directories, except appending dated lines to the project log `logs/progress.md`.
- Read for conventions: the hard rules below; `src/sudoku/looped.py`, `src/sudoku/weights.py`, `src/sudoku/EXPLAIN.md` (a previous hand-written looped model: analytic weights, snap() ReLU pairs, attention heads with a large scale s that pick exact positions using a positional table expanded analytically); `src/expC/looped_multi.py`, `src/expB/` (written multi-hop models). For the stretch Dyck task, a hand-written BBH Dyck solver exists under `src/bbh/` (read its EXPLAIN file), which you may reuse.
## Data protocol (strict)
- BBEH Mini (20 items per task) is DEV: you may read it freely. The other 180 items per task are TEST: never open, print, list the contents of, or compute statistics on them. Get the repo, e.g. `git clone` or a zip download into `data/bbeh/`. List directory and file names to find the Mini file and the task files, but read only the Mini items. Infer the item schema from the Mini file.
- The TEST script loads a task's full item file programmatically, removes the Mini items (by exact input match), asserts that exactly 180 remain, runs the frozen model once, scores them, and prints only aggregate numbers. Use the repo's official scoring/normalisation function if it has one (otherwise exact match after the paper's normalisation), and say which.
- DEV: the 20 Mini items, plus a synthetic generator you write from the Mini items and the paper's task descriptions (Appendix A.16 for Shuffled Objects, A.21 for Web of Lies). Make the generator broader and harder than the Mini items (all variants the paper describes: Web of Lies subset 1 and subset 2 with cycles and "unknown"; Shuffled Objects variant 1 with no-effect swaps and variant 2 with named actions that recur later), so nothing is tuned to 20 items.
## Compute rules (strict)
- Develop and run DEV on a local machine with Python and numpy (no restrictions locally).
- Heavier runs and downloads go to one shared GPU machine (shared with another agent: at most 4 CPUs, modest GPU memory). Never run compute on a cluster login node, do not submit new cluster jobs, and do not use a shared /tmp.
## Hard rules
1. TEST is never used for selection and runs exactly once per final model.
2. No training, no gradient-based optimisation, no fitting of weights to labels/targets: every tensor is set analytically by formulas.
3. Report every run: log each DEV eval call and the TEST run in `logs/progress.md`. At most 20 DEV eval calls per task (a run of the full model on DEV items counts as one; unit tests of single components on hand-made inputs are free).
4. Inference is task-agnostic: embedding → R × one shared block (a list of layers is fine: per layer `h += Attn(h); h += ReLU-MLP(h)`, softmax attention, no norm) → linear readout, plus generic autoregressive decoding for multi-token answers (append argmax token, rerun or use an exact KV cache, stop at an end token). Python only tokenises, runs the generic loop and detokenises: no parsing of sentences, no truth propagation, no swap tracking in Python. Your own tokenizer is allowed (character-level, or another fixed generic scheme that handles any input string, including names never seen on DEV); document it.
5. R comes from a generic rule (fixed R_max or R = f(input length)). Fixed-point requirement: for every TEST input, the readout is identical at R_min, 2·R_min and 4·R_min (every decoding step).
6. No parameter limit; prefer the smallest design that works; report total and nonzero parameter counts.
- Never look up benchmark answers or test items; never reuse trained weights. If you hit a problem with the rules, the data or the setup, stop and report it.
## Deliverables (per task)
`src/bbeh/looped.py` (generic forward + decoding), `src/bbeh/weights_<task>.py` (analytic), `src/bbeh/gen_<task>.py` (DEV generator), `src/bbeh/evaluate.py` (DEV/TEST modes; TEST prints only aggregates), unit tests, `src/bbeh/EXPLAIN_<task>.md`, `results/bbeh/<task>_dev.json`.
## Before TEST
When web_of_lies and shuffled_objects pass DEV (Mini + generator) with the fixed-point test, STOP and report back before running TEST: per task, the architecture and parameter counts, tokenizer, R rule and R_min, DEV accuracy (Mini and generated, by variant), fixed-point results, DEV calls used, and anything that worried you. I will check the models against the rules and then tell you to run TEST once.
[Shareable version of the brief given to the builder (Claude Opus 5.5). Only details of our compute setup (machine names, accounts, paths, job ids) were removed or made generic; the task, rules and limits are as given.]
You are building "Exp C" of an overnight research run: a HAND-WRITTEN looped transformer (every weight set analytically, no training) that computes shortest-path length in a directed graph, plus trained baselines. Work only inside src/expC/ (written model, eval tool, docs), results/expC/ (results), and src/baselines/expC/ (trained baselines). Never edit any other file; another agent works on src/ouro_edit/ and other files. Do not modify src/expC/data.py (the task generator, already checked for shortcuts); if you think it has a problem, stop and report it.
## Hard rules (verbatim from the project README §3, never break)
1. **TEST splits are never used for selection.** No tuning of ε, k, edits or weights on TEST. Each final candidate is evaluated on TEST **exactly once**, and that run is logged.
2. **Written/edited conditions use no gradient-based optimization.** No `.backward()`, no optimizers, no training loops, no fitting of weights to task labels or targets. Analysis is allowed: SVD, PCA, reading activations, logit lens. Trained baselines live in separate code (`src/baselines/`).
3. **Report every run**, including failures and abandoned candidates. No silent reruns over seeds to cherry-pick.
4. **Exp B inference is task-agnostic**: a generic loop plus readout. No task-specific control flow (no digit pairing, carry threading or position indexing in Python). (This applies to Exp C too.)
Additional rules for you: do NOT run TEST at all. When the written model is final on DEV, stop and report; the lead will confirm and run TEST. DEV eval budget for the written model: at most 20 eval calls, each logged (with a one-line hypothesis) to results/expC/graph_calls.jsonl. Before each call, state what you expect; read every failure carefully and fix the specific piece. You may use small hand-made unit inputs (not from DEV/TEST) to debug individual layers without spending eval calls; log that you did.
## The task (already implemented in src/expC/data.py — read it)
Tokens, shuffled, then the query token last: node tokens (NODE=0, v, v); edge tokens (EDGE=1, u, v) for u -> v; query (QUERY=2, A, B). Node ids are distinct random ids from 0..63. Label: BFS distance A -> B (1..63) or 64 = unreachable. `split("dev")` (7-12 nodes, distances 1..4, 1 in 4 unreachable) and `split("test")` (24-48 nodes, distances 8..16). Items vary in length; evaluate one item at a time (or group equal lengths).
## Written model constraints (from the user)
One shared block of up to 6 transformer layers, looped R times; d_model <= 512; <= 4 heads per layer; generic loop (embed -> R x block -> linear readout of the last token); R from a generic rule (e.g. R = number of tokens); fixed-point test: identical readout at R_min, 2 R_min, 4 R_min. Every tensor analytic (numpy, float64 is fine). Write: src/expC/looped_multi.py (generic multi-layer looped forward, task-agnostic, like a standard transformer: per layer h += Attn(h); h += MLP(h), ReLU MLP, softmax attention, optional masks only of the generic kind — here bidirectional, no mask), src/expC/weights_graph.py (build() returns all tensors; encode(items) only maps token tuples to embedding indices; r_min(item) is the generic rule), src/expC/evaluate.py (DEV only, budget-enforced, logs per-label accuracy, accuracy at R_min x {1,2,4}, fixed-point share), and src/expC/EXPLAIN_graph.md with one section per layer (what each head and MLP unit computes).
## A design that should work (the lead's; you may improve it, but explain any change)
Embedding = sum of three field tables: type (sets one=1 and one-hot isN/isE/isQ), field1 id f1 -> (a = f1, a^2), field2 id f2 -> (b = f2, b^2). Node tokens have a = b = own id; edges a = u (tail), b = v (head); query a = A, b = B.
Lookups use the exact quadratic match trick: query vector (2s*x, -s, -s*P), key vector (y, y^2, penalty_feature) gives score -s*(y - x)^2 - s*P*penalty + const, so the token whose y equals x wins (s ~ 50, P ~ 1e4 to exclude token types). Use float64.
Node state: reached (0/1), cnt (number of loops in which the node was not yet reached, capped at CAP=64 so the state becomes a fixed point).
Per loop (3 layers):
- Layer 1 attention: head 1, every edge reads `reached` of the node whose id equals its tail a (exclude non-node keys with the penalty), into scratch ru; head 2, every token reads A (field a of the query token; select the query token by its isQ key) into scratch Aatt. Layer 1 MLP: gate ru to edges only, ru_c = relu(ru - 1 + isE) (ru in [0,1]); for nodes compute e1 = relu(a - Aatt), e2 = relu(Aatt - a).
- Layer 2 attention: every node averages, over keys whose b equals its own id (all in-edges, whose b = head, and the node itself, whose b = own id; exclude the query token by penalty), the value ru_c + reached. The average is > 0 iff some in-neighbour (or the node itself) is reached; there is always at least one match (itself). Layer 2 MLP: g = flat threshold of the average (e.g. relu(128*avg - 0.5) - relu(128*avg - 1.5), gated to nodes with a -P*(1 - isN) term); eqA = relu(1 - e1 - e2 - P*(1 - isN)) (1 iff this node is A).
- Layer 3 attention: the query token reads (cnt, reached) of node B (match on its b) into (dB, rB) and cnt of node A (match on its a) into dA. Layer 3 MLP: reached <- clamp(g + eqA, 0, 1) via relu(g+eqA) - relu(g+eqA-1); cnt <- cnt + inc - relu(cnt + inc - CAP) with inc = isN - reached_old; then clear every scratch dimension (each layer's attention ADDS into its scratch dims, so scratch must be cleared once per loop at a point after it is last read, using relu(u) - relu(-u) = u; clear the query's dA/dB/rB at the START of the next loop, e.g. in layer 1's MLP, so they hold fresh values at readout).
Timing: A is reached at the end of loop 1; a node at distance d at the end of loop d+1; cnt(v) = d+1 for reached nodes, so dB - dA = distance; the query reads node states from the previous loop, so R_min = distance + 2; with R = number of tokens (always >= nodes + 1) every reachable B is resolved. Readout (query token, last): logit_c = 2c*(dB - dA) - c^2 + Mr*rB for c = 0..63 and logit_64 = Mr/2 (Mr ~ 1e5): nearest integer distance if reached, else unreachable. Flat thresholds everywhere keep errors from growing over hundreds of loops.
## Baselines (trained; code in src/baselines/expC/, GPU via Slurm only)
Run them as one GPU cluster job (one GPU, at most 40 GB of memory, at most 3 hours); never run compute on the login node. Models: T1 = a looped transformer of the same size class as the written model (one shared block of the same number of layers and similar d_model, pre-norm, input injection), trained on the DEV range with random loop counts R ~ U[n_tok, 2 n_tok] and a progressive-loss-style supervision (loss at several loop counts); non-looped transformers with about 10x and about 100x the written model's parameters. Training data: fresh items from data.make('dev', random.Random(1000+i)) style generators (never the DEV/TEST seeds 41/42). For each model, a 3-value learning-rate sweep chosen on DEV; train until DEV plateaus (cap ~40 minutes per run; run several in parallel on the one GPU). Evaluate each final model on DEV and on TEST exactly once (that is allowed for baselines: no selection on TEST); write results/expC/baseline_<model>.json with parameter count, DEV and TEST accuracy by distance (and unreachable), and for T1 at R x {1,2,4}. Batches need left padding with a PAD token and a key-padding mask (the query token stays last). Look at src/baselines/train_expB.py for a working pattern (do not edit it; copy what you need).
## What to return
A short report: the files you wrote; the DEV eval calls (hypothesis -> result, one line each); whether the written model is final on DEV (accuracy by label at R_min x 1,2,4 and the fixed-point share); parameter count; the baseline job id and its status. Do not run TEST for the written model.
[The brief given to each of the five maze builds under a cap on the number of weights. The five copies differ only in <LIMIT>: 1,000, 5,000, 10,000, 20,000 or 40,000. The builder received it as its first message and as BRIEF.md in its folder.]
## Your task
Write the weights of a looped transformer that solves Maze-Hard, the 30 × 30 maze benchmark of the HRM release
(`sapientinc/maze-30x30-hard-1k`). Nothing is trained: every weight is written by code you write.
**Size limit: at most <LIMIT> weights.** The count is the size of the network: every entry of every array (embedding
tables, attention, MLP, readout, biases), zeros included. An array stored in the runner's sparse form counts at its
full shape, not by the values stored. `tools/params.py` prints the count. The orchestrator checks it when it freezes
your files; a network over the limit is not run on TEST.
**The problem.** The input is a maze: a 30 × 30 grid of walls `#` and open cells (a space), with one start `S` and one
goal `G`. The output is the same grid with the cells of a path from `S` to `G` marked `o`, moving up, down, left or
right through open cells, in the form and with the conventions the dataset uses (which cells are marked, and which
path when several are possible).
**Input.** Each problem is one text prompt: the maze as 30 lines of 30 characters, joined by newlines (no newline at
the end). Each line is one row of the dataset's grid, in order.
**Output.** The solved grid in the same form: 30 lines of 30 characters, joined by newlines.
**Scoring:** per maze, solved or not (`tools/grader.py`).
- The response, with newlines at both ends removed, must equal the dataset's solved grid exactly.
- Anything else scores 0.
- The TEST score is the fraction solved.
**TEST** is the 1,000 mazes of Maze-Hard's official test split: new mazes of the same kind and size as DEV. You never
see TEST. When you say you are done, the orchestrator freezes your files and runs TEST on a GPU with the runner's
`torch64` path (float64).
## Data in your folder
- `dev/dev_maze.jsonl`: the 1,000 mazes of Maze-Hard's official train split. Each line is
`{"id", "prompt", "answer", "size"}`, where `answer` is the solved grid.
You may analyse the DEV inputs and answers with any code you like, as often as you like. The dataset's conventions
are for you to work out from DEV.
## The frame (fixed; implemented in `runner/`, described in `runner/README.md`)
Inference is the generic loop: embed → the same block R times → readout.
- **Input.** The network reads exactly the prompt text, character for character. Nothing is removed, added or
reformatted.
- **Tokenizer.** You write it in `tokenizer.py` and declare it. It maps a text string to a sequence of tokens, each a
tuple of non-negative integer fields, each below the size of its embedding table.
- It must work unchanged on any text.
- It must know nothing about mazes, grids, paths or the question format.
- The auditor checks both.
- **Embedding.** The sum of one table per token field.
- **Block.** A fixed list of layers, the same in every loop. Each layer does
`h ← h + Σ_heads softmax(Q Kᵀ/√d_k + mask) V W_O`, then `h ← h + W2 ReLU(W1 h + b1) + b2`.
- The mask is none or causal, per head.
- There is no normalisation.
- The widths and the numbers of layers and heads are yours to choose, within the size limit.
- **Loops.** R comes from a rule you declare that depends only on the number of tokens n (see `runner/README.md`).
- **Readout.** A linear map at every position, then argmax over an output alphabet you declare: a list of strings,
one of which is the empty string.
- Each position writes one alphabet string, or nothing (the empty string).
- The answer is the written strings in position order.
- The harness passes that string to the grader unchanged, with nothing added. Your network must write everything
the grader needs.
- **Weights.** Every number the network uses is in `weights.npz`. `network.json` holds only the settings the runner
reads (`runner/README.md`).
- **Arithmetic.** The runner has these paths (`runner/README.md`): `numpy` (float64) and `numpy32` (float32) on this
machine; `torch32` and `torch64` on a GPU. DEV runs use `numpy` or `numpy32`, as you choose. TEST uses `torch64`. The
written answer must be the same on `numpy` and `torch64`.
- **Compute limit.** At most 1 × 10¹⁴ FLOPs per prompt, counted by the runner from your shapes before it runs
(`runner/flops.py`). The runner refuses any prompt over the limit.
## Rules
1. No training, gradients or fitting weights to data. Every weight is written by your code.
2. Inference is the generic loop above, with no task logic in Python, the tokenizer or the readout. Python only
tokenizes, runs embed → block R times → readout, and joins the written strings. The tokenizer is generic and
declared.
3. **DEV budget: 20 runs.** A run is any evaluation of your network on official DEV problems, on any number of them.
- Running your network on anything built from a DEV problem (a part of one, an edited copy, its inputs or its
answer) also counts as a DEV run.
- Runs on inputs you make yourself do not count. Such inputs may reuse the prompt format, but no inputs or answer
from the DEV file.
- Run your network on DEV, or on inputs built from DEV, only through `tools/dev_run.py` (`--from-dev` for inputs
built from DEV), which counts each run in `ledger/`. Do not edit the ledger; the auditor checks it against your
transcript.
4. **No GPU runs.** This machine has no GPU, and this build has no GPU runs: every DEV run is on this machine.
5. **Time limit:** 12 hours of working time. Time paused by a usage limit doesn't count, and the orchestrator logs each
pause.
6. TEST is never shown to you. Do not look for it, for any other copy of Maze-Hard or HRM's data or code, or for any
other maze dataset.
7. **Isolation.**
- Work only inside this folder: do not read, list or look through anything outside it.
- No web or network access of any kind: no web queries, no page fetches, no `curl`, `wget`, `pip`, `ssh`, `git`
remotes, Hugging Face or GitHub.
- Some of this is blocked by your permissions. The rest is a rule, and your transcript is checked afterwards.
8. During the build you will receive only: "continue", how much DEV budget is left, and answers to questions about
these rules. Design questions get "that's your call."
9. If you find a problem with the rules, the data or the frame, stop and say so rather than working around it.
## Your folder
- `BRIEF.md`: this brief.
- `build.json`: this build's settings (compute cap, DEV budget, DEV file, size limit), read by the tools.
- `runner/`: the generic loop.
- `looped.py`: numpy float64 / float32; torch float32 / float64.
- `flops.py`: the compute counter.
- `README.md`: the network format and exactly what the runner computes.
- `dev/`: the DEV file.
- `tools/`:
- `grader.py`: the scoring above.
- `dev_run.py`: runs your network on chosen DEV problems or on your own inputs, scores them, and counts the run.
- `params.py`: counts the weights of a network folder.
- `ledger/`: the record of counted runs, written by `tools/dev_run.py`.
- `work/`: yours.
Python 3.13 with numpy is installed.
## What to hand back (in `work/`)
1. A network folder: `network.json`, `weights.npz` and `tokenizer.py`, in the format of `runner/README.md`.
2. `write_weights.py`: the code that writes every weight, run as `python3 -I work/write_weights.py`.
3. `BUILD_NOTE.md`, short:
- what the network computes;
- weights, total and nonzero;
- the R rule;
- the FLOPs per prompt;
- DEV results and the runs used;
- anything that worried you.
Say "done" when you are done. If you run out of time or DEV budget without a working network, say so and hand back
what you have. That is a valid result.
[The brief given to the builder (a headless Claude Code session, Claude Opus 5.5) for the Sudoku build under a 1,000-loop limit. It is brief 04 with the loop limit added; the other changes say where DEV runs are evaluated (the orchestrator's server) and drop GPU-run output from the list of messages, since the tool now returns it.]
## Your task
Write the weights of a looped transformer that solves Sudoku puzzles from Sudoku-Extreme. Nothing is trained: every
weight is written by code you write.
**Loop limit: R is at most 1,000.** R is the number of times the block runs (the frame below), and it must be at most
1,000 on every prompt. `tools/dev_run.py` refuses a network over the limit, and the orchestrator checks it when it
freezes your files; a network over the limit is not run on TEST.
**Sudoku.** A puzzle is a 9 × 9 grid divided into nine 3 × 3 boxes. Some cells are given a digit from 1 to 9; the rest
are empty.
- A solution fills every empty cell with a digit from 1 to 9, so that every row, every column and every box contains
each of the digits 1 to 9 exactly once.
- The given digits stay as they are.
- Every puzzle here has exactly one solution.
**Input.** Each problem is one text prompt, exactly as a language model receives it:
Solve this Sudoku: <row 1> ... <row 9>
Each row is 9 characters: a digit 1–9 for a given cell, `0` for an empty cell. The rows are joined by single newlines,
and there is no newline after the last row. Every prompt is 108 characters.
**Output.** The completed grid: 9 lines of 9 digits, one row per line, digits only, with no spaces or other characters.
**Scoring:** per puzzle, solved or not (`tools/grader.py`).
- Leading and trailing newlines are removed, and lines starting with three backticks are dropped.
- Each remaining line is stripped of spaces, and the lines are joined.
- The result must equal the solution's 81 digits in row order. Anything else scores 0.
- The TEST score is the fraction of puzzles solved.
**TEST** is puzzles from Sudoku-Extreme's test file, in a fixed order. They are of the same kind as DEV. You never see
TEST. When you say you are done, the orchestrator freezes your files and runs TEST, on the GPU path (`torch32`).
## Data in your folder
- `dev/train_1000.jsonl`: 1,000 puzzles from Sudoku-Extreme's training file. Each line is `{"id", "prompt", "answer"}`,
where `answer` is the solution's 81 digits in row order.
You may analyse the DEV inputs and answers with any code you like, as often as you like.
## The frame (fixed; implemented in `runner/`, described in `runner/README.md`)
Inference is the generic loop: embed → the same block R times → readout.
- **Input.** The network reads exactly the prompt text, character for character. Nothing is removed, added or
reformatted.
- **Tokenizer.** You write it in `tokenizer.py` and declare it. It maps a text string to a sequence of tokens, each a
tuple of non-negative integer fields, each below the size of its embedding table.
- It must work unchanged on any text.
- It must know nothing about Sudoku, grids, rows, columns, boxes or the question format.
- The auditor checks both.
- **Embedding.** The sum of one table per token field.
- **Block.** A fixed list of layers, the same in every loop. Each layer does
`h ← h + Σ_heads softmax(Q Kᵀ/√d_k + mask) V W_O`, then `h ← h + W2 ReLU(W1 h + b1) + b2`.
- The mask is none or causal, per head.
- There is no normalisation.
- The widths and the numbers of layers and heads are yours to choose.
- **Loops.** R comes from a rule you declare that depends only on the number of tokens n (see `runner/README.md`).
It must be at most 1,000 on every prompt (the loop limit above).
- **Readout.** A linear map at every position, then argmax over an output alphabet you declare: a list of strings,
one of which is the empty string.
- Each position writes one alphabet string, or nothing (the empty string).
- The answer is the written strings in position order.
- The harness passes that string to the grader unchanged, with nothing added. Your network must write everything
the grader needs.
- **Arithmetic.** The runner has these paths (`runner/README.md`):
- on a CPU, `numpy` (float64) and `numpy32` (float32, following the GPU path as closely as numpy can);
- on the GPU, `torch32` (float32, fused attention, TF32 off).
DEV runs on a CPU use `numpy` or `numpy32`, as you choose. DEV runs on the GPU and TEST use `torch32`. The
written answer must be the same on `numpy` and `torch32`.
- **Compute limit.** At most 1 × 10¹⁴ FLOPs per prompt, counted by the runner from your shapes before it runs
(`runner/flops.py`). The runner refuses any prompt over the limit. Peak GPU memory must stay under 30 GB on one
32 GB GPU.
## Rules
1. No training, gradients or fitting weights to data. Every weight is written by your code.
2. Inference is the generic loop above, with no task logic in Python, the tokenizer or the readout. Python only
tokenizes, runs embed → block R times → readout, and joins the written strings. The tokenizer is generic and
declared.
3. **DEV budget: 20 runs.** A run is any evaluation of your network on official DEV problems, on any number of them.
- Running your network on anything built from a DEV problem (a part of one, an edited copy, its grid or its answer)
also counts as a DEV run.
- Runs on inputs you make yourself do not count. Such inputs may reuse the prompt format, but no grid or answer
from the DEV file.
- Run your network on DEV, or on inputs built from DEV, only through `tools/dev_run.py` (`--from-dev` for inputs
built from DEV), which counts each run in `ledger/`. Do not edit the ledger; the auditor checks it against your
transcript.
4. **Where runs happen.** This machine has no GPU. `tools/dev_run.py` sends every call to the orchestrator's server
and runs it there with this folder's `runner/`, unchanged: `numpy` and `numpy32` on its CPUs, `torch32` on its GPU
(`--backend torch32`). Only the network and the prompts are sent; scoring, the budget and the ledger stay here.
- A GPU run holds at most 2 × 10¹⁵ FLOPs counted over all its prompts (for example 20 puzzles at the cap).
- Each GPU run counts as one of the 20, on DEV or on your own inputs.
You have no cluster access yourself.
5. **Time limit:** 12 hours of working time. Time paused by a usage limit doesn't count, and the orchestrator logs each
pause.
6. TEST is never shown to you. Do not look for it or for any other copy of Sudoku-Extreme.
7. **Isolation.**
- Work only inside this folder: do not read, list or look through anything outside it.
- No web or network access of any kind: no web queries, no page fetches, no `curl`, `wget`, `pip`, `ssh`, `git`
remotes, Hugging Face or GitHub.
- Some of this is blocked by your permissions. The rest is a rule, and your transcript is checked afterwards.
8. During the build you will receive only: "continue", how much DEV budget is left, and answers to questions about
these rules. Design questions get "that's your call."
9. If you find a problem with the rules, the data or the frame, stop and say so rather than working around it.
## Your folder
- `BRIEF.md`: this brief.
- `build.json`: this build's settings (compute cap, loop limit, DEV budget, DEV files, GPU-run limits), read by the tools.
- `runner/`: the generic loop.
- `looped.py`: numpy float64 / float32; torch float32 / float64.
- `flops.py`: the compute counter.
- `README.md`: the network format and exactly what the runner computes.
- `dev/`: the DEV file.
- `tools/`:
- `grader.py`: the scoring above.
- `dev_run.py`: runs your network on chosen DEV problems or on your own inputs, scores them, and counts the run.
- `ledger/`: the record of counted runs, written by `tools/dev_run.py`.
- `bridge/`: the calls `tools/dev_run.py` sends to the server, written by the tool.
- `work/`: yours.
Python 3.13 with numpy is installed.
## What to hand back (in `work/`)
1. A network folder: `network.json`, `weights.npz` and `tokenizer.py`, in the format of `runner/README.md`.
2. `write_weights.py`: the code that writes every weight, run as `python3 -I work/write_weights.py`.
3. `BUILD_NOTE.md`, short:
- what the network computes;
- parameters, total and nonzero;
- the R rule;
- the FLOPs per prompt;
- DEV results and the runs used;
- anything that worried you.
Say "done" when you are done. If you run out of time or DEV budget without a working network, say so and hand back
what you have. That is a valid result.
## Your task
Write the weights of a looped transformer that executes one algorithm of the CLRS-Text benchmark,
`strongly_connected_components` (the strongly connected components algorithm of CLRS (Cormen et al.), section 22.5). Nothing is trained: every weight is written by code you write.
**The problem.** The input is a directed graph on n nodes, numbered 0 to n − 1, given as its adjacency matrix `A` (`A[i][j]` is 1 when there is an edge from i to j). The output `scc_id` gives, for every node, the id of its strongly connected component (a largest set of nodes that can all reach each other), in the form and with the id convention the dataset uses.
**Input.** Each problem is one text prompt, exactly as the CLRS-Text dataset gives it to a language model. It starts
with `strongly_connected_components:`, then the inputs and the algorithm's `initial_trace`, and ends with the line `trace | scc_id:`.
The DEV prompts show the exact format. In DEV the number of nodes is one of 4, 5, 10, 11, 12 and 15.
**Output.** The final output `scc_id` in the dataset's format, for example `[0 1 2 0 1]`. You may first write the
execution trace and `|`, as the dataset's answers do, or write only the final output.
**Scoring:** per problem, solved or not (`tools/grader.py`).
- The final output of a response is the text after its last `|` (the whole text if there is none), with lines starting
with three backticks dropped and whitespace stripped at both ends.
- It must equal the problem's final output exactly. Anything else scores 0.
- The TEST score is the fraction solved.
**TEST** is this algorithm's problems in the five CLRS-Text test splits (test_1 to test_5), new random problems of the
same kind, with 4 to 22 nodes: larger graphs than any in DEV. You never see TEST. When you say you are done, the orchestrator freezes your files and runs
TEST on a GPU with the runner's `torch64` path (float64).
## Data in your folder
- `dev/dev_strongly_connected_components.jsonl`: 1,000 problems from the CLRS-Text train split, an equal number per size. Each line is
`{"id", "prompt", "answer", "size"}`, where `answer` is the final output.
You may analyse the DEV inputs and answers with any code you like, as often as you like. The dataset's conventions
(ids, ties, unreachable nodes, number formats) are for you to work out from DEV.
## The frame (fixed; implemented in `runner/`, described in `runner/README.md`)
Inference is the generic loop: embed → the same block R times → readout.
- **Input.** The network reads exactly the prompt text, character for character. Nothing is removed, added or
reformatted.
- **Tokenizer.** You write it in `tokenizer.py` and declare it. It maps a text string to a sequence of tokens, each a
tuple of non-negative integer fields, each below the size of its embedding table.
- It must work unchanged on any text.
- It must know nothing about graphs, matrices, sequences, this algorithm or the question format.
- The auditor checks both.
- **Embedding.** The sum of one table per token field.
- **Block.** A fixed list of layers, the same in every loop. Each layer does
`h ← h + Σ_heads softmax(Q Kᵀ/√d_k + mask) V W_O`, then `h ← h + W2 ReLU(W1 h + b1) + b2`.
- The mask is none or causal, per head.
- There is no normalisation.
- The widths and the numbers of layers and heads are yours to choose.
- **Loops.** R comes from a rule you declare that depends only on the number of tokens n (see `runner/README.md`).
- **Readout.** A linear map at every position, then argmax over an output alphabet you declare: a list of strings,
one of which is the empty string.
- Each position writes one alphabet string, or nothing (the empty string).
- The answer is the written strings in position order.
- The harness passes that string to the grader unchanged, with nothing added. Your network must write everything
the grader needs.
- **Arithmetic.** The runner has these paths (`runner/README.md`): `numpy` (float64) and `numpy32` (float32) on this
machine; `torch32` and `torch64` on a GPU. DEV runs use `numpy` or `numpy32`, as you choose. TEST uses `torch64`. The
written answer must be the same on `numpy` and `torch64`.
- **Compute limit.** At most 1 × 10¹⁴ FLOPs per prompt, counted by the runner from your shapes before it runs
(`runner/flops.py`). The runner refuses any prompt over the limit.
## Rules
1. No training, gradients or fitting weights to data. Every weight is written by your code.
2. Inference is the generic loop above, with no task logic in Python, the tokenizer or the readout. Python only
tokenizes, runs embed → block R times → readout, and joins the written strings. The tokenizer is generic and
declared.
3. **DEV budget: 20 runs.** A run is any evaluation of your network on official DEV problems, on any number of them.
- Running your network on anything built from a DEV problem (a part of one, an edited copy, its inputs or its
answer) also counts as a DEV run.
- Runs on inputs you make yourself do not count. Such inputs may reuse the prompt format, but no inputs or answer
from the DEV file.
- Run your network on DEV, or on inputs built from DEV, only through `tools/dev_run.py` (`--from-dev` for inputs
built from DEV), which counts each run in `ledger/`. Do not edit the ledger; the auditor checks it against your
transcript.
4. **No GPU runs.** This machine has no GPU, and this build has no GPU runs: every DEV run is on this machine.
5. **Time limit:** 12 hours of working time. Time paused by a usage limit doesn't count, and the orchestrator logs each
pause.
6. TEST is never shown to you. Do not look for it or for any other copy of CLRS-Text or CLRS.
7. **Isolation.**
- Work only inside this folder: do not read, list or look through anything outside it.
- No web or network access of any kind: no web queries, no page fetches, no `curl`, `wget`, `pip`, `ssh`, `git`
remotes, Hugging Face or GitHub.
- Some of this is blocked by your permissions. The rest is a rule, and your transcript is checked afterwards.
8. During the build you will receive only: "continue", how much DEV budget is left, and answers to questions about
these rules. Design questions get "that's your call."
9. If you find a problem with the rules, the data or the frame, stop and say so rather than working around it.
## Your folder
- `BRIEF.md`: this brief.
- `build.json`: this build's settings (compute cap, DEV budget, DEV file), read by the tools.
- `runner/`: the generic loop.
- `looped.py`: numpy float64 / float32; torch float32 / float64.
- `flops.py`: the compute counter.
- `README.md`: the network format and exactly what the runner computes.
- `dev/`: the DEV file.
- `tools/`:
- `grader.py`: the scoring above.
- `dev_run.py`: runs your network on chosen DEV problems or on your own inputs, scores them, and counts the run.
- `ledger/`: the record of counted runs, written by `tools/dev_run.py`.
- `work/`: yours.
Python 3.13 with numpy is installed.
## What to hand back (in `work/`)
1. A network folder: `network.json`, `weights.npz` and `tokenizer.py`, in the format of `runner/README.md`.
2. `write_weights.py`: the code that writes every weight, run as `python3 -I work/write_weights.py`.
3. `BUILD_NOTE.md`, short:
- what the network computes;
- parameters, total and nonzero;
- the R rule;
- the FLOPs per prompt at each size;
- DEV results and the runs used;
- anything that worried you.
Say "done" when you are done. If you run out of time or DEV budget without a working network, say so and hand back
what you have. That is a valid result.
## Your task
Write the weights of a looped transformer that executes one algorithm of the CLRS-Text benchmark,
`mst_prim` (MST-PRIM of CLRS (Cormen et al.), section 23.2). Nothing is trained: every weight is written by code you write.
**The problem.** The input is a weighted undirected graph on n nodes, numbered 0 to n − 1, given as a weighted adjacency matrix `A` (0 means no edge), and a start node `s`. The output `pi` gives, for every node, its parent in the minimum spanning tree that Prim's algorithm grows from `s`, in the form and with the conventions the dataset uses (for the start node, for nodes it cannot reach, and for ties).
**Input.** Each problem is one text prompt, exactly as the CLRS-Text dataset gives it to a language model. It starts
with `mst_prim:`, then the inputs and the algorithm's `initial_trace`, and ends with the line `trace | pi:`.
The DEV prompts show the exact format. The number of nodes or the sequence length is one of 4, 5, 10, 11, 12, 15, 19, 23 and 28.
**Output.** The final output `pi` in the dataset's format, for example `[0 1 2 0 1]`. You may first write the
execution trace and `|`, as the dataset's answers do, or write only the final output.
**Scoring:** per problem, solved or not (`tools/grader.py`).
- The final output of a response is the text after its last `|` (the whole text if there is none), with lines starting
with three backticks dropped and whitespace stripped at both ends.
- It must equal the problem's final output exactly. Anything else scores 0.
- The TEST score is the fraction solved.
**TEST** is this algorithm's problems in the five CLRS-Text test splits (test_1 to test_5), new random problems of the
same kind and sizes as DEV. You never see TEST. When you say you are done, the orchestrator freezes your files and runs
TEST on a GPU with the runner's `torch64` path (float64).
## Data in your folder
- `dev/dev_mst_prim.jsonl`: 1,000 problems from the CLRS-Text train split, an equal number per size. Each line is
`{"id", "prompt", "answer", "size"}`, where `answer` is the final output.
You may analyse the DEV inputs and answers with any code you like, as often as you like. The dataset's conventions
(ids, ties, unreachable nodes, number formats) are for you to work out from DEV.
## The frame (fixed; implemented in `runner/`, described in `runner/README.md`)
Inference is the generic loop: embed → the same block R times → readout.
- **Input.** The network reads exactly the prompt text, character for character. Nothing is removed, added or
reformatted.
- **Tokenizer.** You write it in `tokenizer.py` and declare it. It maps a text string to a sequence of tokens, each a
tuple of non-negative integer fields, each below the size of its embedding table.
- It must work unchanged on any text.
- It must know nothing about graphs, matrices, sequences, this algorithm or the question format.
- The auditor checks both.
- **Embedding.** The sum of one table per token field.
- **Block.** A fixed list of layers, the same in every loop. Each layer does
`h ← h + Σ_heads softmax(Q Kᵀ/√d_k + mask) V W_O`, then `h ← h + W2 ReLU(W1 h + b1) + b2`.
- The mask is none or causal, per head.
- There is no normalisation.
- The widths and the numbers of layers and heads are yours to choose.
- **Loops.** R comes from a rule you declare that depends only on the number of tokens n (see `runner/README.md`).
- **Readout.** A linear map at every position, then argmax over an output alphabet you declare: a list of strings,
one of which is the empty string.
- Each position writes one alphabet string, or nothing (the empty string).
- The answer is the written strings in position order.
- The harness passes that string to the grader unchanged, with nothing added. Your network must write everything
the grader needs.
- **Arithmetic.** The runner has these paths (`runner/README.md`): `numpy` (float64) and `numpy32` (float32) on this
machine; `torch32` and `torch64` on a GPU. DEV runs use `numpy` or `numpy32`, as you choose. TEST uses `torch64`. The
written answer must be the same on `numpy` and `torch64`.
- **Compute limit.** At most 1 × 10¹⁴ FLOPs per prompt, counted by the runner from your shapes before it runs
(`runner/flops.py`). The runner refuses any prompt over the limit.
## Rules
1. No training, gradients or fitting weights to data. Every weight is written by your code.
2. Inference is the generic loop above, with no task logic in Python, the tokenizer or the readout. Python only
tokenizes, runs embed → block R times → readout, and joins the written strings. The tokenizer is generic and
declared.
3. **DEV budget: 20 runs.** A run is any evaluation of your network on official DEV problems, on any number of them.
- Running your network on anything built from a DEV problem (a part of one, an edited copy, its inputs or its
answer) also counts as a DEV run.
- Runs on inputs you make yourself do not count. Such inputs may reuse the prompt format, but no inputs or answer
from the DEV file.
- Run your network on DEV, or on inputs built from DEV, only through `tools/dev_run.py` (`--from-dev` for inputs
built from DEV), which counts each run in `ledger/`. Do not edit the ledger; the auditor checks it against your
transcript.
4. **No GPU runs.** This machine has no GPU, and this build has no GPU runs: every DEV run is on this machine.
5. **Time limit:** 12 hours of working time. Time paused by a usage limit doesn't count, and the orchestrator logs each
pause.
6. TEST is never shown to you. Do not look for it or for any other copy of CLRS-Text or CLRS.
7. **Isolation.**
- Work only inside this folder: do not read, list or look through anything outside it.
- No web or network access of any kind: no web queries, no page fetches, no `curl`, `wget`, `pip`, `ssh`, `git`
remotes, Hugging Face or GitHub.
- Some of this is blocked by your permissions. The rest is a rule, and your transcript is checked afterwards.
8. During the build you will receive only: "continue", how much DEV budget is left, and answers to questions about
these rules. Design questions get "that's your call."
9. If you find a problem with the rules, the data or the frame, stop and say so rather than working around it.
## Your folder
- `BRIEF.md`: this brief.
- `build.json`: this build's settings (compute cap, DEV budget, DEV file), read by the tools.
- `runner/`: the generic loop.
- `looped.py`: numpy float64 / float32; torch float32 / float64.
- `flops.py`: the compute counter.
- `README.md`: the network format and exactly what the runner computes.
- `dev/`: the DEV file.
- `tools/`:
- `grader.py`: the scoring above.
- `dev_run.py`: runs your network on chosen DEV problems or on your own inputs, scores them, and counts the run.
- `ledger/`: the record of counted runs, written by `tools/dev_run.py`.
- `work/`: yours.
Python 3.13 with numpy is installed.
## What to hand back (in `work/`)
1. A network folder: `network.json`, `weights.npz` and `tokenizer.py`, in the format of `runner/README.md`.
2. `write_weights.py`: the code that writes every weight, run as `python3 -I work/write_weights.py`.
3. `BUILD_NOTE.md`, short:
- what the network computes;
- parameters, total and nonzero;
- the R rule;
- the FLOPs per prompt at each size;
- DEV results and the runs used;
- anything that worried you.
Say "done" when you are done. If you run out of time or DEV budget without a working network, say so and hand back
what you have. That is a valid result.
## Your task
Write the weights of a looped transformer that executes one algorithm of the CLRS-Text benchmark,
`lcs_length` (LCS-LENGTH of CLRS (Cormen et al.), section 15.4). Nothing is trained: every weight is written by code you write.
**The problem.** The input is two sequences, `string` and `key`, over a small alphabet. The output `b` is the table of the longest-common-subsequence dynamic program: for every cell, the direction its value came from, in the form and with the conventions the dataset uses.
**Input.** Each problem is one text prompt, exactly as the CLRS-Text dataset gives it to a language model. It starts
with `lcs_length:`, then the inputs and the algorithm's `initial_trace`, and ends with the line `trace | b:`.
The DEV prompts show the exact format. The number of nodes or the sequence length is one of 4, 5 and 10.
**Output.** The final output `b` in the dataset's format, for example `[0 1 2 0 1]`. You may first write the
execution trace and `|`, as the dataset's answers do, or write only the final output.
**Scoring:** per problem, solved or not (`tools/grader.py`).
- The final output of a response is the text after its last `|` (the whole text if there is none), with lines starting
with three backticks dropped and whitespace stripped at both ends.
- It must equal the problem's final output exactly. Anything else scores 0.
- The TEST score is the fraction solved.
**TEST** is this algorithm's problems in the five CLRS-Text test splits (test_1 to test_5), new random problems of the
same kind and sizes as DEV. You never see TEST. When you say you are done, the orchestrator freezes your files and runs
TEST on a GPU with the runner's `torch64` path (float64).
## Data in your folder
- `dev/dev_lcs_length.jsonl`: 1,000 problems from the CLRS-Text train split, an equal number per size. Each line is
`{"id", "prompt", "answer", "size"}`, where `answer` is the final output.
You may analyse the DEV inputs and answers with any code you like, as often as you like. The dataset's conventions
(ids, ties, unreachable nodes, number formats) are for you to work out from DEV.
## The frame (fixed; implemented in `runner/`, described in `runner/README.md`)
Inference is the generic loop: embed → the same block R times → readout.
- **Input.** The network reads exactly the prompt text, character for character. Nothing is removed, added or
reformatted.
- **Tokenizer.** You write it in `tokenizer.py` and declare it. It maps a text string to a sequence of tokens, each a
tuple of non-negative integer fields, each below the size of its embedding table.
- It must work unchanged on any text.
- It must know nothing about graphs, matrices, sequences, this algorithm or the question format.
- The auditor checks both.
- **Embedding.** The sum of one table per token field.
- **Block.** A fixed list of layers, the same in every loop. Each layer does
`h ← h + Σ_heads softmax(Q Kᵀ/√d_k + mask) V W_O`, then `h ← h + W2 ReLU(W1 h + b1) + b2`.
- The mask is none or causal, per head.
- There is no normalisation.
- The widths and the numbers of layers and heads are yours to choose.
- **Loops.** R comes from a rule you declare that depends only on the number of tokens n (see `runner/README.md`).
- **Readout.** A linear map at every position, then argmax over an output alphabet you declare: a list of strings,
one of which is the empty string.
- Each position writes one alphabet string, or nothing (the empty string).
- The answer is the written strings in position order.
- The harness passes that string to the grader unchanged, with nothing added. Your network must write everything
the grader needs.
- **Arithmetic.** The runner has these paths (`runner/README.md`): `numpy` (float64) and `numpy32` (float32) on this
machine; `torch32` and `torch64` on a GPU. DEV runs use `numpy` or `numpy32`, as you choose. TEST uses `torch64`. The
written answer must be the same on `numpy` and `torch64`.
- **Compute limit.** At most 1 × 10¹⁴ FLOPs per prompt, counted by the runner from your shapes before it runs
(`runner/flops.py`). The runner refuses any prompt over the limit.
## Rules
1. No training, gradients or fitting weights to data. Every weight is written by your code.
2. Inference is the generic loop above, with no task logic in Python, the tokenizer or the readout. Python only
tokenizes, runs embed → block R times → readout, and joins the written strings. The tokenizer is generic and
declared.
3. **DEV budget: 20 runs.** A run is any evaluation of your network on official DEV problems, on any number of them.
- Running your network on anything built from a DEV problem (a part of one, an edited copy, its inputs or its
answer) also counts as a DEV run.
- Runs on inputs you make yourself do not count. Such inputs may reuse the prompt format, but no inputs or answer
from the DEV file.
- Run your network on DEV, or on inputs built from DEV, only through `tools/dev_run.py` (`--from-dev` for inputs
built from DEV), which counts each run in `ledger/`. Do not edit the ledger; the auditor checks it against your
transcript.
4. **No GPU runs.** This machine has no GPU, and this build has no GPU runs: every DEV run is on this machine.
5. **Time limit:** 12 hours of working time. Time paused by a usage limit doesn't count, and the orchestrator logs each
pause.
6. TEST is never shown to you. Do not look for it or for any other copy of CLRS-Text or CLRS.
7. **Isolation.**
- Work only inside this folder: do not read, list or look through anything outside it.
- No web or network access of any kind: no web queries, no page fetches, no `curl`, `wget`, `pip`, `ssh`, `git`
remotes, Hugging Face or GitHub.
- Some of this is blocked by your permissions. The rest is a rule, and your transcript is checked afterwards.
8. During the build you will receive only: "continue", how much DEV budget is left, and answers to questions about
these rules. Design questions get "that's your call."
9. If you find a problem with the rules, the data or the frame, stop and say so rather than working around it.
## Your folder
- `BRIEF.md`: this brief.
- `build.json`: this build's settings (compute cap, DEV budget, DEV file), read by the tools.
- `runner/`: the generic loop.
- `looped.py`: numpy float64 / float32; torch float32 / float64.
- `flops.py`: the compute counter.
- `README.md`: the network format and exactly what the runner computes.
- `dev/`: the DEV file.
- `tools/`:
- `grader.py`: the scoring above.
- `dev_run.py`: runs your network on chosen DEV problems or on your own inputs, scores them, and counts the run.
- `ledger/`: the record of counted runs, written by `tools/dev_run.py`.
- `work/`: yours.
Python 3.13 with numpy is installed.
## What to hand back (in `work/`)
1. A network folder: `network.json`, `weights.npz` and `tokenizer.py`, in the format of `runner/README.md`.
2. `write_weights.py`: the code that writes every weight, run as `python3 -I work/write_weights.py`.
3. `BUILD_NOTE.md`, short:
- what the network computes;
- parameters, total and nonzero;
- the R rule;
- the FLOPs per prompt at each size;
- DEV results and the runs used;
- anything that worried you.
Say "done" when you are done. If you run out of time or DEV budget without a working network, say so and hand back
what you have. That is a valid result.
## Your task
Write the weights of a looped transformer that decides random 3-SAT formulas from SATLIB, the standard benchmark
library for satisfiability: it must say whether a formula is satisfiable and, if it is, give an assignment that
satisfies it. Nothing is trained: every weight is written by code you write.
**The problem.** A 3-SAT formula over variables 1 … V is a list of clauses, each the OR of three literals (a variable
or its negation). The formula is satisfiable if some true/false assignment to the variables makes every clause true.
**Input.** Each problem is one text prompt: a fixed instruction line, then the formula in DIMACS CNF format, the line
`p cnf V C` followed by C clause lines, each three nonzero integers and a final `0` (k means variable k is true, -k
means it is false). The DEV prompts show the exact text. The formulas are SATLIB's uniform random 3-SAT sets:
`uf20-91` (V = 20, C = 91, satisfiable), `uf50-218` (V = 50, C = 218, satisfiable) and `uuf50-218` (V = 50, C = 218,
unsatisfiable). The prompt does not say which set a formula is from.
**Output.** `SAT` followed by one signed literal per variable in order (for example `SAT 1 -2 3 …`), or `UNSAT`. If
your network gives up (for example at its loop limit), it may answer `UNKNOWN`.
**Scoring:** per problem, verified (`tools/grader.py`).
- `UNSAT` is right only on an unsatisfiable formula.
- `SAT` with an assignment is right only if the formula is satisfiable and the assignment satisfies every clause. The
grader checks every clause; any satisfying assignment counts.
- Anything else, including `UNKNOWN` or nothing, scores 0 and is reported as no answer (a timeout).
- The TEST score is the fraction solved, reported per set, with wrong answers and timeouts counted separately.
**TEST** is 900 other formulas from each of the three sets (2,700 in all). You never see TEST. When you say you are
done, the orchestrator freezes your files and runs TEST on a GPU with the runner's `torch32` path.
## Data in your folder
- `dev/dev_satlib.jsonl`: 300 formulas, 100 from each set. Each line is `{"id", "set", "file", "n_vars",
"n_clauses", "label", "clauses", "prompt"}`, where `label` is SAT or UNSAT and `clauses` is the formula as lists of
integers.
You may analyse the DEV inputs and labels with any code you like, as often as you like. You may also make your own
formulas (for example random 3-SAT with a solver you write to label them); runs on them do not count.
## The frame (fixed; implemented in `runner/`, described in `runner/README.md`)
Inference is the generic loop: embed → the same block R times → readout.
- **Input.** The network reads exactly the prompt text, character for character. Nothing is removed, added or
reformatted.
- **Tokenizer.** You write it in `tokenizer.py` and declare it. It maps a text string to a sequence of tokens, each a
tuple of non-negative integer fields, each below the size of its embedding table.
- It must work unchanged on any text.
- It must know nothing about formulas, clauses, satisfiability or the question format.
- The auditor checks both.
- **Embedding.** The sum of one table per token field.
- **Block.** A fixed list of layers, the same in every loop. Each layer does
`h ← h + Σ_heads softmax(Q Kᵀ/√d_k + mask) V W_O`, then `h ← h + W2 ReLU(W1 h + b1) + b2`.
- The mask is none or causal, per head.
- There is no normalisation.
- The widths and the numbers of layers and heads are yours to choose.
- **Loops.** R comes from a rule you declare that depends only on the number of tokens n (see `runner/README.md`).
- **Readout.** A linear map at every position, then argmax over an output alphabet you declare: a list of strings,
one of which is the empty string.
- Each position writes one alphabet string, or nothing (the empty string).
- The answer is the written strings in position order.
- The harness passes that string to the grader unchanged, with nothing added. Your network must write everything
the grader needs.
- **Arithmetic.** The runner has these paths (`runner/README.md`): `numpy` (float64) and `numpy32` (float32) on this
machine; `torch32` and `torch64` on a GPU. DEV runs use `numpy` or `numpy32`, as you choose. TEST uses `torch32` (float32, fused attention, TF32
off). The written answer must be the same on `numpy` and `torch32`.
- **Compute limit.** At most 1 × 10¹⁴ FLOPs per prompt, counted by the runner from your shapes before it runs
(`runner/flops.py`). The runner refuses any prompt over the limit.
## Rules
1. No training, gradients or fitting weights to data. Every weight is written by your code.
2. Inference is the generic loop above, with no task logic in Python, the tokenizer or the readout. Python only
tokenizes, runs embed → block R times → readout, and joins the written strings. The tokenizer is generic and
declared.
3. **DEV budget: 20 runs.** A run is any evaluation of your network on official DEV problems, on any number of them.
- Running your network on anything built from a DEV problem (a part of one, an edited copy, its inputs or its
answer) also counts as a DEV run.
- Runs on inputs you make yourself do not count. Such inputs may reuse the prompt format, but no inputs or answer
from the DEV file.
- Run your network on DEV, or on inputs built from DEV, only through `tools/dev_run.py` (`--from-dev` for inputs
built from DEV), which counts each run in `ledger/`. Do not edit the ledger; the auditor checks it against your
transcript.
4. **No GPU runs.** This machine has no GPU, and this build has no GPU runs: every DEV run is on this machine.
5. **Time limit:** 12 hours of working time. Time paused by a usage limit doesn't count, and the orchestrator logs each
pause.
6. TEST is never shown to you. Do not look for it or for any other copy of SATLIB or these formulas.
7. **Isolation.**
- Work only inside this folder: do not read, list or look through anything outside it.
- No web or network access of any kind: no web queries, no page fetches, no `curl`, `wget`, `pip`, `ssh`, `git`
remotes, Hugging Face or GitHub.
- Some of this is blocked by your permissions. The rest is a rule, and your transcript is checked afterwards.
8. During the build you will receive only: "continue", how much DEV budget is left, and answers to questions about
these rules. Design questions get "that's your call."
9. If you find a problem with the rules, the data or the frame, stop and say so rather than working around it.
## Your folder
- `BRIEF.md`: this brief.
- `build.json`: this build's settings (compute cap, DEV budget, DEV file), read by the tools.
- `runner/`: the generic loop.
- `looped.py`: numpy float64 / float32; torch float32 / float64.
- `flops.py`: the compute counter.
- `README.md`: the network format and exactly what the runner computes.
- `dev/`: the DEV file.
- `tools/`:
- `grader.py`: the scoring above.
- `dev_run.py`: runs your network on chosen DEV problems or on your own inputs, scores them, and counts the run.
- `ledger/`: the record of counted runs, written by `tools/dev_run.py`.
- `work/`: yours.
Python 3.13 with numpy is installed.
## What to hand back (in `work/`)
1. A network folder: `network.json`, `weights.npz` and `tokenizer.py`, in the format of `runner/README.md`.
2. `write_weights.py`: the code that writes every weight, run as `python3 -I work/write_weights.py`.
3. `BUILD_NOTE.md`, short:
- what the network computes;
- parameters, total and nonzero;
- the R rule;
- the FLOPs per prompt;
- how many loops your search needs on the DEV formulas (for example from a simulator), and what the network
answers when a formula needs more than it has;
- DEV results and the runs used;
- anything that worried you.
Say "done" when you are done. If you run out of time or DEV budget without a working network, say so and hand back
what you have. That is a valid result.
## Your task
Write the weights of looped transformers that solve PlanBench's plan-generation task (task 1) in three domains:
Blocksworld, Mystery Blocksworld and Logistics. Give one network per domain; they may share code. Nothing is trained:
every weight is written by code you write.
**The problem.** Each prompt describes a planning domain in words: its actions and the rules for when each can be
taken and what it changes. Then it gives one solved example (an initial state, a goal and a plan) and a new
problem: an initial state and a goal. The network must write a plan, a sequence of actions that turns the initial
state into one where the goal holds. Any valid plan counts; it need not be the shortest.
- **Blocksworld:** stacks of colored blocks and a hand that picks up, puts down, stacks and unstacks one block at a
time.
- **Mystery Blocksworld:** the same problems, with every action and fact renamed to unrelated words (attack, feast,
succumb, overcome; province, planet, harmony, pain, craves).
- **Logistics:** packages moved between locations by trucks within a city and by airplanes between cities.
**Input.** Each problem is one text prompt, exactly as PlanBench gives it to a language model. It ends with `[PLAN]`.
The DEV prompts show the exact text.
**Output.** The plan, one action per line, worded as in the example plan of the prompt (for example `unstack the red
block from on top of the blue block`). You may end it with `[PLAN END]`.
**Scoring:** per problem, the plan is replayed (`tools/grader.py`).
- The text up to `[PLAN END]` (all of it if absent) is read one line per action. Case, spaces around a line and a
final period are ignored, and blank lines are skipped.
- Every line must be an action of the domain, in its wording. Starting from the initial state, each action's
conditions must hold when it is taken, and the goal must hold at the end. The rules are those of PlanBench's PDDL
domain files (`tools/domains.json`).
- The TEST score is the fraction of valid plans per domain. Plan length against the shortest plan is reported too.
**TEST** is 400 other Blocksworld problems, the same 400 in Mystery Blocksworld wording, and 200 other Logistics
problems, all from PlanBench task 1. You never see TEST. When you say you are done, the orchestrator freezes your
files and runs TEST on a GPU with the runner's `torch32` path.
## Data in your folder
- `dev/dev_planbench.jsonl`: 285 problems: 100 Blocksworld, the same 100 in Mystery Blocksworld wording, and 85
Logistics. Each line is `{"id", "domain", "instance_id", "prompt", "objects", "objects_nl", "init", "goal",
"gt_plan_len", "gt_plan"}`: the problem in PDDL form (objects, initial facts, goal facts), how each object is
named in the prompt, and PlanBench's reference plan with its length.
- `tools/domains.json`: the three domains' actions (parameters, conditions, effects) and their wording.
You may analyse the DEV problems with any code you like, as often as you like. You may also make your own problems
(for example with a planner you write); runs on them do not count.
## The frame (fixed; implemented in `runner/`, described in `runner/README.md`)
Inference is the generic loop: embed → the same block R times → readout.
- **Input.** The network reads exactly the prompt text, character for character. Nothing is removed, added or
reformatted.
- **Tokenizer.** You write it in `tokenizer.py` and declare it. It maps a text string to a sequence of tokens, each a
tuple of non-negative integer fields, each below the size of its embedding table.
- It must work unchanged on any text.
- It must know nothing about planning, these domains or the question format.
- The auditor checks both.
- **Embedding.** The sum of one table per token field.
- **Block.** A fixed list of layers, the same in every loop. Each layer does
`h ← h + Σ_heads softmax(Q Kᵀ/√d_k + mask) V W_O`, then `h ← h + W2 ReLU(W1 h + b1) + b2`.
- The mask is none or causal, per head.
- There is no normalisation.
- The widths and the numbers of layers and heads are yours to choose.
- **Loops.** R comes from a rule you declare that depends only on the number of tokens n (see `runner/README.md`).
- **Readout.** A linear map at every position, then argmax over an output alphabet you declare: a list of strings,
one of which is the empty string.
- Each position writes one alphabet string, or nothing (the empty string).
- The answer is the written strings in position order.
- The harness passes that string to the grader unchanged, with nothing added. Your network must write everything
the grader needs.
- **Arithmetic.** The runner has these paths (`runner/README.md`): `numpy` (float64) and `numpy32` (float32) on this
machine; `torch32` and `torch64` on a GPU. DEV runs use `numpy` or `numpy32`, as you choose. TEST uses `torch32` (float32, fused attention, TF32
off). The written answer must be the same on `numpy` and `torch32`.
- **Compute limit.** At most 1 × 10¹⁴ FLOPs per prompt, counted by the runner from your shapes before it runs
(`runner/flops.py`). The runner refuses any prompt over the limit.
## Rules
1. No training, gradients or fitting weights to data. Every weight is written by your code.
2. Inference is the generic loop above, with no task logic in Python, the tokenizer or the readout. Python only
tokenizes, runs embed → block R times → readout, and joins the written strings. The tokenizer is generic and
declared.
3. **DEV budget: 60 runs, at most 20 per domain.** A run is any evaluation of your network on official DEV problems, on any number of them.
- Running your network on anything built from a DEV problem (a part of one, an edited copy, its inputs or its
answer) also counts as a DEV run.
- Runs on inputs you make yourself do not count. Such inputs may reuse the prompt format, but no inputs or answer
from the DEV file.
- Run your network on DEV, or on inputs built from DEV, only through `tools/dev_run.py` (`--from-dev` for inputs
built from DEV), which counts each run in `ledger/`. Do not edit the ledger; the auditor checks it against your
transcript.
4. **No GPU runs.** This machine has no GPU, and this build has no GPU runs: every DEV run is on this machine.
5. **Time limit:** 12 hours of working time. Time paused by a usage limit doesn't count, and the orchestrator logs each
pause.
6. TEST is never shown to you. Do not look for it or for any other copy of PlanBench or its problems.
7. **Isolation.**
- Work only inside this folder: do not read, list or look through anything outside it.
- No web or network access of any kind: no web queries, no page fetches, no `curl`, `wget`, `pip`, `ssh`, `git`
remotes, Hugging Face or GitHub.
- Some of this is blocked by your permissions. The rest is a rule, and your transcript is checked afterwards.
8. During the build you will receive only: "continue", how much DEV budget is left, and answers to questions about
these rules. Design questions get "that's your call."
9. If you find a problem with the rules, the data or the frame, stop and say so rather than working around it.
## Your folder
- `BRIEF.md`: this brief.
- `build.json`: this build's settings (compute cap, DEV budget, DEV file), read by the tools.
- `runner/`: the generic loop.
- `looped.py`: numpy float64 / float32; torch float32 / float64.
- `flops.py`: the compute counter.
- `README.md`: the network format and exactly what the runner computes.
- `dev/`: the DEV file.
- `tools/`:
- `grader.py`: the scoring above.
- `dev_run.py`: runs your network on chosen DEV problems or on your own inputs, scores them, and counts the run.
- `ledger/`: the record of counted runs, written by `tools/dev_run.py`.
- `work/`: yours.
Python 3.13 with numpy is installed.
## What to hand back (in `work/`)
1. One network folder per domain (`work/net_blocksworld/`, `work/net_mystery_blocksworld/`,
`work/net_logistics/`): `network.json`, `weights.npz` and `tokenizer.py`, in the format of `runner/README.md`.
2. `write_weights.py`: the code that writes every weight, run as `python3 -I work/write_weights.py`.
3. `BUILD_NOTE.md`, short:
- what the network computes;
- parameters, total and nonzero;
- the R rule;
- the FLOPs per prompt;
- the plan lengths against the reference plans on DEV;
- DEV results and the runs used;
- anything that worried you.
Say "done" when you are done. If you run out of time or DEV budget without a working network, say so and hand back
what you have. That is a valid result.
Claude solving mazes directly (section 3). The first prompt comes from the LDT paper, and the first bar of Figure 10 is the paper's published result for it. Each of the next four changes one thing, in the order section 3 lists them. The last one sends the "told how to search" prompt to Claude inside Claude Code, with no tools.
[Shareable version: the prompt and settings as sent, one maze per call. The worked copy with a real test maze filled in is removed; the maze goes where the template says.]
Run 1: the paper's prompt
=========================
[SETTINGS]
model: claude-opus-5-5
API: Anthropic Messages API, streaming
max_tokens: 100000
thinking: {"type": "adaptive", "display": "summarized"}
output_config: {"effort": "high"}
tools: none; no temperature/top_p; no fallbacks; no prompt caching
time cap: one hour per call (wall clock); each maze sampled once
[SYSTEM PROMPT]
You are a maze solver. You will be given a 30 x 30 maze. Every cell of the maze is exactly one of the following four characters:
'#' - wall (impassable)
' ' - free cell
'S' - the start cell (exactly one)
'G' - the goal cell (exactly one)
Find a path of orthogonally adjacent (up/down/left/right) free cells that connects S to G without passing through any wall. Diagonal moves are not allowed. Mark every free cell that lies on the path with the character o. The cells #, S, and G are unchanged, and free cells that are not on the path remain ' '. Respond with ONLY the completed 30 x 30 grid: exactly 30 lines, each containing exactly 30 characters drawn from the set {#, ' ', S, G, o}. Do not include row numbers, column markers, blank lines, code fences, prose, or any other text. Whitespace inside each row is significant: a leading or trailing space is itself a free cell, not formatting. Example response format (shown for a 6 x 6 maze for brevity; your output must be 30 rows of 30 characters):
######
#Sooo#
# #o#
# #o#
## ooG
######
[END SYSTEM PROMPT]
[USER MESSAGE TEMPLATE]
Solve this maze:
<the 30 x 30 maze: 30 lines of 30 characters from '#', ' ', 'S', 'G', joined by newlines>
[END USER MESSAGE TEMPLATE]
[Shareable version: the prompt and settings as sent, one maze per call. The worked copy with a real test maze filled in is removed; the maze goes where the template says.]
Run 2: + a plain description of breadth-first search
====================================================
[SETTINGS]
model: claude-opus-5-5
API: Anthropic Messages API, streaming
max_tokens: 100000
thinking: {"type": "adaptive", "display": "summarized"}
output_config: {"effort": "high"}
tools: none; no temperature/top_p; no fallbacks; no prompt caching
time cap: one hour per call (wall clock); each maze sampled once
[SYSTEM PROMPT]
You are a maze solver. You will be given a 30 x 30 maze. Every cell of the maze is exactly one of the following four characters:
'#' - wall (impassable)
' ' - free cell
'S' - the start cell (exactly one)
'G' - the goal cell (exactly one)
Find a path of orthogonally adjacent (up/down/left/right) free cells that connects S to G without passing through any wall. Diagonal moves are not allowed. Mark every free cell that lies on the path with the character o. The cells #, S, and G are unchanged, and free cells that are not on the path remain ' '. Respond with ONLY the completed 30 x 30 grid: exactly 30 lines, each containing exactly 30 characters drawn from the set {#, ' ', S, G, o}. Do not include row numbers, column markers, blank lines, code fences, prose, or any other text. Whitespace inside each row is significant: a leading or trailing space is itself a free cell, not formatting. Example response format (shown for a 6 x 6 maze for brevity; your output must be 30 rows of 30 characters):
######
#Sooo#
# #o#
# #o#
## ooG
######
[END SYSTEM PROMPT]
[USER MESSAGE TEMPLATE]
Solve this maze:
<the 30 x 30 maze: 30 lines of 30 characters from '#', ' ', 'S', 'G', joined by newlines>
Method: use breadth-first search. Start at G and spread out one step at a time. The free cells next to G are 1 step away. The free cells next to those that you have not reached yet are 2 steps away. Keep going, one step at a time, until you reach S. Then walk the path from S to G: from S, step to a neighbouring cell that is one step closer to G, and repeat until you reach G. The cells you pass through form a shortest path.
[END USER MESSAGE TEMPLATE]
[Shareable version: the prompt and settings as sent, one maze per call. The worked copy with a real test maze filled in is removed; the maze goes where the template says.]
Run 3: one cell per token (cells separated by spaces, free cell '.')
====================================================================
[SETTINGS]
model: claude-opus-5-5
API: Anthropic Messages API, streaming
max_tokens: 100000
thinking: {"type": "adaptive", "display": "summarized"}
output_config: {"effort": "high"}
tools: none; no temperature/top_p; no fallbacks; no prompt caching
time cap: one hour per call (wall clock); each maze sampled once
[SYSTEM PROMPT]
You are a maze solver. You will be given a 30 x 30 maze, one row per line, with the cells of each row separated by single spaces. Every cell of the maze is exactly one of the following four characters:
'#' - wall (impassable)
'.' - free cell
'S' - the start cell (exactly one)
'G' - the goal cell (exactly one)
Find a path of orthogonally adjacent (up/down/left/right) free cells that connects S to G without passing through any wall. Diagonal moves are not allowed. Mark every free cell that lies on the path with the character o. The cells #, S, and G are unchanged, and free cells that are not on the path remain '.'. Respond with ONLY the completed 30 x 30 grid in the same format: exactly 30 lines, each containing exactly 30 cells drawn from the set {#, ., S, G, o}, separated by single spaces. Do not include row numbers, column markers, blank lines, code fences, prose, or any other text. Example response format (shown for a 6 x 6 maze for brevity; your output must be 30 rows of 30 cells):
# # # # # #
# S o o o #
# . . # o #
# . . # o #
# # . o o G
# # # # # #
[END SYSTEM PROMPT]
[USER MESSAGE TEMPLATE]
Solve this maze:
<the maze: 30 lines; each line is the row's 30 cells separated by single spaces, with '#', '.', 'S', 'G'>
Method: use breadth-first search. Start at G and spread out one step at a time. The free cells next to G are 1 step away. The free cells next to those that you have not reached yet are 2 steps away. Keep going, one step at a time, until you reach S. Then walk the path from S to G: from S, step to a neighbouring cell that is one step closer to G, and repeat until you reach G. The cells you pass through form a shortest path.
[END USER MESSAGE TEMPLATE]
[Shareable version: the prompt and settings as sent, one maze per call. The worked copy with a real test maze filled in is removed; the maze goes where the template says.]
Run 5: path-only answer (grid in, list of coordinates out)
==========================================================
[SETTINGS]
model: claude-opus-5-5
API: Anthropic Messages API, streaming
max_tokens: 100000
thinking: {"type": "adaptive", "display": "summarized"}
output_config: {"effort": "high"}
tools: none; no temperature/top_p; no fallbacks; no prompt caching
time cap: one hour per call (wall clock); each maze sampled once
[SYSTEM PROMPT]
You are a maze solver. You will be given a 30 x 30 maze. Every cell of the maze is exactly one of the following four characters:
'#' - wall (impassable)
' ' - free cell
'S' - the start cell (exactly one)
'G' - the goal cell (exactly one)
The maze is given as exactly 30 lines of exactly 30 characters. Whitespace inside each row is significant: a leading or trailing space is itself a free cell, not formatting. Rows are numbered 0 to 29 from top to bottom and columns 0 to 29 from left to right; a cell is written (row, column).
Find a path of orthogonally adjacent (up/down/left/right) free cells that connects S to G without passing through any wall. Diagonal moves are not allowed. Respond with ONLY the path as a list of the (row, column) coordinates of the cells it visits, in order from S to G, including S and G, in the form [(r, c), (r, c), ...]. Do not include prose, code fences, or any other text. Example response format (a path of 8 cells in a 6 x 6 maze; your path must go from S to G of your maze): [(1, 1), (1, 2), (1, 3), (1, 4), (2, 4), (3, 4), (4, 4), (4, 5)]
[END SYSTEM PROMPT]
[USER MESSAGE TEMPLATE]
Solve this maze:
<the 30 x 30 maze: 30 lines of 30 characters from '#', ' ', 'S', 'G', joined by newlines>
Method: use breadth-first search. Start at G and spread out one step at a time. The free cells next to G are 1 step away. The free cells next to those that you have not reached yet are 2 steps away. Keep going, one step at a time, until you reach S. Then walk the path from S to G: from S, step to a neighbouring cell that is one step closer to G, and repeat until you reach G. The cells you pass through form a shortest path.
[END USER MESSAGE TEMPLATE]
[Shareable version: the prompt and settings as sent, one maze per call. The worked copy with a real test maze filled in is removed; the maze goes where the template says.]
Run 4: no grid (list of free cells; answer = list of coordinates)
=================================================================
[SETTINGS]
model: claude-opus-5-5
API: Anthropic Messages API, streaming
max_tokens: 100000
thinking: {"type": "adaptive", "display": "summarized"}
output_config: {"effort": "high"}
tools: none; no temperature/top_p; no fallbacks; no prompt caching
time cap: one hour per call (wall clock); each maze sampled once
[SYSTEM PROMPT]
You are a maze solver. You will be given a 30 x 30 maze as the list of its free cells. Rows are numbered 0 to 29 from top to bottom and columns 0 to 29 from left to right; a cell is written (row, column). Every cell that is not in the list is a wall (impassable). You will also be given the start cell S and the goal cell G, which are free cells.
Find a path of orthogonally adjacent (up/down/left/right) free cells that connects S to G without passing through any wall. Diagonal moves are not allowed. Respond with ONLY the path as a list of the (row, column) coordinates of the cells it visits, in order from S to G, including S and G, in the form [(r, c), (r, c), ...]. Do not include prose, code fences, or any other text. Example response format (a path of 8 cells in a 6 x 6 maze; your path must go from S to G of your maze): [(1, 1), (1, 2), (1, 3), (1, 4), (2, 4), (3, 4), (4, 4), (4, 5)]
[END SYSTEM PROMPT]
[USER MESSAGE TEMPLATE]
Solve this maze:
Start S: (<row>, <column>)
Goal G: (<row>, <column>)
Free cells:
<the free cells (S and G included) as (row, column), row-major, ", " between cells, one line per maze row that has free cells>
Method: use breadth-first search. Start at G and spread out one step at a time. The free cells next to G are 1 step away. The free cells next to those that you have not reached yet are 2 steps away. Keep going, one step at a time, until you reach S. Then walk the path from S to G: from S, step to a neighbouring cell that is one step closer to G, and repeat until you reach G. The cells you pass through form a shortest path.
[END USER MESSAGE TEMPLATE]
Claude on its own, answering inside Claude Code
===============================================
[PURPOSE]
The same task and prompt as run 2 (told how to search), on the same 50 mazes, one try each. Only the harness changes:
Claude answers inside Claude Code instead of the raw API, as a plain message, with every tool switched off.
[SETTINGS]
harness: Claude Code CLI 2.1.327, headless (claude -p), one fresh process per maze, started in an empty folder
model: claude-opus-5-5
effort: high (--effort high)
tools: none at all, so no code can run (no Bash, no Python, no file writes):
--tools "" no built-in tools
--strict-mcp-config no MCP servers (with no --mcp-config given)
--disable-slash-commands no skills or commands
checked per maze from the stream-json init event: the tools list and MCP servers must be empty, and the answer
must contain no tool use; a maze that fails this check is not scored
system prompt: Claude Code's own, with the run-2 system prompt below appended (--append-system-prompt); replacing it
would remove the harness this check is about
sessions: not saved (--no-session-persistence); output as stream-json with --verbose (init event, tokens and cost)
each maze sampled once; scored by the same scorer as runs 1-5 (shortest path, and any valid path)
[APPENDED SYSTEM PROMPT, same as run 2]
You are a maze solver. You will be given a 30 x 30 maze. Every cell of the maze is exactly one of the following four characters:
'#' - wall (impassable)
' ' - free cell
'S' - the start cell (exactly one)
'G' - the goal cell (exactly one)
Find a path of orthogonally adjacent (up/down/left/right) free cells that connects S to G without passing through any wall. Diagonal moves are not allowed. Mark every free cell that lies on the path with the character o. The cells #, S, and G are unchanged, and free cells that are not on the path remain ' '. Respond with ONLY the completed 30 x 30 grid: exactly 30 lines, each containing exactly 30 characters drawn from the set {#, ' ', S, G, o}. Do not include row numbers, column markers, blank lines, code fences, prose, or any other text. Whitespace inside each row is significant: a leading or trailing space is itself a free cell, not formatting. Example response format (shown for a 6 x 6 maze for brevity; your output must be 30 rows of 30 characters):
######
#Sooo#
# #o#
# #o#
## ooG
######
[END APPENDED SYSTEM PROMPT]
[USER MESSAGE TEMPLATE, same as run 2]
Solve this maze:
<the 30 x 30 maze: 30 lines of 30 characters from '#', ' ', 'S', 'G', joined by newlines>
Method: use breadth-first search. Start at G and spread out one step at a time. The free cells next to G are 1 step away. The free cells next to those that you have not reached yet are 2 steps away. Keep going, one step at a time, until you reach S. Then walk the path from S to G: from S, step to a neighbouring cell that is one step closer to G, and repeat until you reach G. The cells you pass through form a shortest path.
[END USER MESSAGE TEMPLATE]
Claude on its own on the three new benchmarks (Figure 19). Claude Opus 5.5 answered 50 test items per task inside Claude Code, with no tools and reasoning effort set to high. These are its settings and answer instructions.
New benchmarks: Claude on its own (CLRS-Text, PlanBench, SATLIB)
================================================================
[PURPOSE]
The comparison for the written transformers on the new benchmarks: Claude answers the same TEST prompts itself, as a
plain message, with no tools. 50 TEST items per group, drawn at random (fixed seed) from the items the networks ran:
CLRS-Text strongly_connected_components, mst_prim and lcs_length (all five test splits together); PlanBench task 1
Blocksworld, Mystery Blocksworld and Logistics; SATLIB uf20-91, uf50-218 and uuf50-218. 450 items, one try each.
[SETTINGS] (the same harness as 10_maze_claude_code_check.txt)
harness: Claude Code CLI, headless (claude -p), one fresh process per item, started in an empty folder
model: claude-opus-5-5
effort: high (--effort high)
tools: none at all (--tools "", --strict-mcp-config with no MCP config, --disable-slash-commands); checked per item
from the stream-json init event (tools and MCP servers empty) and the stream (no tool use); an item that fails this
check is not scored
system prompt: Claude Code's own, with the text below appended (--append-system-prompt)
sessions: not saved (--no-session-persistence); output as stream-json with --verbose
time cap: one hour per item; a capped item counts as no answer
retries: only for infrastructure failures (no reply produced), each in a new empty folder, and logged
[APPENDED SYSTEM PROMPT]
You are answering one problem on your own. You have no tools: work it out yourself, then give your answer in the format the message asks for.
[END APPENDED SYSTEM PROMPT]
[USER MESSAGE TEMPLATE]
<the item's prompt, exactly as the network received it>
<the answer instruction for its benchmark, below>
[END USER MESSAGE TEMPLATE]
[ANSWER INSTRUCTION, CLRS-Text; <name> is scc_id, pi or b]
Give the final output `<name>` in the dataset's format, for example `[0 1 2 0 1]`. End your reply with `ANSWER:` followed by the final output alone, in plain text.
[END]
[ANSWER INSTRUCTION, PlanBench]
Write the plan, one action per line, worded as in the example plan, and end it with `[PLAN END]`. End your reply with `ANSWER:` followed by the plan alone, in plain text.
[END]
[ANSWER INSTRUCTION, SATLIB]
End your reply with `ANSWER:` followed by your answer alone, in plain text: `SAT` and one signed literal per variable in order, or `UNSAT`.
[END]
[SCORING]
The answer is the text of Claude's final reply after its last `ANSWER:` (the whole reply if there is none), with one
surrounding pair of backticks removed. It is graded by the same grader as the network's TEST answer on that item:
- CLRS-Text: the final output must equal the dataset's exactly;
- PlanBench: the plan is replayed under PlanBench's PDDL rules and must reach the goal; plan length is reported;
- SATLIB: a satisfying assignment is checked against every clause; UNSAT is right only on an unsatisfiable formula
(Claude is not asked for a proof, so on uuf50-218 a bare UNSAT counts as right, as it does for the network).
Reported per group: solved, wrong, no answer, Wilson 95% intervals, the network on the same 50 items, and the paired
exact McNemar test; also output tokens and Claude Code's cost estimate.
Reading the maze transformer from its weights (section 6). Three fresh Claude Code sessions received only the maze transformer's weights and a bare description of its architecture. A separate prompt then evaluated their reports.
[The blind reading of the maze transformer. The three reader sessions each got the first message below, in a folder holding only weights.npz, weights.txt and ARCH.md (below). The scorer got the scorer prompt with the ground truth, the rubric and one answer filled in.]
=== FIRST MESSAGE TO EACH READER ===
Your folder holds the weights of a small neural network (`weights.npz`, and the same numbers as text in
`weights.txt`) and a description of its architecture (`ARCH.md`). There is nothing else.
What does this network compute? What does each of the 35 numbers per token stand for, and what does each head do?
- Work it out from the weights. You may write and run any code you like in this folder (Python 3 with numpy is
installed), including running the network on inputs you make.
- Work only inside this folder: do not read, list or look through anything outside it. No web or network access of
any kind.
- Time limit: 3 hours of working time.
- During the session you will receive only "continue".
- Write your answer in `ANSWER.md`, then say "done".
=== ARCH.md (in the reader's folder) ===
# A looped network
- **Input:** a sequence of n tokens. Each token is three integers (a, b, c), with 0 ≤ a < 128, 0 ≤ b < 128 and
0 ≤ c < 5.
- **State:** h, an n × 35 array (35 numbers per token). At the start, row i is E0[a_i] + E1[b_i] + E2[c_i].
- **One block**, applied R = 2n times with the same weights:
- Attention, 4 heads of width 8. Head k uses columns 8k to 8k + 7 of Wq, Wk and Wv, and rows 8k to 8k + 7 of Wo.
- Q = h Wq, K = h Wk, V = h Wv.
- A_k = softmax over j of Q_k K_kᵀ / √8. There is no mask: every token can attend to every token. Subtract each
row's maximum before taking exp, because scores can be very large.
- h ← h + Σ_k A_k V_k Wo_k.
- MLP: h ← h + relu(h W1 + b1) W2 + b2, with 86 hidden units.
- No normalisation.
- **Output:** at every token, logits = h Wout + bout (5 numbers). The output at that token is the argmax, a symbol
from 0 to 4.
## Files
- `weights.npz`: the arrays above (numpy), under the names used here.
- `weights.txt`: the same numbers as text, one array after another.
=== SCORER PROMPT ===
You are scoring an answer against a rubric. Below are three parts: the ground truth (the design note of a small
neural network), the rubric, and the answer written by someone who saw only the network's weights and its bare
architecture.
For each of the 11 rubric items, give 1 if the answer states it, in any words, and 0 if it does not. Follow the
rubric's rules: names may differ, and an item stated and then contradicted elsewhere in the answer scores 0. Judge
only what the answer says. Do not credit what it could have meant.
Reply with JSON only, a list of 11 objects: {"item": <1-11>, "score": <0 or 1>, "evidence": "<the sentence of the
answer that supports the score, copied exactly, or empty>"}.
=== GROUND TRUTH ===
{GROUND_TRUTH}
=== RUBRIC ===
{RUBRIC}
=== ANSWER ===
{ANSWER}
BThe limits of each transformer
A written transformer gives the right answer at a given size when three conditions hold. First, its tables must be large enough. The maze transformer reads grids of up to 128 × 128 cells, the parity transformer strings of up to 4,095 bits and the graph search transformer node numbers up to 63. Second, its loop rule must give enough loops. The maze transformer runs twice as many loops as the maze has cells, more than any path needs. Third, its arithmetic must be precise enough. Each attention head prefers its target by a wide margin, so almost no attention goes to other positions, and after every loop each value is snapped back to a clean 0 or 1, so small errors cannot add up.
Within these limits, correctness follows by induction over loops. If every value is right before a loop, the loop computes the algorithm's next step, so after enough loops the transformer holds the algorithm's final answer, and further loops leave it unchanged. Larger inputs only need larger tables, which the same formulas write, while the looped block stays the same.
The other transformers have limits of their own, given in their sections. The Sudoku transformer has room for 24 saved grids and runs 40,000 loops (appendix E). The Tower of Hanoi transformer needs 64-bit arithmetic and handles at most 20 disks (appendix F). The GraphWalks and BIG-Bench transformers read only the prompt format they were built for (appendices F and G).
CGraph search, parity and reasoning chains in full
These are the full results behind section 4. In each task, the trained models learned from the checking range and were then tested on larger inputs.
| Model | Weights | Checking range | Test, paths 8–16 | Test, "unreachable" |
|---|---|---|---|---|
| Hand-written (looped) | 6,966 | 100 | 100 | 100 |
| Trained, looped | 26,561 | 25.6 | 0 | 98.3 |
| Trained, ~10× the hand-written size | 69,905 | 46.2 | 0 | 76.7 |
| Trained, ~99× the hand-written size | 690,197 | 97.4 | 0 | 98.3 |
Table 2. Graph search in full. Accuracy in %. The trained models were trained on the checking range, with their settings tuned and their best version kept, and each test ran once. The two smaller trained models do not learn even the checking range well. No single clue in the input gives the answer away, since none beats guessing the most common answer by more than 1 point.
How the parity and chains transformers work. The parity transformer keeps a running answer, odd or even so far, at every position, and on each loop every position updates its answer from the one before it. The chains transformer works the same way along a chain. Each statement looks up the statement that defines the variable it depends on, so one more link gets its value on each loop.
| Model | Weights | Checking range (≤ 20 bits) | Test (21–128 bits) |
|---|---|---|---|
| Hand-written (looped) | ~190 + table | 100 | 100 |
| Trained, looped | 50,434 | 100 | 53.8 |
| Trained, 1 block | 50,434 | 100 | 52.6 |
| Trained, 4 blocks | 13,234 | 100 | 49.2 |
| Trained, 8 blocks | 101,858 | 100 | 49.5 |
| Trained, 12 blocks | 600,258 | 100 | 45.5 |
Table 3. Parity in full. Accuracy in %, where chance is 50%. Only two trained models still reach 99% at 21 bits, and none does at longer lengths. The written transformer's looped part has about 190 weights, plus a table of positions that grows with the input (24,766 entries at 4,096 positions).
| Model | Weights | Checking range (≤ 8 steps) | Test (12–32 steps) |
|---|---|---|---|
| Hand-written (looped) | 4,763 | 100 | 100 |
| Trained, looped | 77,924 | 69.1 | 2.2 – 9.2 |
| Trained, 1 block | 77,924 | 7.0 | 2.8 |
| Trained, 4 blocks | 51,368 | 43.4 | 2.8 |
| Trained, 8 blocks (~90× the hand-written size) | 427,812 | 93.7 | 3.5 |
| Trained, 12 blocks | 627,748 | 49.6 | 4.0 |
Table 4. Reasoning chains in full. Accuracy in %. Each trained model had up to 60 minutes of GPU time, and several did not fully learn the checking range. The cleanest comparison is therefore the 8-block model, which reaches 93.7% on the checking range and 3.5% beyond it.
DSudoku-Extreme in full
The Sudoku transformer solved every test puzzle we ran, 141,040 in all, and Table 5 compares it with trained models and LLMs on the first 10,000.
| Model and training | First 50 | First 10,000 |
|---|---|---|
| Hand-written (17,014 weights) No gradient training | 100 | 100 |
| Sotaku v2 (800K weights) Trained on 2.7M puzzles | – | 98.96 |
| TRM (5M weights) Trained on 1K puzzles, plus rearranged copies | – | 79.5 |
| HRM (27M weights) Trained on 1K puzzles, plus rearranged copies | – | 55.4 |
| GPT-6 Astra No Sudoku training | 68 | – |
| Claude Opus 5.5 No Sudoku training | 54 | – |
| GPT-6.1 Sol No Sudoku training | 44 | – |
Table 5. Sudoku-Extreme results. Accuracy in %. A puzzle counts as solved when the answer matches its one solution, and a dash means not run. Trained scores are from Davis et al. (NeurIPS 2026), Table 1, which evaluates the released HRM, TRM and Sotaku v2 models on the first 10,000 puzzles. Sotaku v2 (Lou, 2026) is a small recurrent transformer built for Sudoku. LLM scores are from their Table 25, run in October 2026 with no worked examples, reasoning effort set to high and up to 100,000 output tokens. In the LDT paper's April 2026 tests, Claude Opus 4.6, DeepSeek V4-Pro and GPT-5.4 solved none of the test puzzles.
The transformer reads the puzzle as text, one character per token, and writes back the solved grid as one line of 81 digits rather than nine rows, which counts the same because the evaluation ignores line breaks. It does 21.7 trillion operations per puzzle, against 0.22 trillion for HRM, 0.41 trillion for TRM and 4.6 trillion for LDT's 15 models, counted as in Davis et al.
Within each column, every model is evaluated on the same puzzles, taken in the fixed test-set order that the LDT code sets. The first 31,104 puzzles we ran form an unbroken run from the start of the test set, and we stopped after 141,040 puzzles to free the GPUs, by which point none had failed. LDT is not in the table, because its paper reports only the full test set, which we did not run in full, and we compare only on puzzles both sides ran. Before the test, the transformer ran once on 92 training puzzles and solved all of them.
Its limits would show only on a puzzle that reached them. On the test puzzles, it used at most 16 of its 24 saved grids and 14,904 of its 40,000 loops. Stopped early on training puzzles, it wrote a full grid with wrong digits, so a puzzle that needed more than 40,000 loops would get a plausible but wrong answer. Rebuilt with room for only 4 or 8 saved grids, it wrote a 1 in every cell for each puzzle that needed more, a plainly wrong answer, while the puzzles that fit were still solved.
ETower of Hanoi and Checker Jumping in full
Tower of Hanoi. The puzzle needs no search, since each move follows from a simple rule, so it tests long, error-free execution. Part of the debate around the Apple paper, The Illusion of Thinking, was whether the models' collapse on larger puzzles came from output limits. The authors replied that the first errors appear early, around move 40 at 8 disks. Newer models still fail early. In 2026 tests, o4-mini failed from 6 disks, while Qwen3-235B-Thinking fell to about 52% at 7 disks and 20% at 8 (Pushkin and Abbe, 2026, read from a plot).
LLMs do finish the puzzle with outside help. With code execution, reasoning models solved every size they were tested on, up to 13 disks [14]. MAKER [15] solved 20 disks by asking an LLM for every move at least three times and voting on the answer, which took over 3 million LLM calls. The Hanoi transformer makes all 1,048,575 moves for 20 disks with one small block, without tools, votes or second attempts.
Extra loops do not change its answer, since running its block 4 or 8 times per move instead of 2 produces the same moves. It only moves the stack from the first peg to the third, and from any other starting position it does not finish. It needs 64-bit numbers, because with 32-bit numbers rounding errors could pile up over a million moves. Its context window, the number of tokens it can read, is sized so that 20 disks is the most it can handle.
Checker Jumping. This is the second puzzle in the Apple study. Red and blue checkers sit in a row with one gap and must swap sides. They move only forward, either sliding into the gap or jumping a single checker of the other color. In the paper's tests, Claude 3.7 Sonnet Thinking and DeepSeek-R1 failed from about 3 checkers per side, while o3-mini on its high setting held about 50% or better up to 8 per side (read from the paper's figures). In 2026 tests, GPT-5.2 at low effort fell below 20% from 9 per side and to about zero by 11 (Pushkin and Abbe, 2026, read from a plot).
The Checker Jumping transformer works like the Hanoi transformer. Its attention reads the board and every move so far, its block computes the next move, and it stops when no move is left. It has 11,062 weights and is built for boards of up to 40 checkers per side, well beyond the Apple paper's largest size of 15. Claude checked it only on boards of up to 3 per side, yet it solves every size from 4 to 40 per side in the fewest possible moves, 1,680 of them at 40 per side.
FGraphWalks in full
The GraphWalks transformer is two blocks looped 400 times, with no gradient training. The first block has one attention head and 811 neurons and the second has 12 neurons, and 400 loops are enough for any number of steps N up to 397.
| Model | F1 (%) |
|---|---|
| Hand-written (7,777 weights) | 100.0 |
| Gemini 4 Carbon | 96.2 |
| Gemini 4 Argon | 84.2 |
| GPT-6 Astra | 71.8 |
| Claude Opus 5.5 | 66.8 |
| Claude Fable 5.1 | 65.0 |
Table 6. GraphWalks results. F1, the standard GraphWalks score, compares the nodes in each answer with the true ones and is averaged over the 200 problems, each run once. LLM scores are Google's runs, from its Gemini 4 Carbon announcement (28 October 2026).
GBIG-Bench Hard and Extra Hard in full
All four transformers read only the wording they were built for. It comes from the public example questions, the benchmark papers' task descriptions and a few everyday words such as "swaps" and "trades". The test questions sat on the same machine while the transformers were being written, and the session records show they were not opened.
BIG-Bench Hard. To check that these transformers follow the rule rather than anything taken from the test set, we also ran them on 300 freshly generated questions per task, where they again reached 100%.
| Model | Weights | Boolean Expressions | Dyck Languages |
|---|---|---|---|
| Hand-written (one transformer per task) | 6,756 / 8,491 | 100.0 | 100.0 |
| SmolLM2-360M | 361.8M | 69.6 | 23.6 |
| SmolLM2-135M | 134.5M | 66.8 | 19.2 |
| Pythia-410M | 405.3M | 52.0 | 33.2 |
| Pythia-160M | 162.3M | 50.4 | 22.4 |
Table 7. BIG-Bench Hard results. Accuracy in %. For every model, an answer counts only if it matches the reference answer, ignoring spaces. Chance on Boolean Expressions is 50%. The Boolean transformer also has a fixed table of 2,048 positions, which lets it read inputs of up to about 2,048 characters, and its looped part is two blocks with 89 neurons.
BIG-Bench Extra Hard. Our transformers answered 180 of 180 questions on each task, which a separate check confirmed by running both again. The 20 public example questions per task are not counted.
| Model | Method | Reported | Web of Lies | Shuffled Objects |
|---|---|---|---|---|
| Hand-written | One transformer per task | Nov 2026 | 100.0 | 100.0 |
| Qwen3-235B-A22B | Plain reasoning | Oct 2025 | 81.2 | 14.4 |
| Qwen3-235B-A22B | Program synthesis | Oct 2025 | 81.2 | 56.9 |
| o4-mini | Plain reasoning | Oct 2025 | 38.8 | 8.1 |
| o4-mini | Program synthesis | Oct 2025 | 52.5 | 34.4 |
| o3-mini (high) | Plain reasoning | Feb 2025 | 43.0 | 49.5 |
| DeepSeek-R1 | Plain reasoning | Feb 2025 | 29.5 | 6.0 |
| GPT-4o | Plain reasoning | Feb 2025 | 14.5 | 14.0 |
| Random guess | Chance | Feb 2025 | 5.5 | 14.3 |
Table 8. BIG-Bench Extra Hard results. Accuracy in %. "Plain reasoning" means the model reasons in text, and "program synthesis" means it writes a program that is then run. The Feb 2025 rows come from the BBEH paper (Kazemi et al.), on all 200 questions per task, and the Oct 2025 rows from Stein et al. (Tables C.2 and C.5), on a random 80% of each task's questions. The question sets differ, so compare the scores loosely.
Because the test questions are public, we also generated 40 new problems per task with a fresh seed, from generators written from the task descriptions in the BBEH paper. Both transformers solved all 40. Rewriting these problems while keeping the same underlying problem and answer shows what each transformer depends on (Table 9). Neither cares about new names. The Web of Lies transformer also handles reordered statements, but with one sentence per line or new wording it can no longer read the statements and answers "unknown". The Shuffled Objects transformer handles new layouts and new wording, but it picks an option by its place in the starting list, so reordering that list breaks it. An LLM would likely handle these changes, though we did not test this.
| Version of the 40 new problems | Web of Lies | Shuffled Objects |
|---|---|---|
| As generated | 40 | 40 |
| New names for every person | 40 | 40 |
| The statements, or the starting list, in a new order | 40 | 6 |
| One sentence per line | 5 | 40 |
| The same statements in other words | 5 | 40 |
Table 9. Format changes, same problems. Problems solved out of 40 per task. Each rewrite keeps the problem and its answer. The 5 Web of Lies problems counted as solved under the last two changes are the ones whose answer is "unknown".
The Extra Hard transformers read BBEH's fixed question templates, and none of the extra everyday words they know appear in the test questions. The Shuffled Objects transformer assumes the options are listed in the order the objects were first handed out, as in every public example. Both transformers need 64-bit numbers and a high-precision version of softmax, the step that turns attention scores into weights. With the standard library version, Web of Lies drops to 139 of 180. Web of Lies has 44,550 weights and Shuffled Objects 40,316.
HWritten transformers as test cases for interpretability
Knowing what every number means also makes the written transformers useful to interpretability research. Tracr compiles programs into transformers as a laboratory for testing interpretability methods on models whose algorithm is known [16]. InterpBench later trained such models to score methods that search for circuits [17]. The transformers in this post add looped models that solve hard benchmarks, with a known meaning for every number at every loop. A method that claims to find the algorithm inside a looped model can be checked against them, since the right answer is already written down.
IRelated work
Writing weights. Weight-Space Programming named the idea and showed LLMs reading and editing a model's weights directly. AdderBoard showed coding agents hand-setting the weights of tiny transformers. At the same time, Singh had Claude set every weight of small transformers for ten algorithmic tasks, including parity. Chaubard compares weight-space programming with ordinary training on small algorithmic tasks. Earlier, LLMs wrote programs that a compiler turned into weights (Weng et al., TracrBench).
Hand-built and compiled transformers. Programs have long been compiled into transformer weights (Tracr, and ALTA, which also compiles looped programs for parity and addition). Looped transformers can simulate general programs (Giannou et al.). Closest to our tasks are hand-constructed looped transformers that run breadth-first search, depth-first search and Dijkstra's algorithm (Back de Luca and Fountoulakis), a hand-built transformer for parity (Chiang and Cholak), and programs in RASP, a programming language that maps onto transformers, for balanced brackets (Weiss et al.). Compiled and semi-synthetic transformers also serve as test beds for interpretability methods (Tracr, InterpBench).
Trained models that handle bigger inputs. With special training recipes, trained models do handle inputs longer than the ones they saw. Looped transformers handle longer parity inputs when the loop count grows with the input (Fan et al., over 40 bits) or when the loop also carries state from token to token (Zhang et al., 256 bits). Transformers track variable chains longer than those seen in training (Wu et al.). Models that reason in a hidden loop and are trained on every intermediate step do this too (Altabaa et al.), as do graph neural models trained on algorithms' step-by-step runs (Ibarz et al.).
Looped models. Trained recursive reasoners such as HRM, TRM, LDT, EBR, FPRM and Looped Flows set the Maze-Hard results we compare against. Overthinking was named for recurrent models by Bansal et al. Overthinking in looped language models is studied by Blayney et al. and addressed with training by STARS. Methods that need no training, which change how a looped language model writes its answer or how many loops it runs, have also been tried (Liu et al., Wang et al.). LT2 saw attention pile up on the first token, loop after loop, in a looped transformer.