core practice · coding problem
Temperature scaling logits
Logits [2,1,0]. Apply temperature T=2 and T=0.5 before softmax. Which T makes the distribution sharper?
The mechanism
After the model outputs a probability for each next token, you have to pick one. Greedy picks the top — safe but dull. Temperature, top-k, and top-p (nucleus) introduce controlled randomness. Pick by how much variety the task can tolerate.
Expected evidence
T<1 sharpens (more greedy); T>1 flattens.
Try this drill in the practice workspace →
Hints when you need them
- Divide logits by T before softmax.
- T→0 approaches argmax.