Doom loops kill reasoning models: the model emits a span, then repeats it until the context window is exhausted. Antidoom identifies the first token that starts the loop, trains a LoRA adapter to prefer coherent alternatives at that exact position using FTPO, and leaves the rest of the distribution untouched. Qwen3.5-4B: 22.9% to 1%. Eval scores improved. Full pipeline runs in hours.
# The Problem
A reasoning model gets a hard math problem. It starts thinking. Then it emits a phrase. Then the same phrase again. And again. Until the context window is exhausted. That is a doom loop.
Let me reconsider... Let me reconsider... Let me reconsider... Let me reconsider... Let me reconsider... ... (2048 more tokens) [context exhausted]
Model stuck in infinite repetition. No answer produced.
Let me reconsider... Actually, I should try a different approach. The key insight is that x = 2pi... Therefore the answer is 42. [coherent completion]
Model recovers at the exact loop-start token. Answer produced.
# How FTPO Works
Most anti-repetition methods retrain on full gold answers. Antidoom does something narrower: fix exactly one token.
FTPO spreads probability across multiple coherent alternatives. It does not pick one replacement.
Rank 128-256 produces best results. Higher learnability with less degradation than low-rank alternatives.
Trains on all attention + MLP projections + lm_head. One epoch. Learning rate 4e-6 to 2e-5.
# The Numbers
2 models tested · Loop rate and eval scores measured independently
This is the critical finding. Antidoom does not trade capability for stability. Eval scores improved across the board after training. The improvement is attributable entirely to the reduction in looping: the model was already capable of producing the right answer, it was just getting stuck before reaching it.
# Try It
The full pipeline is one command. Edit configs/default.yaml, set your model, run.
git clone https://github.com/Liquid4All/antidoom.git cd antidoom pip install -e . # Edit configs/default.yaml # Set model_name to the checkpoint you want to fix # Default prompts: LiquidAI/antidoom-mix-v1.0 python -m antidoom # Generates FTPO pairs -> Trains LoRA -> Merges adapter
Doom loops are not a capability problem. The model already knows the answer. It just gets stuck repeating before it can reach it. Antidoom recovers, not teaches. One LoRA, one epoch, a few hours, and the failure mode drops to near zero. If you run small reasoning models in production, this is a mandatory fix.
VulnHunter: Capital One Built an Agent That Hacks Your Code First
Capital One open-sourced an agentic security tool that thinks like an attacker. It finds the bug, writes a PoC exploit, runs it, then fixes your code.
Enjoyed this?
New episodes Mon, Wed, Sat.