Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Top-p

Topic: Prompting and contextAlso called nucleus sampling

Definition

A sampling setting that restricts the model to the smallest set of likely tokens whose probabilities add up to p, then samples from that set.

In more detail

Top-p of 0.9 means the model picks only among tokens that together make up 90 per cent of the probability. Providers generally advise adjusting temperature or top-p, not both.

Top-p is also called nucleus sampling. A low value makes output more predictable by cutting off unlikely tokens; a value of 1 disables the cut-off. For extraction, classification and code, low temperature with default top-p is the usual starting point. Some reasoning models ignore or reject sampling parameters, so check the model's documentation.

  • Log probabilities (logprobs)

    The log of the probability a model gave each token it generated, returned by some APIs to show how confident the model was.

  • Temperature

    A sampling setting that controls randomness: lower values favour the most likely tokens, higher values spread probability more evenly.

  • LLM API parameters cheat sheet

    Temperature, top_p, max tokens, stop, seed, logprobs, JSON output and reasoning effort, with exact names for OpenAI, Claude and Gemini, checked on the API docs.

    Cheat sheetIntermediate

  • Prompt engineering

    Writing clear, testable instructions for models and checking them on real inputs.

    SkillBeginner

  • Temperature

    A sampling setting that controls randomness: lower values favour the most likely tokens, higher values spread probability more evenly.

    Glossary

  • Prompting fundamentals: clear tasks, examples and formats

    How to write a good prompt: frame the task, say who the output is for, show an example and specify the format, so a model's answers are useful and repeatable.

    TutorialBeginner25 min