NotesByLex

Weight-Space Programming

Can frontier LLMs write, read and edit neural network weights directly?

Intro

Remember when neural networks were considered black boxes?

It turns out frontier LLMs can read, write and edit the weights of other small neural networks without running a gradient-based training loop (Takehi et al., 2026).

Researchers from MIT call this Weight-Space Programming.

In their blog post, they proclaim that:

our neural network weights will soon be natively optimized by LLMs that deliberately reason about their weights.

The authors ran several experiments with GPT-6 Astra to evaluate its "weight-space programming" capability.

For reading capability, they found that:

  • For four small game-playing networks, Astra could identify the game from the weights, given the input format and action labels.
  • Astra could identify the shapes a small diffusion model was trained to generate.
  • Using just four transformer blocks from the middle of a language model, Astra could distinguish models trained on Python, English and romanised Japanese.

For writing, the story seems even more impressive. Astra wrote a 1.5-million-weight network for 9×9 Go from scratch (starting from zeros), without gradient-based training. The authors tested this with and without inference feedback.

Astra also wrote smaller networks for playing Breakout, Seaquest and Asterix.

Maybe even more amazingly, Astra managed to edit Qwen3.5-0.8B’s weights to reduce reasoning loops, raising its MATH-500 score from 7.9% to 48.1%.

A visual overview of three weight-space tasks: read weights to identify a game; fix existing Qwen weights, with an author-reported MATH-500 change from 7.9% to 48.1%; and write small game-network weights from zeros. The diagram distinguishes these examples and notes that tools and test feedback vary by experiment.

Conceptual overview of the authors' experiments. The symbols are illustrative; the benchmark figures are their reported results.

For the rest of the post, I want to take a closer look at the results and try to understand what's really going on. Does Astra really possess the capability to understand a neural network just from studying the weights?

Reading Weights

Game-playing network

The LLM is attempting to read the weights of a game-playing model. Let's take a close look at that model.

The game-playing model receives the game state as a 10×10 grid with five labelled binary channels. The first channel describes the player-controlled agent, the next the moving objects, the third the reward targets, the fourth obstacles, and the final channel shows the previous game step.

Each channel is a mask of zeros and ones.

The whole 10x10x5 grid is then flattened into an array of 500 inputs for the small 500 → 32 → 32 → 5 network.

Here's a frame from the authors' Breakout animation, split into those channels using NumPy:

The authors' Breakout animation frame and five reconstructed binary channels. The agent channel marks a three-cell paddle on row 8; the moving-object channel marks a ball at row 6, column 5; reward targets occupy the top three playable rows; obstacles mark the border. The history illustration uses the preceding displayed GIF frame, which may differ from the preceding game step.

Reconstructed from frames 19 and 20 of the authors’ animation. Coloured cells are 1; pale cells are 0. The history channel uses the preceding GIF frame, which may not match the previous game step.

We can also inspect the agent channel for a reconstructed example:

Show code
import numpy as np

example_file = (
    "../_media/weight-space-programming/"
    "breakout-observation-example.npz"
)
with np.load(example_file, allow_pickle=False) as example:
    state = example["observation"]

print("State shape:", state.shape)
print()
print(state[:, :, 0])  # Channel 0: the player-controlled paddle.
State shape: (10, 10, 5)

[[0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 0 0 0 0 0]
 [0 0 0 0 0 1 1 1 0 0]
 [0 0 0 0 0 0 0 0 0 0]]

Note that Astra wasn't actually given an input game-state example. It was told the input format, the channel meanings and which output meant each action.

Here's the authors' original prompt, with line wrapping added. I've left out the 17,253 numerical weights, but they're in the full Breakout prompt.

Prompt: Takehi et al., CC BY 4.0 (Takehi et al., 2026).

Read the original instruction prompt
THE OBSERVATION
The network sees a 10 x 10 grid. Rows are numbered 0 (top) to 9 (bottom) and
columns 0 (left) to 9 (right). The outer ring of cells (row 0, row 9, column 0
and column 9) is a wall border; the playable area is the inner 8 x 8 cells
(rows 1-8, columns 1-8).
Each cell has 5 binary channels (0 or 1):
  channel 0  agent: the cells the player controls
  channel 1  moving objects: things other than the agent that move
  channel 2  reward targets: things that give reward
  channel 3  obstacles: cells the agent cannot enter or that end the episode
  (the wall border is always here)
  channel 4  previous frame: the cells that were in channel 0 or channel 1 on
  the previous step
