29/29
Part 6 of 6 · What interviewers ask nextCheck yourself
Check yourself
5 questions
  1. 1.You write logits * temperature and call it with T = 2. What comes out?

  2. 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. 3.Sorted probabilities are 0.5, 0.3, 0.15 and 0.05, and top_p is 0.7. Which tokens form the nucleus?

  4. 4.Your top-p code sorts the logits, masks the sorted tensor and returns it without scattering back. What do you sample?

  5. 5.sample() calls filter_logits() but then draws from (logits / temperature).softmax(-1). With top_k=3, the kept tokens hold 91% of the probability. How often does it draw a token top-k removed?

Now the problem this lesson builds to: 05 Decoding: temperature, top-k, top-p, and a repetition penalty (PyTorch)Practice it