Sparks of Weight-Space Programming
Read first: A Mathematical Framework for Transformer Circuits · In-context Learning and Induction Heads · Locating and Editing Factual Associations in GPT · Refusal in Language Models Is Mediated by a Single Direction · Towards Best Practices of Activation Patching in Language Models: Metrics and Methods
TL;DR. A frontier LLM (“GPT-6 Astra” in the post), used with no special training and just a numpy harness, can read what a network does from its raw weights, fix it with a small targeted edit, and write a working network from scratch. It does all this without gradient descent. The post’s headline: removing a looping direction from 0.016% of Qwen3.5-0.8B’s weights raises MATH-500 from 7.9% to 48.1%.
Why it matters now. Two research lines meet here.
- Interpretability: reading circuits by hand, as in induction heads, ROME and the refusal direction.
- LLMs as optimizers: OPRO, DSPy, GEPA and autoresearch.
Earlier work already read and wrote weights in other ways: humans reverse-engineering circuits, trained probes and weight readers, compilers such as Tracr, fast-weight programmers and hand-designed networks. The narrower contribution here is that a general-purpose pretrained model directly proposes and inspects weights without an additional task-specific training stage, in these demonstrations. That treats weights as one more program an LLM can edit. For an IR/agents lab, the open question is whether “audit or patch a model by reading it” becomes an agent task with its own benchmarks and harnesses. The authors say they are building those.
The eight experiments
Section titled “The eight experiments”The access column matters: results under different access regimes are not directly comparable.
| # | Mode | Target | Access | What happened |
|---|---|---|---|---|
| 1 | Read | 4 PPO game MLPs (17,253 weights) | Raw-text weights, no tools | Named the game from raw weights alone, e.g. Breakout at 99% confidence |
| 2 | Read | 3 small DDPMs | Raw-text weights, no tools, no forward passes | Drew the shape each one generates (as outlines; the true outputs are filled) |
| 3 | Read | 7.2M-param character transformers, middle blocks only | Python weight analysis (up to 100 runs), no forward passes | Named the training language every time and found every induction head |
| 4 | Fix | Kinetix car-on-ramp actor (171,664 weights) | One try, no tools; scene description and one recorded episode | One edit to 3.5% of the weights took success from 0 to 1,024/1,024 episodes |
| 5 | Write | MinAtar networks, zero-shot | Weights written as text in one reply, no tools, no feedback | Breakout 517.4 vs. PPO@100M steps 15.8; Seaquest 53.1 vs. 5.6; Asterix 53.2 vs. 25.8 |
| 6 | Write | Go 9×9 network (1.48M weights) | Python sandbox (cannot run the net) + 0–50 forward passes, each a batch of up to 128 games | With 0 forward passes, wrote a 336-line “Go program as layers” that beats small PPO nets more than half the time. With 50 passes, beats an equal-size PPO net trained on 20M games |
| 7 | Read | Gemma 3 270M honest vs. sycophant pairs | Python on weights + attention-only probe on up to 16 self-written texts (≤ 20 runs) | Failed from weights alone. Succeeded 3/3 with attention patterns on texts it wrote (no outputs) |
| 8 | Fix | Qwen3.5-0.8B (thinking) | Python kernel + 10/25/50 forward passes, each answering up to 512 practice problems | Removed a looping direction (layers 15 and 19, 131K weights). MATH-500 7.9→48.1, GSM8K 13.8→67.1, IFEval 21.0→62.3 |
Keep three levels of evidence apart. Author-reported: every number in the table is from the post; full logs are in the linked repo. Checkpoint rebuilder’s rerun: the released Qwen checkpoint’s model card reports 51.0% MATH-500 (500 problems × 4 samples, 31.6% hitting the token limit), run on the full multimodal release with matching language-model tensors; its base-model check was a 25-problem smoke test, so this is not a fresh, full paired base-vs-edited replication. This site: we checked the numbers against the post, not by re-running anything.
Limitations and open questions
Section titled “Limitations and open questions”- Scale: the authors say capabilities are “still limited… due to inefficiencies in context length and harnesses”. A 0.8B model was edited with tools, not read as text.
- One frontier model, few runs. Results come from a handful of attempts with one model. Variance and the role of the prompt and harness are not yet measured. A benchmark is announced.
- Evaluation hygiene: Exp 8 benchmarks were never shown to the model, but the forward-pass prompts came from the GSM8K and MATH training sets. That is fine, but note it when comparing with fine-tuning baselines.
- Research questions:
- Can weight reading find planted backdoors (cf. agentic-backdoor poisoning)?
- Can circuits be grafted between architectures?
- Do retrievers and rerankers have “readable” directions (e.g. a length-bias or lexical-match direction) that could be patched the same way?
Proposed uses (from the post, not observed results)
Section titled “Proposed uses (from the post, not observed results)”Auditing without evaluation · cheaper optimization (one-shot initialization) · capability steering and unlearning without data · recursive self-improvement · merging across architectures.
None of these is demonstrated in the post. Exp 7 is a counterexample to a universal weights-only audit: sycophancy was invisible in the static weights and needed attention probes.
Reading path around this post
Section titled “Reading path around this post”A short version is below. The full related-reading page has about 40 verified blogs and papers, including interpretability agents, model diffing, Transluce/Goodfire posts, and the authors’ other work.
- Prerequisites (how humans read networks): Zoom In: circuits → A Mathematical Framework for Transformer Circuits → IOI circuit → Towards Monosemanticity and SAEs find interpretable features → Circuit Tracing → ROME → Refusal is mediated by a single direction → Why do reasoning models loop?
- LLMs that read other models (trained readers): LMs explain neurons (OpenAI) · Activation Oracles · Learning to interpret weight differences · Weight Oracles · Natural Language Autoencoders
- Generating weights without gradients: G.pt · Neural Network Diffusion · MeZO · Evolution Strategies at scale for LLMs
- LLMs as optimizers: OPRO → DSPy → MIPROv2 → GEPA → Meta-Harness · autoresearch · Reactive Optimizers · AdderBoard
- Neighbors in this site: Recursive Language Models (same “the model drives its own computation” idea) · Karpathy’s Software 2.0 (weights as code; the page returned 403 to our checker, so the link is identified but not re-read).
Connections
Section titled “Connections”- Before: induction heads, ROME / task vectors, refusal-direction ablation, DSPy/GEPA (LLM as optimizer).
- After / open: a weight-space programming benchmark (announced), auditing for backdoors, merging circuits across architectures.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
Do the bookkeeping for two experiments. (a) The Qwen3.5-0.8B fix subtracts one unit direction u from 64 output columns of the MLP in each of layers 15 and 19, changing 131,072 weights. How many entries does each edited column have, what fraction of 0.8B weights is this, and what is the edit for one column w? (b) The Go network is 243 → 512 × 6 → 82. Count its weight-matrix entries and, assuming about 4 tokens per printed number, estimate whether it could be read as raw text in a context window.
What a strong answer covers
- (a) 131,072 / (2 layers × 64 columns) = 1,024 entries per column, so each column is one neuron's write vector into the residual stream (worth checking that 1,024 matches the model's hidden size). 131,072 / 0.8B ≈ 0.016%, the post's figure.
- Edit: w ← w − (uᵀw)u, i.e. W_S ← (I − uuᵀ)W_S on the 64 selected columns. Then uᵀw_new = uᵀw − (uᵀw)(uᵀu) = 0, so those neurons can no longer write along u.
- This is a rank-1 change on a few columns, not a full orthogonalisation of every matrix that writes to the residual stream (as in refusal-direction ablation). Attention and other neurons can still write along u.
- (b) 243·512 + 5·512·512 + 512·82 = 124,416 + 1,310,720 + 41,984 = 1,477,120 weights (≈1.48M with biases). At ~4 tokens per number that is ~6M tokens, far beyond a context window, which is why Exp 6 moves to a Python harness.
- Contrast: the MinAtar nets (600 → 32 → 32 → 6) have 19,200 + 1,024 + 192 = 20,416 weights, about 80k tokens under the same assumption, small enough to write as text in one reply.
- Mechanism
The Qwen edit raised MATH-500 from 7.9% to 48.1% by removing one direction, yet editing Gemma 3 270M left MATH-500 near 7%. Explain the mechanism that makes a single-direction ablation so effective on one model and useless on the other. What does the "hit token limit" column tell you about where the gain comes from?
What a strong answer covers
- Base Qwen hits the 32,768-token limit on 93% of MATH-500 answers, so most failures are non-answers, not wrong answers. After the 50-pass edit this falls to 33%, and accuracy rises because answers the model could already derive now finish.
- If the looping state is sustained by a feature written along one residual direction, removing the MLP writes along it breaks the self-reinforcing repetition without touching the computation that solves problems. Same logic as the single-direction refusal result.
- Gemma rarely loops (8.5% of answers at its token limit). Its errors are ordinary arithmetic and algebra mistakes with no single component to switch off, so there is no low-rank obstacle to remove.
- These runs removed a blocker in Qwen and did not establish a capability gain in Gemma; they do not prove that weight editing cannot add abilities. The IFEval gain (21.0 → 62.3) fits the blocker-removal reading, since looping is not math-specific.
- Critique
In the Qwen experiment each forward-pass budget is a separate editing run. With 10, 25 and 50 passes: MATH-500 12.3 / 14.1 / 48.1, IFEval 49.0 / 39.9 / 62.3, and share of MATH-500 answers at the token limit 87.2 / 86.4 / 33.1. What can and cannot be concluded about "more forward passes give better edits", and which controls would you require before believing this edit needs a frontier LLM to find?
What a strong answer covers
- One run per budget, one model: budget is confounded with run-to-run variance of the agent. The jump between 25 and 50 may be a different edit being found, not a smooth scaling trend. You need several runs per budget and intervals.
- IFEval more than doubles at 10 passes while MATH looping barely moves, then drops at 25. So the 10-pass edit changed something the MATH looping metric does not capture. Probe: measure token-limit hits and length on IFEval too, and compare the directions found at each budget (cosine similarity).
- Baselines at equal access: (i) ablate a random direction in the same 64 columns; (ii) a hand-computed difference-of-means direction between looping and non-looping activations, ablated the same way; (iii) decoding-side fixes beyond the presence penalty of 1.5 already used. If (ii) or (iii) recovers most of the gain, the contribution is the diagnosis, not the edit.
- Side effects: check the other reported benchmarks and perplexity, so an edit that only shortens outputs is not read as a capability gain.
- What if…
In the sycophancy experiment Astra failed in all four attempts from weights alone, but picked the sycophant in all three pairs once it could see attention patterns (not outputs) on up to 16 texts it wrote itself. Embeddings and output layers were frozen during fine-tuning. Explain why the extra access mattered, and predict what changes if (a) the output layer had not been frozen, (b) Astra were given only the weight difference between the two models, (c) the texts were fixed in advance instead of chosen by Astra.
What a strong answer covers
- Two fine-tunes from the same start differ in many weights, and most of that difference is irrelevant to the behaviour. Behaviour depends on weights and inputs together, so a static comparison cannot say which differences matter.
- Attention on chosen texts is an experiment: put a user suggestion in the prompt and see where the answer position looks. In the sycophant, head 10.2 put 85.7% of its weight on the user's answer, against 0.75% in the honest model.
- (a) An unfrozen output layer allows a shortcut through output-token preferences, so success would no longer show that internals were read. Freezing is the control that makes the result meaningful.
- (b) A weight diff narrows where to look but still lacks input dependence. Open probe (not tested in the post): localisation gets easier, naming the behaviour stays hard without running anything.
- (c) Tests whether the gain comes from adaptive experiment design. If fixed or random texts work as well, the attention tool, not Astra's choice of probes, does the work.
- Connect
Place weight-space programming precisely among three neighbours: refusal-direction ablation, zeroth-order optimisation such as MeZO or evolution strategies, and LLM-as-optimizer methods such as GEPA. For each, state what proposes the update and what is searched over, and describe the limiting case where weight-space programming reduces to that method.
What a strong answer covers
- Refusal-direction ablation: a fixed human recipe computes a direction from contrastive activations and projects it out. Here the LLM chooses the direction and the components to edit. Put the recipe in the prompt and the two coincide.
- MeZO / ES: updates come from random perturbations scored by many forward passes, with no understanding. Weight-space programming uses 0 to 50 forward passes and reasoned proposals. An LLM that proposed random perturbations and kept the better one would be a very inefficient ES.
- GEPA / DSPy: an LLM reads traces and rewrites prompts or programs while weights stay fixed. Here the program being rewritten is the weights, so the same reflect-and-edit loop moves into parameter space.
- With 0 forward passes and writing from scratch (Exp 5; Exp 6 at budget 0), it is closest to compiling a program into weights (cf. Tracr), not optimisation at all.
- Research idea
Pitch a project testing whether neural rankers have readable, patchable directions the way Qwen had a looping direction. Pick one known ranking bias (for example a preference for longer passages or for exact lexical overlap), and give a falsifiable hypothesis, a minimal experiment with an LLM editor and a forward-pass budget, and the result that would kill the idea.
What a strong answer covers
- Hypothesis: the bias is mediated by a low-rank direction in a cross-encoder or dense retriever, so removing it reduces the bias while preserving ranking quality elsewhere.
- Setup: a small cross-encoder; an LLM with a Python harness over the weights and a forward-pass budget on training queries only; it must report which components it edits and why. Evaluate on held-out collections (e.g. BEIR) with nDCG plus a bias metric on controlled pairs (same passage, padded vs unpadded).
- Baselines at equal access: a hand-computed difference-of-means direction, a random direction, and a small fine-tune on debiased pairs. Report how many weights each changes.
- Falsified if the LLM edit does no better than the hand-computed direction, if removing the bias costs as much nDCG as it gains, or if no single direction captures it (the bias is spread out, like Gemma's math errors).