Als nächstesNächster Leitfaden
Typische Probenahme
Sprach-KI
Sprach-KI-GUIDE
Top-k and nucleus (top-p) sampling are stochastic decoding methods that truncate a model’s next-token distribution before drawing a token.
Hören Sie sich diesen Leitfaden anKI-erzählt · ~2 min
Temperature rescales logits and changes distribution sharpness; none of these settings guarantees factual accuracy.
Holtzman et al. identify a gap between likelihood training and open-ended generation: likelihood-maximizing decoding can produce bland and repetitive text in their experiments. Nucleus sampling retains a dynamic set of tokens containing most probability mass and samples from it, trimming the unreliable tail. Top-k instead fixes the number of candidates. Later analysis explains properties and limitations of truncation heuristics; their findings are scoped to the studied models and tasks. For a no-sampling baseline, greedy decoding selects the highest-scoring next token directly. This removes token-sampling randomness for a fixed model and input; it does not guarantee correct code, and deployment-level reproducibility can also depend on system details.
Top-k keeps a fixed number of high-probability tokens at a step.
Top-p keeps the smallest probability-ranked set whose cumulative mass reaches the chosen threshold.
Temperature changes the relative sharpness of the distribution before sampling.
When evaluating open-ended outputs, compare decoding settings on diversity, coherence and repetition rather than assuming one setting is best.
Choose decoding settings by task-specific evaluation and record the model, prompt and sampling parameters for reproducibility. Assess diversity and coherence alongside task success. The cited papers do not establish a universal default or guarantee that sampling prevents repetition or errors.
Kostenloser Newsletter
Drei verifizierte KI-Geschichten jeden Werktagmorgen, in einfachem Englisch geschrieben. Für immer kostenlos, keine Werbung.
Eine E‑Mail jeden Werktag. Abmelden mit einem Klick. Wir verkaufen oder teilen Ihre Adresse nie.
Testen Sie sich selbst
Sofortiges Feedback zu jeder Antwort und ein teilbares Zertifikat mit verifizierbarer ID, sobald Sie einen Kurs bestanden haben.
Unterstützen Sie kostenlose KI-Bildung. AI Understanding ist eine 501(c)(3) gemeinnützige Organisation – keine Werbung, keine Paywall, nie. Machen Sie eine Spende
Top-k and nucleus (top-p) sampling are stochastic decoding methods that truncate a model’s next-token distribution before drawing a token. Temperature rescales logits and changes distribution sharpness; none of these settings guarantees factual accuracy.
Top-k kürzt die Verteilung auf eine feste Anzahl k der wahrscheinlichsten Token, renormiert sie und entnimmt daraus Stichproben.
Top-p behält die kleinste Gruppe von Top-Tokens, deren kumulative Wahrscheinlichkeit den Schwellenwert p erreicht, und führt dann Stichproben unter ihnen durch.
Die Kandidatenmenge von Top-p schrumpft, wenn das Modell sicher ist, und wächst, wenn es unsicher ist, im Gegensatz zur festen Anzahl von Top-k.
Eine niedrigere Temperatur konzentriert die Wahrscheinlichkeit auf die Top-Token (deterministischer); Höhere Temperaturen machen es flacher (vielfältiger).
Holtzman et al. report that sampling from the dynamic nucleus produced more diverse generations while retaining fluency and coherence in their evaluated setups; this is not a universal guarantee.
Lerne weiter
Weitere Leitfäden zu diesem Thema ausgewählt
Als nächstesNächster Leitfaden
Typische Probenahme
Sprach-KI