cd ~/series/demystifying-ai
Antidoom - One LoRA to Kill Your Model's Doom Loops
EP 06 GitHub Jul 18, 2026 5 min

Antidoom: One LoRA to Kill Your Model's Doom Loops

Liquid AI found the exact token where repetition starts. One LoRA adapter, trained in hours, drops Qwen3.5-4B looping from 22.9% to 1%. Full pipeline open-sourced.

Share:
// TL;DR

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.

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.

AFTER ANTIDOOM
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.

22.9%
Qwen3.5-4B loop rate
10.2%
LFM2.5-2.6B loop rate
Small models
Most vulnerable

# How FTPO Works

Most anti-repetition methods retrain on full gold answers. Antidoom does something narrower: fix exactly one token.

01
Generate Sample completions on hard prompts
02
Detect Find the first token of each repeated span
03
Train FTPO on chosen/rejected pairs at that token
04
Merge LoRA adapter merged into base model
TOKEN-LEVEL TARGETING
context: Let me think about this ...
rejected: Let (starts the loop)
chosen: Actually Wait So (coherent alternatives)

FTPO spreads probability across multiple coherent alternatives. It does not pick one replacement.

High LoRA rank

Rank 128-256 produces best results. Higher learnability with less degradation than low-rank alternatives.

Minimal collateral damage

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

Qwen3.5-4B
22.9% 1%
doom loop rate
LFM2.5-2.6B
10.2% 1.4%
doom loop rate
KEY RESULT Eval scores went UP, not down

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.

1
Epoch
128-256
LoRA Rank
Hours
Total Training Time

# 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
One-shot Generate, detect, train, merge in one run
Idempotent Skips generation if FTPO pairs already exist
Early stopping Prevents over-training that degrades quality
// Bottom Line

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.

NEXT EPISODE
Mon
#07Upcoming

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.