Learn Before
Comparison

Comparison of Top-p and Top-k Sampling

Top-p (nucleus) sampling and top-k sampling are similar decoding methods that primarily differ in how they construct the candidate pool for the next token. Top-k sampling uses a fixed-size pool, selecting the 'k' most probable tokens. In contrast, top-p sampling uses a dynamically sized pool, selecting the smallest set of the most probable tokens whose cumulative probability exceeds a predefined threshold 'p'.

Image 0

0

1

Updated 2025-10-10

Contributors are:

Who are from:

Tags

Ch.5 Inference - Foundations of Large Language Models

Foundations of Large Language Models

Foundations of Large Language Models Course

Computing Sciences

Related