Repetition Penalty
Also called penalized sampling, repetition_penalty.
A repetition penalty is a decoding setting that lowers the probability of tokens that have already appeared in the generated text, to discourage a language model from repeating itself.
Description
Keskar et al. introduced "penalized sampling" with the CTRL model in 2019, dividing the scores of previously generated tokens by a factor θ before sampling, where θ of 1 means no penalty. They found greedy decoding with θ of about 1.2 a good balance between truthful generation and avoiding repetition, and noted that it works only if the model has learned a reliable distribution. Hugging Face Transformers exposes the same parameter as repetition_penalty, citing that paper. Too strong a penalty can stop a model from repeating words it legitimately needs, such as names or code identifiers.
Sources
- Keskar et al. (2019). CTRL: A Conditional Transformer Language Model for Controllable Generation.
- Hugging Face (2026). Generation.
Cite this entry
Protologue. (2026). Repetition Penalty. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.9.1, PTL-0258). https://protologue.com/t/repetition-penalty/
BibTeX
@misc{protologue_repetition_penalty,
title = {Repetition Penalty},
author = {{Protologue}},
year = {2026},
howpublished = {Protologue: A Taxonomy of Prompting and LLM Techniques, v1.9.1},
note = {Entry PTL-0258},
url = {https://protologue.com/t/repetition-penalty/}
}New terms, as they're coined
One email a week with the newest techniques, each defined and sourced like this entry.
Delivered through Beehiiv. Unsubscribe from any issue.