Lemma 4.3: the unsupervised loss bounds the mean classifier loss
ProvedContrastiveUnsupervised.mean_classifier_loss_le_unsup_lossLet be a countable set of latent classes with distribution , let each class have a data distribution , and let be the probability that two independent classes coincide. Let be the hinge or the logistic loss, and let be measurable and bounded. Then, for binary tasks with uniform label distribution and one negative sample,
The contrastive loss is therefore a surrogate for the average loss of the mean classifier.
Formalization Note The paper states the lemma for , which only gives boundedness and measurability. Those are the hypotheses here. The hypothesis is implicit in the paper.
import Mathlib import Definitions.Def_ContrastiveUnsupervised_Basic open MeasureTheory Filter Topology universe u v
namespace ContrastiveUnsupervised
theorem mean_classifier_loss_le_unsup_loss {X : Type*} [MeasurableSpace X] {C : Type*}
[Countable C] {d : ℕ} (D : C → Measure X) (ρ : C → ℝ) (hDρ : IsLatentClassModel D ρ)
(hτ : collisionProb ρ < 1) (hinge : Bool) (f : X → Rep d) (R : ℝ) (hf : IsBoundedRep f R) :
avgMeanSupLoss (stdLoss hinge) D ρ 1 f ≤
(unsupLoss hinge D ρ 1 f - collisionProb ρ) / (1 - collisionProb ρ) := by sorry
end ContrastiveUnsupervisedRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting and hypotheses. The statement is quantified over the following data:
- a measurable space (the data space);
- a countable (finite or countably infinite) type of latent classes;
- a dimension , with allowed;
- a family of measures on ;
- a function ;
- a Boolean flag selecting the loss ;
- a function , where carries the Euclidean norm and inner product;
- a real number .
The hypotheses are:
- Latent class model. Every is a probability measure, for all , and as an unconditionally convergent sum.
- Collision probability. The collision probability satisfies , so is not concentrated on a single class.
- Bounded representation. is measurable and for every .
The number appears only in hypothesis 3, not in the conclusion. Since the are probability measures and the sum to , the space is nonempty, so hypothesis 3 forces .
The loss . The flag selects one of two losses of a single real score :
- the hinge loss ;
- the logistic loss .
Class means. For each class , the class mean is the Bochner integral
Left-hand side: average mean-classifier loss on 2-way tasks. For an ordered pair of distinct classes , the task has uniform labels (weight each). Its loss under the mean classifier is
The left-hand side averages this over ordered pairs of distinct classes:
Both sums run over ordered pairs with . Under hypothesis 1, the denominator equals , which is positive by hypothesis 2.
Right-hand side: contrastive loss with one negative sample. A training triple is drawn from , where
- is the law of the similar pair ;
- is the law of the negative sample , drawn independently of the pair.
The unsupervised loss is
Conclusion. Under hypotheses 1–3, for either choice of loss,
Conventions. All integrals are Bochner integrals, which take the value when the integrand is not integrable. All infinite sums are unconditional, and an infinite sum is taken to be when the family is not summable. Division by would give , but the denominators here are positive under hypothesis 2.
Degenerate case. When , is the zero map and every score is . Every loss value is then , for both the hinge and the logistic loss.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.