Theorem 2: supervised contrastive loss is minimized exactly by collapse onto a regular simplex
ProvedSupConGeometry.supcon_loss_lower_boundLet with , let be the batch size, and let . Let be a configuration on the sphere with balanced labels . Then
Equality holds if and only if there are such that
- (C1) for all , and
- (C2) form a -sphere-inscribed regular simplex.
So the supervised contrastive loss over all batches is minimal exactly when every class collapses to a single point and these points are the vertices of a regular simplex on the sphere.
Formalization Note is implicit in the factor . For the collapsed configuration attains the bound but no simplex exists. and are the paper's standing assumptions (Section 2 and Supplementary S1). The loss sums over all multisets of indices, as in Definition 2.
import Mathlib import Definitions.Def_SupConGeometry_Basic open Finset
namespace SupConGeometry
theorem supcon_loss_lower_bound {N K h b : ℕ} (hK : 2 ≤ K) (hKh : K ≤ h + 1) (hb : 3 ≤ b)
(ρ : ℝ) (hρ : 0 < ρ) (Z : Fin N → Rep h) (hZ : ∀ n, ‖Z n‖ = ρ)
(Y : Fin N → Fin K) (hY : IsBalanced Y) :
(∑ l ∈ Icc 2 b, (l : ℝ) * (batchCountTotal Y b l : ℝ) *
Real.log ((l : ℝ) - 1 + ((b : ℝ) - l) *
Real.exp (-((K : ℝ) * ρ ^ 2 / ((K : ℝ) - 1))))) ≤ scLoss Z Y b ∧
(scLoss Z Y b =
∑ l ∈ Icc 2 b, (l : ℝ) * (batchCountTotal Y b l : ℝ) *
Real.log ((l : ℝ) - 1 + ((b : ℝ) - l) *
Real.exp (-((K : ℝ) * ρ ^ 2 / ((K : ℝ) - 1)))) ↔
∃ ζ : Fin K → Rep h, (∀ n, Z n = ζ (Y n)) ∧ IsSphereInscribedRegularSimplex ζ ρ) := by sorry
end SupConGeometryRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. Fix natural numbers (number of points), (number of classes), (dimension) and (batch size), and assume
Let be a real number. Let be points in Euclidean space with standard inner product , all on the sphere of radius , so that for every . Let be labels .
The labels are assumed balanced: for every class , the class size satisfies . Two consequences follow:
- is a multiple of .
- is allowed. In that case the hypotheses on and are vacuous, there are no batches, and every quantity below is .
Batches and the loss. A batch is a multiset of exactly indices from . Repetitions are allowed, and all sums over count multiplicity. For a class , let be the sub-multiset of consisting of the indices with label , and write for its size counted with multiplicity.
For indices , define
where removes a single copy of from . Since , this multiset is nonempty and the denominator is positive.
The batch loss is
Here again removes only one copy of , so other copies of remain among the 's.
The supervised contrastive loss is
summed over all multisets of size .
Batch counts. For , define
the number of pairs (class , batch ) in which class occurs exactly times, counted with multiplicity.
Claim. Both of the following hold.
- Lower bound.
- Equality case. Equality holds in (1) if and only if there exist vectors such that:
-
for every , so all points of the same class coincide; and
-
form a "sphere-inscribed regular simplex" of radius . By definition this means exactly three conditions:
- ;
- for all ;
- there is a real with for all .
The value of is not prescribed, and distinctness of the is not stated separately. For , the common-inner-product condition is automatic, and the conditions reduce to with .
-
The left-hand side of (1) depends on only through . It depends on only through the counts .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.