AIToday
Large Language ModelsOpen-Source AIZenn AI/MLPublished: Nov 21, 2026, 16:00 JST

repeat_last_n 1024 cuts abliterated model loops from 76% to 6%

Send on LINE
repeat_last_n 1024 cuts abliterated model loops from 76% to 6%

3 Key Points

  1. What happened

    With no repetition settings, qwen3.5-abliterated:9b ran to 16,291 characters against a roughly 1,000-character request, with 76% of sentences repeating earlier ones; widening repeat_last_n to 1024 and setting repeat_penalty to 1.3 cut this to 6%.

  2. Why it matters

    The penalty only works when its reference window is wide enough to see the repeated sentence, so raising the penalty value alone on the default window changed almost nothing — a trap for anyone tuning local models.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, every morning.

Context & Analysis

The experiment separates two things that are easy to conflate: the repetition rate and what is being measured. In the Ollama runs, the model's thinking and final answer are mixed into one output stream, so the 76% figure mostly reflects loops in the reasoning, not the essay itself. When Shinka Spool Labs ran the same model and prompt through llama-server, which returns reasoning and body separately, the body showed no repetition at all without DRY, while the reasoning repeated 64% of the time.

The Ollama results also show why the window size mattered more than the penalty value. A sentence-level loop can return hundreds of tokens later, so a 64-token window never sees the earlier sentence and cannot penalize it. Once repeat_last_n was set to 1024, repeat_penalty began to take effect. The trade-off is real: stronger penalties reduced repetition but made the Japanese less natural, with DRY 0.8 producing 52.3 occurrences of 「」 per 1,000 characters versus 1.3 in the control.

The author notes that every condition was run only once, so sampling noise and the effect of each setting are not separated; the numbers are a guide rather than fixed constants. Results also come from a single model and a single prompt. A separate practical note: with ctx 8192, the reasoning once used up the context and the body came back empty, so ctx 16384 is safer for longer outputs.

FAQ
What setting actually stopped the repetition?
The key was widening repeat_last_n from Ollama's default 64 tokens to 1024, which let the repeat_penalty see repeated sentences; raising the penalty value alone had little effect.
Did the fix have any downside?
Yes — at repeat_penalty 1.3, the Japanese at the end of the output became slightly unnatural, because a strong penalty can push away words that are actually needed.
Where was the looping actually happening?
In llama-server tests, the loop was mainly in the model's reasoning (thinking) rather than the final text: with no DRY, reasoning repetition was 64% while body repetition was 0%.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articlenference, Cedars-Sinai to pool 5M patients' records for AI research