Liquid AI has released Antidoom, an open-source method designed to stop reasoning models from getting stuck in repetitive output loops. This issue, known as a doom loop, occurs when a model emits a specific span of text and then repeats it endlessly until the context window fills up. The problem is most common in smaller reasoning models handling difficult problems or long chains of thought.
In this article
On an early version of the LFM2.5-2.6B model, 10.2% of completions for hard math and coding tasks entered these loops. After applying Antidoom, that figure dropped to 1.4%. Evaluation scores improved across all tests, driven entirely by the reduction in looping.
How Antidoom works
The method targets a specific failure point rather than changing the model’s general sampling behaviour. It identifies the exact token that starts the loop and retrains the model to prefer different options at that single position. The rest of the probability distribution remains largely unchanged.
Antidoom adapts a technique called Antislop. It trains on pairs of chosen and rejected tokens representing a single completion step. The algorithm uses Final Token Preference Optimization (FTPO), which functions similarly to Direct Preference Optimisation (DPO).
The training does not teach the model new knowledge about mathematics or code. It simply removes the looping behaviour that was preventing the model from producing answers it already knew.
Why models loop
The Liquid AI team identifies three mechanisms working together to cause doom loops.
First, overtrained tokens combined with uncertainty. Certain tokens appear more frequently in general use. Examples include ‘delve’ and ‘testament’. These often trace back to synthetic data in the training set. In reasoning traces, high-probability continuations often include discourse markers like ‘Wait’ or ‘Alternatively’. These tokens are not inherently negative. They can signal a useful change in strategy or a verification step. However, when the model is uncertain or stuck, they become attractive fallback options.
The most common loop-starting tokens for an early LFM2.5-2.6B checkpoint were:
the (11.39%), So (4.51%), Alternatively (3.22%), Wait (2.56%), and But (2.46%).
Second, prior context reinforces the loop. Each repetition pushes every token in the span toward higher probability. Duan et al. study this in their work on circular reasoning. They link it to a V-shaped attention pattern. They find that semantic repetition precedes textual repetition.
Third, greedy sampling. Reasoning models usually run at low temperature for stable, reproducible traces. At temperature 0, the most likely token is always selected. A locally reinforced loop then has no exit. Liquid AI reports significant looping even at temp=0.67. Lower temperatures make the problem worse.
Locating the failure
Antidoom generates completions on a prompt mix designed to elicit looping, at low temperature. That mix ships as the LiquidAI/antidoom-mix-v1.0 dataset. A loop is detected when a section repeats at least four times, over at least 60 characters.
The method then targets the first token of the first repeat. At that position, it takes the base model’s top-k log-prob alternatives. It filters short or non-alphanumeric noise. It keeps up to 20 plausible substitutes as chosen tokens.
Each training row is a tuple of prompt prefix, one rejected token, and one or more chosen tokens. The chosen and rejected distributions are regularised before training. Otherwise a few culprits like Wait, So, and the would dominate and over-suppression would degrade reasoning.
The detection rule itself is simple to state in code. The snippet below is illustrative.
# A loop = a unit repeating >=4 times, spanning >=60 characters.
# Returns the index of the first token of the first repeat (the target), else None.
def find_loop(text, min_repeats=4, min_chars=60):
n = len(text)
for span in range(1, n // min_repeats + 1):
start = 0
while start + span * min_repeats <= n:
unit = text[start:start + span]
repeats = 1
pos = start + span
while text[pos:pos + span] == unit:
repeats += 1
pos += span
if repeats >= min_repeats and span * repeats >= min_chars:
return start + span # first token of the first repeat
start += 1
return NoneEach detected loop then becomes one training row. The structure is a simple tuple.
# One FTPO training row, per the post's [prefix, rejected, chosen] format.
row = {
"prompt": prefix_up_to_the_loop, # text before the first repeat
"rejected": " Wait", # the single token that started the loop
"chosen": [" So", " Since", " The", " Therefore"], # up to 20 alternatives
}Final Token Preference Optimization
FTPO is a preference-optimisation algorithm similar to DPO. A training sample has a prompt, a chosen continuation, and a rejected continuation. It is built to change a handful of tokens, with minimal disturbance to the model otherwise.
FTPO differs from DPO in four ways:
- Final token training: It trains only the trailing token of a sequence that is midway through generation.
- Multiple chosen tokens per sample: It spreads probability across a group of alternatives, so one overtrained token is not simply replaced by another.
- KL-like loss in logit space: It omits the softmax and computes divergence from reference in logits, avoiding pressure on unrelated tokens.
- Two-part regularization: Chosen and rejected logits move more freely, while the remaining vocab stays tightly constrained.
In the Antidoom implementation, the model trains for one epoch with LoRA. High LoRA ranks of 128-256 gave the best results. Training covers all attention and MLP projections, plus lm_head. Learning rates land around 4e-6 to 2e-5.
Training uses early stopping on chosen_win, the share of samples where chosen tokens beat rejected. Stopping at chosen_win=0.35 cut doom-loop rates from 20-30% down to 1-2%. Training longer tended to degrade the model.
For the early LFM2.5-2.6B checkpoint, training-set generation took about one hour on 8x MI325 GPUs. Training then took about one to two hours on a single MI325 GPU. Generation stops after collecting 20k pairs.
Comparison to other fixes
Standard repetition penalty reweights the output distribution. It is an inference-time fix that is cheap but acts as a band-aid and can degrade performance.
Reinforcement learning uses a policy via rewards. It requires calibrated rewards and costly online rollouts. The setup and compute overhead are high.
DPO final-token trains one chosen token per sample. It is an offline training method. A coarse beta updates a single token.
Antidoom (FTPO) targets the first loop token with many chosen tokens. Generation takes about one hour on 8x MI325 GPUs plus one to two hours on a single MI325 GPU. It can expose new loops and may need extra rounds.
Results
After training, the doom-looping rate on the early LFM2.5-2.6B checkpoint dropped from 10.2% to 1.4%. Evaluation scores improved across the board, attributable entirely to the reduction in looping.
Liquid AI team also ran the pipeline on Qwen3.5-4B, which is known to loop during reasoning. Its doom-looping rate dropped from 22.9% to 1% under greedy sampling. Evaluation scores increased markedly.
The evaluation score changed inversely with the doom-loop rate as temperature rose. After training, both models showed a performance drop near temp=1.0. This is expected, since higher-temperature sampling can favour less-preferred tokens. Once looping is removed, near-greedy sampling gave the strongest results.
What it means
Developers can now apply a targeted fix to stop models from repeating themselves. The pipeline runs in a few hours and the full stack is open source. This allows teams to improve reliability on hard tasks without changing the core model or relying on inference-time hacks.




