Inference
Two sampling parameters that discourage a model from repeating itself by lowering the scores of tokens it has already produced.
Two sampling parameters that discourage a model from repeating itself by lowering the scores of tokens it has already produced. Frequency penalty grows with how many times a token has appeared, which reduces verbatim repetition. Presence penalty applies once a token has appeared at all, which nudges the model toward new topics. In OpenAI's Chat Completions API both range from -2.0 to 2.0, and negative values encourage repetition instead.
Primary source: developers.openai.com
Example
In practice, developers reach for Frequency and Presence Penalty when they need the capability described above as part of an AI feature or workflow.
Hands-on guides, comparisons, and tutorials that cover Inference.
FAQ
Two sampling parameters that discourage a model from repeating itself by lowering the scores of tokens it has already produced.
Frequency and Presence Penalty sits in the Inference part of the AI stack. Understanding it helps you make better decisions when building, debugging, and shipping AI features.
Developers Digest publishes tutorials and videos that cover Inference topics including Frequency and Presence Penalty. Check the blog and YouTube channel for hands-on walkthroughs.
Related
The part of a model's parameters that is actually used to process each token.
A generation technique that restricts which tokens a model may pick at each step so the output is guaranteed to match a format such as a regular expression, a grammar, or a JSON Schema.
The raw, unnormalized scores a language model's output layer assigns to every token in its vocabulary at each step, before softmax turns them into probabilities.

New tutorials, open-source projects, and deep dives on coding agents - delivered weekly.