learn me a gpt
Pages in Tools

19 Nov 2026

Softmax

The tool turns a list of scores into probabilities that sum to 1.

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
ScoreMinus largest (3)e to that powerProbabilityBar
1-20.13530.0900
2-10.36790.2447
301.00000.6652
Total1.50321.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