Your bot isn't broken. Your history is teaching it.

Three different diseases get filed under “looping”: verbatim re-paste, pet imagery, and fossilized openers. A triage guide built from our repetition detector: 12-token shingle receipts on Grok 4.5 (three straight rounds at 100% old text) and DeepSeek (one 72% slip, self-corrected), why history contamination beats every sampler knob — corrective instructions lost 9 of 10 rounds in our test — which penalty settings backfire, and the fix list in the order that actually works.

Hand-drawn ink illustration on aged paper: a wind-up gramophone with its needle stuck, identical speech bubbles spiraling out of the horn and curling back into the machine, a small pair of scissors lying on the table beside it

Three complaints, same week, all filed under the same word. One chat re-pasted an entire paragraph, word for word, from six replies earlier. One had mentioned the character’s “amber eyes” seven times in ten replies. One opened every single message with “A slow smile curls across her lips.” Three players, one self-diagnosis — “my bot is looping” — and, under that one word, three different diseases with three different cures.

That conflation is why the standard advice fails so often. “Crank the repetition penalty” treats one of the three, badly. “Tell it to stop repeating” barely treats any of them. We built a browser diagnostic, the repetition doctor, on the same measurement recipe our fiction bench uses, and this post is its triage logic in prose: what each disease looks like, which causes produce which shapes, and the fix list in the order that survived testing.

Three diseases wearing one name

Verbatim copying is the crude one, the disease people mean when they say the bot broke. The caliper for it: slice the text into every run of 12 consecutive tokens — a CJK character or a Latin word each, punctuation excluded — and count how many of a reply’s runs already appeared in earlier replies. It also has an inside-one-message form: in the doctor’s demo corpus, the final reply says “I’m not going anywhere. Not now, not ever.” three times in a single message, and an earlier reply re-pastes a whole paragraph from two replies back, key included, word for word.

Motif fixation is quieter. The sentences are new; the furniture recurs. In that same demo chat, “her amber eyes” shows up seven times across eight replies, “barely above a whisper” four times, “ozone and old paper” four times. No paragraph is copied. The scene still feels like wallpaper. Two guardrails matter here, because this layer loves false accusations: character names don’t count, and a single recurring word gets reported as an observation rather than a disease — a character who says “obviously” too much is characterization. Painting every room with the same amber lamplight is not.

Structural molding is the third: four of the demo’s eight replies open with the identical sentence, and sentence starts cluster around the same stems. This layer also ships two exemptions learned the hard way. Dialogue-heavy prose front-loads “she said” and “she whispered” clauses — normal, exempt. And repetition inside one reply, the deliberate drumbeat of anaphora, is rhetoric, not rot; it gets demoted to a note.

Separating the layers is not pedantry. They point at different suspects. Heavy verbatim overlap with fresh sentence shapes says the problem lives in your history or your context window. Opener molds with little verbatim copying say your sampling is squeezed too tight. Motif alone is usually the early, soft form of the first — worth watching, rarely worth panicking over.

The most underrated cause: the loop already lives in your history

Models imitate the transcript more than they obey instructions. Once a phrase or an opener has appeared two or three times in the visible history, it stops being an accident and starts being a few-shot example — every reply that contains it raises the odds of the next one. We measured this directly: in a chat whose history already carried the bad pattern, corrective instructions failed in 9 of 10 rounds. A fresh chat with the same instructions showed zero residue. Your one OOC note is competing with five examples the model can see. The examples win.

The same mechanism has a slower cousin: context saturation. A long chat gradually swaps fresh material — the card, the scene, your own writing — for the model’s earlier replies, until the window is mostly self-echo. Our 20-round continuation bench replays exactly that evolution, and every verbatim collapse in the archive happened from round 9 onward, never earlier. If your overlap climbs toward the end of the chat, that’s the signature.

And there is a starvation variant. If your side of the chat averages a handful of words per message, the model has nothing new to react to, so it re-derives the scene from its own last reply — a recycling loop by construction. Community guides across every platform converge on this one, and it is the cheapest fix on the whole list: two or three sentences with one new fact per reply.

When it is the model: receipts from twenty-round runs

Sometimes the family really is the suspect. Same continuation protocol, same measuring stick, wildly different outcomes. Grok 4.5 spent rounds 10 through 12 at 100% cross-round overlap — three consecutive rounds without one new sentence — easing to 68.4% at round 13. DeepSeek v4 flash stayed at 0% in 18 of 19 measured rounds, slipped once at round 14 by opening with three paragraphs copied from round 13 (72% overlap), then recovered completely the next round. Slips happen; the difference is self-correction versus spiral. Generation matters too: Kimi K2.6 seized mid-chain at 97.6% old text, while its successor K3 re-ran the same protocol and peaked at 6.8%.

Two honesty notes before you switch providers over this. That bench ran a fiction-continuation protocol with no penalty settings, so treat the numbers as propensity evidence, not a verdict on your exact setup — the full Grok file is public. And not every failure is a loop: Gemini’s characteristic collapse in the same bench was plot regression, the story rolling back and re-running, with barely any verbatim copying — a different disease entirely. Families we haven’t measured are labeled exactly that in the doctor, not padded with invented numbers.

