Architectures

Weight-Space Programming and Model Surgery

What Weight-Space Programming, presented by MIT, actually is, how to read its results, and why the idea of fixing a model by operating surgically on its representations, without retraining it, was at the heart of my 2024 paper Brain Surgery.

Weight-Space Programming and Model Surgery

News about how we will write neural networks

On November 2, 2026, a group from MIT CSAIL made up of Rikiya Takehi, Jayden Teoh, Alex Zhang and Omar Khattab published a post titled Sparks of Weight-Space Programming. In it they show that a general-purpose language model, in this case GPT-6 Astra, can read and directly modify the weights of another neural network without using gradient descent. Within two days the news had spread across the international tech press, mostly because of one specific result: the score of Qwen3.5-0.8B on MATH-500 went from 7.9% to 48.1%, by changing about 0.016% of its parameters.

In this article I try to explain what Weight-Space Programming really is, which experiments support it, and how to read the numbers, separating what the work demonstrates from what is still only a promise. In the second part I explain why this news hits close to home for me. In September 2024 I published a paper on arXiv, Brain Surgery, which proposed intervening surgically on a model’s internal representations to remove specific concepts without retraining it, with the goal of making local models GDPR-compliant. I will try to be precise about where the two ideas overlap and where they diverge, because the interest of this story lies in exactly that distinction.

What Weight-Space Programming is

The authors define Weight-Space Programming as the situation in which a general-purpose LLM reads and writes the weights of a network starting from a natural-language specification, without going through an optimizer and in particular without gradient descent, and in some cases without any feedback from the environment. The target network is treated as an artifact to inspect and fix, much as a programmer treats source code. The model doing the work reasons about what each part of the network computes, or what it should compute, and changes the numbers accordingly.

To see what is new here, it helps to place it against three existing lines of work. The first is classical training, in which the weights are written by an optimization algorithm such as Adam or Muon, which knows nothing about the meaning of the parameters and simply follows the gradient of a loss function. The second is so-called weight space learning, a research area in which specialized networks are trained to take the weights of other networks as input, in order to classify them, predict their performance or generate new ones. It has to deal with the symmetries of weight space, starting from the fact that permuting the neurons of a layer gives you a functionally identical network with completely different parameters. The third is mechanistic interpretability and model editing, from ROME and MEMIT to directional ablation techniques, where human researchers use purpose-built tools to locate circuits or directions and modify them.

Compared with all three, the novelty is in the operator. In place of the blind optimizer, the network trained specifically to read weights, or the researcher building the tools, there is a language model used as it is. It receives the weights as text or explores them with a Python interpreter, and it produces a diagnosis and a correction, both explained in natural language. The authors frame it as the extension to weights of an already widespread paradigm, the one in which LLMs are used to optimize prompts, programs and harnesses. Until now that paradigm stopped at textual artifacts, because nobody knew how to optimize a matrix of numbers by hand.

The experiments: reading, fixing, writing

The work is organized into eight experiments, ranging from tiny networks whose weights fit entirely in the model’s context, up to a language model with 0.8 billion parameters explored with tools. The table summarizes the setup.

Experiment Target network Task given to Astra Outcome
1. Which game MLP with 17,253 weights trained with PPO Say which game it was trained on, with no options given Correct game for all four networks
2. Which shape DDPM with 23,824 weights Say which shape it generates, without a forward pass Correct shape, but drawn as an outline
3. Which language 7.2M Transformer without first and last layer Training language and function of the 24 heads Correct language and all induction heads identified
4. Fixing Kinetix policy with 171,664 weights stuck in a local minimum Explain the failure and fix it in one shot Success from 0% to 100%, changing 3.5% of the weights
5. Writing from scratch MLP for three MinAtar games, initial weights at zero Write the weights with no data, gradients or tools Beats PPO at 100M steps in all three games
6. Go Network with 1.48M weights Write a Go policy with a Python sandbox With 50 forward passes it beats a PPO of the same size
7. Sycophancy Two copies of Gemma 3 270M Identify the sycophantic one Fails from the weights alone, succeeds by observing attention
8. Math Qwen3.5-0.8B Improve it at math without training MATH-500 from 7.9% to 48.1%