The observation is flattened to 500 numbers. Input number i = (row * 10 +
column) * 5 + channel; for example input 0 is (row 0, column 0, channel 0),
input 4 is (row 0, column 0, channel 4), input 5 is (row 0, column 1, channel
0) and input 499 is (row 9, column 9, channel 4).

THE ACTIONS
The network outputs 5 numbers (logits), one per action; the action is sampled
from the softmax of these logits:
  action 0  no-op
  action 1  up (toward row 0)
  action 2  down (toward row 9)
  action 3  left (toward column 0)
  action 4  right (toward column 9)

THE NETWORK
A policy network (multilayer perceptron) with 500 inputs, two hidden layers of
32 units with tanh activations, and 5 outputs:
  h1 = tanh(x @ W1 + b1)          W1: 500 x 32, b1: 32
  h2 = tanh(h1 @ W2 + b2)         W2: 32 x 32,  b2: 32
  logits = h2 @ W3 + b3           W3: 32 x 5,   b3: 5
Row i of W1 holds the weights from input i to the 32 hidden units; column j of
a weight matrix belongs to unit j of the next layer. 17,253 parameters in
total. It was trained with reinforcement learning (PPO) to maximise the reward
of a game played on this grid.

QUESTION. The weights below belong to one policy network that was trained with
reinforcement learning to play a game on this grid. Which game was it trained
on? Work from the weights. You have no tools: no code execution, no
calculator, nothing to run. This is a single response.

Answer in this order:
Observations: <what you see in the weights: for each input channel, where in
the grid its weights are large or show structure and what that suggests; what
the output layer and its biases show about the actions; quote the weights you
rely on>
Reasoning: <which kinds of game fit these observations, which are ruled out,
and why>
Game: <the game, as specifically as you can; if it resembles a well-known
game, give that game's name>
Description: <what the agent does and what gives reward, in one or two
sentences>
Confidence: <0-100>%

[The 17,253 numerical weights follow here; omitted from this excerpt.]

So each first-layer weight maps to a known cell and channel.

For Breakout, the model figured out the largest agent weights sit on row 8, the bottom playable row, and reward-target weights cluster near the top. The output weights suggest horizontal control, because left and right are more distinct than up and down. Astra inferred a paddle and bricks from these patterns, using the weights as text.

Screenshot of Astra's Breakout answer, showing 99% confidence and highlighted observations: agent weights on row 8 suggest a bottom paddle, moving-object weights suggest a ball, and reward-target weights in rows 1 to 3 suggest bricks.

Excerpt from Astra's published explanation of the Breakout weights. Response text: Takehi et al., CC BY 4.0. Original results.

To me, this is a pretty incredible result.

But others, like Sean Goedecke have argued that it's not “superhuman” AI research (Goedecke, 2026). With labelled inputs, a human researcher could reveal the same patterns with a few lines of NumPy.

I've done that below, following his example. I reshaped the first-layer weights back into the grid and plotted the strength of the connections for each cell and channel.

The code downloads all four checkpoints and rounds the weights to three decimal places to match what Astra received.

Show code
from io import BytesIO
from urllib.request import urlopen

import matplotlib.pyplot as plt
import numpy as np

base_url = (
    "https://raw.githubusercontent.com/RikiyaT/lm_understand-logs/"
    "4d09ba6d6a7e891dd8063974dfe81b3d78e3494f/"
    "exp1_which_game/networks/"
)
checkpoints = {
    "Breakout": "a9f535cc",
    "Pong": "dfc6cb65",
    "Pac-Man": "bdf99279",
    "Freeway": "0bbcc3ea",
}
names = ["Agent", "Moving objects", "Reward targets"]

for game, checkpoint_id in checkpoints.items():
    with urlopen(base_url + checkpoint_id + ".npz", timeout=60) as response:
        with np.load(BytesIO(response.read()), allow_pickle=False) as data:
            W1 = np.round(data["actor/dense1/kernel"].astype(float), 3)

    grid_weights = W1.reshape(10, 10, 5, 32)
    magnitudes = np.linalg.norm(grid_weights, axis=-1)

    fig, axes = plt.subplots(
        1, 3, figsize=(12, 4), layout="constrained", facecolor="#FBFAF6",
    )
    fig.suptitle(game)
    for channel, (ax, name) in enumerate(zip(axes, names)):
        image = ax.imshow(magnitudes[:, :, channel], cmap="Greens", vmin=0)
        ax.set(
            title=name, xlabel="Column", ylabel="Row",
            xticks=[0, 1, 8, 9], yticks=[0, 1, 8, 9],
        )
        fig.colorbar(image, ax=ax, shrink=0.7, label="L2 norm")

    plt.show()
    plt.close(fig)

