29/29
Part 6 of 6 · What interviewers ask nextCheck yourself
Check yourself
5 questions
1.You write
logits * temperatureand call it with T = 2. What comes out?2.You sort the logits largest first and drop everything below
sorted_logits[..., k]. With k = 3 and no ties, how many tokens survive?3.Sorted probabilities are 0.5, 0.3, 0.15 and 0.05, and
top_pis 0.7. Which tokens form the nucleus?4.Your top-p code sorts the logits, masks the sorted tensor and returns it without scattering back. What do you sample?
5.
sample()callsfilter_logits()but then draws from(logits / temperature).softmax(-1). Withtop_k=3, the kept tokens hold 91% of the probability. How often does it draw a token top-k removed?
That's the lesson.Next lesson: Backprop by hand
Now the problem this lesson builds to: 05 Decoding: temperature, top-k, top-p, and a repetition penalty (PyTorch)Practice it