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.

Level: intermediateTopic: Prompt context engineering

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

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.