Computed from first-layer weights rounded to three decimal places. Source: Takehi et al., CC BY 4.0.

Note that each figure shows the same three input channels for one game. Each panel has its own colour scale, so compare the spatial patterns rather than the shades of green between panels.

Do other models have the same capability?

The authors focused on Astra, but could other frontier models identify the games too?

I replayed the authors' four original game-identification tests with eight other models, using the same prompts and weights. Under the authors' scoring, Opus 5.5, Sol 6.1, Terra 6.1 and Gemini 4 Argon identified all four games.

The last column is a control: the same prompt with the numerical weights removed. All four networks share one architecture, so I ran one control per model. The percentages are the models' own confidence estimates.

Model Correct Shape-only guess
Opus 5.5 4/4 Pac-Man, 15%
Sol 6.1 4/4 Indeterminate, 0%
Terra 6.1 4/4 Indeterminate, 0%
Gemini 4 Argon 4/4 Pac-Man, 0%
Sonnet 5.5 3/4 Snake, 20%
Muse Wonder 3/4 Indeterminate, 5%
Kimi K3.1 Pro 3/4 Indeterminate, 0%
Haiku 5.5 1/4 Uncertain Frogger/Pac-Man, 15%

Each test used a fresh session at high effort with tools disabled. The authors accept Frogger for their Freeway-style road-crossing game, so I did too.

The Opus responses, Sol, Terra, Sonnet and Haiku responses, and Argon, Muse and Kimi responses include the answers, scores and usage. The experiments repo has the runner and scoring code.

Language model test

The language-model test seems much harder.

Astra got four transformer blocks from the middle of a language model, with no input or output layer and no labels on the 384 dimensions. It could use Python to analyse the weights, but couldn't run the blocks.

It found a head that looks one character back, then used products of the weight matrices to find later heads that copy earlier text. Lots of copying heads suggested code. Also worth noting that this approach was apparently already described in the paper A Mathematical Framework for Transformer Circuits (Elhage et al., 2021).


Writing Weights

Astra didn't train the networks it wrote. It designed an algorithm and set the weights to compute it.

For the MinAtar version of Breakout, Astra was given the game rules and source code. It set the first layer to work out where the ball will land and the second to move the paddle there. It wrote 815 non-zero weights out of 20,486 in one reply, with no tools or test games.

The network scored 517.4, compared with 25.3 for a PPO network of the same size trained for 500 million steps.

Conceptual diagram of the MinAtar Breakout policy Astra constructed. A 600-input game state passes through two 32-unit hidden layers, estimating the ball's landing point and comparing it with the paddle, to six action scores. Astra started from zeros and wrote 815 non-zero parameters out of 20,486 in one reply, with no tools or test games.

Conceptual summary of the authors' MinAtar Breakout construction. They used a six-channel encoding here, separate from the five-channel identification test above.

For 9×9 Go, the no-feedback run produced a 336-line Python script that set the layers to mark stones and liberties, find groups in danger, and score each move.

In the runs with feedback, Astra played practice games, looked at how it lost and revised the weights. The authors call each evaluation-tool request a pass. For Go, one request could play up to 128 games or return the network's outputs on up to 256 board positions.

With 50 passes, it won 70% to 79% of games against three PPO networks of the same size, each trained on about 20 million games. Moves were sampled, with no search.

Incredible.


Editing Qwen

The prompt asked Astra to make Qwen3.5-0.8B better at maths. It also told it to diagnose failures first and explicitly allowed fixing repetition.

In the 50-pass run, each pass let Astra test the model on a batch of practice problems or inspect its internal activations. Here's what it did:

  1. Diagnose. It ran the model on 96 practice problems. Of those, 85 hit the 32,768-token limit, almost all with repeated phrases at the end.
  2. Find a loop direction. It compared internal states from answers that kept making progress with ones that started repeating. The differences gave it directions associated with looping.
  3. Find who writes it. It found the neurons that contributed most to those directions.
  4. Push against it. It changed those neurons' output weights to push against the looping direction. The edit touched about 0.016% of the model's weights.
  5. Check it. On held-out practice problems, 576 of the 579 it rescued had previously hit the token limit. A separate random edit of the same strength showed no clear gain.

