IT lexicon › AI & ML › Repetition penalty

Repetition penalty

AI & ML På svenska → Updated: 2026-05-23

Sampling parameter that dampens the probability of tokens that have already appeared in context — counteracts LLM loops ("the the the…").

Maintains a logit adjustment: divide the logit by the factor (typically 1.0–1.3) if the token is already in the sequence. More refined variants: frequency penalty (proportional to count) and presence penalty (binary: seen or not).

Helps small or poorly fine-tuned models; for large modern instruction-tunes, the default 1.0 (off) plus temperature/top-p alone is usually enough. Too high a penalty → the model jumps topics incoherently.

← Back to the lexicon