Theorem 1 (eq. (2) and result 3): the limit of and its rate
ProvedAlignmentUniformity.contrastive_limit_and_rateLet and . Let be a probability distribution on and a symmetric probability distribution on with marginal . Let be a measurable encoder. Then, as the number of negative samples tends to infinity,
and the deviation from the limit is : there is a constant with
This is eq. (2) together with result 3 of Theorem 1.
Formalization Note The constant may depend on , , and , as in the paper's for fixed and .
import Mathlib import Definitions.Def_AlignmentUniformity_Basic open MeasureTheory Filter Topology
namespace AlignmentUniformity
theorem contrastive_limit_and_rate {n m : ℕ} (hm : 1 ≤ m) {τ : ℝ} (hτ : 0 < τ)
(pdata : Measure (Vec n)) [IsProbabilityMeasure pdata]
(ppos : Measure (Vec n × Vec n)) [IsProbabilityMeasure ppos] (hpos : IsPosPairLaw pdata ppos)
(f : Vec n → Vec m) (hf : IsEncoder f) :
Tendsto (fun M : ℕ => contrastiveLoss pdata ppos f τ M - Real.log M) atTop
(𝓝 (alignTerm ppos f τ + uniformTerm pdata f τ)) ∧
∃ C : ℝ, ∀ M : ℕ, 1 ≤ M →
|contrastiveLoss pdata ppos f τ M - Real.log M -
(alignTerm ppos f τ + uniformTerm pdata f τ)| ≤ C / Real.sqrt M := by sorry
end AlignmentUniformityRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. Fix natural numbers and with , and a real temperature . Write for -dimensional Euclidean space with the standard inner product and Euclidean norm ; is allowed, in which case is a single point. The data are:
- , a Borel probability measure on .
- , a Borel probability measure on . It is assumed to be a "positive-pair law" for , meaning both of the following hold:
- it is invariant under swapping coordinates, i.e. its pushforward under equals ;
- its pushforward under the first projection equals .
- , an "encoder". This means is Borel measurable and for every , not merely almost every . Consequently every inner product lies in .
The contrastive loss. For each , the contrastive loss is the integral, with respect to the product probability measure , of a function of together with independent negatives , each distributed as and independent of :
Two features of this formula:
- The negatives are compared against , the second element of the positive pair, not against .
- For the sum is empty, and the integrand is identically .
The integrand is bounded and measurable, so the integral is an ordinary finite expectation. In general, the integrals here follow the convention that a non-integrable function has integral .
The limit terms. Define the alignment term
and the uniformity term
The inner integral in is at least .
Claim. Under all of the above hypotheses, both of the following hold.
- Limit. As through the natural numbers,
Here is the natural logarithm of viewed as a real number. At it takes the junk value , which does not affect the limit.
- Rate. There exists a real constant such that for every natural number ,
The constant is chosen after are fixed, so it may depend on all of them. It is not required to be nonnegative explicitly, but the inequality forces .
Read literally, the second conclusion implies the first.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.