Do LLMs Read Neural Network Weights?. experiment.. experiment. interpretable ml.. experiment. interpretable ml. llm.. experiment. interpretable ml. llm. mit.. experiment. interpretable ml. llm. mit. искусственный интеллект. - страница 16

In November a wave of loud headlines swept through: “LLMs have learned to read and edit neural network weights.” The authors of enthusiastic articles reported that MIT had proven LLMs could work directly with neural network weights, that they could analyze them, edit them and, who knows, even write them from scratch. Well, it looks very promising and, to some extent, frightening.

This article is a breakdown of the original publication, in which the MIT authors used LLMs to experiment with neural network weights.

Breaking down the experiments

From the very beginning I was sure the retellers had misunderstood something. For me, the possibility of an LLM directly reading neural network weights runs into plain computational complexity. If a model gets confused by simple arithmetic on long sequences and loses carries in elementary addition, then weight analysis, which involves complex linear-algebra computations, is all the more impossible.

Moreover, given a context window of a million tokens, I assumed that any analysis at all was possible only for networks of at most 50,000 parameters.

But rather than guess, let me look at what was in the original.

The authors of “Sparks of Weight-Space Programming: LLMs can natively read & write neural network weights” ran eight experiments. (What’s quite amusing here is that “Sparks of Weight-Space Programming” is set in small type, while “LLMs can natively read & write neural network weights” is large and bold. The “Sparks of…” formula itself echoes Microsoft’s 2023 “Sparks of AGI”: a genre where the hedge goes into the title, but in small print.) By “natively” the authors mean that the LLM itself reasons about the weights, translating between natural language and weights. I’ll focus on four experiments:

  1. The LLM recognized a network’s task from the weights of a tiny network.

  2. The LLM fixed a failure in a larger network.

  3. The LLM wrote the weights of a tiny Breakout-playing network from scratch.

  4. The LLM improved another LLM by correcting its weights.

Along the way I’ll also look at two more experiments, which lead to amusing conclusions too. In one, the model used weights to determine what shape a small diffusion model draws. In the other, it tried to determine from weights which of two language models flatters the user, and failed.

OK, let’s arm ourselves with Opus, Astra and Neon and see what actually happened.

1. The LLM recognizes a network’s task

This is what seems the most interesting of the experiments. Astra (GPT-6 Astra) received the weights of a tiny 500 → 32 → 32 → 5 network with 17,253 parameters and, with no runs and no tools, named the correct game for all four networks: Breakout, Pong, Pac-Man and Freeway, Breakout with 99% confidence.

It looks as if the LLM read the weights. Unfortunately, the experiment is muddied by the description of the inputs: the prompt names the channels outright (agent, moving objects, reward targets, obstacles, previous frame) and names the outputs too (stay, up, down, left, right). For an LLM, such hints sharply narrow the space of choices. But that isn’t the main problem with the experiment. The thing is, I suspect that in this task the LLM doesn’t need the weights at all to give the right answer.

OK. To check, I took Claude and looked at how it reads weights. The initial assessment gave the following:

In the first layer, weights grew only where something occurred during training: the agent only in row eight, reward targets in rows 1–3, obstacles around the perimeter, and the rest remained initialization noise. That is, the first layer stores a fingerprint of the data: not what the network does, but where it had something on its input.

So Claude, without going into what the weights actually do, was able to interpret by purely statistical methods what goes into the network.

I ran a new experiment. ChatGPT produced a blinded statistical description of the weights. You can see it in the spoiler.

Spoiler: blinded weight description

Скрытый текст

A fully connected network 500 → 32 → 32 → 5. Both hidden layers use tanh. 17,253 parameters in total, including biases.

Each of the 500 inputs has a corresponding vector of 32 first-layer weights. In their original order, the inputs can be arranged into a 10 × 10 × 5 array: five consecutive inputs at each position, ten positions per row. Zero-based indexing. Below is the Euclidean norm of the input vector, averaged over the ten columns, computed from the network’s weights.

Row

A

B

C

D

E

0

0.37

0.35

0.35

0.66

0.37

1

0.37

2.89

1.87

0.41

2.54

2

0.33

6.38

1.79

0.41

5.01

3

0.38

9.94

3.25

0.42

6.98

4

0.36

12.04

0.35

0.42

9.00

5

0.37

9.53

0.38

0.39

8.24

6

0.36

9.04

0.36

0.42

9.81

7

0.34

6.83

0.37

0.39

12.68

8

4.44

0.35

0.37

0.39

2.06

9

0.37

0.35

0.38

0.61

0.36

D shows a pronounced perimeter. At the 36 boundary positions, the mean cosine similarity of the input vector with the first-layer bias vector is 0.84, at the 64 interior positions it is 0.01. For B and E, the vectors at matching interior positions have a mean cosine similarity of 0.57. The maximum mean norm for B falls in row 4, for E in row 7.