Conceptual diagram of the Qwen repetition edit: contrast hidden states, find a loop direction, edit 64 MLP output columns in each of layers 15 and 19, then test using practice feedback. The selected columns receive W prime equals W minus six times u times u transpose W. The authors report editing 0.016 percent of weights and raising MATH-500 from 7.9 to 48.1 percent in the 50-pass run.

Conceptual summary of the authors' 50-pass Qwen run. The formula applies only to the selected MLP output columns. The benchmark results are the authors' held-out evaluation, distinct from the practice feedback used to choose the edit.

The results suggest the edit helped the model finish its answers instead of repeating itself until it exhausted its token budget.

I still say this is utterly mind-blowing, but it's important to note that it's more of a bug fix rather than introducing a new capability.

Failure cases and limitations

The authors also tried improving Gemma 3 270M, which rarely looped. Astra couldn't find a way to meaningfully improve its maths scores.

They also asked Astra to identify which of two models had been fine-tuned to be sycophantic (i.e. always going with the answer you suggest). It failed in all four weight-only attempts. When it could inspect attention patterns from runs on texts it wrote itself, it identified the sycophant in all three pairs. It saw the attention patterns, not the models' answers.

Conclusions

This seems like a step towards more interpretable models. At the time of writing, there's been quite a lot of excitement about this technique, and some pushback on how the approach was reported (Honnibal, 2026).

Whether it's a step towards Recursive Self Improvement or whether models are going to be editing and building themselves in the future is not clear. A lot of what the model does when reading and editing weights is based on fairly well-established techniques. The Qwen edit, for example, is a stronger version of a known weight orthogonalisation technique used to switch off refusal in chat models (Arditi et al., 2024).

And the way it writes networks is actually quite close to how a researcher might have built a machine learning model in the 1990s - well before the deep learning era. The Go script hand-codes stones, liberties and groups in danger, the kind of features rule-based Go programs relied on for decades.

But all that said, this is still one of the most exciting discoveries of the LLM era, and I'm keen to see more exploration into this technique.

References

Andy Arditi, Oscar Obeso, Aaquib Syed, Daniel Paleka, Nina Panickssery, Wes Gurnee, and Neel Nanda. Refusal in language models is mediated by a single direction. 2024. arXiv preprint, first released June 2024; version 3, October 2024. URL: https://arxiv.org/abs/2406.11717 (visited on 2026-11-09), arXiv:2406.11717. ↩

Nelson Elhage, Neel Nanda, Catherine Olsson, Tom Henighan, Nicholas Joseph, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, Tom Conerly, Nova DasSarma, Dawn Drain, Deep Ganguli, Zac Hatfield-Dodds, Danny Hernandez, Andy Jones, Jackson Kernion, Liane Lovitt, Kamal Ndousse, Dario Amodei, Tom Brown, Jack Clark, Jared Kaplan, Sam McCandlish, and Chris Olah. A mathematical framework for transformer circuits. Transformer Circuits Thread, 2021. URL: https://transformer-circuits.pub/2021/framework/index.html (visited on 2026-11-03). ↩

Sean Goedecke. LLMs are not superhuman at reading and writing neural network weights. November 2026. Blog post, 3 November 2026. URL: https://www.seangoedecke.com/llms-are-not-superhuman-at-reading-and-writing-neural-network-weights/ (visited on 2026-11-03). ↩

Matthew Honnibal. The 'Astra can read and write weights to improve Qwen' post is misleading. November 2026. Blog post, 3 November 2026. Accessed 4 November 2026. URL: https://honnibal.dev/blog/astra-read-write-misleading (visited on 2026-11-04). ↩

Rikiya Takehi, Jayden Teoh, Alex Zhang, and Omar Khattab. Sparks of weight-space programming: released experiment logs and networks. 2026. Released prompts, networks, logs and scoring. Commit 4d09ba6d6a7e891dd8063974dfe81b3d78e3494f. Accessed 3 November 2026. URL: https://github.com/RikiyaT/lm_understand-logs/tree/4d09ba6d6a7e891dd8063974dfe81b3d78e3494f (visited on 2026-11-03). ↩

Rikiya Takehi, Jayden Teoh, Alex Zhang, and Omar Khattab. Sparks of weight-space programming: LLMs can natively read & write neural network weights. November 2026. Blog post, 2 November 2026. URL: https://rikiyat.github.io/blog/weight-space-programming/ (visited on 2026-11-03). ↩

Video

I've made a YouTube video for this article.