How Do You Fix a Small Reasoning Model Stuck in Loops?
Small reasoning models often loop until the token limit cuts them off. Count truncated answers first, then adjust mode, temperature and output limit.
For Engineering and IT

How do you tell if a small reasoning model is stuck in a thinking loop?
Count how many of its answers never reach a final answer. Run your math set, flag every response that hit the generation limit or ended without a final answer, and compute that share. If most responses are cut off, the model is looping, and your low score reflects truncation, not missing ability. Fix the mode, temperature or output limit before you blame the model or reach for fine-tuning.
TL;DR
- A low math score from a small reasoning model often means most answers never finish, not that the model cannot solve the problems.
- The first diagnostic is simple: count responses that hit the token limit or lack a final answer.
- In a recent MIT paper, most of a six-fold math gain came from stopping the loops, not from adding skill.
- The Qwen model card in question defaults to non-thinking mode and warns that thinking mode is more prone to loops on this very small model.
- The paper ran in thinking mode at a lower temperature than recommended, and separate research suggests lower temperatures make reasoning models loop more.
- Fixes to try in order: switch mode, use the recommended temperature, raise the output limit. Do not expect any of them to add skills the model lacks.
Where does this advice come from?
An MIT paper on "weight space programming" had a frontier model (GPT-6 Astra, per the paper) read and edit the weights of a small Qwen reasoning model with no training. Given a notebook with the weights and practice math problems to score against, the frontier model noticed that the small model usually never finished. It would start reasoning, then repeat the same few lines until it hit the cap on generated text.
The frontier model compared internals on answers that progressed against answers that looped. It found a direction (a specific mix of internal activations) that appeared right before repetition. It then removed that direction from the two most heavily weighted layers, a known interpretability technique. After the edit, the model scored about six times higher on the math benchmark.
You do not need any of that machinery to use the lesson. The interesting part is what the edit actually changed.
What did the edit actually fix?
It fixed finishing, not solving. The logs showed that for more than 1,000 practice problems, almost every answer the edit rescued had previously hit the generation limit. Where the original model did finish, it was already right almost every time.
The real benchmark showed the same pattern. The original model hit the limit on almost every problem. After the edit, the share that hit the limit dropped to roughly a third. Most of the six-fold gain came from answers the model already knew how to produce but never completed.
The authors also tried a small Gemma model that loops, and the edits barely moved its math score. Their conclusion: editing can remove an obstacle that hides an ability, but it cannot add a missing one.
How do you measure truncated answers?
Log the stop reason for every response. Most OpenAI-compatible APIs and local servers report a finish_reason, where length means the model hit the cap. Pair that with a check for a final answer in your expected format.
def truncation_report(results):
total = len(results)
hit_limit = sum(1 for r in results if r["finish_reason"] == "length")
no_answer = sum(1 for r in results if not r["has_final_answer"])
print(f"hit limit: {hit_limit}/{total} ({hit_limit/total:.0%})")
print(f"no final answer: {no_answer}/{total} ({no_answer/total:.0%})")
Then split accuracy into two buckets: finished answers and truncated ones. This tells you the most.
| What you see | Likely meaning | Next step |
|---|---|---|
| Most answers hit the limit, finished ones are mostly correct | Looping or overlong reasoning | Change mode, temperature, limit |
| Few hit the limit, many finished answers are wrong | A real capability gap | Larger model, better prompts, training |
| Many hit the limit, finished ones are also often wrong | Both problems | Fix looping first, then re-measure |
Also skim a few truncated outputs by eye. A loop looks like the same lines repeated, not a long chain of new steps. If the text keeps making progress and simply runs long, a bigger limit may be enough.
Should you turn off thinking mode?
Try it first, especially on very small models. The Qwen model card for the model in the paper says it runs in non-thinking mode by default. It warns that in thinking mode, where the model writes out reasoning before answering, this model is more prone to loops than the other Qwen 3.5 models. The stated reason is its small size.
The paper ran every test in thinking mode, which is the setting the card cautions against. So a baseline measured that way may understate what the model can do in its default configuration.
Run your set in both modes and compare three numbers: accuracy, truncation rate and average output length. Non-thinking mode may lose some accuracy on hard multi-step problems. For a tiny model that loops on most questions, it can still come out ahead.
Does temperature affect looping?
Yes, and the direction may surprise you. Temperature controls how random the word choices are. The paper used a lower temperature than Qwen recommends, and the video cites separate research finding that reasoning models loop more at lower temperatures. Low randomness makes it easier for a model to fall back into the same phrases.
Practical steps:
- Check the model card for recommended sampling settings and use them as your baseline.
- If you had lowered temperature for "stability", raise it back to the recommended value.
- Change one setting at a time and re-run the truncation report.
Do not push temperature up without limit. Higher randomness can hurt answer quality. The goal is to land on the vendor's recommended range, not to maximize variety.
Is a bigger output limit the fix?
Sometimes, but check first. A larger generation cap helps when the model is reasoning productively and gets cut off early. It does little when the model is repeating itself, because a looping model will fill any limit you give it. You will just wait longer and pay for more tokens.
A quick test: raise the limit and watch the truncation rate. If it barely moves, you have a loop. If it drops and accuracy rises, you had a budget problem. Many setups find a mix of both.
Can weight editing make a weaker model smarter?
Not according to this paper. The edit removed a blocker and added no new skill. There are also caveats on the result itself:
- The gains came from the runs where the model could finish. Other runs saw smaller gains or no edit at all.
- The experiments appear to have been run only once.
- The Gemma comparison involves a different model, so it is not a clean test.
- The edit also had feedback: the frontier model proposed changes, scored them on practice problems and kept what worked. That is a search process, not training with gradients, but it is still tuning against a score.
For builders, the lesson is about evaluation hygiene. A headline benchmark number can be dominated by one failure mode, and settings that differ from the vendor's guidance can create that failure mode.
Frequently Asked Questions
What is a thinking loop in a reasoning model?
It is a failure where the model starts reasoning, then repeats the same few lines instead of progressing to an answer. It keeps going until it hits the generation limit, so the response ends with no final answer.
How many truncated answers mean I have a looping problem?
The source gives no exact threshold. In the paper, the original model hit the limit on almost every problem. If most of your responses are cut off, treat it as looping and fix that before judging the model's ability.
Will switching to non-thinking mode always improve math scores?
No. It removes the long reasoning step that triggers loops, but it can cost accuracy on harder problems. Measure accuracy and truncation rate in both modes on your own set.
Does this mean small models are secretly strong at math?
Not necessarily. The paper's own Gemma test suggests you can remove an obstacle that hides an ability but not create a missing one. Fixing loops reveals what the model can already do, and that has a ceiling.
Topics
Useful for
How we source, write, and correct our articles. Editorial standards



