Select a candidate index using contrastive score = (1−alpha)*probability − alpha*degeneration. Degeneration is the maximum cosine similarity between that candidate embedding and any history embedding.
Use zero similarity if either vector has zero norm; if history is empty, degeneration is zero. Negative cosine similarities remain negative. Return the smallest candidate index among equal scores; candidate indices are the token IDs for this exercise.