Liquid AI has been released destroyerAn open-source method that targets a common failure mode in logic models. that’s failure mode doom loop. In the doom loop, a model emits a span. Then it repeats that period again and again. Output continues until the context window closes. Models with shorter logic are more sensitive to this, especially on long thought traces and difficult problems.
at the initial check post of LFM2.5-2.6B10.2% of completions on difficult math and coding prompts produce repetitive loops. After antidoom training, this rate dropped to 1.4%. Evel scores improved across the board, which was entirely attributed to less looping.
TL;DR
- Antidoom reduces doom loops by retraining only the first loop-start token.
- FTPO spreads the possibility across multiple compatible options, not a single replacement.
- LFM2.5-2.6b looping dropped from 10.2% to 1.4%; Qwen3.5-4B fell 22.9% to 1%.
- The pipeline runs in a few hours, and the entire stack is open source.
What is antidoom?
Antidoom is a targeted solution, not a widespread sample change. It finds the exact token that starts the loop. It then trains the model to prioritize consistent options in that single situation. The rest of the distribution remains largely untouched.
method suits antislope. It trains on selected/rejected pairs that represent a single completion token. is the training algorithm Final Token Preference Optimization (FTPO)Which is similar to DPO.
Training doesn’t teach the model anything new about math or code. This clears up the looping that blocking answers the model may have already generated.
Anatomy of the Doom Loop
The Liquid AI team attributes the doom loop to three mechanisms working together:
Mechanism 1: Overtrained tokens and uncertainty. Some tokens generally have a higher chance of being selected. Well-known examples in the wild include ‘Delve’ and ‘Testament’. The Liquid AI team says it can detect synthetic data in the training set. In argument markers, high-form continuations often include discourse markers such as ‘wait’ or ‘alternatively’. These tokens are not inherently bad. They can mark useful changes to the strategy, validation step or branch. They become attractive fallback continuations when the model is uncertain or stuck.
For the initial LFM2.5-2.6B checkpoint, the most common loop-starting tokens were the following.
| token | part of the loop starts |
|---|---|
the |
11.39% |
So |
4.51% |
Alternatively |
3.22% |
Wait |
2.56% |
But |
2.46% |
Mechanism 2: Prior context reinforces the loop. Each iteration pushes each token toward the probability of Duan et al. Study this in your work on circular reasoning. They associate it with the “V-shaped” meditation pattern. They find that semantic repetition occurs before textual repetition.
Mechanism 3: Greedy Sampling. Reasoning models typically run at low temperatures for stable, reproducible traces. At temperature 0, the most probable token is always selected. The locally reinforced loop has no exit. Liquid AI reports significant looping even at temp=0.67. Low temperatures aggravate the problem.
How does Antidoom detect failure
Antidoom produces perfection on quick mixes designed to achieve looping at low temperatures. as that mixing vessels LiquidAI/antidoom-mix-v1.0 The dataset detects a loop when a section repeats at least four times, over at least 60 characters.
This method then aims to first token of first iteration. In that case, it takes the top-k log-probe option of the base model. It filters out small or non-alphanumeric noise. It holds up to 20 plausible options Chosen Token.
Each training line is a tuple of prompt prefixes, a rejected token, and one or more Chosen Token. The selected and rejected distributions are regularized before training. otherwise some criminals prefer wait, soAnd Will dominate and excessive oppression will distort logic.
Expressing the identity rule in code is simple in itself. 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 None
Each detected loop then becomes a 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)
FTPO is a priority-adaptation algorithm similar to DPO. A training sample consists of a signal, a chosen continuation, and a rejected continuation. It is designed to replace a handful of tokens, otherwise there will be minimal disturbance to the model.
FTPO differs from DPO in four ways:
- final signaling training: It trains only the trailing tokens of the sequence that are in the middle of the generation.
- Multiple selected tokens per sample: It spreads the probability across a set of alternatives, so one overpreserved token is not easily replaced by another.
- KL-like loss in logit space: This removes the softmax and calculates the deviation from the reference in the logit, avoiding pressure on unrelated tokens.
- two-part regularization: Selected and rejected logs move more freely, while the rest of the vocabulary remains tightly constrained.
In the Antidoom implementation, the model is trained for one epoch with LoRA. Higher LoRA ranks of 128-256 gave the best results. Training includes all attention and MLP estimates lm_head. The learning rate ranges from 4e-6 to 2e-5.
Early stopping is used in training chosen_winThe portion of the sample where selected tokens were rejected. stop at chosen_win=0.35 Reduce doom-loop rates from 20-30% to 1-2%. Long-term training tends to degrade the model.
For the initial LFM2.5-2.6B checkpoint, training-set creation took about an hour on an 8x MI325 GPU. Then training on a single MI325 GPU took about one to two hours. Production stops after collecting 20 thousand pairs.
How does Antidoom compare to normal fixes?
| Approach | what does it change | cost profile | deficiency reported |
|---|---|---|---|
repetition_penalty |
Reweights the output distribution | estimate-time, cheap | band Aid; may impair performance |
| reinforcement learning | policy through rewards | Calibrated rewards, costly online rollout | Setup and calculate overhead |
| DPO (last-token) | One chosen token per sample | offline training | rough beta; updates a single token |
| Antidoom (FTPO) | First loop token → multiple selected tokens | ~1 hour generation (8x MI325) + 1-2 hours train (1x MI325) | Can uncover new loops; Additional rounds may be required |
Result
After training, the doom-looping rate dropped from 10.2% to 1.4% at the initial LFM2.5-2.6b checkpoint. Evel scores improved across the board, which was entirely attributed to the reduction in looping.
Liquid AI team also started the pipeline QUEN3.5-4BWhich is known to loop during the logic. Its destruction-looping rate dropped from 22.9% to 1% under the greedy sample. The Eval score increased significantly.
As the temperature increased, the evil score changed inversely to the doom-loop rate. After training, both models showed a drop in performance near temperature = 1.0. This is expected, as high-temperature sampling may favor less-preferred tokens. Once looping was removed, near-greedy sampling gave the strongest scores among the models tested.
The Liquid AI team highlights a related point about common practice. The belief that high temperatures aid logic may be linked to the doom-looping effect. In their tests, once the loop terminates, near-greedy sampling performs best.
Multiple rounds may help. The first round rejects the tokens causing the loop and refocuses toward alternatives. This may highlight new failure points, which are then targeted in the second round.
interactive explainer
Use cases with examples
- on-device logic model: Sub-1GB reasoning models like the LFM2.5 family can prevent mid-proofs at hard prompts. Antidoom recovers the accuracy of the cost of those loops.
- small coding agent: A 4B coding model can loop over a hard debugging trace and burn out its context window. Removing the loop takes it to the fix it already knew about.
- agent pipeline cost control:loops consume tokens until the context expires. Cutting them reduces wasted tokens and latency during long agent runs.
- Repair after training. Teams shipping streamlined logic checkpoints can run Antidoom as a cleanup pass in a few hours.
Strengths and Challenges
Strength:
- Targeted: This first edits the loop tokens and leaves the rest of the distribution largely intact.
- Fast: The entire pipeline runs in a few hours.
- Measured: LFM2.5-2.6b dropped 10.2% to 1.4%; Qwen3.5-4B fell 22.9% to 1%.
- Open source: Generation, detection, and FTPO trainer have all been released.
- Recovers, not teaches: It restores answers that the model could already generate.
Challenges:
- This may expose new failure points, so sometimes multiple rounds are required.
- Over-training degrades the model, so stop early
chosen_winIs necessary. - The reported results cover both LFM checkpoints and QWEN3.5-4B small logic models.
- Performance may drop near temperature=1.0 after training.
- Each model requires its own generated looping dataset.
check it out technical details And GitHub repo. Also, feel free to follow us Twitter And don’t forget to join us 150k+ml subreddit and subscribe our newsletter. wait! Are you on Telegram? Now you can also connect with us on Telegram.
Do you need to partner with us to promote your GitHub repo or Hugging Face page or product release or webinar, etc? join us