
Learn how temperature, top-k, and top-p influence the way language models select their next tokens. This episode explains what each setting controls, when developers might adjust it, and how it changes generated text. It also covers repetition penalties, output limits, stop sequences, and seeds.
Voice narration is AI-generated.
RESEARCH NOTES
The episode distinguishes three sampling controls:
- Temperature reshapes the probability distribution, changing how strongly the model favors its most likely candidates.
- Top-k retains a fixed number of the highest-probability candidate tokens.
- Top-p, or nucleus sampling, retains the smallest group of high-probability candidates whose cumulative probability reaches the selected threshold.
The numerical probability example is illustrative. It was not drawn from a measured model output. The episode also covers frequency penalty (a penalty proportional to how often a token has appeared), presence penalty (a one-time penalty after a token appears), maximum output tokens, stop sequences, and seed-based repeatability. A seed does not guarantee identical output if the model or serving infrastructure changes.
Parameter availability is provider- and model-specific. OpenAI's Chat Completions API documents temperature and top-p and recommends adjusting one rather than both. Hugging Face Transformers documents temperature, top-k, and top-p generation controls. Anthropic's current model deprecation documentation shows that the temperature, top-p, and top-k request parameters were removed entirely as of API version 2026-10-21, which returns an error for any model that sets them; before that removal, earlier API versions already rejected non-default values specifically on Claude 4.7-and-later models and Claude Mythos Preview.
REFERENCES
1. OpenAI API — Create Chat Completion
https://developers.openai.com/api/reference/go/resources/chat/subresources/completions/methods/create
2. OpenAI API — Advanced Usage: Frequency and Presence Penalties
https://developers.openai.com/api/docs/guides/advanced-usage
3. Hugging Face Transformers — Text Generation
https://huggingface.co/docs/transformers/main_classes/text_generation
4. Anthropic — Model Deprecations and API Parameter Changes
https://platform.claude.com/docs/en/about-claude/model-deprecations
Weitere Episoden von „Learn AI in Bits“



Verpasse keine Episode von “Learn AI in Bits” und abonniere ihn in der kostenlosen GetPodcast App.








