Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem D.7: error propagation from pre-training to the downstream task

Open
SpectralContrastive.error_propagation

by Xeroth · Nov 23, 2026 · Mathlib 0df444a (Lean v4.33.1)

cheeger-inequalitycontrastive-learninglinear-probeself-supervised-learningspectral-graph-theory

There is a universal constant CCC with the following property. Consider the finite data model with N=∣X∣N=|\mathcal X|N=∣X∣ and labels in [r][r][r], let 4r+2≤k≤N4r+2\le k\le N4r+2≤k≤N, and suppose Assumption 3.6 holds for some α>0\alpha>0α>0. Let γi\gamma_iγi​ be the iii-th largest eigenvalue of A‾\overline AA and assume that the eigengap Δγ:=γ⌊3k/4⌋−γk\Delta_\gamma:=\gamma_{\lfloor3k/4\rfloor}-\gamma_kΔγ​:=γ⌊3k/4⌋​−γk​ and ρ⌊k/2⌋\rho_{\lfloor k/2\rfloor}ρ⌊k/2⌋​ are positive. Let fpop∗f^*_{\mathrm{pop}}fpop∗​ minimize L\mathcal LL over all functions. Then for every ϵ>0\epsilon>0ϵ>0 and every f^\hat ff^​ with L(f^)<L(fpop∗)+ϵ\mathcal L(\hat f)<\mathcal L(f^*_{\mathrm{pop}})+\epsilonL(f^​)<L(fpop∗​)+ϵ there is a linear head B^∈Rk×r\widehat B\in\mathbb R^{k\times r}B∈Rk×r with

E(f^,B^)≤C(αρ⌊k/2⌋2log⁡k+kϵΔγ2),\mathcal E(\hat f,\widehat B)\le C\Big(\frac{\alpha}{\rho_{\lfloor k/2\rfloor}^2}\log k+\frac{k\epsilon}{\Delta_\gamma^2}\Big),E(f^​,B)≤C(ρ⌊k/2⌋2​α​logk+Δγ2​kϵ​),

and, if λk<1\lambda_k<1λk​<1, with ∥B^∥F≤2(k+1)/(1−λk)\|\widehat B\|_F\le2(k+1)/(1-\lambda_k)∥B∥F​≤2(k+1)/(1−λk​). In particular E(f^)\mathcal E(\hat f)E(f^​) obeys the same bound.

The downstream error therefore grows at most linearly in the excess pretraining loss ϵ\epsilonϵ.

Formalization Note The paper's ≲\lesssim≲ is a universal constant CCC quantified before all data. The paper states the theorem for f^emp∈F\hat f_{\mathrm{emp}}\in\mathcal Ff^​emp​∈F; the class plays no role in the bound, so the statement is for every f^\hat ff^​. The hypotheses ρ⌊k/2⌋>0\rho_{\lfloor k/2\rfloor}>0ρ⌊k/2⌋​>0 and Δγ>0\Delta_\gamma>0Δγ​>0 exclude division by zero, and k≤Nk\le Nk≤N makes γk\gamma_kγk​ an eigenvalue. The norm clause is conditional on λk<1\lambda_k<1λk​<1, where its right side is defined.

Preamble
import Mathlib
import Definitions.Def_SpectralContrastive_Basic

open Matrix
Formal statement
namespace SpectralContrastive

