Real samplers chain several steps, and order matters. Implement the order Hugging Face's generate uses:
temperaturetop_k highest logits (ties at the boundary all kept), and set others to -inftop_p (always at least one token)Implement next_token_probs(logits, generated=(), repetition_penalty=1.0, temperature=1.0, top_k=None, top_p=1.0) returning the final probability array. Any step at its default value is skipped.