Step-by-step answer
Stretch 45 min6 stepsSimulate decoding strategies
Greedy, temperature, top-p and min-p written as small numpy functions over raw logits, run on Qwen2.5-0.5B-Instruct on a laptop CPU through Hugging Face transformers, with 20 samples per strategy scored for distinct-n diversity, repetition loops, garbled text and four factual errors agreed in advance.
Back to the exercise