Theorem B.1: guarantee with k negative samples
OpenContrastiveUnsupervised.k_negative_samples_guaranteeLet be a countable set of latent classes with distribution and class distributions . Let be the number of negative samples, with . Let every task have a label distribution . Let be the hinge or logistic loss, and let be a pointwise separable class of measurable with , . Let for training sets of tuples drawn from . There are absolute constants and such that, for every , with probability at least , for all ,
with , , , and the law of the set of distinct classes of conditioned on .
This is the formal version of Theorem 6.1. For and uniform it gives the second inequality of Theorem 4.5 (then and ); it does not give the first inequality , and for non-uniform it bounds a different, weighted quantity.
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 . Losses of an empty vector are , the convention the proof uses for when .
import Mathlib import Definitions.Def_ContrastiveUnsupervised_Basic open MeasureTheory Filter Topology universe u v
namespace ContrastiveUnsupervised
theorem k_negative_samples_guarantee :
∃ K c' : ℝ, 0 < c' ∧
∀ {X : Type u} [MeasurableSpace X] {C : Type v} [Countable C] {d : ℕ}
(D : C → Measure X) (ρ : C → ℝ), IsLatentClassModel D ρ →
∀ (k : ℕ), 1 ≤ k → tauK ρ k < 1 →
∀ (pT : Finset C → C → ℝ), IsTaskDistFamily pT →
∀ (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 k → X)) → X → Rep d),
(∀ S, fhat S ∈ F ∧ ∀ f ∈ F, empUnsupLoss hinge k (fhat S) S ≤ empUnsupLoss hinge k f S) →
∀ δ : ℝ, 0 < δ → δ ≤ 1 / 2 →
sampleMeasure D ρ k M {S | ¬ ∀ f ∈ F,
weightedTaskMeanSupLoss (stdLoss hinge) D ρ k pT (fhat S) ≤
(1 - tauAll ρ k) / (1 - tauK ρ k) * unsupLossNeq hinge D ρ k f +
c' * k * (collisionProb ρ / (1 - tauK ρ k)) * intraclassDeviation D ρ f +
1 / (1 - tauK ρ k) * genError K R k 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 exist two real constants and , with and no sign condition on , such that the following holds. Both constants are fixed once, before any of the data below is chosen, so they cannot depend on any of it.
Setting. Let be any measurable space and any countable set of "classes". Let be a natural number; is allowed, in which case is a single point. Representations take values in with the Euclidean norm and inner product .
Let be probability measures on . Let satisfy for all and (as an unconditionally convergent sum).
Let be an integer. Draw classes i.i.d. from , and define:
- the collision set ;
- the set of distinct classes ;
- , the probability that some negative class equals ;
- ;
- , the collision probability.
It is assumed that .
Let assign to each finite set a function . For every nonempty , it must satisfy for all and . Nothing is required for , and values of outside are otherwise unconstrained.
The loss. A Boolean flag selects the loss , applied to a finitely-indexed family :
- either the hinge loss , set to when ;
- or the logistic loss , which also equals when .
The same choice of is used in every quantity below.
Function class. Let . Let be a set of maps such that:
- each is measurable and satisfies for all ;
- is pointwise separable: there is a countable such that every is the pointwise limit of some sequence in .
Samples. Let . A training sample is with . Its law is the -fold product of the following single-tuple law:
- is drawn from ;
- independently of that pair, are i.i.d. from .
The empirical contrastive loss of on is
The learner. Let be any map (no measurability is required) sending each sample to . For every sample , it must satisfy and for all . In other words, is an exact empirical minimizer over at every sample. If no exact minimizer exists for some , the hypothesis cannot be met and the statement is vacuous for that .
Conclusion. For every with , consider the set of samples for which it is not the case that, for all simultaneously,
This set has -measure at most . The measure is applied to the set as written, so if the set is not measurable this means its outer measure.
The quantities in the inequality. Write for the class mean of .
- Left-hand side. It is a weighted average of mean-classifier losses over the tasks , conditioned on :
Its ingredients are:
- ;
- ;
- the mean-classifier supervised loss
with the means computed from .
- First right-hand term. It uses
Here is the expectation of , under and , all independent. Negatives that collide with are dropped.
- Second right-hand term. It uses the intraclass deviation
Here is the covariance matrix of for , and is the spectral norm.
- Third right-hand term. It is
with natural logarithms. The quantity is the Rademacher average
where .
Conventions. All expectations over classes are countable weighted sums.
- A division by evaluates to .
- A non-summable sum, a non-integrable integral, or a supremum of an unbounded or empty family would also evaluate to .
- Under the boundedness hypotheses these junk cases do not arise for the sums, integrals and suprema. The exception is the supremum over an empty , which is possible only when is empty.
- The denominators and are positive under the hypotheses.
- may be .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.