Each output has a corresponding vector of 32 last-layer coefficients. Pairwise distances between the vectors of outputs 0, 1 and 2 lie in the range 3.22–3.79. Distances from each of them to outputs 3 and 4 are 9.37–10.35. The largest distance is between outputs 3 and 4: 13.44. The biases of the five outputs in original order: 1.221, 1.008, 1.024, 0.897, 1.298.

Then I took this description and tested it on Gemini Neon and GLM 5.3 max. Both identified Breakout (Neon a bit faster, GLM a bit slower) and recognized the paddle, the bricks and the walls. Beyond that there were discrepancies irrelevant for the purposes of the experiment. Gemini took the “previous frame” channel for the ball’s trail, but in the wrong channel. GLM chose Breakout/Arkanoid and called that channel a “falling power-up capsule.” DeepSeek didn’t manage, getting only as far as “some kind of gridworld.”

That is, the models guessed the game not from the meaning of the weights but from the arrangement of their magnitudes, and then the learned database of games did the rest. The statistical description was enough for them, the weights themselves weren’t needed. To be precise: this shows that the fingerprint is sufficient for the answer, and there is no sign that Astra, which did receive the raw weights, used anything more.

This is especially clear in another experiment, where Astra used weights to determine what three small diffusion models generate: filled circles, squares and triangles on a 12×12 image (no list of options was given in the prompt). The last layer of each network turns 64 internal neurons into 144 pixels. So each neuron has 144 output weights, one per pixel. Lay them out as a 12×12 square and you get a picture: which pixels this neuron affects most strongly. That’s exactly how Astra read them: “a curve in row 1, columns 2–4.” It was explicitly forbidden to run the network, even mentally.

Astra named the shape correctly all three times, but each time drew an outline with an empty middle, although the models generate filled shapes. The MIT authors present this error as a plus: supposedly it proves that the model didn’t cheat by running the network, but read the geometry of the weights. But I checked the output weights: individual neurons draw not outlines but pieces of the shape, stripes and blobs. A filled shape appears only when the neurons’ contributions are summed, taking their activations and biases into account. Astra looked at the pictures one by one, saw narrow stripes with negative weights next to each other, and took them for an outline. The ban on running the network showed precisely the limit of such reading: to guess a silhouette from individual filters, the ability to recognize images is enough. To understand what the network actually draws, you would still have to compute.

2. The LLM fixed a failure in a larger network

Here the network is bigger. Kinetix: 679 → 128 → five layers of 128 → 16, 171,664 weights in total. For a billion steps the network was trained to drive a car up a ramp and jump over a red stripe, but it got stuck on the ramp: the network failed in all 256 episodes. Astra received all the weights, a description of the scene and one recorded episode, and was given one attempt without tools. Result: 1,024 successes out of 1,024, with 3.5% of the weights changed.

Here I have to admit that my estimate, that an LLM with a million-token context window could analyze only tiny networks of at most 50,000 parameters, was too pessimistic. Here all 171,000 weights fit into the prompt, about 355,000 tokens. Each tensor was written as integers multiplied by a shared scale, which came to roughly two tokens per weight.

But what did Astra actually do with the loaded weights? The whole analysis mostly came down to the recorded episode and the physics of the scene: where the car loses speed on the ramp and doesn’t back up to build up speed. The trained weights are mentioned in passing. The entire edit is 51 commands: zero out three neurons of the first hidden layer and six neurons in each of the other hidden layers, cutting them off from the trained network, and route its own pathway through them. In effect, Astra hard-coded the car’s movement in the problem zone. Beyond it, the old network drives the car.

Astra set huge, round weights: 80, ±10, biases down to −876. At such values tanh saturates and works like a logic gate. Most of the 6,073 changed weights are zeros that cut the captured neurons off from the rest of the network.

So Astra didn’t understand or repair the trained network. It built its own small controller alongside it. A good engineering solution, but not reading weights.

3. Breakout from scratch

The LLM was given the task of writing a network’s weights. Starting point: a 600 → 32 → 32 → 6 network with all weights at zero, the rules of the game, the source code, and the layout of inputs and outputs. No data, no gradients, no tools, no trial runs of the network for evaluation. Result in Breakout: 517.4 points versus 15.8 and 25.3 for PPO networks trained for 100 and 500 million steps. It should be noted that this staggering gap is due to Astra having the source code and the complete rules, while PPO trained from scratch (though in Seaquest and Asterix the PPO network trained for 500 million steps beat it: 88.9 versus 53.1, and 55.2 versus 53.2).

Still, it looks impressive. Let’s see how Astra did it.

The network’s input is 600 bits: a 10×10 field with six channels per cell. A bit equals 1 if the cell contains an object: the paddle, the ball, its trail, a brick. A first-layer neuron sums the weights of the bits that are on. There is one ball on the field, so out of the hundred bits in the “ball” channel exactly one is on, and the neuron simply outputs the weight of that cell. That is, the neuron’s 100 weights responsible for the ball’s position are a 10×10 array indexed by cell. Writing weights here means filling in a table.

