This tool turns a list of scores into probabilities that add up to 1, using softmax, the same step a model uses to choose the next token.
The calculation runs in your browser, and the numbers you type are not sent anywhere.
Scores
3 of 6 scores
| Score | Minus largest (3) | e to that power | Probability | |
|---|---|---|---|---|
| 1 | -2 | 0.1353 | 0.0900 | |
| 2 | -1 | 0.3679 | 0.2447 | |
| 3 | 0 | 1.0000 | 0.6652 | |
| Total | 1.5032 | 1.0000 |
Each score has the largest score subtracted, is raised as a power of e (about 2.718), and is divided by the total of those powers. The probabilities always add up to 1.
This Python function does the same calculation and prints the probabilities and their total for the starting scores.
import math
def softmax(scores):
largest = max(scores)
exps = [math.exp(s - largest) for s in scores]
total = sum(exps)
return [e / total for e in exps]
probabilities = softmax([1, 2, 3])
print(", ".join(f"{p:.4f}" for p in probabilities))
print(f"{sum(probabilities):.4f}")
# 0.0900, 0.2447, 0.6652
# 1.0000