theorem error_propagation :
    ∃ C : ℝ, ∀ (Xbar X : Type) [Fintype Xbar] [Fintype X] [DecidableEq X] (r k : ℕ)
      (P : Xbar → ℝ) (A : Xbar → X → ℝ), IsAugModel P A → 4 * r + 2 ≤ k →
      k ≤ Fintype.card X →
      ∀ (y : Xbar → Fin r) (α : ℝ), 0 < α → (∃ g : X → Fin r, labelDisagree P A y g ≤ α) →
      0 < sparsestPartition (augWeight P A) (k / 2) →
      0 < adjEig (augWeight P A) (3 * k / 4) - adjEig (augWeight P A) k →
      ∀ fstar : X → Fin k → ℝ, (∀ f' : X → Fin k → ℝ, scLoss P A fstar ≤ scLoss P A f') →
      ∀ (ε : ℝ), 0 < ε → ∀ fhat : X → Fin k → ℝ, scLoss P A fhat < scLoss P A fstar + ε →
      ∃ B : Matrix (Fin k) (Fin r) ℝ,
        (lapEig (augWeight P A) k < 1 →
          frobNorm B ≤ 2 * (k + 1) / (1 - lapEig (augWeight P A) k)) ∧
        probeError P A y fhat B ≤
          C * (α / sparsestPartition (augWeight P A) (k / 2) ^ 2 * Real.log k +
            k * ε / (adjEig (augWeight P A) (3 * k / 4) - adjEig (augWeight P A) k) ^ 2) := by sorry

end SpectralContrastive
Source
HaoChen, Wei, Gaidon and Ma, Provable Guarantees for Self-Supervised Deep Learning with Spectral Contrastive Loss, arXiv:2106.04156v7 (NeurIPS 2021), Appendix D.3, Theorem D.7, eq. (45), pp. 41-42
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Read-back. The statement asserts that there is a single real constant CCC, chosen once before everything else, such that the following holds. CCC is not required to be positive, and it does not depend on any of the data below.

Data and standing hypotheses. Let Xˉ\bar{\mathcal X}Xˉ ("natural data") and X\mathcal XX ("augmented data") be arbitrary finite types, with X\mathcal XX having decidable equality. Let r,k∈Nr, k \in \mathbb Nr,k∈N. Let P:Xˉ→RP : \bar{\mathcal X} \to \mathbb RP:Xˉ→R and A:Xˉ×X→R\mathcal A : \bar{\mathcal X} \times \mathcal X \to \mathbb RA:Xˉ×X→R, written A(x∣xˉ)\mathcal A(x \mid \bar x)A(x∣xˉ). These must form an augmentation model:

  • P(xˉ)≥0P(\bar x) \ge 0P(xˉ)≥0 for all xˉ\bar xxˉ, and ∑xˉP(xˉ)=1\sum_{\bar x} P(\bar x) = 1∑xˉ​P(xˉ)=1;
  • A(x∣xˉ)≥0\mathcal A(x \mid \bar x) \ge 0A(x∣xˉ)≥0 for all xˉ,x\bar x, xxˉ,x, and ∑xA(x∣xˉ)=1\sum_x \mathcal A(x \mid \bar x) = 1∑x​A(x∣xˉ)=1 for every xˉ\bar xxˉ;
  • every x∈Xx \in \mathcal Xx∈X has some xˉ\bar xxˉ with P(xˉ)>0P(\bar x) > 0P(xˉ)>0 and A(x∣xˉ)>0\mathcal A(x \mid \bar x) > 0A(x∣xˉ)>0.

In particular Xˉ\bar{\mathcal X}Xˉ is nonempty. The integers must also satisfy

4r+2≤k≤∣X∣.4r + 2 \le k \le |\mathcal X|.4r+2≤k≤∣X∣.

This forces k≥2k \ge 2k≥2, and X\mathcal XX is nonempty.

The augmentation graph. From the model, define the edge weights

wxx′=∑xˉP(xˉ) A(x∣xˉ) A(x′∣xˉ).w_{xx'} = \sum_{\bar x} P(\bar x)\,\mathcal A(x \mid \bar x)\,\mathcal A(x' \mid \bar x).wxx′​=xˉ∑​P(xˉ)A(x∣xˉ)A(x′∣xˉ).

The degrees are wx=∑x′wxx′w_x = \sum_{x'} w_{xx'}wx​=∑x′​wxx′​. The normalized adjacency matrix Aˉ∈RX×X\bar A \in \mathbb R^{\mathcal X \times \mathcal X}Aˉ∈RX×X has entries

