Theorem 2: minimizers of the InfoNCE loss invert the generative process on the hypersphere up to an orthogonal transformation and scaling
ProvedContrastiveInverts.contrastive_learning_inverts_on_sphereLet , , and . Let the latents lie on with uniform marginal and von Mises–Fisher conditional . Let the mixing function map injectively into and be differentiable on an open neighbourhood of .
Let be a class of encoders , each with measurable on . Assume the model's form of matches : some has on . Let be differentiable on , with differentiable on an open neighbourhood of , and let minimise the contrastive loss for over :
Then is linear on : there is an orthogonal map of with
So recovers the latent sources up to an orthogonal linear transformation and the constant scaling factor .
Formalization Note "The assumed form of matches that of " is encoded as in Proposition 1: the encoders map into the sphere of radius , and the class contains an encoder whose equals . Minimisation is over this class, whose members are required to give measurable , so that every objective in the comparison is defined. Following Section 3, is only required to map into .
import Mathlib import Definitions.Def_ContrastiveInverts_Basic open MeasureTheory Filter Topology
namespace ContrastiveInverts
theorem contrastive_learning_inverts_on_sphere {N K : ℕ} (hN : 0 < N) (hNK : N ≤ K)
(τ κ : ℝ) (hτ : 0 < τ) (hκ : 0 < κ)
(X : Set (Vec K)) (g : Vec N → Vec K) (hgX : ∀ z ∈ Metric.sphere (0 : Vec N) 1, g z ∈ X)
(hg_inj : Set.InjOn g (Metric.sphere (0 : Vec N) 1))
(hg_diff : ∃ U : Set (Vec N), IsOpen U ∧ Metric.sphere (0 : Vec N) 1 ⊆ U ∧
DifferentiableOn ℝ g U)
(F : Set (Vec K → Vec N))
(hF : ∀ f' ∈ F, (∀ x ∈ X, f' x ∈ Metric.sphere (0 : Vec N) (Real.sqrt (τ * κ))) ∧
Measurable (fun z : Sph N => f' (g z)))
(hflex : ∃ f₀ ∈ F, ∀ z ∈ Metric.sphere (0 : Vec N) 1, ∀ z' ∈ Metric.sphere (0 : Vec N) 1,
sphModelCond τ (f₀ ∘ g) z z' = vmfCond N κ z z')
(f : Vec K → Vec N) (hfF : f ∈ F) (hf_diff : DifferentiableOn ℝ f X)
(hh_diff : ∃ U : Set (Vec N), IsOpen U ∧ Metric.sphere (0 : Vec N) 1 ⊆ U ∧
DifferentiableOn ℝ (f ∘ g) U)
(hmin : ∀ f' ∈ F, infoNCELimit κ τ (f ∘ g) ≤ infoNCELimit κ τ (f' ∘ g)) :
∃ U : Vec N ≃ₗᵢ[ℝ] Vec N, ∀ z ∈ Metric.sphere (0 : Vec N) 1,
f (g z) = Real.sqrt (τ * κ) • U z := by sorry
end ContrastiveInvertsRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. Fix natural numbers with , and real numbers , . Write:
- and for Euclidean spaces with the standard inner product ;
- for the unit sphere;
- for the measure on induced from Lebesgue measure on by the cone construction. For a set it is . This is the surface measure; for , where , it gives mass to each point.
- for the normalized uniform measure on .
Hypotheses. The theorem is given the following data and assumptions:
- An arbitrary set , with no openness, measurability or other condition.
- A map such that:
- for every ;
- is injective on ;
- is differentiable at every point of some open set .
- A set of maps such that every :
- maps every point of into the sphere of radius about in ;
- makes measurable as a function on .
- Realizability: there exists such that, with ,
The two conditionals are defined by
- A map such that:
- is differentiable on in the relative sense (within at each point of );
- is differentiable at every point of some open set containing .
- Minimality: for every ,
The objective . For and , define
The ingredients are:
- is the measure on with density with respect to .
- The negatives are independent and uniform.
- The integral is a Bochner integral, so it is defined to be if the integrand is not integrable.
Then
taken over natural numbers , with the convention . If this sequence does not converge, is an unspecified junk value rather than "undefined". In that case the minimality hypothesis compares such junk values.
Minimality is required only against competitors in , and only in terms of .
Conclusion. There exists a linear isometric automorphism of , that is, an orthogonal map (rotations and reflections are both allowed), such that
Nothing is asserted about off the unit sphere, or about off .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.