Proposition 4 (ii) and eq. (6): the temperature-scaled next-token loss tends to the margin
ProvedArxiv2610_39302.next_token_prediction_margin_limitLet a context be embedded by and the tokens of a finite nonempty vocabulary by vectors , and let . Then for every target token :
- (eq. 6) the next-token loss with a linear softmax head is
where does not depend on ; 2. as ; 3. the temperature-scaled loss tends to the margin: as ; 4. the margin is nonnegative, and it vanishes if and only if the target attains the maximal logit.
Formalization Note The temperature tends to from above.
import Mathlib import Definitions.Def_Arxiv2610_39302_Basic open MeasureTheory Filter Topology Matrix
namespace Arxiv2610_39302
theorem next_token_prediction_margin_limit {V : Type*} [Fintype V] [Nonempty V] {k : ℕ}
(w : V → Fin k → ℝ) (h : Fin k → ℝ) (y : V) :
ntpLoss w h y = -(h ⬝ᵥ w y) + ntpAntiCollapse w h ∧
Tendsto (fun t : ℝ => t * ntpAntiCollapse w (fun i => h i / t)) (𝓝[>] 0)
(𝓝 (⨆ v, h ⬝ᵥ w v)) ∧
Tendsto (fun t : ℝ => t * ntpLoss w (fun i => h i / t) y) (𝓝[>] 0)
(𝓝 ((⨆ v, h ⬝ᵥ w v) - h ⬝ᵥ w y)) ∧
0 ≤ (⨆ v, h ⬝ᵥ w v) - h ⬝ᵥ w y ∧
((⨆ v, h ⬝ᵥ w v) - h ⬝ᵥ w y = 0 ↔ ∀ v, h ⬝ᵥ w v ≤ h ⬝ᵥ w y) := by sorry
end Arxiv2610_39302Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Let be a finite, nonempty set (the vocabulary). Let be a natural number; is allowed, in which case is a single point and every inner product below equals . The statement is universally quantified over:
- a family of vectors , one for each (the rows of a linear softmax head). No condition is imposed: the may coincide or be zero.
- a vector ;
- a token .
For write for the score (logit) of , and write . This maximum exists because is finite and nonempty. The statement involves two functions of a vector :
- the anti-collapse term
- the next-token loss of target
The sum is strictly positive, so both logarithms are of positive numbers. For , let denote the vector with components .
The theorem asserts the conjunction of the following five claims.
- Decomposition of the loss.
- Limit of the rescaled anti-collapse term. As tends to through strictly positive values only (a one-sided limit from the right; itself is excluded),
- Limit of the rescaled loss. As in the same sense,
- Non-negativity of the margin.
- Characterisation of zero margin.
This says the margin vanishes exactly when attains the maximal score. Ties are allowed: need not be the unique maximiser.
Claims 4 and 5 concern only the scores and do not involve or . There are no hypotheses beyond being finite and nonempty.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.