AIToday
Large Language ModelsQiita 機械学習Published: Nov 30, 2026, 16:00 JST

Softmax explained: logit gap of 1 gives ~2.72x odds

Send on LINE
Softmax explained: logit gap of 1 gives ~2.72x odds

3 Key Points

  1. What happened

    The tutorial runs Softmax on logits (2, 1, 0.1), getting probabilities 0.659, 0.242 and 0.099, and PyTorch outputs 0.6590, 0.2424, 0.0986.

  2. Why it matters

    Because outputs stay positive and sum to 1, they can be treated as a probability distribution, and adding the same constant to every logit leaves results unchanged.

Ask AI

Ask the AI about this article. Questions and answers are published on this page

Context & Analysis

The post builds from a familiar puzzle: a function that turns raw model scores into probabilities is easy to use but harder to justify. Working through three logits by hand — exponentiating, summing to 11.212 and dividing — shows the two properties that make the output a probability distribution, all values above zero and a total of 1.

The more interesting step is the ratio between two tokens' probabilities, which reduces to e raised to the difference of their logits. That reframes Softmax as a converter of logit gaps into odds rather than a simple normalizer, and it explains why a gap of 1 lands at roughly 2.72x.

That same ratio view carries over to Temperature, which divides logits before the exponential and therefore sharpens or softens the gaps. The constant-shift demonstration, mirrored in a short PyTorch run, reinforces the takeaway that absolute logit values matter less than their differences. The author closes by pointing to Cross Entropy as the next topic.

FAQ
Why can Softmax outputs be treated as probabilities?
Every output is greater than 0 because it is an exponential divided by a sum of exponentials, and the outputs sum to exactly 1.
What happens if I add the same number to every logit?
Nothing changes. The constant cancels in the numerator and denominator, so Softmax(z+c) equals Softmax(z), as the Python check shows.
How does Temperature relate to Softmax?
Dividing logits by T before Softmax makes the probability ratio e^((z_i-z_j)/T), so a smaller T widens probability gaps between tokens.
Qiita 機械学習Read Original Article
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

By signing up you agree to the Terms of Service and Privacy Policy.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Related Articles

Next articleClaude Code works harder when told it trains another AI