← Roleplay terms explained

What is repetition penalty in AI chat?

Updated

Repetition penalty is a sampler setting that lowers the chance of the model reusing tokens that already appear in the recent text. A value of 1 means off; values slightly above 1, such as 1.05 to 1.15, discourage loops and pet phrases. Set it too high and the model starts avoiding ordinary words, names and punctuation, and the writing gets strange.

Try it now, free, no account neededStart a story with Ronan KadeNo gifts. No mercy. Paid in money you don't have.

How it works

Before picking the next token, the app checks which tokens already appear in the recent text and makes them less likely. With repetition penalty, that is a multiplier: at 1.1 a repeated token's score is reduced by roughly a tenth. Many apps also let you choose how far back to look, the penalty range, such as the last 2,048 tokens.

There are related settings from the OpenAI-style API:

- presence_penalty: a flat reduction for any token that has appeared at all. - frequency_penalty: a reduction that grows with how often a token has appeared. Both run from -2 to 2, with 0 meaning off. Positive values discourage repeats.

In a request: "repetition_penalty": 1.08.

What it fixes, and what it does not

It helps with word-level loops: a character who "smirks" in every reply, or a sentence pattern that keeps returning. It does not fix story-level repetition, such as a character asking the same question every scene, which comes from the card, the greeting or examples that are too similar. For that, see stopping the AI repeating itself.

Common mistakes

  • Values like 1.3 or higher. The model can no longer reuse "the", the character's name or your name, so it starts using odd synonyms and skipping punctuation.
  • A very long penalty range. In a roleplay, names and places must repeat; penalising the whole chat punishes the story's own nouns.
  • Stacking strong repetition, presence and frequency penalties together.
  • Using it to cover a card full of catchphrases. Remove the catchphrases from the examples instead.

A practical routine

Start at 1.0 (off) with a sensible temperature and min_p. If you notice a pet phrase, move to 1.05 and play twenty messages. If it persists, try 1.1. If names start getting replaced with "the man" or "the woman", go back down. A character with a strong verbal style, like Ronan Kade, is a good test: his clipped voice should survive while repeated filler fades.

In UnsavedAI and other apps

UnsavedAI's API accepts repetition_penalty above 0, where 1 is off, plus presence_penalty and frequency_penalty from -2 to 2, so SillyTavern and JanitorAI presets work without editing. The UnsavedAI website sets these for you. More presets: roleplay sampler settings.

Questions people ask

Is repetition penalty the same as frequency penalty?

They aim at the same problem but calculate differently. Repetition penalty is a multiplier where 1 is off; frequency penalty is added and 0 is off.

Can a value below 1 be useful?

Below 1 makes repeats more likely, which is rarely what you want in roleplay.

Characters for this story