The softmax function (logit choice rule) #
softmax sᵢ = exp sᵢ / Σⱼ exp sⱼ: the normalized exponential of a score vector
over a Fintype, with partition function partitionFn and logSumExp. This is
the logit choice rule — the exponential parameterization of Luce's choice
rule and the Gibbs/Boltzmann distribution. The inverse-temperature / rationality
parameter enters by scaling the argument (softmax (α • s)); elementary
properties are surveyed in [FD23].
It is the domain-neutral logit core shared across the library: RSA speakers and
listeners (pragmatics), MaxEnt / Noisy HG (phonology), and rational-action agents
(Core.RationalAction) all build on it. With the Gumbel→softmax result
(rumMaxProb_gumbel_eq_softmax) it is the logit sibling of the probit choice rule
(gaussianChoiceProb).
[UPSTREAM]: Mathlib has Real.exp / Real.sigmoid but no softmax /
log-sum-exp layer. Quality-and-role marker: pure-math foundation, no linguistics.
Main definitions #
softmax,partitionFn,logSumExp— the normalized exponential and its normalizing constant.logit— the inverse ofReal.sigmoid.
Main results #
softmax_sum_eq_one,softmax_pos— softmax is a probability distribution.softmax_odds,log_softmax_odds,softmax_ratio— log-odds are score differences (the defining IIA property).softmax_binary— the two-element case isReal.sigmoid.rpow_luce_eq_softmax— Luce'sf^αpower rule is softmax of log-scores.
The softmax function #
The softmax function σ(s, α)ᵢ = exp(α · sᵢ) / Σⱼ exp(α · sⱼ) is the
exponential parameterization of the Luce choice rule; its elementary properties
are surveyed in [FD23].
The partition function (normalizing constant) Z = Σⱼ exp(sⱼ).
Equations
- partitionFn s = ∑ j : ι, Real.exp (s j)
Instances For
The partition function is always positive.
Each softmax probability is positive.
Softmax probabilities sum to 1.
Softmax is non-negative.
Softmax is at most 1.
Odds are determined by score differences: pᵢ/pⱼ = exp(sᵢ - sⱼ).
Log-odds equal the score difference.
Ratio form of the odds identity.
For n = 2, softmax reduces to Real.sigmoid.
Softmax log-odds equals logit of the binary softmax probability
(when there are exactly two alternatives).
Softmax is translation invariant.
Raising one coordinate's score, holding all others fixed, strictly raises its softmax probability.
Constant scores give the uniform distribution (the α = 0 case of
softmax (α • s)).
Log of softmax = score minus log partition function.
Softmax is an exponential family distribution.
Luce choice with rpow scores equals softmax over scaled log scores:
f(i)^α / Σⱼ f(j)^α = softmax (α • (log ∘ f)) i when all f(i) > 0. This
connects belief-based RSA (which uses rpow) to the softmax framework.