Activity (Process)

Ranking Stage in Top-k Sampling

The ranking stage is the second step in the Top-k sampling process, following expansion. In this stage, all potential next tokens generated by the language model are sorted in descending order based on their assigned probabilities. A predefined integer, 'k', determines how many of the top-ranked tokens are kept for the next stage. All other tokens with lower probabilities are pruned, or removed from consideration. For example, in the provided diagram where k=3, the tokens 'cute' (Pr=.34), 'on' (Pr=.32), and 'sick' (Pr=.21) are kept, while 'are' (Pr=.12) and '.' (Pr=.01) are pruned.

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