Raschka codes top-k: keep the k largest logits, set the rest to minus infinity, and take the softmax, so only those k tokens can be drawn.