frequency and presence penalties
Sampling settings that lower the scores of tokens already used, to discourage repetition.
In more detail
A presence penalty applies once to any token that has appeared; a frequency penalty grows with each repeat. OpenAI's Chat Completions API accepts both, while many reasoning models reject sampling settings other than their defaults.
Related terms
- sampling (decoding) — Choosing each next token at random from the model's probability distribution, shaped by settings such as temperature, top k and top p.
- logits — The raw, unnormalised scores a model assigns to every token in its vocabulary as candidates for the next position.
Taught in
- How The Next Token Is Chosen — AI Engineering: LLM Apps, RAG & Agents
References
- OpenAI: Chat Completions API reference (temperature, penalties, logprobs, stop)
- OpenAI: Reasoning models guide (unsupported sampling parameters)