Skip to content

Model repeats itself in a loop

Symptom

The same phrase or sentence repeats until the token limit.

Likely causes

  • Temperature too low for the model
  • Context overflowed and truncation removed instructions
  • Wrong chat template or missing stop tokens

How to fix it

  1. Raise temperature slightly (0.6 to 0.8) and add min-p 0.05.
  2. Add a mild repeat penalty (1.05 to 1.1); strong values hurt coherence.
  3. Check the prompt isn't truncated: increase the context size.
  4. Verify the chat template and stop tokens.
bash
llama-cli -m model.gguf --temp 0.7 --min-p 0.05 --repeat-penalty 1.1 -c 8192

Still stuck? Check the lessons or measure first with the benchmark lab.