Lemma 1: BYOL learning dynamics (gradient of the stop-gradient objective)
ProvedSSLWithoutPairs.byol_gradientLet have law and let be an augmentation distribution with finite second moments, for , . Let be independent given . Let with , and . For
with and , the partial derivatives with held fixed are
The BYOL flows (2)-(3) are these negative gradients, the predictor one scaled by , plus weight decay , .
Formalization Note The stop-gradient is encoded by passing as a separate argument of , so differentiation in does not reach the target branch. Each partial derivative is stated as the derivative at of . The printed main-text Lemma 1 already includes and ; these are modelling choices rather than consequences of , so the statement is the gradient computation of Appendix A, Lemma 1.
import Mathlib import Definitions.Def_SSLWithoutPairs_Basic open MeasureTheory ProbabilityTheory Filter Topology Matrix
namespace SSLWithoutPairs
theorem byol_gradient {n₁ n₂ : ℕ} (μ : Measure (Fin n₁ → ℝ)) [IsProbabilityMeasure μ]
(κ : Kernel (Fin n₁ → ℝ) (Fin n₁ → ℝ)) [IsMarkovKernel κ]
(h2 : ∀ i, Integrable (fun q : (Fin n₁ → ℝ) × (Fin n₁ → ℝ) => q.2 i ^ 2) (μ ⊗ₘ κ))
(Wp : Matrix (Fin n₂) (Fin n₂) ℝ) (W Wa : Matrix (Fin n₂) (Fin n₁) ℝ) :
(∀ i j, HasDerivAt (fun s : ℝ => byolLoss μ κ (Wp + s • Matrix.single i j 1) W Wa)
(-(byolFlowWp 1 0 (augMeanCorr μ κ) (augCov μ κ) Wp W Wa) i j) 0) ∧
(∀ i j, HasDerivAt (fun s : ℝ => byolLoss μ κ Wp (W + s • Matrix.single i j 1) Wa)
(-(byolFlowW 0 (augMeanCorr μ κ) (augCov μ κ) Wp W Wa) i j) 0) := by sorry
end SSLWithoutPairsRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. Let be natural numbers; either may be . The theorem fixes the following data:
- Data distribution. is a probability measure on .
- Augmentation kernel. is a Markov kernel from to itself: for each data point , is a probability measure on , the distribution of an augmented view of .
- Hypothesis. For every coordinate , the function is integrable with respect to the joint measure . Here and then a single view . Nothing else is assumed, in particular no moment condition on itself.
- Weights. , and are arbitrary real matrices. is an independent argument with no assumed relation to .
Definitions used. All integrals below are Lebesgue/Bochner integrals, which by convention take the value when the integrand is not integrable.
- Average augmented view. For each , the vector has coordinates
- Moment matrices. and are the matrices
So is the uncentred second-moment matrix of , and is the -average of the covariance matrix of .
- Objective. The objective is
Here , and given the two views are drawn independently, each from . The norm is the sum of squared coordinates.
- Matrix units. denotes the matrix of the appropriate size with entry at position and elsewhere.
Claim. The theorem asserts the conjunction of two statements.
- For every , the real function is differentiable at in the ordinary two-sided sense, and its derivative there is
This is the negative of the entry of the predictor-flow expression , evaluated at and .
- For every and , the function is differentiable at , with derivative
This is the negative of the entry of the online-flow expression at .
Scope.
- In both parts is held fixed while or is perturbed. In part 2 the perturbation of does not change .
- Only directional (entrywise partial) derivatives at the given point are asserted, not joint (Fréchet) differentiability.
- If , both statements are vacuous. If , part 2 is vacuous and part 1 reduces to a statement about empty products.
- Because of the integral convention, is defined as at any for which fails to be -integrable. The same applies to the inner and outer integrals defining , and .
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.