Chapter 021 / 5
Prefill, Decode, and KV Cache Memory
Implement temperature + top- + top- sampling from a logits vector in numpy
Easy
Target interface
sample(logits, temperature=1.0, top_k=0, top_p=1.0, 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.