Aˉxx′=wxx′wxwx′,\bar A_{xx'} = \frac{w_{xx'}}{\sqrt{w_x w_{x'}}},Aˉxx′​=wx​wx′​​wxx′​​,

with the convention that division by 000 gives 000. The normalized Laplacian is L=I−AˉL = I - \bar AL=I−Aˉ.

Eigenvalues.

  • γi\gamma_iγi​ is the iii-th entry, counting from 111, of the list of real roots of the characteristic polynomial of Aˉ\bar AAˉ. The roots are counted with multiplicity and sorted in decreasing order.
  • λi\lambda_iλi​ is the iii-th entry of the real roots of the characteristic polynomial of LLL, counted with multiplicity and sorted in increasing order.
  • In both cases the value is 000 if the list has fewer than iii entries.

Conductance and sparsest partition. For a set S⊆XS \subseteq \mathcal XS⊆X, the conductance is

ϕ(S)=∑x∈S∑x′∉Swxx′∑x∈Swx,\phi(S) = \frac{\sum_{x \in S}\sum_{x' \notin S} w_{xx'}}{\sum_{x \in S} w_x},ϕ(S)=∑x∈S​wx​∑x∈S​∑x′∈/S​wxx′​​,

which is 000 if the denominator is 000. For i∈Ni \in \mathbb Ni∈N, ρi\rho_iρi​ is the infimum, over all partitions of X\mathcal XX into iii nonempty labelled blocks S1,…,SiS_1, \dots, S_iS1​,…,Si​, of max⁡jϕ(Sj)\max_j \phi(S_j)maxj​ϕ(Sj​). The partitions are encoded as surjections X→{1,…,i}\mathcal X \to \{1,\dots,i\}X→{1,…,i}. The value is 000 if no such partition exists.

Spectral contrastive loss. For f:X→Rkf : \mathcal X \to \mathbb R^kf:X→Rk,

L(f)=−2∑xˉP(xˉ)∑x,x′A(x∣xˉ) A(x′∣xˉ) f(x)⊤f(x′)  +  ∑xˉ,xˉ′P(xˉ)P(xˉ′)∑x,x′A(x∣xˉ) A(x′∣xˉ′) (f(x)⊤f(x′))2.\mathcal L(f) = -2\sum_{\bar x} P(\bar x)\sum_{x,x'} \mathcal A(x\mid\bar x)\,\mathcal A(x'\mid\bar x)\, f(x)^\top f(x') \;+\; \sum_{\bar x,\bar x'} P(\bar x)P(\bar x')\sum_{x,x'}\mathcal A(x\mid\bar x)\,\mathcal A(x'\mid\bar x')\,\big(f(x)^\top f(x')\big)^2 .L(f)=−2xˉ∑​P(xˉ)x,x′∑​A(x∣xˉ)A(x′∣xˉ)f(x)⊤f(x′)+xˉ,xˉ′∑​P(xˉ)P(xˉ′)x,x′∑​A(x∣xˉ)A(x′∣xˉ′)(f(x)⊤f(x′))2.

Universally quantified hypotheses. For every labelling y:Xˉ→{1,…,r}y : \bar{\mathcal X} \to \{1,\dots,r\}y:Xˉ→{1,…,r}, which can only exist if r≥1r \ge 1r≥1, and every real α>0\alpha > 0α>0, assume all of the following:

  1. There exists some g:X→{1,…,r}g : \mathcal X \to \{1,\dots,r\}g:X→{1,…,r} with
Δ(y,g):=∑xˉP(xˉ)∑xA(x∣xˉ) 1[g(x)≠y(xˉ)]≤α.\Delta(y,g) := \sum_{\bar x} P(\bar x)\sum_x \mathcal A(x\mid\bar x)\,\mathbf 1[g(x) \ne y(\bar x)] \le \alpha.Δ(y,g):=xˉ∑​P(xˉ)x∑​A(x∣xˉ)1[g(x)=y(xˉ)]≤α.
  1. ρ⌊k/2⌋>0\rho_{\lfloor k/2\rfloor} > 0ρ⌊k/2⌋​>0.
  2. γ⌊3k/4⌋−γk>0\gamma_{\lfloor 3k/4\rfloor} - \gamma_k > 0γ⌊3k/4⌋​−γk​>0.
  3. f∗:X→Rkf^\ast : \mathcal X \to \mathbb R^kf∗:X→Rk is a global minimizer of L\mathcal LL, i.e. L(f∗)≤L(f′)\mathcal L(f^\ast) \le \mathcal L(f')L(f∗)≤L(f′) for all f′:X→Rkf' : \mathcal X \to \mathbb R^kf′:X→Rk. The statement assumes such an f∗f^\astf∗ is given; it does not assert that one exists, and if none exists the conclusion is vacuous for that model.
  4. ε>0\varepsilon > 0ε>0 is real, and f^:X→Rk\hat f : \mathcal X \to \mathbb R^kf^​:X→Rk satisfies the strict inequality L(f^)<L(f∗)+ε\mathcal L(\hat f) < \mathcal L(f^\ast) + \varepsilonL(f^​)<L(f∗)+ε.

Conclusion. Under these hypotheses there exists a matrix B∈Rk×rB \in \mathbb R^{k \times r}B∈Rk×r satisfying both of the following. BBB may depend on all the data above.

(a) If λk<1\lambda_k < 1λk​<1, then

∥B∥F=(∑i,jBij2)1/2≤2(k+1)1−λk.\|B\|_F = \Big(\sum_{i,j} B_{ij}^2\Big)^{1/2} \le \frac{2(k+1)}{1-\lambda_k}.∥B∥F​=(i,j∑​Bij2​)1/2≤1−λk​2(k+1)​.

If λk≥1\lambda_k \ge 1λk​≥1, nothing is asserted about BBB.

(b) The following inequality holds, where log⁡\loglog is the natural logarithm:

E(f^,B)  ≤  C(αρ⌊k/2⌋2 log⁡k  +  k ε(γ⌊3k/4⌋−γk)2).E(\hat f, B) \;\le\; C\left(\frac{\alpha}{\rho_{\lfloor k/2\rfloor}^{2}}\,\log k \;+\; \frac{k\,\varepsilon}{\big(\gamma_{\lfloor 3k/4\rfloor} - \gamma_k\big)^{2}}\right).E(f^​,B)≤C(ρ⌊k/2⌋2​α​logk+(γ⌊3k/4⌋​−γk​)2kε​).

Here E(f^,B)E(\hat f, B)E(f^​,B) is the supremum, over all pairs (g,gˉ)(g, \bar g)(g,gˉ​) described below, of ∑xˉP(xˉ) 1[gˉ(xˉ)≠y(xˉ)]\sum_{\bar x} P(\bar x)\,\mathbf 1[\bar g(\bar x) \ne y(\bar x)]∑xˉ​P(xˉ)1[gˉ​(xˉ)=y(xˉ)]. The value is 000 if there are no such pairs. The pairs are:

  • g:X→{1,…,r}g : \mathcal X \to \{1,\dots,r\}g:X→{1,…,r} such that, for every xxx, g(x)g(x)g(x) maximizes i↦(f^(x)⊤B)ii \mapsto (\hat f(x)^\top B)_ii↦(f^​(x)⊤B)i​;
  • gˉ:Xˉ→{1,…,r}\bar g : \bar{\mathcal X} \to \{1,\dots,r\}gˉ​:Xˉ→{1,…,r} such that, for every xˉ\bar xxˉ, gˉ(xˉ)\bar g(\bar x)gˉ​(xˉ) maximizes the vote i↦∑xA(x∣xˉ) 1[g(x)=i]i \mapsto \sum_x \mathcal A(x\mid\bar x)\,\mathbf 1[g(x) = i]i↦∑x​A(x∣xˉ)1[g(x)=i].

So E(f^,B)E(\hat f, B)E(f^​,B) is the worst case over all ways of breaking ties.

The label yyy enters the conclusion only through EEE. The bound in (b) involves α\alphaα but not the particular ggg from hypothesis 1. The minimizer f∗f^\astf∗ enters only through hypothesis 5.

Human review
  • Endorsed by Shuze Chen · Nov 23, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 23, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me