It sounds like this“Scores of 3, 1 and 0 add up to 4, so the top one gets 3 out of 4: 75%.”
Reading the scores as shares of 100%
Why it feels right
Turning scores into shares is something we do all the time. Marks out of a total, votes out of all the votes, slices of a pie. So with scores of 3, 1 and 0, adding up to 4, giving the top one 3 out of 4 is the natural move. It is simple, it adds up to 100%, and it is wrong for these scores in two ways.
Why it’s wrong
The scores go through e to the power of each before they are shared out, so every point of lead multiplies the odds by about 2.7. The top token gets 84%, and a token scoring 0 still has a chance.
A worked example
Three candidate next words get scores of 3, 1 and 0. Sharing out by the total gives 75%, 25% and 0%.
What the model does is raise e (about 2.72) to the power of each score first: e to the 3 is about 20.1, e to the 1 is 2.7 and e to the 0 is 1. They add up to 23.8, so the chances are 20.1 / 23.8 = 84%, 2.7 / 23.8 = 11% and 1 / 23.8 = 4%.
Two things differ. The leader gets 84%, not 75%, because every extra point of score multiplies the odds by about 2.7. And the word scoring 0 still has a 4% chance, where shares would have made it impossible. Under the share method a negative score would even give a negative chance, which cannot be.
How to catch yourself
- You divide each score by the sum to get the chances.
- You expect a score of 0 to mean no chance.
- You think doubling a score doubles the chance.
What to hold instead
The scores are turned into chances by raising e to each one and dividing by the total, a step called softmax. A lead of one point multiplies the odds by about 2.7, so a modest lead in score becomes a big lead in chance, and no token ever gets exactly zero.
Where you’ll meet it
- Reading the 'logprobs' or top-token probabilities an AI service can return.
- Understanding what temperature does to a model's choices.
- Any classifier built on a neural network, which usually ends in the same step.
Questions people ask
- What is softmax?
- The step that turns a list of scores into chances that add up to 100%. Raise e to the power of each score, then divide each result by the total. Higher scores get disproportionately more of the chance.
- Why use e and not another number?
- The choice of base is a convention. Using a different base is the same as rescaling every score, which is what temperature does. Using e keeps the maths tidy.