{
  "id": "top-p-sampling",
  "code": "PTL-0007",
  "term": "Top-p Sampling",
  "aliases": [
    "nucleus sampling"
  ],
  "category": "foundations",
  "definition": "Top-p sampling, also called nucleus sampling, draws each next token only from the smallest set of candidates whose cumulative probability exceeds a threshold p.",
  "description": "It was proposed to avoid both the repetitive text produced by greedy or beam decoding and the incoherent text produced by sampling from the full distribution. It is usually combined with temperature.",
  "example": null,
  "broader": [],
  "narrower": [],
  "related": [
    "temperature"
  ],
  "introduced": 2019,
  "sources": [
    {
      "title": "The Curious Case of Neural Text Degeneration",
      "authors": "Holtzman et al.",
      "year": 2019,
      "url": "https://arxiv.org/abs/1904.09751"
    }
  ],
  "url": "https://protologue.com/t/top-p-sampling/",
  "citation": "Protologue. (2026). Top-p Sampling. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.0.0, PTL-0007). https://protologue.com/t/top-p-sampling/"
}