Chapter 023 / 5
Prefill, Decode, and KV Cache Memory
Implement nucleus (top-) sampling with correct renormalization and edge cases
Medium
Target interface
top_p_sample(probs, p=0.9, rng=None)Complete the starter code in the editor. Any correct approach is accepted.
Hints0 / 2
Reference solution
Your own code stays in the editor.