The parameter checkup, minus the folklore

Penalty sliders are the most oversold fix in this whole genre, and the vendor surfaces are stranger than the folklore admits. Claude has no repetition penalty of any kind — the Messages API simply doesn’t define one, so a frontend that shows the slider for a Claude connection is dropping the value silently. Its temperature also tops out at 1.0, so a preset written for another family’s 1.3 doesn’t mean the same thing there. On OpenAI-style APIs, the official docs put reasonable penalty coefficients at roughly 0.1 to 1 — values up to 2 are legal and, in the docs’ own words, degrade quality noticeably.

Temperature folklore runs backwards, too. DeepSeek’s own documentation recommends 1.3 for general conversation and 1.5 for creative writing; running it at 0.6 “for safety” is deep deterministic territory where the favorite phrasings recur by construction. Google’s guidance for Gemini 3 is to leave temperature at the default 1.0. And the classic own-goal: repetition penalty at 1.3+ makes the model dodge words it genuinely needs — names, pronouns — so the wording degrades while the loop survives, the model thrashing between the few phrasings the penalty still allows.

Local backends are the one place where sampler surgery genuinely cures loops. DRY (multiplier 0.8, base 1.75, allowed length 2) targets verbatim sequences directly and is the community’s preferred anti-loop sampler; the standing advice is to keep classic repetition penalty at 1.0–1.1 and let DRY do the work. The doctor’s checkup labels every reference band by where it comes from — official docs, sourced community consensus, our own archived measurements, or honest guesswork — because a recommendation without a pedigree is just a vibe.

The fix list, in order — and why reroll isn’t item one

Order matters more than the knobs. First, remove the loop from history: edit or delete the replies that carry the repeated passage, reroll the worst offenders, so the examples are gone from the context. This outranks everything else on the list, by the 9-of-10 margin above. Second, if surgery is fiddly, rewind: branch back to the last clean message and continue — you lose a few turns, not the relationship. Third, refresh the window: summary-restart a long chat, and feed the model actual material instead of “ok.” Fourth — only now — parameters, one change at a time, inside your family’s documented band. Fifth, if you’re deep in a long chat on a family with a measured looping record, switching models is a legitimate fix, not an admission of defeat. Instructions come last on purpose: an OOC note costs nothing and occasionally helps at the margin, but as long as the loop stays in history it loses to the examples.

Which explains the missing item. Rerolling the newest reply resamples from the same poisoned classroom — the examples teaching the loop sit in the messages above it, and they’re all still there when the dice land. Reroll earns its place on this list only as a scalpel, re-rolling the earlier offending replies to expunge the examples. As a slot machine pulled on the latest message, it burns money to re-ask a question the context has already answered.

Run the triage on your own chat

The repetition doctor takes a pasted chat or a .jsonl export, runs all three layers, and shows the exact passages behind every number — then ranks the seven root causes against your chat’s shape and checks your sampler settings against your family’s actual parameter surface, every claim labeled by evidence. It runs entirely in your browser; nothing uploads. Fair warning about its temperament: when nothing crosses a threshold, it says so and stops, because a diagnostic that always finds something is an astrology engine. If it tells you your chat is fine and your openers just got a little samey around round 30, that’s not a bug. That’s the reading.

FAQ

Why does my AI roleplay bot keep repeating the same phrases?

Most often because the repetition already sits in your visible chat history. Once a phrase has appeared two or three times, it works as a few-shot example the model actively imitates — in our experiment, a chat whose history contained the bad pattern reproduced it in 9 of 10 rounds despite corrective instructions, while a fresh chat showed zero residue. Clean the history first; parameters come second.

Does repetition penalty fix looping?

Far less than folklore says. Claude has no repetition penalty parameter at all — if your frontend shows one for a Claude connection, the value is silently dropped. OpenAI's own docs put reasonable penalty coefficients around 0.1–1. Oversized penalties (1.3+) make the model dodge names and pronouns, degrade the prose, and often leave the loop standing. On local backends, DRY (multiplier 0.8, base 1.75, allowed length 2) targets verbatim sequences directly and is the community's preferred tool.

Why does looping get worse the longer the chat runs?

Context saturation. A long chat gradually replaces fresh material — your card, the scene — with the model's own earlier replies, and the denser that self-echo gets, the stronger the pull to repeat. In our 20-round continuation bench, every verbatim collapse in the archive happened from round 9 onward, once the window was thick with the model's own prior output. A summary restart carries the story forward while dropping the echo.

What is the fastest way to stop an active loop right now?

Edit or delete the replies that contain the repeated passage — reroll the worst offenders — or rewind the chat to the last clean message, then continue. That single move outranks every parameter change: while the loop stayed in history, corrective instructions failed 9 of 10 rounds in our test. Adjust one sampler setting at a time only after the history is clean.

Questions or ideas? Join our Discord →

Why Your Bot Keeps Looping (It's Usually Not the Model) · Foreverse · Xinmeng