Technical Deep Dive November 23, 2026 9 min read Interpretability Weight-Space Skepticism Flag

Weight-Space Programming: Reading Weights in Context, Editing Them with Code, and What Changes Without Gradients

Take-home: The MIT study combines two setups. Reading raw weights as text relies heavily on input/output shapes and dataset priors. Editing weights from a Python sandbox produced the headline result: removing one direction from 131,072 MLP weights (0.016%) of Qwen3.5-0.8B largely cured its reasoning loops.

Contents

1. Two setups under one name

Weight-Space Programming (WSP), introduced by Rikiya Takehi, Jayden Teoh, Alex Zhang and Omar Khattab at MIT CSAIL (experiment logs), asks whether a language model can work with a neural network's parameters directly, reading them or writing them, without gradient descent. The study's eight experiments use two setups that behave quite differently, and keeping them apart explains both the striking results and the criticism.

Write $\theta = \{W^{(\ell)}, b^{(\ell)}\}_{\ell=1}^L$ for the parameters of a target network $f_\theta$. Let $M_\phi$ be the language model doing the work: mainly gpt-6-astra, with smaller replications on Qwen 3.8 27B and Claude.

  1. Setup A: reading and writing weights as text. The weights are written into the prompt as numbers. $M_\phi$ cannot run the network. It either names what the network does (weight reading) or writes out a complete set of weights in one response from a description of the task (weight writing).
  2. Setup B: working on weights with code. $M_\phi$ works in a Python sandbox with torch and numpy. It has read and write access to $\theta$ and a budget of $B \in \{0, 10, 25, 50\}$ forward passes, with no backpropagation or optimizer. It writes analysis scripts (SVD, norms, attention statistics, activation comparisons) and applies closed-form linear-algebra edits to selected parts of $\theta$.
ExpTaskTargetSetup and budgetOutcome
1Identify the Atari game a policy was trained on (Breakout, Pong, Pac-Man, Freeway)Small RL policiesA ($B = 0$)High accuracy for gpt-6-astra; replicated locally on 3 of 4 games with Qwen 3.8 27B
2Identify the 2D shape a model generatesToy diffusion MLPA ($B = 0$)Infers the shape from symmetries and bias offsets
3Identify a model's training language (Python, romanized Japanese, English)Small LMs with embeddings removedB (sandbox)Uses attention statistics and copying-head structure
4Repair a broken car-control policySmall control MLPA (one edit, $B = 0$)Finds an inverted or saturated sign and fixes it in one turn
5Write MinAtar policies from the game rules (Breakout, Seaquest, Asterix)Small CNN/MLP policiesA ($B = 0$)Hand-built feature detectors beat multi-million-step PPO baselines on simple games
6Build a $9 \times 9$ Go policy/value network1.5M-parameter conv netB ($B$ up to 50)Generates translation-invariant kernels for liberties and captures; improves steadily with $B$
7Find which checkpoint was fine-tuned for sycophancyTwo Gemma-3-270M variantsB (weights plus attention probes)Weight differences alone are not enough; combined with attention maps they locate the responsible heads
8Stop reasoning loops in a small LMQwen3.5-0.8BB ($B = 50$)Editing 0.016% of weights raises MATH-500 from 7.9% to 48.1% and IFEval from 21.0% to 62.3%

2. Experiment 8: removing a loop direction from Qwen3.5-0.8B

Experiment 8 is the result that drew attention beyond toy models, so it is worth seeing exactly what was changed.

The problem

Qwen3.5-0.8B has $L = 24$ transformer blocks, hidden size 1024, and about $8.0 \times 10^8$ parameters. Its model card documents a known failure: during step-by-step math solutions it often falls into repeating phrases until it runs out of tokens. On MATH-500, 93.0% of its attempts hit the token limit without an answer, and its score is 7.9%.

Finding the cause with 50 forward passes

