Blog
hedwigaihedwigaihedwigai

Interpretability

Does a weight edit teach Qwen3.5-0.8B math, or stop it looping?

A team at MIT CSAIL gave an AI agent a hard job. Make Qwen3.5-0.8B better at math, with no training and no gradient descent. The agent had a Python session over the weights and 50 forward passes on practice problems.

It changed 131,072 weights in two layers, 0.016% of the model. With thinking on, the model’s MATH-500 score rose from 7.9% to 48.1%. The write-up calls this weight-space programming.

Watching an agent do this is thrilling. The authors say plainly that it traced the model’s thinking loops. Much of the excitement online read it as an agent teaching a model math. Those are different claims, so we tested the difference.

The short answer is that the edit stops a loop. It adds very little math.

Share of MATH-500 answers that are right, Qwen3.5-0.8B
Thinking on Thinking with a budget Thinking off Edited model
Unedited, thinking on7.9%

Up to 32,768 tokens. The authors' number.

Edited, thinking on48.1%

Up to 32,768 tokens. The authors' number.

Unedited, thinking cut at 8,192 tokens34.3%

Thinking that has not ended by 8,192 tokens is closed, and the model is asked for its answer.

Unedited, thinking off43.6%

The model card's default mode and settings. Up to 8,192 tokens.

Edited, thinking off45.2%

The same settings.

The edit

The edit takes away one direction

Each layer of the model ends with an MLP. Its last matrix, down_proj, takes 3,584 neuron values and writes them into the residual stream, the 1,024-number vector that every token carries from layer to layer.

We subtracted the original weights from the published edited weights. Only two matrices differ, the down_proj of layers 15 and 19. In each one, 64 neurons were changed.

Each change has rank one. Every changed neuron now writes a little less along one shared direction. The directions of the two layers are nearly the same, with a cosine of 0.85.

So the edit works like this. When those 64 neurons fire together, a fixed direction is taken out of the residual stream. The harder they fire, the more is taken out.

64 of 3,584 neurons

In each of layers 15 and 19

One direction taken out

More when the neurons fire harder

The residual stream

The 1,024 numbers each token carries

What the neurons track

The edited neurons fire when the model repeats itself

The authors published 20 answers from the unedited model with thinking on. 19 of the 20 run to the token limit. We read the first 12,000 tokens of each answer back through the unedited model. At every token we measured how much the edit would take away there.

We marked a token as repeated when the 16 tokens ending at it had already appeared in the same answer. That gave 105,107 repeated tokens and 133,483 new ones.

In 92 of 100 pairs of one repeated token and one new token, the edit takes away more at the repeated one. In layer 19, it takes away 4.5 times as much at a repeated token as at a new one.

One problem shows this clearly. The model has to convert the point (0, 3) to polar coordinates.

How much the edit removes at each token, layer 19, on “Convert the point (0, 3) in rectangular coordinates to polar coordinates.”
01234503k6k9k12ktokens into the answerRight answer writtenLoop begins
The unedited model’s answer, which loops The edited model’s answer, which finishes

Both answers are read by the unedited model. Each point is the mean over 200 tokens.

The unedited model finds θ = π/2 by token 1,423 and writes the full answer by token 2,553. Then it keeps checking. At token 7,200 it starts to write one line over and over: “Wait, tan(3π/2) = tan(π + π/2) = tan(π/2) = ∞.” It writes that line until the limit of 32,768 tokens and never gives an answer.

The value stays below 1.5 while the model reasons, and climbs past 4 as soon as the loop starts. The edited model answers the same problem correctly in 10,097 tokens, and on its answer the value stays low throughout.

The agent found a real mechanism. These neurons track the loop, and what they write keeps the loop going. Take it away and the model stops going round in circles.

Other ways out of the loop

Turning thinking off does almost as much

The model card says Qwen3.5-0.8B runs without thinking by default. It also warns that in thinking mode the model is more prone to thinking loops. So we ran MATH-500 the way the card suggests.

With thinking off, the unedited model scores 43.6%, and the edited model scores 45.2%. The edit is worth 1.6 points here.

The answers that finish are just as good with and without the edit. 65.1% of the unedited model’s finished answers are right, and 65.5% of the edited model’s. The edit lets 1,371 of 2,000 answers finish, against 1,331 without it. That small gain is the whole difference.

We also kept thinking on and gave it a budget. Thinking that had not ended by 8,192 tokens was closed, and the model was asked for its answer. 946 of 1,000 answers were still thinking at that point. Asked to stop, the model got 30.7% of them right. All 53 answers that finished on their own were right. Overall it scored 34.3%.

The control

A random edit of the same size does not stop the loop

Any large change to a small model can shake it out of a loop. So we made a control edit. It changes the same 64 neurons in the same two layers by exactly as much. The only difference is the direction, which is random.

We ran all three models on the first 100 problems of MATH-500, with thinking on and one answer a problem.

First 100 MATH-500 problems, thinking on, one answer a problem

Unedited

Right, of 100 problems

12

Answers that hit the token limit, of 100

90

Random edit of the same size

Right, of 100 problems

19

Answers that hit the token limit, of 100

80

The agent's edit

Right, of 100 problems

51

Answers that hit the token limit, of 100

34

The random edit moves the score a little, within what chance gives on 100 problems. It leaves 80 of 100 answers stuck at the limit. The agent’s edit leaves 34. The direction is what matters, and the agent found the right one.

Try it yourself