In the reading experiments, what’s interesting is how Astra reasons. With the games, it looks at where the first-layer weights concentrate for each input channel, for example along the bottom row of the grid where the Breakout paddle sits, and at which actions the output layer tells apart. With the transformers, without being able to run anything, it finds a first-layer head that looks one character back. Then, by multiplying the weight matrices, it finds the later heads that use it to look for repetitions. In effect, it rebuilds the circuit composition method of Elhage and colleagues without anyone having pointed it out. The error in the shapes experiment, where the shapes were drawn as outlines rather than filled figures, is instructive in its own way, because it suggests the model is reading the geometry of the output-layer weights instead of mentally simulating the computation.

In the writing experiments, Astra works like a programmer compiling an algorithm into neural form. In Breakout, it sets the first layer to compute where the ball will land and the second to move the paddle to that spot. For Go, it writes, layer by layer, a small program that marks stones and liberties, propagates information along chains of connected stones to find groups in danger, and finally assigns a score to each move. For the car stuck on the ramp, it adds a small parallel path through a few neurons per layer. The path reads the vehicle’s position and velocity, makes it reverse to gain momentum, and then switches itself off, leaving the trained network in control.

The Qwen3.5-0.8B case and how to read it

The experiment that has drawn the most attention is the last one. Astra is given a Python kernel with the weights of Qwen3.5-0.8B loaded, no GPU, a set of practice problems taken from GSM8K and MATH, and a budget of 10, 25 or 50 forward passes, each of which consists of having the model answer a batch of problems. Training and gradients are not allowed, and the evaluation benchmarks stay hidden.

Looking at the base model’s answers, Astra notices that the vast majority get stuck in repetitive reasoning loops until they hit the limit of 32,768 tokens, a known flaw of very small reasoning models, and one flagged by Qwen’s own model card. It then traces this back to a single direction in activation space, written by the MLPs of layers 15 and 19, and subtracts it from 64 columns of the output matrix in each of the two layers, for a total of 131,072 weights.

Qwen3.5-0.8B MATH-500 GSM8K IFEval Answers hitting the token limit
Base model 7.9% 13.8% 21.0% 93.0%
Modified, 10 forward passes 12.3% 25.7% 49.0% 87.2%
Modified, 25 forward passes 14.1% 25.1% 39.9% 86.4%
Modified, 50 forward passes 48.1% 67.1% 62.3% 33.1%

The last column is the key to reading the whole result. The improvement coincides almost entirely with the reduction in loops, which drop from 93% to 33% of answers, and indeed it extends to IFEval, which measures instruction following and has nothing to do with math. In other words, Astra removed an obstacle that kept the model from finishing reasoning it was already capable of, while its underlying math skills stayed what they were before.

From a technical point of view, the intervention belongs to a well-known family, directional ablation, in which you identify a direction associated with a behavior and project it out of the weights that write into the residual stream, as in the 2024 work by Arditi and colleagues on the refusal direction. What makes the experiment remarkable is that a generalist model found the direction, diagnosed its cause and carried out the edit, starting from a generic request like making the model better at math. It is also worth noting that with 10 or 25 forward passes the result is modest, and that the jump comes only at 50, a sign that the quality of the diagnosis depends heavily on how much experimental evidence the model can gather.

Limits and negative results

The post’s greatest merit, in my view, is that the authors report the cases where things went badly with the same prominence as the successes. The most significant one concerns Gemma 3 270M, a model that, unlike Qwen, rarely falls into loops. Here Astra, reading the errors, found arithmetic mistakes and incorrect algebraic steps with no single responsible component to switch off. Its small, targeted modifications did not move MATH-500 by more than about a point, a gain that Astra itself declared unproven. The authors’ conclusion is clear and I share it: editing weights this way can remove an obstacle that hides a capability, but adding a capability that is absent remains out of reach.