gpt-6-astra did not try to read 800 million numbers. It wrote Python hooks to record the residual stream: the 1024-dimensional vector $h_t^{(\ell)}$ that each layer reads from and adds its output to.

  1. Comparing looping and non-looping text. Contrasting hidden states during repetitive stretches with those during productive reasoning revealed one dominant unit direction $v_{\text{loop}}$. Its projection $\langle h_t^{(\ell)}, v_{\text{loop}} \rangle$ rose sharply just before and during repetition.
  2. Locating where the direction is written. Each layer adds an attention output and an MLP output to the residual stream. Splitting the contributions showed that $v_{\text{loop}}$ was mainly written by the MLP output matrices in layers 15 and 19. These are the down_proj matrices $W_{\text{down}}^{(\ell)}$ of the model's SwiGLU blocks:
$$\Delta h_{t,\text{mlp}}^{(\ell)} = W_{\text{down}}^{(\ell)} \Big( \operatorname{SiLU}\!\big(W_{\text{gate}}^{(\ell)} \tilde{h}_t^{(\ell)}\big) \odot W_{\text{up}}^{(\ell)} \tilde{h}_t^{(\ell)} \Big)$$

The edit

Each column $w_c^{(\ell)}$ of $W_{\text{down}}^{(\ell)}$ is a vector that gets added to the residual stream, scaled by how active the MLP's hidden unit $c$ is. The agent ranked columns by $|\langle w_c^{(\ell)}, v_{\text{loop}} \rangle|$. It took the top 64 in each of layers 15 and 19 and removed most of their component along the loop direction:

$$w_c^{(\ell)} \;\longleftarrow\; w_c^{(\ell)} - \alpha \,\langle w_c^{(\ell)}, v_{\text{loop}} \rangle\, v_{\text{loop}}, \qquad \ell \in \{15, 19\},\; c \in \mathcal{C}_\ell.$$
# Gradient-free projection applied to layers 15 and 19
for layer_idx in (15, 19):
    W = model.layers[layer_idx].mlp.down_proj.weight.data  # shape: [1024, d_ff]
    scores = (v_loop @ W).abs()                            # alignment per MLP channel
    top_cols = scores.topk(64).indices                     # 64 channels out of d_ff
    proj = torch.outer(v_loop, v_loop @ W[:, top_cols])    # shape: [1024, 64]
    W[:, top_cols] -= alpha * proj

That accounts for the parameter count, which some secondary summaries confused with the vector dimension:

$$N_{\text{edited}} = 2 \text{ layers} \times 64 \text{ columns} \times 1024 \text{ rows} = 131{,}072, \qquad \frac{131{,}072}{8.0 \times 10^8} \approx 0.016\%.$$

Results, and why one edit helps so broadly

Without any fine-tuning:

  • The share of attempts that hit the token limit fell from 93.0% to 33.1%.
  • MATH-500 rose from 7.9% to 48.1%, and GSM8K from 13.8% to 67.1%.
  • IFEval, a strict instruction-following benchmark that played no part in the 50 practice passes, rose from 21.0% to 62.3%.

The edit is a form of directional ablation written into the weights. Arditi et al. showed that refusal in chat models is largely carried by a single direction, and that projecting it out of the weights removes refusals. Activation steering (Turner et al.; see T7) adds or subtracts such directions at inference time. ROME showed that individual facts can be edited in specific MLP layers. Experiment 8 applies this idea to a failure mode, and the agent found the direction and the layers itself. The broad gains point to a simple explanation. The model already had much of the relevant skill in the other 99.984% of its weights (R10 makes a related point about agents), and one narrow feedback pattern was derailing its generation.

3. Reading weights as text: what models use, and the limits

Setup A has drawn more scrutiny, most directly from Nazmus Sakib Ahmed's follow-up audit (arXiv:2611.08070, "Can an LLM Actually Reason and Program about Neural Network's Weights or is it just memorization on steroids?"; community discussion in T2).

What the models pick up on

