Weight-Space Programming
From learning weights to writing them
Sundong Kim
Associate Professor @ GIST AI
Nov 25, 2026
AI5102 (Artificial General Intelligence)
Which game was this network trained on?
Opening
R. Takehi, J. Teoh, A. Zhang, O. Khattab, “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026)
2
W1 row 3 -0.080 0.255 -0.015 -0.141 0.010 …
W1 row 62 0.531 0.897 0.219 -0.267 0.321 …
W1 row 66 -0.632 0.718 0.238 -0.591 0.622 …
W1 row 69 -0.199 0.777 -0.881 -0.140 0.926 …
W1 row 111 -0.608 -0.837 -0.047 0.061 0.895 …
W1 row 157 -4.811 0.022 -0.837 0.227 0.108 …
W1 row 405 -0.289 -0.347 0.481 -0.345 -0.731 …
… 17,253 weights in all …
W3 row 11 -0.177 0.185 0.450 4.057 -0.414
W3 row 22 0.376 0.387 0.537 -5.336 -1.203
W3 row 24 0.367 0.561 0.305 0.911 3.031
b3 1.221 1.008 1.024 0.897 1.298
A policy trained with PPO to play one Atari-style game.
Which game? Where would you even start?
Who writes the program?
Part 1 · Who writes the weights
A. Karpathy, “Software 2.0” (2017);
4
Each step moved more of the program out of people's hands and into numbers.
Software 1.0
A person writes code
The logic is explicit and readable, line by line.
Software 2.0
An optimizer writes weights
SGD, Adam or Muon fill them in from data and a loss.
2023 – 2026
An LLM optimizes text
Prompts, pipelines, harnesses, even training code.
Nov 2026
An LLM writes weights
It reads, fixes and writes them from a plain-language goal.
Remark: Weight-Space Programming moves the LLM from the code around the network into the network itself.
Learning: an optimizer writes the weights
Part 1 · Who writes the weights
R. Takehi et al., “Sparks of Weight-Space Programming”
5
Gradient descent: take many small steps downhill on the loss over the data.
We specify what (data, loss), never how; the weights mean whatever training made them mean.
Weight-Space Programming: a reasoner reads θ and writes θ′ from a goal in words, with no gradient.
Remark: Training gives us weights that work but that nobody wrote, so nobody can read them.
Before Nov 2026: who could write weights?
Part 1 · Who writes the weights
Elsayed et al., MBZUAI (Nov 2026), introduction
6
Writer | Works from | Scope | Readable result |
Gradient descent (SGD, Adam, Muon) | data and a loss | any network | no |
Generator networks (hypernetworks, weight diffusion) | a model trained to write weights | one family of tasks | no |
Compilers (Tracr) | a formal program (RASP) | short programs | yes |
By hand or by coding agents (AdderBoard) | a person or agent sets each number | tiny networks | yes |
A general LLM, natively (WSP) | a goal in plain language | today's question | today's question |
Remark: Readable weights existed only for tiny networks built to be read; everything useful came out of an optimizer.
Why the weights stayed with the optimizer
Part 1 · Who writes the weights
R. Takehi et al., “Sparks of Weight-Space Programming"
7
We let LLMs edit everything around the network, but not the network.
Remark: That was a human limit, not a law: nobody can look at 17,253 numbers and say Breakout. Can an LLM?
Weight-Space Programming: treat the weights as code
Part 2 · Weight-Space Programming
R. Takehi, J. Teoh, A. Zhang, O. Khattab, “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), TL;DR and “Common Questions”
8
Read the weights to see what a network computes; write or edit them to change it, with no optimizer.
READ · Exp. 1–3, 7
What was this network trained to do?
Game, drawn shape, training language, sycophancy.
FIX · Exp. 4, 8
Why does it fail, and which edit fixes it?
A car stuck at a ramp; a small LLM that loops.
WRITE · Exp. 5, 6
Write a network for this goal.
Game policies from scratch; a 1.5 M-weight Go player.
The programmer is GPT-6 Astra, used as is, from a natural-language spec: no gradients, sometimes no feedback.
Breakout, 99% confident: the input layer read as a map
Part 2 · Weight-Space Programming · Read
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 1 (the post's interactive figure)
9
Four PPO policies (Breakout, Pong, Pac-Man, Freeway), same shape; options never shown; no tools.
Remark: All four games named correctly.
What does this diffusion model draw?
Part 2 · Weight-Space Programming · Read
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 2 (the post's interactive figure)
10
Three DDPMs trained to draw circles, squares or triangles: 23,824 weights each, no tools, no forward pass.
Remark: Astra reads the geometry of the weights.
without simulating the network.
The middle of a language model, read from its weights
Part 2 · Weight-Space Programming · Read
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 3 and Figure 1
11
Char-level LMs (7.2 M) on Python, romaji or English; input and output layers removed.
Remark: It used the method of Elhage et al. (2021), which nobody had mentioned to it.
Fixing a stuck policy by editing its weights
Part 2 · Weight-Space Programming · Fix
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 4, Kinetix ramp task (the post's interactive figure)
12
0% → 100% success over 1,024 episodes, in one try, with no tools.
Remark: Gradient descent never sampled reverse; reasoning went straight to it.
Writing a game-playing network from scratch
Part 2 · Weight-Space Programming · Write
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 5
13
Rules and source code only: no data, no loss, no gradients, no tools, no rollouts.
MinAtar game | PPO, 100 M steps | PPO, 500 M steps | Astra, one shot |
Breakout | 15.8 | 25.3 | 517.4 |
Seaquest | 5.6 | 88.9 | 53.1 |
Asterix | 25.8 | 55.2 | 53.2 |
Remark: Astra's networks beat PPO after 100 M steps in all three games, without the game ever being played.
The Breakout policy Astra wrote, line by line
Part 2 · Weight-Space Programming · Write · 1/3
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 5, Astra's reasoning summary
14
Astra's reasoning, rewritten as pseudo-code (paraphrased from its summary; one reply of 3,739 tokens).
# layer 1: where will the ball land? (wall reflections included)
u0 = land_x(descending, right) - paddle_x
u1 = land_x(descending, left) - paddle_x
u2 = land_x(ascending, right) - paddle_x
u3 = land_x(ascending, left) - paddle_x
u5 = descending - ascending
# layer 2: move the paddle there
err = pick(u0..u3, by direction and u5)
if |err| small: no-op
elif err < 0: left
else: right
1 Landing points. Four units predict where the ball lands for each direction it can travel, bounces included, minus the paddle position.
The Breakout policy Astra wrote, line by line
Part 2 · Weight-Space Programming · Write · 2/3
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 5, Astra's reasoning summary
15
Astra's reasoning, rewritten as pseudo-code (paraphrased from its summary; one reply of 3,739 tokens).
# layer 1: where will the ball land? (wall reflections included)
u0 = land_x(descending, right) - paddle_x
u1 = land_x(descending, left) - paddle_x
u2 = land_x(ascending, right) - paddle_x
u3 = land_x(ascending, left) - paddle_x
u5 = descending - ascending
# layer 2: move the paddle there
err = pick(u0..u3, by direction and u5)
if |err| small: no-op
elif err < 0: left
else: right
2 Direction. Unit 5 tells a falling ball from a rising one, so the next layer knows which estimate to trust.
The Breakout policy Astra wrote, line by line
Part 2 · Weight-Space Programming · Write · 3/3
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 5, Astra's reasoning summary
16
Astra's reasoning, rewritten as pseudo-code (paraphrased from its summary; one reply of 3,739 tokens).
# layer 1: where will the ball land? (wall reflections included)
u0 = land_x(descending, right) - paddle_x
u1 = land_x(descending, left) - paddle_x
u2 = land_x(ascending, right) - paddle_x
u3 = land_x(ascending, left) - paddle_x
u5 = descending - ascending
# layer 2: move the paddle there
err = pick(u0..u3, by direction and u5)
if |err| small: no-op
elif err < 0: left
else: right
3 The gate. Layer 2 moves the paddle toward the landing point and does nothing once it is there.
The Breakout policy Astra wrote, line by line
Part 2 · Weight-Space Programming · Write
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 5, Astra's reasoning summary
17
Astra's reasoning, rewritten as pseudo-code (paraphrased from its summary; one reply of 3,739 tokens).
# layer 1: where will the ball land? (wall reflections included)
u0 = land_x(descending, right) - paddle_x
u1 = land_x(descending, left) - paddle_x
u2 = land_x(ascending, right) - paddle_x
u3 = land_x(ascending, left) - paddle_x
u5 = descending - ascending
# layer 2: move the paddle there
err = pick(u0..u3, by direction and u5)
if |err| small: no-op
elif err < 0: left
else: right
Remark: Astra decided the program first (predict, then move) and then expressed it in weights.
Writing Go: 1.5 M weights, too many to read as text
Part 2 · Weight-Space Programming · Write
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 6 (the post's figure: wins against PPO by forward passes)
18
243 → 512 × 6 → 82, all zeros at first; Python to read and save tensors; each run of the net costs a forward pass.
Remark: Astra wrote a Go program; the program happens to be a neural network.
Which model is the sycophant? A failure, then a fix
Part 2 · Weight-Space Programming · Read
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 7 and Figure 2
19
Two Gemma 3 270M copies, same data; one learns to agree with the user.
Remark: Behavior spread across a model still needed a little evidence from running it.
Qwen3.5-0.8B: one direction removed, math unlocked
Part 2 · Weight-Space Programming · Fix
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 8
20
0.016%
of the weights edited: 131,072 of 0.8 B
7.9 → 48.1%
MATH-500, same sampling settings
21.0 → 62.3%
IFEval, never targeted
93 → 33%
answers that hit the token limit
Remark: One loop direction, in layers 15 and 19, subtracted. No gradients.
Qwen3.5-0.8B before and after the edit
Part 2 · Weight-Space Programming · Fix
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 8 table (accuracy in %)
24
Qwen3.5-0.8B | MATH-500 | GSM8K | IFEval | Hit token limit |
Base | 7.9 | 13.8 | 21.0 | 93.0 |
Edited, 10 forward passes | 12.3 | 25.7 | 49.0 | 87.2 |
Edited, 25 forward passes | 14.1 | 25.1 | 39.9 | 86.4 |
Edited, 50 forward passes | 48.1 | 67.1 | 62.3 | 33.1 |
1 Base. 93% of MATH-500 answers run to the 32,768-token limit: the model loops and never answers.
2 Small budgets. IFEval already jumps, but 86–87% of answers still hit the limit: the loops stay.
3 50 forward passes. The loop direction is found and removed: token-limit hits fall to 33%, MATH-500 rises to 48.1%.
Remark: The loops are not special to math, so fixing them helped instruction following too.
Removing an obstacle is not adding an ability
Part 2 · Weight-Space Programming · Fix
R. Takehi et al., “Sparks of Weight-Space Programming”, MIT CSAIL blog (Nov 2026), Experiment 8, “Additional experiment”
25
Qwen3.5-0.8B: the ability was hidden
Gemma 3 270M: nothing to switch off
Remark: A weight edit uncovered an ability the loops were hiding; it could not create one the model lacked.
Part 2 in three lines
Part 2 · Weight-Space Programming
26
1
LLMs can read weights.
From the numbers alone Astra named the game, the drawn shape and the training language, and found every copying head.
2
LLMs can fix weights.
A 3.5% edit took a stuck car from 0% to 100%; a 0.016% edit took Qwen3.5-0.8B from 7.9% to 48.1% on MATH-500.
3
LLMs can write weights from scratch.
Breakout 517.4 against 15.8 for PPO after 100 M steps; a 1.5 M-weight Go player that beats an equal-size PPO.
→ Part 3: if every step of a computation needs its own block, how can a written network finish a 110-step maze?
Can't solve the maze, can write the solver
Part 3 · Looped WSP
A. Elsayed et al., “Looped Weight-Space Programming”, MBZUAI (Nov 2026), Figure 1
27
Remark: Claude Opus 5.5 solves 26% of Maze-Hard mazes itself; the looped transformer it wrote solves 100%.
One loop, one step of a shortest-path search
Part 3 · Looped WSP
A. Elsayed et al., “Looped Weight-Space Programming”, MBZUAI (Nov 2026), Fig. 2 and 5 (11 × 11 demo maze, redrawn with the same rule)
29
Remark: The wave from G visits S at loop 26 and the path is complete at loop 52, twice the path length; extra loops change nothing.
The maze block, read from its weights
Part 3 · Looped WSP · 1/4
A. Elsayed et al., “Looped Weight-Space Programming”, MBZUAI (Nov 2026), Figure 4
30
1 Cell state. Each cell is one token with 35 numbers: position, type, distance in threes, pointer, path flag, and 20 copied from neighbours.
The maze block, read from its weights
Part 3 · Looped WSP · 2/4
A. Elsayed et al., “Looped Weight-Space Programming”, MBZUAI (Nov 2026), Figure 4
31
2 Attention. Four heads with one job each: copy five numbers from the cell above, to the left, to the right or below.
The maze block, read from its weights
Part 3 · Looped WSP · 3/4
A. Elsayed et al., “Looped Weight-Space Programming”, MBZUAI (Nov 2026), Figure 4
32
3 MLP, 86 neurons. Wave, pointer, pointer clear, chain and clean-up neurons, in pairs that give clean 0s and 1s.
The maze block, read from its weights
Part 3 · Looped WSP · 4/4
A. Elsayed et al., “Looped Weight-Space Programming”, MBZUAI (Nov 2026), Figure 4
33
4 Write, then loop. Each cell writes #, open, S, G or path, and the block runs again: 1,800 times for a 30 × 30 maze.
The maze block, read from its weights
Part 3 · Looped WSP
A. Elsayed et al., “Looped Weight-Space Programming”, MBZUAI (Nov 2026), Figure 4
34
Remark: Claude chose the meaning of every number first, then set the 19,936 weights so each loop does exactly this.
Maze-Hard: 30 × 30 mazes, shortest paths over 110 steps
Part 3 · Looped WSP
A. Elsayed et al., “Looped Weight-Space Programming”, MBZUAI (Nov 2026), Fig. 8, 10 and Sec. 4 (any shortest path counts)
38
Remark: Claude cannot run a 110-step search in text, but it can write one step of it into 19,936 weights.
Written in 39 minutes, against hours of training
Part 3 · Looped WSP
A. Elsayed et al., “Looped Weight-Space Programming”, MBZUAI (Nov 2026), Figure 3
39
Star: the written transformer, ready 39 minutes after the task, about $19 of tokens.
Remark: The written solver needs no gradient training at all.
Why Claude can write the solver but not solve the maze
Part 3 · Looped WSP
A. Elsayed et al., “Looped Weight-Space Programming”, MBZUAI (Nov 2026), Sec. 3 and Figure 10
40
Better prompts lift Claude from 26% to at most 50%.
Remark: Like a programmer who cannot do the arithmetic in their head but can write the program that does it.
Can gradient descent find the same weights?
Part 3 · Looped WSP
A. Elsayed et al., “Looped Weight-Space Programming”, MBZUAI (Nov 2026), Sec. 4
41
Training run on the same 1,000 mazes | Test mazes solved |
Claude's architecture, random weights, no normalization (6 runs) | broke down within 30 steps |
+ RMSNorm, up to 2.8 M weights, 8 hours each | 0%: learned to copy the maze |
+ curriculum from 10 × 10 to 30 × 30 mazes | 0% |
+ class-balanced loss, + supervision of distance and pointers every loop | 0 of 185 checkpoints |
Plain transformer, 6.4 M weights (320 ×), 3,000 mazes | 46% (94–99% on training mazes) |
Written by Claude, 19,936 weights, about $19 | 100% |
Remark: The architecture holds a 100% solution, but gradient descent found no partial credit on the way to it.
Where the numbers get their meaning
Part 3 · Looped WSP
A. Elsayed et al., “Looped Weight-Space Programming”, MBZUAI (Nov 2026), Sec. 6 and Figure 20
47
Trained: meaning comes from training. Written: meaning comes first.
Remark: Interpretability by construction, but only because the algorithm was known in advance.
What could change if this keeps working
Synthesis
Takehi et al., MIT CSAIL (Nov 2026), “What Comes Next?”; Elsayed et al., MBZUAI (Nov 2026), “What's next”
50
Audit
Audit without evaluation
Find backdoors or hidden abilities in the weights before any benchmark.
Cost
Skip the training run
Write or initialize a network in one shot instead of collecting data.
Steer
Zero-data steering
Add or remove a capability by touching 0.016% of the weights, not all of them.
Self-improve
A native path to RSI
A model that reads and fixes its own weights, not just its training code.
Merge
Graft circuits
Move a module between different architectures instead of averaging weights.
Train
Written weights as a start
Does training from a 100% looped solution keep its size generalization?
What to remember from today
Recap
51
1
Learning has always had a writer.
People wrote programs, optimizers wrote weights from data, and LLMs began writing the text around models.
2
A frontier LLM can now read, fix and write weights natively.
Breakout from 17,253 numbers; a stuck car fixed with a 3.5% edit; Qwen math 7.9% → 48.1% with a 0.016% edit.
3
A loop turns one written step into long reasoning.
19,936 weights solve every Maze-Hard maze and gradient descent on the same block found 0%; Hanoi runs 1,048,575 moves without error.
→ Where in your own research would you rather write the weights than train them?
52
Closing question:
If an LLM can read and write the weights, which parts of a network should still be learned by gradient descent?
Logs, weights and demos: github.com/RikiyaT/lm_understand-logs · mbzuai-oryx.github.io/LoopedWSP
sundong@gist.ac.kr | https://sundong.kim