The sycophancy experiment is instructive too. Given two copies of Gemma 3 270M trained identically except for the behavior, one honest and one that always goes along with the answer suggested by the user, Astra could not tell them apart from the weights alone in any of the four attempts. It found many differences between the two networks without being able to link them to a difference in behavior. It got there only when it was allowed to observe where the attention heads look on texts it had written itself, discovering that in the sycophantic model some mid-layer heads focus on the answer proposed by the user instead of on the problem’s data.

There are also limits to the setup that are worth keeping in mind. This is a research post, for now without peer review. The experiments use a single operator model, the cases on large networks are few, and in many experiments the networks are so small that they fit entirely in the context. The authors say so openly, attributing the current limits mostly to context length and the quality of the harnesses, and they announce a benchmark to make this capability measurable. In their favor, they have published the full logs of every experiment, with everything Astra received and produced, along with the modified Qwen model on Hugging Face, which makes the work verifiable by anyone.

Brain Surgery, September 2024

On September 22, 2024, I published Brain Surgery: Ensuring GDPR Compliance in Large Language Models via Concept Erasure (arXiv:2409.14603) on arXiv. The problem I started from was very concrete. The GDPR gives every person the right to have their data erased, and a language model that absorbed personal information during training offers no simple way to remove it: retraining from scratch costs too much, and a corrective fine-tuning risks damaging unrelated knowledge. The proposal was to treat removal as a surgical operation, localized on the internal representations associated with a concept, leaving the rest of the model intact.

The technical core of the paper was a procedure for targeted corruption of the embedding associated with the concept to be removed. Let e_c be the vector that represents concept c in a space of dimension d. The embedding is updated iteratively in the direction that reduces the concept’s influence on the model’s outputs, and is then renormalized, so as not to alter the scale of the surrounding space.

\mathbf{e}'_c = \mathbf{e}_c - \alpha \, \nabla_{\mathbf{e}_c} L(\mathbf{e}_c), \qquad \mathbf{e}'_c \leftarrow \frac{\mathbf{e}'_c}{\lVert \mathbf{e}'_c \rVert}

Alongside the removal procedure, the paper introduced a conflict score, designed to measure collateral damage. Given a set X_r of concepts related to the removed ones, the score is the fraction of them that the model still answers correctly after the intervention. A value close to 1 means the surgery did not touch the adjacent knowledge.

S_c = \frac{1}{|X_r|} \sum_{x_r \in X_r} \mathbf{1}\big(f(x_r) = y_r\big)

The rest of the architecture dealt with the regulatory side: a continual learning mechanism that flags incoming sensitive data and triggers removal when a threshold is exceeded, a blockchain ledger that makes every erasure request verifiable and immutable, and the ability for users to define their own retention preferences. The work placed itself explicitly in the line of model editing, citing ROME by Meng and colleagues, MEND by Mitchell and colleagues, and the iterative nullspace projection of Ravfogel and colleagues, that is, the technique that removes from a representation the direction associated with a protected attribute.

Where the two meet

Rereading the MIT post today, I find several ideas that in 2024 I had put at the center of Brain Surgery. The first is that a concept or a behavior is localized in an identifiable portion of the representation space, enough that it can be hit without touching the rest. This is exactly what Astra does with Qwen when it subtracts a single direction from two layers, with an operation that belongs to the same family as the directional projection of Ravfogel that my paper cited. The second is the rejection of retraining as a tool for correction. In my case it was motivated by cost and by the risk of side effects, while in theirs it becomes the very core of the definition. The third is attention to collateral damage, which I measured with the conflict score on related concepts and which they check by verifying that the modification does not degrade other benchmarks, and in fact improves them.

There is also a coincidence that I find particularly significant. Among the future applications the authors list at the end are data-free unlearning, presented as a way to remove a capability by touching a few weights and avoiding the catastrophic forgetting typical of fine-tuning, and model auditing carried out directly on the weights. These are the two goals Brain Surgery was built around, targeted erasure and verifiability of the intervention, which I had applied to the case of the right to be forgotten.

