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.

Level: intermediateTopic: Transformers LLM architecture

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

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.

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.