A robot vision classifier can assign the same softmax output to score vectors whose entries differ by a large common constant. The individual exponentials change, but their normalized ratios do not. This algebraic freedom also supplies a useful way to avoid unnecessarily large intermediate numbers.
The original examples below use three hypothetical class scores. They explain a numerical transformation, not the accuracy of a trained model or a confidence guarantee for an actual robot decision.
Define the class axis and finite scores
For one observation, let z contain one finite real logit for each mutually exclusive class in the declared set. Define p_i = exp(z_i)/sum_j exp(z_j), where the sum covers those classes for this observation.
Every p_i is positive in exact real arithmetic, and the values sum to one. A logit can be negative or larger than one because it is not itself a probability.
SciPy's version 1.16.2 softmax reference documents this normalization, including the chosen axis, and notes its use of shifting to avoid overflow. Its logsumexp reference documents a more stable evaluation of the logarithm of the exponential sum. The calculations here are independently constructed.
A simple score vector has exact fractions
Choose z = [0, ln(2), ln(6)]. The exponentials are [1,2,6], with sum nine. Softmax is therefore [1/9,2/9,6/9], approximately [0.111111,0.222222,0.666667].
The third class has the largest logit and largest normalized value. The ratio p_3/p_2 is three, matching exp[ln(6)-ln(2)]. Pairwise score differences determine these probability ratios.
That is a mathematical property of the stated transform. It does not say that an observation assigned 0.666667 is correct two-thirds of the time in a real deployment. Such a calibration claim needs evidence beyond one score vector.
Add one constant to every score
Define z'_i = z_i + c for the same finite c across all classes. Then exp(z_i+c) = exp(c)exp(z_i). The common factor exp(c) appears in numerator and denominator and cancels exactly.
Thus softmax(z+c) equals softmax(z) in exact arithmetic. With c = 1,000, the original three output fractions remain unchanged even though each unnormalized exponential contains the enormous common factor exp(1,000).
The transformation is not invariant to adding 1,000 to only one class. That changes the pairwise differences. Likewise, subtracting a different offset from each class would alter the modeled comparison rather than merely changing its numerical representation.
Choose the maximum as the common shift
Let m be the largest entry of z. Evaluate p_i using exp(z_i-m) divided by the sum of those shifted exponentials.
Every exponent argument is now nonpositive, and at least one is zero. Hence each exponential lies between zero and one inclusive in finite-precision computation, with a denominator at least one for a nonempty vector of finite inputs.
For the large-offset example, m = 1,000 + ln(6). The shifted arguments are [-ln(6),-ln(3),0]. Their exponentials are [1/6,1/3,1], whose sum is 1.5. Dividing gives the same [1/9,2/9,2/3].
Subtracting the maximum avoids forming the huge common exponential. It does not recover score differences already lost through an earlier rounding or quantization step. Algebraic equivalence also does not promise bit-for-bit equality between every finite-precision evaluation order.
The log-normalizer retains the removed offset
Define L(z) = ln[sum_j exp(z_j)]. Factoring out exp(m) gives L(z) = m + ln[sum_j exp(z_j-m)].
Unlike softmax, L is not invariant to a common shift. Instead, L(z+c) = L(z)+c. For the original three scores, L = ln(9), approximately 2.197225. For the vector shifted by 1,000, L is approximately 1,002.197225.
Dropping m from that calculation would produce the wrong log-normalizer, even though dropping the common exponential factor from the softmax ratio was correct. The requested output determines which term must be restored.
Log probabilities avoid a second fragile conversion
The log probability is ln(p_i) = z_i - L(z). A stable equivalent form is (z_i-m) - ln[sum_j exp(z_j-m)].
Now use another original vector [0,-1,000]. Its second probability is extremely small. In exact arithmetic it is exp(-1,000)/(1+exp(-1,000)), while its log probability is -1,000 - ln[1+exp(-1,000)], very close to -1,000.
In a finite format, exp(-1,000) may round to zero. Taking the logarithm of that rounded probability then yields negative infinity, although the exact log probability is finite. Computing the log-domain expression avoids first materializing that tiny probability.
This example explains a numerical route; it is not a reported library execution or a promise that every arithmetic format behaves identically at every score separation.
Rescaling scores changes the output
For a positive scalar temperature T, define a separate transform softmax(z/T). This is a multiplicative rescaling of score differences, not a common additive shift.
At T = 2, the original vector's unnormalized values become [1,sqrt(2),sqrt(6)]. Its largest-class probability is approximately 0.50363, smaller than two-thirds, while the class ordering is unchanged.
Positive division preserves the ordering of finite logits, but changes their normalized separation. T = 0 is undefined in this expression, and a negative T would reverse the ordering. No temperature is selected here for an actual model.
Changing numerical sharpness is also not proof of better calibration. A fitting procedure and representative validation would be separate evidence.
Normalization needs the intended population
For several observations stored in a matrix, summing across all entries would mix observations into one distribution. Per-observation class normalization requires the corresponding class axis. A result summing to one somewhere in an array does not by itself establish that the intended groups were used.
The useful robot inference record therefore retains class order, logits, normalization axis, numerical method, and any score rescaling. Stable arithmetic preserves a defined mathematical comparison; it does not add missing evidence about what the classes mean or how reliably the model predicts them.
Sources checked October 23, 2026:
SciPy 1.16.2, scipy.special.softmax: https://docs.scipy.org/doc/scipy-1.16.2/reference/generated/scipy.special.softmax.html
SciPy 1.16.2, scipy.special.logsumexp: https://docs.scipy.org/doc/scipy-1.16.2/reference/generated/scipy.special.logsumexp.html
All score vectors, fractions, limiting examples, and interpretations are original hypothetical analysis.
Illustration note: The accompanying site-library robot vision scene is a concept illustration. It does not show this classifier, measured probabilities, or validated recognition accuracy.