Natural Language Processing · 免费预览
解码与采样策略
贪心解码及其失效模式、随机采样、温度,以及在质量与多样性之间取得平衡的 top-k 和 top-p 截断。
1. Decoding and Sampling Strategies
Decoding and Sampling Strategies
2. Temperature and truncation
Temperature and truncation
3. Four decoders in NumPy
Four decoders in NumPy
4. Greedy decoding
A model's next-token distribution is fog , tide , gulls , horn . Which word does greedy decoding emit? Answer with the word.
5. Which way does the temperature bend the distribution?
A decoder divides logits by before the softmax. What happens to the probability of the leading token, and what generation quality changes with it?
6. Top-k renormalization
A distribution over four words is . Top-2 sampling keeps the largest, discards the rest, and renormalizes. Compute the new probability of the top word, rounding to three decimals.
7. Why the nucleus adapts
Two contexts both decode with top-p at 0.6. In context A the top two tokens hold 0.85 of the mass together, in context B the top five hold 0.55. What does the nucleus keep in each?
8. When greedy fails
Which task and decoder pairing is most defensible?