A model that writes the same sentence over and over, restates your question back at you, or trails off into an endless list is almost never broken. It’s a sampling or context problem, and on a phone it usually comes down to five causes: the temperature is too low, the chat has outgrown the context window, the model is too small or too heavily quantized for the task, the prompt invites repetition, or a custom model file is running with the wrong chat template.
Work through them in that order. The first two fix most cases in under a minute.
What a repetition loop looks like #
The symptoms differ enough to be diagnostic:
- The same sentence, verbatim, forever. Classic sampling collapse. Temperature is the first thing to check.
- The same paragraph rephrased three times in one answer. Usually a small model padding toward a long output target.
- It restates your question instead of answering. Often a prompt or template problem.
- It was fine for twenty messages, then started going in circles. That’s the context window filling up.
- It answers, then starts writing your next message for you. Wrong chat template, or a model file missing its stop tokens.
Fix 1: raise the temperature #
Temperature controls how much the model is allowed to deviate from its single most likely next word. Set it very low and the model becomes deterministic, which is what you want for extraction and what causes loops in open-ended writing: once it produces a sentence, the highest-probability continuation is often that same sentence again.
If you’re running at 0.1 or 0.2 for a chat or a story, move to around 0.7. Most apps ship presets that do this for you, typically named something like Precise, Balanced and Creative. Top-p and top-k work alongside it by trimming the candidate pool; if yours are set aggressively low, loosen them before you touch anything else. Settings that change answer quality covers what each slider actually does.
Some apps also expose a repetition penalty, which directly discourages tokens that have already appeared. If yours has one, a small nudge upward is the targeted fix. If it doesn’t, temperature is your lever.
Fix 2: the chat has outgrown the context window #
Every model has a fixed window of text it can see at once, counted in tokens, covering the system prompt, the whole conversation so far and the answer it’s currently writing. When a conversation fills it, the oldest messages fall out of view. The model then sees mostly its own recent output and starts echoing it, because that’s the pattern in front of it.
The giveaway is timing: quality was fine and degraded gradually in a long session. The fix is not a better model.
- Start a new chat.
- Before you do, ask for a summary of what matters: “Summarise the decisions and facts from this conversation in ten bullet points.”
- Paste that summary as the first message of the new chat.
An app that shows context usage in the chat header makes this obvious rather than mysterious. Why AI forgets what you said earlier explains the window in more detail. Raising the context size setting helps if your phone has the memory for it, but a larger window uses more RAM and slows generation, so it’s a trade rather than a free fix.
Fix 3: the model is too small, or too heavily quantized #
Quantization shrinks a model by storing its weights at lower precision. A 4-bit build of a 9B model runs on a phone; the same model at 8-bit usually doesn’t. The compression costs accuracy, and the first thing to degrade is often coherence over long outputs, which shows up as repetition.
Two moves help:
- Step up a quantization level if you have the storage and RAM, for instance from a Q4 build to Q5 or Q8 of the same model. GGUF quantization explained covers which names mean what.
- Step up a model size. A 0.8B model asked to write five paragraphs will loop; the same request to a 4B or 9B model usually won’t. What 4B, 9B and E2B mean is the guide to sizes.
If your phone can’t hold a bigger model, shorten what you ask for instead. Small models stay coherent over short outputs.
Fix 4: your prompt is asking for it #
Three prompt habits produce loops reliably:
Asking for more length than you have content for. “Write 1,000 words on this” with a small model and a thin topic gives you the same three ideas in rotation. Ask for the structure you want instead: “five bullet points, one sentence each”.
A max tokens setting far above the natural answer length. The model reaches its natural ending, and if the template doesn’t stop cleanly it keeps generating to fill the budget. Lower max tokens to something near the length you want.
Chaining “continue” repeatedly. Each continuation sees more of its own previous output and less of your original instruction. Re-state the goal when you continue, rather than typing the word alone.
Being specific also helps for an unrelated reason: a vague prompt has many equally likely continuations, and models handle ambiguity by hedging and restating.
Fix 5: a custom model with the wrong chat template #
This one only affects models you added yourself. Every instruct model expects its conversation formatted with particular markers around the user and assistant turns, and expects to stop at a particular token. Load a GGUF whose template doesn’t match what the app applies and you get textbook symptoms: the model answers and then writes the next user message itself, or emits a special token as visible text, or never stops.
If a catalog model behaves and your own download doesn’t, the file is the difference. Check the model card on Hugging Face for the expected prompt format, prefer builds packaged for chat use, and test a known-good catalog model in the same app to confirm the app isn’t the problem. Running a custom GGUF on your phone covers loading them properly.
Quick diagnosis table #
| What you see | Most likely cause | First thing to try |
|---|---|---|
| Identical sentence repeated | Temperature or top-p too low | Move temperature to ~0.7 |
| Same ideas rephrased in one reply | Output length target too high for the model | Ask for fewer, shorter points |
| Circles after a long session | Context window full | New chat, carry a summary across |
| Writes your side of the conversation | Wrong chat template on a custom model | Test a catalog model; check the model card |
| Looping only on hard questions | Model too small or too quantized | Larger model or higher quantization |
| Gibberish rather than repetition | Corrupt or incomplete download | Redownload the model |
That last row is a different failure. Repetition means the model is working and sampling badly; garbage characters usually mean a bad file, which is covered in fixes when a local AI app crashes or won’t load a model.
Diagnosing it is easier when the app shows its numbers #
Most of this troubleshooting is guesswork unless you can see what’s happening. Personal LLM shows tokens per second on every reply and context usage in the chat header, exposes temperature, top-p, top-k, context size and max tokens directly, and lets you switch models mid-conversation, so you can hand the same failing prompt to a larger model without retyping it. It runs the models on the phone itself, free on iOS and Android, so all of this experimenting happens without anything being sent anywhere.
Frequently asked questions #
Why does the AI repeat my question back to me instead of answering? #
Usually a template or prompt issue rather than a sampling one. Check that you’re using an instruct or chat build of the model rather than a base build, since base models continue text instead of responding to it. A clear instruction verb at the start of your message (“Explain…”, “List…”) also helps a small model tell the difference between a question and text to continue.
Does a bigger model stop repetition for good? #
It makes it much rarer, not impossible. Any model will loop if the temperature is pinned low or the context window is full. Size buys you coherence over longer outputs, which is where most repetition shows up.
What temperature should I use to avoid loops? #
Around 0.7 for conversation and writing, around 0.3 for extraction, summarising and anything where you want the same answer every time. Below about 0.2 in open-ended writing, repetition gets likely. Above about 1.2, coherence starts to suffer in the other direction.
Why does it only repeat in long chats? #
Because the context window filled up and the oldest part of the conversation stopped being visible to the model. Start a fresh chat with a summary. This is also why answers can contradict something you established twenty messages ago.
Is repetition a sign the model file is corrupt? #
Rarely. A corrupt or truncated file usually fails to load, crashes the app, or produces obvious gibberish rather than fluent repeated sentences. If you suspect the download, delete and refetch it, and see what to do when a model download fails.