Concepts

Frequency and presence penalties

Quick explainer1 min readIntermediate

Frequency and presence penalties are settings that make a language model less likely to repeat words it has already used in its answer.

In plain words

As a model writes, these penalties lower the scores of tokens already in the output. The presence penalty applies once a token has appeared at all, nudging the model towards new words and topics. The frequency penalty grows with how often a token has appeared, so heavy repetition is pushed down harder. Positive values reduce repetition; negative values encourage it. Not every model accepts them.

A quick example

If a model keeps writing "very" in every sentence, raising the frequency penalty makes each extra "very" less likely. Raising the presence penalty instead nudges it to bring up words it has not used yet.

Where you'll meet it

  • Generation settings in LLM APIs and serving engines.
  • Reducing repetitive or looping output.

Related

Sources

  1. DocsContent generation parameters, Google Cloud Vertex AI docs · read 29 Sept 2026
  2. DocsSamplingParams, vLLM docs · read 29 Sept 2026

Checked by WhatIsAI against the sources above · 29 Sept 2026. Spotted an error? Report it.