Presence penalty is a decoding setting that applies a fixed, one-time reduction to the probability of any token that has already appeared in the output, regardless of how many times it was used. Where frequency penalty scales with repetition count, presence penalty treats the first use and the tenth use identically. Its effect is to push the model towards introducing new words and topics.
Key takeaways
- Triggered by a token appearing at least once.
- The penalty is a flat amount subtracted from the logit.
- Common API range is −2.0 to 2.0, with 0 meaning off.
- Useful values are usually 0.1 to 0.6.
- Use it for topic variety; use frequency penalty for word overuse.
Presence penalty explained in simple terms
Imagine brainstorming with a facilitator who says “you’ve mentioned that, what else?” every time you return to something already on the board. It does not matter whether you mentioned it once or five times; the nudge towards new ground is the same. That is presence penalty.
How it works
At each step, any token already present in the generated text has a fixed value subtracted from its logit. Softmax then converts the adjusted logits into probabilities.
Worked example with a presence penalty of 0.6:
| Token | Times used | Logit reduction |
|---|---|---|
| ” cloud” | 1 | 0.6 |
| ” security” | 4 | 0.6 |
| ” migration” | 0 | 0 |
Both used tokens get the same reduction. With a frequency penalty instead, ” security” would be penalised four times as much as ” cloud”.
Frequency vs presence penalty side by side
| Aspect | Frequency penalty | Presence penalty |
|---|---|---|
| Scales with count | Yes | No |
| Effect | Discourages overusing the same word | Discourages returning to the same ground |
| Best for | Vocabulary variety | Topic variety |
| Risk at high values | Unnatural word choices | Drifting off topic |
Many teams use a small amount of both, for example frequency 0.3 with presence 0.3.
When to use it
- Brainstorming, where each item should raise something new.
- Long content plans or outlines that should cover varied ground.
- Chat assistants that keep circling the same suggestion.
- Generating lists of distinct examples or ideas.
When to avoid it
- Focused technical explanations that need consistent terminology.
- Code and structured output.
- Translation and summarisation, where faithfulness matters.
- Short outputs, where repetition is rarely a problem anyway.
Practical notes
- Start at 0 and increase gradually; small values change behaviour noticeably.
- Penalties interact with temperature and top-p, so change one setting at a time.
- High presence penalties can make a model avoid the very keyword you asked about, since that word appears early and is then penalised for the rest of the output.
Limitations
- Cannot tell useful repetition from padding.
- Can push output away from the main topic.
- Applies to all tokens, including function words.
- Exact implementation differs between providers, so values are not directly transferable.
