WRITE · TRACE · UNDERSTAND
Stable Softmax & Temperature
Subtract the largest logit before exponentiating.
Your experiment
softmax(logits, temperature) returns normalized probabilities for finite logits and temperature > 0. Return [] for empty input. Avoid overflow for large logits.
Python runs in your browser. Your draft stays on this device.
What to look for
Subtract the largest logit before exponentiating. Temperature changes concentration without changing rank, and equal scores share probability.
Watch your code work
Ready to experimentWrite a solution or load the worked answer, then choose Trace & check.
Step through arrays, variables and training curves produced by your own Python.