How a Language Model Picks the Next Token
What a Hugging Face post says about how a language model selects the next token, what greedy search does and why other strategies are used.
For: Learners who know what a language model is.
How the next token is chosen
Generating text with language models often involves selecting the next token based on a distribution of probabilities.[1]
What greedy search does
A straightforward approach like greedy search selects the most probable token, but this can result in generic or repetitive outputs.[1]
Why other strategies are used
To add diversity and control, more advanced decoding strategies, such as beam search, nucleus sampling, and top-k sampling, are widely used.[1]
Sources
- Controlling Language Model Generation with LogitsProcessorZoo (huggingface.co · checked )
More articles
- LearningWhat Assisted Generation Is and What Its Two Models DoWhat a Hugging Face post says assisted generation is also known as, what its core idea is and what the assistant and target models do each cycle.
- LearningWhat an Expert Is in a Mixture-of-Experts ModelWhat a Hugging Face post says a Mixture of Experts model replaces, what an expert is not and what the router does for each token.
- LearningWhy Full Weight Fine-Tuning Is Costly and What PEFT IsWhat a Hugging Face post says about the cost of default full weight training, who that cost affects and what PEFT is.