AI engineering glossary · Transformers LLM architecture
What is frequency and presence penalty?
Frequency and presence penalty: Two API settings that reduce repetition by subtracting from a token's logit. The presence penalty applies once if the token has appeared at all; the frequency penalty grows with how many times it has appeared.
Frequency and presence penalty: an example
A token used 3 times gets logit - 3 * frequency_penalty - presence_penalty.
Related terms
More Transformers LLM architecture terms
- GPT
- Greedy decoding
- Grouped-query attention
- Head dimension
- Hidden states
- Induction head
- Instruct model
- KV cache
Where you learn it
Frequency and presence penalty is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.