Overthinking it: why small reasoning models get stuck in loops, and how to fix it
Small reasoning models like Qwen3.5 often find the answer early, then keep checking it until the token budget runs out. Here's what research says about these loops, and how the fixes now going around compare: sampling tricks, Unloop, AntiLoop, steering and FTPO. At the end you'll find concrete settings for llama.cpp, LM Studio and vLLM.

What's going on
If you run a small reasoning model like Qwen3.5-0.8B or -2B locally with "thinking" switched on, you've probably seen this: the model works through the problem, arrives at a result, and then writes "Wait, let me double-check…" over and over until the token budget runs out. You never get an answer. Qwen itself warns in the Qwen3.5-0.8B model card that with the recommended settings, the model is more prone to "thinking loops" than its larger siblings.
New measurements from the Russian research institute AIRI (project Optimal Cognitive Core, OCC) put numbers on the problem. According to their Habr article, Qwen3.5-0.8B gets stuck in a loop in 25.1 percent of responses. The key finding comes from 23,818 looping responses from the 4B model: in 76 percent of them, the correct answer was already in the text, at a median of 6 percent of the response length. The loop didn't set in until around 25 percent. So the model knows the answer. It just can't stop checking it. The authors write:
"The loop isn't an inevitable price of small size: the model often already knows the answer and simply can't stop."
This matters right now because local agent apps like LM Studio Bionic or Linger let small models work on their own for hours. In the issue tracker of the Zed editor, users describe Qwen3.6-35B-A3B, running as an agent, trying again and again to create a folder it had created long ago. One session ran like that for three to four hours.
Why models go in circles
Two research papers offer explanations. The paper "Wait, Wait, Wait… Why Do Reasoning Models Loop?" by Pipis et al. traces the cause to learning errors: gaps between what the model was supposed to pick up in training and what it actually learned. The authors identify two mechanisms:
- Risk aversion: If the step that actually moves things forward is hard to learn but repeating is easy, the model assigns more probability to repetition. "Check again" is always a safe bet.
- Temporally correlated errors: Transformers tend to stick with a mistake once they've made it. So the same steps get chosen again and again.
The numbers at temperature 0, where the model always picks the most likely word, are stark. The benchmark was AIME, a math competition:
| Model | Share of loops (T = 0) |
|---|---|
| R1-Distill-Qwen-1.5B | 76% |
| R1-Distill-Qwen-7B | 49% |
| R1-Distill-Qwen-32B | 37% |
| OpenThinker3-1.5B | 30% |
| OpenThinker3-7B | 10% |
| QwQ-32B (teacher model) | 4% |
Smaller models loop more often. Distilled models stand out in particular. These are small "students" trained to imitate the reasoning of a large "teacher", and they fall into loops even though their teacher hardly ever does. A higher temperature, meaning more randomness in word choice, largely gets rid of the loops. But the answers stay needlessly long. The authors' verdict: temperature is "a stopgap, not a holistic solution."
The second paper, "Circular Reasoning", describes the loop as a self-reinforcing trap. The text already written becomes the template for its own repetition. Loops get triggered where the model is stuck, often at words like "But" or "Wait". After that, the model's confidence jumps, and its attention locks more and more onto the passages it's repeating. The practical takeaway: the model repeats itself in content before it repeats itself word for word. At a temperature of 0.1, R1-Distill-Qwen-7B looped in 92 percent of cases on the LoopBench test set. At 1.0 it was 18.7 percent. There is one contradiction, though: unlike Pipis et al., these authors find no significant link to model size or distillation. So the cause isn't fully settled.
The fixes compared
| Fix | Where it works | Measured effect | Cost |
|---|---|---|---|
| Presence penalty / temperature | at sampling time | helps partly, depending on model and software | also penalizes numbers and names that legitimately repeat |
| Qwen3.5-Unloop (DPO) | new weights, 0.8B–9B | 0.8B: 25.1% → 3.1% loops | separate download, first version cost a lot of points |
| AntiLoop (LoRA, Qwen3.6-35B-A3B) | fine-tuning, merged | LoopHard: 25.26% → 3.51% | so far NVFP4 for vLLM only |
| Steering vector (0.8B) | at runtime, two layers | MATH-500: 18 → 46 correct out of 100 | only via the PTS tool, not in llama.cpp |
| Antidoom / FTPO (LiquidAI) | training method you run yourself | per Liquid, Qwen3.5-4B: 22.9% → 1% | compute cost, risk of new loops |
Presence penalty. The presence penalty docks points from every token that has already appeared. For thinking mode, Qwen recommends temperature 1.0 and a presence penalty of 1.5. AIRI points out the catch: the penalty applies to every response, including the ones that don't loop. If the model writes "let x = 3", every further x and every further 3 becomes less likely. Qwen itself admits that high values can cause language mixing and slightly reduce performance. Whether it helps at all is disputed. In NobodyWho issue #557, a developer tested around 20 configurations, including the official ones, and every one of them looped. David Vassallo writes on his blog about running Qwen3.6-35B-A3B in vLLM: a higher presence penalty produced endless thinking full of random words. What helped him was a repetition penalty of 1.1. Qwen issue #145 about infinite loops despite official parameters was closed as "not planned" in August, without a fix.
DRY sampler. DRY ("Don't Repeat Yourself") only penalizes a token if it would extend a verbatim repetition of an earlier passage. According to a paper from August, DRY roughly halves verbatim loops. Reasoning models weren't tested there, though. Since "Circular Reasoning" shows that thinking loops start in content first, DRY probably only catches them late. That's our assessment; there are no measurements on this.
Unloop (DPO). AIRI post-trained the models with DPO (Direct Preference Optimization), using pairs of a good and a bad response. The good response is built like this: the text is cut right after the first correct answer, and the model then writes a short ending. The bad response is the original loop. The first version went wrong. The 4B model lost 7 points on GPQA and 16 on AIME, because 37 percent of the "bad" responses weren't loops at all, just long, correct chains of reasoning. The model learned to stop too early. The fix: only texts that hit the token limit without an answer and end in repetition now count as bad. Here are the numbers for the released version, according to the model cards:
| Size | Loops (LoopScore) | Token limit hit | Avg. score (7 tests) | Tokens |
|---|---|---|---|---|
| 0.8B | 25.1 → 3.1% | 32.6 → 8.6% | 19.5 → 24.7 | −49.5% |
| 2B | 11.7 → 5.2% | 18.7 → 9.7% | 48.5 → 53.3 | −30.8% |
| 4B | 4.8 → 2.7% | 9.3 → 6.8% | 70.9 → 71.9 | −12.2% |
| 9B | 6.5 → 3.9% | 13.9 → 4.0% | 74.2 → 74.7 | −29.2% |
The smallest model gains the most: on MATH-500 it jumps from 22.0 to 50.8 points. There are losses too, such as −2.1 points on τ²-bench (4B) and −2.0 on BFCL (9B). The weights are available under Apache 2.0 in the Hugging Face collection, as GGUF from BF16 down to Q4_0. All numbers come from AIRI itself. We found no independent replication.
AntiLoop for Qwen3.6-35B-A3B. Developer N8Programs tuned the model with a LoRA, a small add-on module trained after the fact. The training data was just 178 examples. Each starts with a real loop opening and then shows the model noticing it isn't making progress and answering honestly. To keep the model otherwise unchanged, KL regularization makes sure it barely shifts on everyday questions. On the LoopHard test, with 285 enumeration tasks, the loop rate drops from 25.26 to 3.51 percent, and combined with a presence penalty of 1.5 down to 0.35 percent. GPQA Diamond stays practically flat (84.34 vs. 83.84 percent). So far the model is only available in NVFP4 format for vLLM. There's no GGUF version yet.
Steering vector. A steering vector is a direction inside the model that you subtract out while it generates. MIT researchers traced the loops of Qwen3.5-0.8B back to a single such direction. According to Simon Willison, MATH-500 rose from 7.9 to 48.1 percent after changing 0.016 percent of the weights. Critics note that this doesn't make the model better at math, it just stops it from getting stuck. As a runtime option there's LocalLLaMA/Qwen3.5-0.8B-anti-loop for the PTS tool (MLX and PyTorch): instead of 8 out of 96 math problems, it fully solves 49.
Antidoom/FTPO. LiquidAI's method targets the first token of the first repetition and shifts its probability to the alternatives. According to the Liquid blog, the loop rate for Qwen3.5-4B with no randomness in word choice drops from 22.9 to 1 percent. AIRI, by contrast, measures 14.1 percent residual loops for FTPO. The reason is different test conditions. Above all, it shows how much the detector shapes the results: for the same base model, Qwen3.5-4B, LiquidAI's detector reports 0.38 percent loops, while AIRI's LoopScore reports 4.78 percent.
Concrete settings
llama.cpp (original Qwen3.5 with thinking):
llama-server -hf unsloth/Qwen3.5-4B-GGUF --reasoning on \
--temp 1.0 --top-p 0.95 --top-k 20 --min-p 0 \
--presence-penalty 1.5 --reasoning-budget 8192 \
--reasoning-budget-message "Enough checking, answer now."
Important: in llama.cpp, the presence penalty only applies to the last tokens in the --repeat-last-n window, 64 by default. You can see this in the source code, which passes both values to the same sampler. So longer loops slip through. A bigger window (say 256) may help, but it also penalizes more legitimate repetition. That's our assessment; nobody has measured it. The reasoning budget acts as an emergency brake. In May, a bug caused it to insert garbled characters instead of the message (issue #22717). It's been fixed since. To run Unloop, use -hf occ-ai/Qwen3.5-4B-Unloop-GGUF --temp 0.6 --top-p 0.95 --top-k 20 --presence-penalty 0.
LM Studio: The presence penalty slider has been there since version 0.4.7. According to the bug tracker, though, it was still missing for MLX models as of April. If you can't find it, use the GGUF variant, or go straight to Unloop, which doesn't need the penalty.
Ollama: According to the open issue #14493, the Go runner silently drops presence, frequency and repeat penalties. So if you're relying on the penalty in Ollama, it may not be active at all.
vLLM:
vllm serve Qwen/Qwen3.5-4B --reasoning-parser qwen3 \
--override-generation-config '{"temperature":1.0,"top_p":0.95,"top_k":20,"presence_penalty":1.5}'
Here the penalty counts all generated text, so it hits harder than in llama.cpp. According to a write-up on DEV, an API layer dropped top_k and the thinking switch. It's worth pinning the settings on the server and checking at startup that they actually took effect.
The big picture
The research agrees on one point: loops are a training flaw, not a sign of stupidity. Sampling settings only treat the symptom. That explains why experiences with the presence penalty are so contradictory: they depend on the software, the window and even the quantization. In one Ollama case, a broken NVFP4 quantization was what caused the loops.
Our take: for Qwen3.5 up to 9B, Unloop is currently the easiest route, because it ships as GGUF and doesn't need penalty tricks. In agent setups, you should still always add a reasoning budget as an emergency brake. It remains to be seen how well the developers' numbers hold up under independent testing. It's also unclear whether these methods carry over to agents making tool calls. AIRI itself names that as its next project.
Sources
- Habr: Qwen3.5-Unloop (AIRI/OCC) habr.com
- Braintools: Spiegel des Habr-Artikels braintools.ru
- Hugging Face: occ-ai/Qwen3.5-0.8B-Unloop huggingface.co
- Hugging Face: occ-ai/Qwen3.5-2B-Unloop huggingface.co
- Hugging Face: occ-ai/Qwen3.5-4B-Unloop huggingface.co
- Hugging Face: occ-ai/Qwen3.5-9B-Unloop huggingface.co
- Hugging Face: N8Programs/Qwen3.6-35B-A3B-AntiLoop-NVFP4 huggingface.co
- Hugging Face: AntiLoop-SFT-Datensatz huggingface.co
- arXiv: Wait, Wait, Wait... Why Do Reasoning Models Loop? arxiv.org
- arXiv: Circular Reasoning arxiv.org
- LiquidAI-Blog: Antidoom liquid.ai
- Hugging Face: LiquidAI/antidoom-mix-v1.0 huggingface.co
- Hugging Face: LocalLLaMA/Qwen3.5-0.8B-anti-loop huggingface.co
- Simon Willison: Sparks of Weight-Space Programming simonwillison.net
- Hugging Face: Qwen/Qwen3.5-0.8B huggingface.co
- Hugging Face: Qwen/Qwen3.5-4B huggingface.co
- GitHub: NobodyWho Issue #557 github.com
- GitHub: Ollama Issue #14493 github.com
- GitHub: Ollama Issue #15880 github.com
- GitHub: LM Studio Bug-Tracker #1604 github.com
- GitHub: Zed Issue #55848 github.com
- GitHub: llama.cpp Issue #22717 github.com
- llama.cpp Server README github.com
- llama.cpp common/sampling.cpp (Spiegel) huggingface.co
- vLLM: SamplingParams-Doku docs.vllm.ai
- Hugging Face: Qwen3.5-35B-A3B Diskussion #39 huggingface.co
- David Vassallo: Hard lessons learned with Qwen3.6-35B-A3B blog.davidvassallo.me
- DEV Community: Serving Qwen3.5-0.8B with a 0.016% weight edit dev.to
- alphaXiv: Don't Repeat Yourself (DRY) alphaxiv.org
- Unsloth: Qwen3.5 lokal ausführen unsloth.ai
Ask the AI assistant
Questions about this article, installation or background? Our assistant knows this page and runs on our own machine, not in someone else's cloud.
The Assistant is an AI (Gemma 4) and can make mistakes – please check important details against the source. Questions are used only to generate an answer and are deleted after one hour. Please don't enter any personal data.
Comments
What do you think? Already tried it? Write it here, no sign-up needed.
Comments are public. Links aren't allowed, and we delete abusive posts. You can delete your own comment at any time in this browser. Learn more in the Privacy Policy.