Free · Daily brief + weekly playbookDaily 60-sec AI Voice Brief + Weekly Production AI Agent PlaybookGet the brief →
ReleaseInsight · On RadarHabr AI→ original

Qwen3.5-0.8B Stopped Looping: A One-Minute Weight Edit Lifted MATH-500 From 7% to 52%

The small Qwen3.5-0.8B often repeats the same lines and never reaches an answer: on the MATH-500 test, it hit the token limit in 93% of cases. The Astra AI agent from MIT CSAIL spent 8 hours searching for a weight edit, while the author of the analysis found an equivalent fix with two one-minute calculations: accuracy rose from 7% to 51.7%. This suggests such behavioral fixes are better computed than found by brute-force search.

AI-processed from Habr AI; edited by Hamidun News
Qwen3.5-0.8B Stopped Looping: A One-Minute Weight Edit Lifted MATH-500 From 7% to 52%
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1The calculation changed 16,291 weights, while the agent changed 130,188: eight times fewer.
Key metric #2A GPU solver finishes in about a minute, while the standard HiGHS solver takes over 20 minutes.
Key metric #3On Gemma 3 270M, where loops are rare, math performance did not improve.

If you have run small models with "reasoning," you know the pain: the network starts thinking, then, like a stuck record, repeats the same few lines until it hits the token limit. In the end, there is no answer. Qwen3.

5-0.8B shows this problem especially clearly: on MATH-500 (500 competition math problems), the base version failed to formulate an answer before the 32,768-token limit in 93% of cases. The MIT CSAIL lab showed that the Astra AI agent can fix such a model with a direct weight edit, without training or gradients.

The author of the analysis on Habr noticed that almost all of the agent's work can be replaced with two one-minute calculations. The result is the same, but the number of weights that must be changed is eight times smaller.

What the Astra agent did

In the article Sparks of Weight-Space Programming, Astra got access to the weights of Qwen3.5-0.8B and changed only 0.016% of them. Accuracy on MATH-500 rose from 7.9% to 48.1%, on GSM8K (school-level word problems) from 13.8% to 67.1%, and on IFEval (instruction-following checks) from 21% to 62.3%. The share of answers cut off by the token limit fell from 93% to 33.1%.

The mechanism is straightforward. In a transformer, each layer adds its own term to the overall vector that carries a token through the network. When the model starts looping, this vector drifts in the same direction. Astra wrote four pairs of short texts: normal reasoning and its looping version. She ran them through the model and averaged the difference, obtaining a "loop direction." This took about 15 minutes.

Next, the agent modified the output matrices of the MLP blocks in layers 15 and 19 so that their columns pushed the vector in the opposite direction. A random direction did nothing (12.5% versus a baseline of about 9% on training tasks), while the correct direction raised accuracy to 33–55%, depending on the strength of the push. The longest part came next: choosing which columns to touch and how strongly. This took about 8 hours and 28 forward passes of the model.

How linear programming replaced it

The author of the analysis labeled tokens in the base model's answers: "looping," deep inside a loop, and "productive," appearing long before any repetition. In plain terms, the task is to find an edit that strongly pushes the first tokens away from the loop while barely affecting the second group. The effect of the edit depends linearly on the coefficients being sought, so all the conditions can be written as linear inequalities. That is a linear programming problem.

There is also a useful side effect: minimizing the sum of the absolute values of the coefficients (the L1 norm) yields a "sparse" solution. Almost all coefficients turn out to be zero, meaning the algorithm itself selects which columns to edit. For rigor, the author kept the 8 most influential columns in each layer and solved the problem again.

The standard HiGHS solver took more than 20 minutes on this problem. So the author wrote their own GPU solver (the PDHG algorithm, on which PDLP is based), which finds a solution in about a minute with a deviation from the optimum of no more than 0.2%.

Results and limitations

The author checked the result on data that was used neither for selecting parameters nor for tuning (the parameters were tuned on a separate set of 128 tasks). The base model scored 14.1% on GSM8K, 7.0% on MATH-500, and 22.9% on IFEval. Astra's edit (130,188 changed weights) raised these figures to 68.2%, 50.9%, and 61.9%. Linear programming with the direction Astra found (16,291 weights) gave 69.6%, 51.7%, and 59.7%. This matches the agent's result within statistical noise. A variant without an LLM and without hand-written texts, where the direction is computed as a simple repetition detector, gives 65.4%, 47.8%, and 60.4%, which is about 93% of the agent's result.

Search still matters: reapplying Astra's method (64 columns, coefficient 6) to the heuristic direction without a new search yields 44.5% on MATH-500, while solving the linear programming problem raises the result to 54.7%.

The limitations also matter:

  • only one model and one type of behavior, looping, were tested;
  • Astra still selected the layers; without the agent, this step is not automated;
  • on Gemma 3 270M, which rarely loops, there is no noticeable math improvement. As the article's authors note, the edit may remove an obstacle to a skill the model already has, but it does not add a new capability.

The practical takeaway for anyone working with small models: if a behavioral defect is encoded by a single direction inside the network, it can be found from a few pairs of examples and the minimal weight edit can be computed. Hours of search with an agent, or full fine-tuning, are not required for this.

Story

Key Questions Answered

What the Astra agent did?

In the article Sparks of Weight-Space Programming, Astra got access to the weights of Qwen3.5-0.8B and changed only 0.016% of them. Accuracy on MATH-500 rose from 7.9% to 48.1%, on GSM8K (school-level word problems) from 13.8% to 67.1%, and on IFEval (instruction-following checks) from 21% to 62.3%. The share of answers cut off by the token limit fell from 93% to 33.1%. The mechanism is straightforward. In a transformer, each layer adds its own term to the overall vector that carries a token through the network.

How linear programming replaced it?

The author of the analysis labeled tokens in the base model's answers: "looping," deep inside a loop, and "productive," appearing long before any repetition. In plain terms, the task is to find an edit that strongly pushes the first tokens away from the loop while barely affecting the second group. The effect of the edit depends linearly on the coefficients being sought, so all the conditions can be written as linear inequalities. That is a linear programming problem.

What are the key details on Results and limitations?

The author checked the result on data that was used neither for selecting parameters nor for tuning (the parameters were tuned on a separate set of 128 tasks). The base model scored 14.1% on GSM8K, 7.0% on MATH-500, and 22.9% on IFEval. Astra's edit (130,188 changed weights) raised these figures to 68.2%, 50.9%, and 61.9%. Linear programming with the direction Astra found (16,291 weights) gave 69.6%, 51.7%, and 59.7%. This matches the agent's result within statistical noise.

ZK
Zhemal Khamidun — Head of AI at Alpina Digital · MIPT (academic supervisor of the Tech Entrepreneurship department). Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
Jemal Hamidun

Editor-in-chief · Cite this analysis

Jemal Hamidun

Head of AI at Alpina Digital · Academic Supervisor of the Tech Entrepreneurship Department at MIPT

Head of AI & CPO of AlpinaGPT at Alpina Digital, Academic Lead of Tech Entrepreneurship at MIPT. Founder of Hamidun News and Vibe Academy.

Ready-to-paste citation for journalists, blogs and Telegram channels

Source: Hamidun News — Qwen3.5-0.8B Stopped Looping: A One-Minute Weight Edit Lifted MATH-500 From 7% to 52% https://news.hamidun.com/en/news/18287/qwen3-5-0-8b-stopped-looping-a-one-minute-weight-edit-lifted

What do you think?
Loading comments…