Theorem 4.1 (as proved): upper bound using the unsupervised loss
ProvedContrastiveUnsupervised.unsup_loss_upper_boundLet be a countable set of latent classes with distribution and class distributions , and let . Let be the hinge or the logistic loss. Let be a pointwise separable class of measurable with , . Let be an empirical minimizer, for every training set of tuples (one negative sample). There is an absolute constant such that, for every , with probability at least over the training set of tuples drawn from , for all ,
If contains a representation with small unsupervised loss, the learned representation has small average binary loss with the mean classifier.
Formalization Note The paper's is an absolute constant , and "with probability at least " means that the outer measure of the failure set is at most . The statement is restricted to because the proof (Mohri et al., Theorem 3.1, and Hoeffding) produces and . These are only for bounded away from ; for the two forms agree up to the constant. Pointwise separability of and measurability of each are standing conventions the paper does not state. The hypothesis is implicit in the paper's division by .
import Mathlib import Definitions.Def_ContrastiveUnsupervised_Basic open MeasureTheory Filter Topology universe u v
namespace ContrastiveUnsupervised
theorem unsup_loss_upper_bound :
∃ K : ℝ, ∀ {X : Type u} [MeasurableSpace X] {C : Type v} [Countable C] {d : ℕ}
(D : C → Measure X) (ρ : C → ℝ), IsLatentClassModel D ρ → collisionProb ρ < 1 →
∀ (hinge : Bool) (R : ℝ), 0 < R →
∀ (F : Set (X → Rep d)), (∀ f ∈ F, IsBoundedRep f R) → IsPointwiseSeparable F →
∀ (M : ℕ), 1 ≤ M →
∀ (fhat : (Fin M → X × X × (Fin 1 → X)) → X → Rep d),
(∀ S, fhat S ∈ F ∧ ∀ f ∈ F, empUnsupLoss hinge 1 (fhat S) S ≤ empUnsupLoss hinge 1 f S) →
∀ δ : ℝ, 0 < δ → δ ≤ 1 / 2 →
sampleMeasure D ρ 1 M {S | ¬ ∀ f ∈ F,
avgMeanSupLoss (stdLoss hinge) D ρ 1 (fhat S) ≤
1 / (1 - collisionProb ρ) * (unsupLoss hinge D ρ 1 f - collisionProb ρ) +
1 / (1 - collisionProb ρ) * genError K R 1 M (rademacherAvg F S) δ} ≤
ENNReal.ofReal δ := by sorry
end ContrastiveUnsupervisedRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
There is a single real constant such that the statement below holds for every choice of the following data:
- a measurable space and a countable set of "latent classes";
- a dimension , possibly , in which case every representation is the zero vector;
- a family of measures on and a real-valued function on ;
- a choice of loss (hinge or logistic);
- a radius , a function class , a sample size , a learning rule , and a confidence level .
is chosen before all of these, so it may not depend on any of them.
Hypotheses on the class model.
- Every is a probability measure.
- for all , and . This forces and . may be infinite.
- The collision probability satisfies .
The loss. On one real number , the loss is one of:
The same choice is used everywhere below.
Hypotheses on and .
- .
- is a set of functions , with the Euclidean norm and inner product on .
- Every is measurable and satisfies for all .
- is pointwise separable: some countable has the property that every is a pointwise limit of a sequence in .
Samples. is an integer. A sample is a tuple
The empirical unsupervised loss of a function on is
Hypothesis on . assigns to every sample a function such that:
- ;
- for every .
That is, is an exact empirical-risk minimizer over for every sample. No measurability of is assumed.
Hypothesis on . .
The quantities in the conclusion.
Distribution of samples. The sample is drawn from the -fold product of the law of one tuple . In that law, and are independent, with
Population unsupervised loss. For ,
with expectation over the tuple law just described.
Mean-classifier supervised loss. For a representation , the class means are
For a pair , the two-class mean-classifier loss is
This uses the uniform label distribution . The averaged loss is
Both sums run over ordered pairs. This is averaged over independent , conditioned on .
Empirical Rademacher average. Write , , . Then
where is the -th coordinate.
Generalization term. With natural logarithm,
This depends on . It is the general expression evaluated at one negative sample, where the factor and the term vanish.
Conclusion. Let be the set of samples for which some violates
The theorem asserts that has probability at most under the product sample law. need not be measurable; in that case the asserted bound is on its outer measure. Equivalently, outside a set of probability at most , the displayed inequality holds simultaneously for all .
Conventions. The integrals and infinite sums above are taken with the usual conventions:
- an integral of a non-integrable function is ;
- a non-summable infinite sum is ;
- a supremum of a set that is not bounded above, or is empty, is .
Under the stated hypotheses the integrands are bounded and is nonempty.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.