proofs
Provedllmlarge-language-modelsformal-proofsoftmax

Scaling logits with temperature rescaling leaves sampling unchanged

For all T,c∈R\htmlData{mx=1}{T, c \in \htmlData{mx=0}{\mathbb{R}}}, n∈N\htmlData{mx=1}{n \in \htmlData{mx=0}{\mathbb{N}}}, w:Fin⁡ n→R\htmlData{mx=5}{w : \htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fin}}\,\htmlData{mx=1}{n}} \mathrel{\htmlData{mx=4}{\to}} \htmlData{mx=3}{\mathbb{R}}} and i∈Fin⁡ n\htmlData{mx=3}{i \in \htmlData{mx=2}{\htmlData{mx=0}{\operatorname{Fin}}\,\htmlData{mx=1}{n}}}:

T≠0  ⟹  c≠0  ⟹  smT⁡(c⋅T,j↦c⋅w(j),i)=smT⁡(T,w,i)\htmlData{mx=0}{T} \mathrel{\htmlData{mx=1}{\neq}} 0 \mathrel{\htmlData{mx=23}{\implies}} \htmlData{mx=2}{c} \mathrel{\htmlData{mx=3}{\neq}} 0 \mathrel{\htmlData{mx=22}{\implies}} \htmlData{mx=15}{\htmlData{mx=4}{\operatorname{smT}}(\htmlData{mx=7}{\htmlData{mx=5}{c} \cdot \htmlData{mx=6}{T}}, \htmlData{mx=13}{j \mapsto \htmlData{mx=12}{\htmlData{mx=8}{c} \cdot \htmlData{mx=11}{\htmlData{mx=9}{w}(\htmlData{mx=10}{j})}}}, \htmlData{mx=14}{i})} \mathrel{\htmlData{mx=21}{=}} \htmlData{mx=20}{\htmlData{mx=16}{\operatorname{smT}}(\htmlData{mx=17}{T}, \htmlData{mx=18}{w}, \htmlData{mx=19}{i})}
What the notation means · or point at any symbol
RReal numbers
The real numbers: every point on the number line. (ℝ)
x ∈ TVariables
T, c range over real numbers: the statement must hold for every choice. ((T c : ℝ))
NNatural numbers
The natural numbers 0, 1, 2, …. In Lean they start at 0. (ℕ)
Fin
Fin: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (Fin)
f(x)Function application
Fin applied to n. Lean writes f x; papers write f(x). (Fin n)
⟹Implies
If Fin(n), then ℝ. (Between types, A → B is the type of functions from A to B.) (Fin n → ℝ)
≠Not equal
T and 0 are different. (T ≠ 0)
smT
LLMSoftmax.smT: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (LLMSoftmax.smT)
=Equality
smT(c · T, j ↦ c · w(j), i) and smT(T, w, i) are the same. (LLMSoftmax.smT (c * T) (fun j => c * w …)
·Multiplication
c times T. (c * T)
x ↦ f(x)Function (λ-abstraction)
The function sending j to c · w(j). Lean writes fun x => …; papers write x ↦ …. (fun j => c * w j)

smT (c*T) (c·w) = smT T w for c ≠ 0, T ≠ 0: logit scale can be absorbed into temperature.

How it was proved

Proved
28 September 2026
By
Ajax, with the agent “ompmuse”
Checked by
Lean's kernel (Lean 4.33.1, with Mathlib); the proof is signed and replays offline
Axioms
Classical.choice, Quot.sound, propext
Proof
18 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.

More proved statements