Simon Willison's local replication with Qwen 3.8 27B correctly identified Pac-Man, Pong and Breakout but not Freeway. That result and Ahmed's controlled ablations point to the same cues:

  1. The input and output layers. The first layer's shape and sign patterns reflect the geometry of the input, for example a paddle tracking a ball versus a grid of bricks. The last layer's size and biases reveal how many actions there are and which ones the policy favors by default.
  2. Simple statistics. Language models handle summary arithmetic in context well. They can read normalization statistics or weight norms to spot dead units, sign flips (Experiment 4), or roughly how long a network was trained.

Limits

  1. Permutation symmetry. Reordering the hidden units of a layer, and reordering the next layer's inputs to match, leaves the network's function unchanged. For any permutation matrix $P$:

    $$\widetilde{W}^{(2)} \sigma\!\big(\widetilde{W}^{(1)} x + \widetilde{b}^{(1)}\big) = W^{(2)} \sigma\!\big(W^{(1)} x + b^{(1)}\big), \qquad \widetilde{W}^{(1)} = P W^{(1)},\; \widetilde{b}^{(1)} = P b^{(1)},\; \widetilde{W}^{(2)} = W^{(2)} P^\top.$$

    The text of the weights changes completely while the function stays the same. Architectures built to learn from weights are designed around exactly this symmetry (Navon et al.). Tracking it across several layers by reading numbers is hard to do reliably without computing anything.

  2. Dataset priors. In Ahmed's audit, small CNNs were trained on non-standard data, for example CIFAR-10 with its class labels shuffled. Language models still mapped what they saw onto the standard benchmark's expected structure, rather than working out what the network actually computes. Takehi et al.'s Experiment 3 partly anticipated this by removing the input and output embeddings. Notably, that experiment then needed Setup B.

  3. Token cost. Each number takes roughly 4 to 6 tokens of text. A network with $10^7$ parameters would need about $5 \times 10^7$ tokens. Reading weights directly is practical only for very small networks, on the order of $10^3$ to $10^4$ parameters, unless code reduces them first.

4. Writing networks without gradients favors different architectures

When language models write networks from scratch (the MinAtar policies in Experiment 5, the Go kernels in Experiment 6), they build explicit, modular pieces: convolution filters that match specific board patterns or ball-paddle offsets, connected by simple threshold rules. Trained networks look different. They tend to store many features in overlapping combinations of neurons (superposition), which is efficient for gradient descent but makes individual weights hard to interpret.

Hyunjong Ok and Jaeho Lee at POSTECH (arXiv:2611.22055, covered in R1) followed this observation through:

  • Transformers suit gradient descent: dense projections give smooth, high-dimensional loss landscapes. That suitability comes at the cost of spreading each fact across many neurons.
  • When language models may choose both the architecture and the weights, they consistently pick sparse associative-memory tables over Transformers. On ARC-style reasoning these tables reached 54.4% accuracy with about 1,800× fewer parameters and 17× faster GPU execution than LLM-written Transformers. Each row stays readable and can be edited on its own.
  • Small, table-structured policies can be checked formally. Probabilistic model checkers such as Storm can verify exact safety and reachability bounds in the logic PCTL without sampling rollouts.

5. What this means for ML practice

  1. Where hand-written weights fit. Learning rich representations of language, vision and the world remains a job for gradient training at scale. Writing weights directly pays off in small, well-structured problems (MinAtar, rule tables) and where data is very scarce.
  2. Agentic weight surgery is usable now. Experiment 8 shows that a strong language model with torch, 50 forward passes and basic linear algebra can debug a model end to end. It found a harmful direction and wrote a low-rank fix into an open-weight model in minutes, with no fine-tuning run.
  3. A new way to build small, checkable modules. Combined with Ok and Lee's sparse tables (R1), WSP is best seen as a way for language models to produce compact neural or table-based modules in which every parameter has a clear role. That also makes them candidates for formal verification.