That’s exactly what Astra did. For each cell where the ball could be, it estimated from the rules of the game which column the ball would land in, accounting for bounces off the walls, and wrote the answer into the weight, scaled by 0.02. Into the paddle weights it wrote the same thing with a minus sign. The result is a neuron that computes a difference: where the ball will land minus where the paddle is. There are four such neurons, one for each direction of the ball’s flight, with the direction determined from the trail channel.

The second layer is just an ordinary if. If the difference is positive, go right. If negative, go left. Near zero, stay.

In Python it would look like this:

landing = LANDING[direction][ball_row][ball_col]  # table computed in its head from the rules of the game
err = landing - paddle_col
if err > 0:   action = RIGHT
elif err < 0: action = LEFT
else:         action = NOOP

Astra wrote a similar program and then, in essence, compiled it into weights by hand. By the way, the same idea is behind the car fix in the second experiment: the model writes weights in a grammar of its own, where a neuron is a table or a condition, and a weight is a number whose meaning is known in advance. In such a grammar the arithmetic is trivial, and my argument about carries doesn’t apply here. The problems LLMs have are specifically with reading weights, not with writing them.

4. How Qwen got better at solving problems

Now this experiment, I suppose, greatly interested neural network developers. After Astra processed its weights, Qwen3.5-0.8B rose on MATH-500 from 7.9% to 48.1%, and on GSM8K from 13.8% to 67.1%. Astra found a direction written by the MLP blocks of layers 15 and 19 that drives the model into repetition loops, and subtracted it from 64 output columns in each of these layers (directional ablation, a method known since 2024 as “abliteration”, building on Arditi et al.’s work on the refusal direction). 131,072 weights changed, 0.016% of the model.

The only nuance is that here Astra had access to Python and up to 50 runs of the model. And so, no magic: it didn’t climb into the weights directly. Its merit is that, having assessed the task, it initiated and carried out a standard ML engineer’s pipeline: network behavior, self-written probes, activation analysis, choosing a direction, editing weights, checking with controls. Wonderful! But there’s no understanding of the weights as such there. There’s good research carried out by a model.

Tellingly, in the experiment with Gemma 3 270M the same approach gave no results: 6.8% → 7.7%, and Astra itself didn’t count this as a real improvement. Moreover, where Astra tried to find from weights alone which of two Gemmas flatters the user, all four attempts failed. It worked only when it was given the model’s attention patterns on its own texts. That is, Astra didn’t “teach Qwen math” by editing weights, it removed the looping: 93% of the unmodified model’s answers on MATH-500 hit the 32,768-token limit. That’s why even IFEval rose, from 21% to 62.3%, although nobody touched it: the looping model simply never got to the answer. Gemma’s baseline was almost the same, 6.8%, but only 8.5% of its answers hit the limit. The problem there wasn’t looping but arithmetic errors, and since there was nothing to unblock, the weight edit didn’t raise the score.

Links to the original authors’ GitHub with logs and code.

Conclusions from the experiments

So far, LLMs don’t read weights as such. Weight analysis is possible where LLMs can assess the statistical fingerprint of the data. That is, the model identified the game from the first layer, and the shape from the output layer. Where there is no fingerprint, as with the sycophantic Gemma, the model couldn’t read anything.

LLMs can analyze neural network weights, but only the way they were taught in their datasets: through code and runs, that is, by classical engineering methods.

Models can write weights. That’s amusing, but explainable. They write in a grammar where computations are trivial. And the networks created this way execute a single explicit algorithm (and, as you know, that’s not what we love neural networks for). Overall, LLMs read weights like a photograph of the data, and write them like a program. The meaning of trained weights as such doesn’t exist for them.

I’m not alone in this reading. Independent work on arXiv describes zero-shot weight reading by this model as “local arithmetic plus priors” rather than weight-flow tracing (arXiv:2611.08070). Jens Lehmann concludes that, under a protocol that forbids fitting and search, weight-space programming amounts to writing a restricted class of programs, not networks of the kind training produces (arXiv:2611.16981). My own test came from a different angle: one blinded statistical description fed to different models.

That said, I’m talking about current LLMs. My own experiments with tiny networks on Boolean functions showed that a small network can be trained to predict, from weights alone, which function another network computes. Moreover, such a network can predict functions that weren’t in its training set, for example XOR. In the terms of weight-space learning, this is a metanetwork.

In any case, I believe that as the analyzed network grows, the difficulty of such reading grows exponentially and quickly goes beyond available compute. Though the question is open. Checking the full truth table requires 2^n examples for n Boolean inputs (not to mention the growing complexity of the network itself). But it doesn’t yet follow that recognizing the function itself will require going through the whole table. Perhaps it’s enough to isolate relations between weights that persist across different writings of the same network, that is, invariants under weight-space symmetries such as neuron permutations and rescaling. This is exactly what permutation-equivariant metanetworks (DWSNets, neural functionals) are built to exploit. Which, in fact, is a topic for a separate deep reflection.

P.S. Thanks to @vldmrmlkv for the questions, without him I wouldn’t have gotten around to this article.

Автор: Kamil_GR

Источник