Left alone, a language model will loop — ‘the the the’, or repeating a whole phrase forever — because the most likely next word after a word is often that same word. The repetition penalty breaks the loop by DOCKING the probability of any token already used, so the model is nudged to move on. Slide the penalty and watch the echo fade.
After a token has appeared, its logit is divided by the penalty θ>1 (positive logits shrink toward zero; negative ones are pushed further down) before the softmax — so its probability drops and the model is steered away from repeating it. At θ=1 nothing changes; larger θ more aggressively suppresses seen tokens. A fail-loud self-check throws unless a penalised (already-seen) token’s probability is strictly LOWER than its unpenalised value.
A blunt instrument: too high a penalty banishes words that SHOULD recur (‘the’, a character’s name), harming fluency — frequency/presence penalties and better sampling are gentler fixes. The divide-the-logit rule and the probability drop are exact.