Where they diverge

The differences are just as clear and deserve the same precision. Brain Surgery used the gradient of a loss function to move an embedding, while Weight-Space Programming excludes the gradient by definition and entrusts everything to the reasoning of a language model. In 2024 there was no general-purpose operator able to read a weight matrix and understand its function, and in any case, with the models of that time, an experiment like the one on Qwen would hardly have worked. My paper also presented the methodology and its regulatory framing with a qualitative validation on LLaMA 3, while the MIT work brings numbers, benchmarks and full logs.

Aspect Brain Surgery (September 2024) Weight-Space Programming (November 2026)
Goal Targeted removal of concepts and personal data Reading, fixing and writing networks
Object of the intervention Embeddings associated with the concept Network weights
Who decides the intervention A gradient-based procedure A general-purpose LLM that reasons about weights
Retraining Excluded Excluded
Control of side effects Conflict score on related concepts Evaluation on external benchmarks
Verifiability Blockchain ledger of erasures Full experiment logs
Application context GDPR and the right to be forgotten Interpretability and optimization

The picture that emerges strikes me as both honest and satisfying. Two years before MIT, I had identified surgery on internal representations as the way to correct a model without retraining it, and I had pointed to regulatory erasure as the use case where this path becomes necessary. MIT found the missing operator: a model that can diagnose and operate on its own. That is a real step forward. It takes nothing away from the original intuition, and it finally gives that intuition the tools to be tested at scale.

The Right to Be Forgotten as a Testing Ground

If Weight-Space Programming keeps its promises, I think regulatory erasure is the ground on which to truly measure it, because it imposes requirements that none of the MIT experiments addresses yet. Article 17 of the GDPR gives the data subject the right to have their data erased. When that data has ended up in a model’s weights, the question that matters for a company or a supervisory authority becomes how to prove that the information has really been removed, and that the model still works as before on everything else.

The Qwen case is in a sense the most favorable one possible, because the flaw was concentrated in a single, easily recognizable direction, and its effect could be measured with a simple indicator such as the percentage of truncated answers. Personal data tends to behave differently. A name, an address or a clinical history is spread across many components and can resurface indirectly, through paraphrased questions, associations with other entities, or extraction techniques that exploit memorization. The literature on unlearning has shown repeatedly that knowledge that seems erased can be recovered with a few steps of fine-tuning, and this is exactly the kind of check a surgical intervention should pass.

A serious testing ground for erasure in weight space should therefore ask the operator for three things at once. The first is to remove a defined set of information about a person, withstanding indirect questions as well as extraction and relearning attacks. The second is to preserve related knowledge, which is the function for which I introduced the conflict score, and which should be compared against a reference model retrained without that data. The third is to produce documentation of the intervention that a third party can read. Here, the fact that a language model explains in natural language what it changed and why could become the real added value, because it turns an opaque operation into a verifiable act.

This is the proposal I made to the authors, writing to them in these days, and it seems to me the most useful way to pick up the thread between the work of then and the work of today. For those like Algoretico who bring private, on-premise models to regulated sectors, the ability to correct a model already in production with a small, explained and verifiable intervention answers a need that customers already have now, well before the technique is mature.

Weight-Space Programming marks an important shift, because it moves intervention on weights from the hands of researchers and optimizers to those of a model that can explain what it is doing. The results should be read with measure. The most striking case is the removal of a flaw rather than the addition of a skill, and attempts to add capabilities have so far failed. Still, the direction is clear and the work is documented in an exemplary way.

As for me, seeing an MIT group arrive at surgery on models and point to targeted erasure as one of its natural applications confirms the reasoning I made two years ago, when the idea of using model surgery to meet a regulatory obligation like the right to be forgotten was still little explored. The dates are public and anyone can compare the two texts, and for this very reason I prefer to let the comparison speak, with its similarities and its differences.

Sources

Keep reading