Explaining Token Sampling Using Raffle Tickets
ProfTomYeh · x · 2026-07-13
This thread provides a step-by-step demonstration of how LLM token sampling works:
- First, input embeddings are fed into the model to obtain a probability distribution for the next word.
- This probability is then converted into a cumulative distribution, akin to allocating 100 "raffle tickets" among different words.
- A random number is drawn; whichever range it falls into determines the selected word, which is then placed in the sequence.
- Through three rounds of examples, the phrase "how are you" is generated.
The author uses the "raffle ticket" analogy to explain why high-probability words are chosen more frequently, while low-probability words still stand a chance.
More from Research
- Structural ensembles beat single predictions in TCR:pMHC generalization study — quaidmorris · 2026-07-22
- RSS launches under OMSF to push structural biology data modeling at scale — MoAlQuraishi · 2026-07-22
- enFoldX tops 8 neoantigen scans and an unseen-peptide benchmark — quaidmorris · 2026-07-22
- enFoldX reaches AUC 0.82 on human VDJdb and transfers to mouse at 0.76 — quaidmorris · 2026-07-22
- enFoldX gains accuracy as AF3 ensemble disagreement rises for non-binders — quaidmorris · 2026-07-22
- A 3D ray plot shows how hard this Jacobian counterexample is to read — moultano · 2026-07-22