Top-p (nucleus) sampling in NumPy
Implement top-p sampling in NumPy: from a vector of logits, keep the smallest set of most likely tokens whose probabilities add up to at least p, renormalize them, and sample one token.
No answer yet. Write the first one; the best answer gets endorsed.
