How to Stop a Model Repeating Itself With Frequency and Presence Penalties
Set frequency and presence penalties when output loops, then check the loop breaks without pushing the text off-topic.
WORKFLOW TAG
Control output variation, reproducibility, and repetition.
Set frequency and presence penalties when output loops, then check the loop breaks without pushing the text off-topic.
Run the same task at temperature 0 and with sampling, compare the answers, and record which one the task needs.
Set top-k to keep only the k most likely tokens in play, then check the output stays coherent.
Set top-p to 0.9 so the model samples only from the smallest token set that reaches 90 percent probability.
Raise temperature into the 0.7 to 1.0 range for varied creative drafts, then lower it if the text turns incoherent.
Set temperature to 0 for extraction and classification so the output stays predictable and repeatable.
Decide whether vLLM applies a model's generation_config.json or its own defaults, with --generation-config vllm.
Set the same seed on every Ollama request so the same prompt returns the same reply, for testing and comparisons.
Send vLLM-only parameters such as top_k through the OpenAI client's extra_body field, since they are not part of the OpenAI API.
Set the seed for mlx_lm.generate or for a make_sampler sampler so the same prompt and settings give the same reply again.