Mid-level interview question
Greedy decoding on a small model gives fluent text that soon repeats itself word for word. Why does that happen?
Model answer
It's a feedback loop: once a phrase has appeared, the model rates it more likely to appear again, and greedy always takes the top choice. Continuing "I opened the box and found", GPT-2 small picked " amount" at 0.027 the first time and 0.988 on the repeat.
Holtzman et al. report the same for most phrases they tested: decoding that maximizes probability tends to give bland or looping text.
Practise the rest
9 Sampling questions, 492 in all, each with a model answer. Free.
More Sampling interview questions
- What are logits, and how does a model go from them to a whole sentence of output?
- Explain temperature, top-k and top-p. Why would you usually reach for top-p rather than a fixed k?
- Your integration tests call a hosted model at temperature 0 and compare the output with an exact string. They fail now and then. What's going on, and what do you change?
- A PM wants to show users a 'confidence' percentage computed from the answer's token probabilities. What's your position, and what would you build instead?
- Write beam search that returns each sentence with its probability. How does it differ from greedy decoding?
- Build a bigram next-word predictor that samples the next word in proportion to how often it followed.