Does the edit stop the loop on your problem?

  • Four MATH-500 problems, recorded and free to look at
  • Your own problem, answered by both models with the same seed
  • The edit's signal under each answer, with the loop marked

Three runs free, then 5 cents a run.

Run both models

Run it from ChatGPT, Claude or Hermes

Connect hedwigai to your assistant once. Then ask it in plain words, and it runs the weight-edit program for you, on the same account and the same free runs.

“Use hedwigai's weight-edit program on this problem and tell me whether the unedited model loops: How many positive divisors does 196 have?”

What it means

The score measures a loop removed, not math learned

We love this result. An agent read a model’s weights, found the direction that traps it, and removed it with 0.016% of the parameters. That is interpretability done by a machine, and it worked.

The jump from 7.9% to 48.1% measures something narrower than math. The unedited model already solves 43.6% of the problems when it is not allowed to loop. The edit gets it to roughly that point with thinking on.

A fair baseline for an edit like this is the model at its best settings, not at its worst. Against that baseline, the gain is 1.6 points.

  • Qwen3.5-0.8B has a residual width of 1,024 and 3,584 MLP neurons per layer. Layers and neurons are numbered from 0. The base weights are revision 2fc06364 on Hugging Face.
  • Every run used vLLM with bf16 weights on one RTX 3090. Answers were graded with math-verify on the last \boxed{} after the thinking, using the authors’ prompt.
  • Thinking on used the authors’ settings: temperature 0.6, top-p 0.95, top-k 20 and presence penalty 1.5. The run with a thinking budget drew 2 answers a problem and allowed 4,096 tokens of answer after the thinking was closed.
  • Thinking off used the model card’s settings: temperature 0.7, top-p 0.8, top-k 20 and presence penalty 1.5, with 4 answers a problem and a limit of 8,192 tokens.
  • The value at a token is the dot product of the 64 changed neurons’ values with the edit’s coefficients, scaled by the size of the edit. It is how far the edit moves the residual stream at that token.
  • The thinking-on scores without a budget are the authors’. On the first 100 problems we measured 12% for the unedited model and 51% for the edited one.

More head-to-head evals

GLM-5.3 against DeepSeek V4.1 Flash on 75 questionsTwo models answer the same 75 questions; one is always right, the other 14× cheaper.
MeasureGLM-5.3DeepSeek V4.1 Flash
Right, of 757571
Seconds a question, median3.91.8
Read the comparison
How we made a long-running AI agent for knowledge work 4× fasterOne cited knowledge work task through 13 experiments: 937 s to 233 s, with the model held constant.
MeasureFirst runBest since
Landscape, seconds937233
Memo, seconds759602
Read the report
Ten models plan a change to a spreadsheet: which do it in under a minute, traced call by callTen models drive one agent harness through the same spreadsheet request; six write the plan, timed and traced call by call.
MeasureQwen3 235BGLM-5.2Gemini 3.8 FlashClaude Opus 5
Seconds to the plan, median27485794
Plans written, of three runs2333
Read the comparison
SubQ, jev, Perplexity's Decider and Bespoke's Nimble on biotech diligence memos: finding the sentences a column is aboutFour decision models judge every sentence of ten biotech diligence memos for five columns, scored against sentences a person marked.
MeasureSubQjevDeciderNimble
Found, mean of five columns at section length64%65%66%68%
Mechanism of action, found at section length57%51%61%54%
Read the comparison
Leads with a reason to write: hedwigai ask, Apollo and treg on one brief40 leads each, every one checked: the right person, an inbox that accepts, and a dated reason to write.
MeasureaskApollotreg
Usable leads13 of 407 of 406 of 28
Cost per usable lead$0.037$0.27$0.23
Read the comparison
Self-hosted decisions for ask: Perplexity's open Decider in place of jev on 92 company questionsThe decisions inside hedwigai ask made by Perplexity's open Decider on two NVIDIA RTX 3090s, against jev.
Measureask with jevask with Decider
Questions right, of 928989
Wrong answers12
Read the comparison
Clinical decisions: jev and ask on System One, PubMedQA, SciFact and a 370-decision setEdgeEvals' System One board, PubMedQA, SciFact, and a clinical set built to System One's rules.
Measurejevask
Our 370 clinical decisions, right94.6%93.0%
PubMedQA, right (best EdgeEvals scored: 62.2%)77.0%74.4%
Read the comparison
Executive lookup for US-listed companies: Claude Opus 5.5 and ask on 95 questionsWho runs a public company, and how to email them: a frontier model from memory against hedwigai ask.
MeasureaskClaude Opus 5.5
Questions right, of 955963
Small companies right, of 20139
Read the comparison
Rental comps: floor-plan rents and amenities on 14 listings, five assistants comparedRent per floor plan and amenities for US rentals: hedwigai realestate-us against Claude, GPT, Gemini and Perplexity with web search.
Measurerealestate-usBest of four assistants
Floor-plan rents right, of 262623
Amenities claimed the listing doesn't state12129
Read the comparison
Company screening from SEC filings: jev, Vela 2.0 and ask on 92 yes/no questionsYes-or-no questions about public companies, answered by two decision models alone and by hedwigai ask.
Measureaskjev
Right, of the questions answered98%79%
Wrong answers, of 92219
Read the comparison
Defect localization in industrial images: four frontier models and a trained localizerFour frontier models asked to put a box around what they just described.
MeasureTrained localiserBest of four frontier models
Mean overlap with the defect (IoU, 0 to 1)0.4210.109
Read the comparison