AI engineering glossary · Prompt context engineering
What is frequency penalty?
Frequency penalty: A sampling setting that lowers the chance of a token in proportion to how many times it has already appeared in the output. It reduces word-for-word repetition. Too high a value can push the text toward odd vocabulary.
Frequency penalty: an example
Set a frequency penalty of 0.5 to stop a product description from repeating 'premium quality' in every line.
Related terms
More Prompt context engineering terms
- Function calling
- GBNF grammar
- Generated knowledge prompting
- Grammar-constrained decoding
- Grounding
- In-context learning
- Instruction following
- Instruction hierarchy
Where you learn it
Frequency 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.