Skip to content
AI360Xpert
Beta

VICReg Triple Objective

Keep two views close, keep each feature lively with variance above one, and keep features uncorrelated. Three plain terms stop collapse.

VICReg balances variance plus invariance plus covariance across views
VICReg balances variance plus invariance plus covariance across views

Why Does This Exist?

Pairs alone can collapse to a constant because matching a constant is easy. VICReg writes the guardrails as loss terms: pull views together, push each slot variance above 11, and push cross-slot covariance to 00. Readers of siamese networks know the twins; this page adds the three-term guard.

This page covers the triple loss only. Correlation-only variants are siblings, reachable from contrastive loss.

The one idea you need first.

Variance Var(zj)Var(z_j) measures spread of slot jj over the batch. A hinge max⁡(0,1−Var+ϵ)\max(0, 1 - \sqrt{Var + \epsilon}) charges only slots narrower than 11. Covariance CovCov measures slot leakage.

Think of It Like This

A gym coach with three whistles

A coach watches two runners do the same drill. One whistle blows when they drift apart, one when anyone jogs too flatly, and one when runners copy each other stride. All three must stay quiet for a good rep.

Invariance is staying together, variance is running lively, and covariance is not copying. Where it stops: runners hear whistles live, while the net gets one summed number per batch.

How It Actually Works

For views zz and z′z' let invariance be s=∥z−z′∥22/ds = \lVert z - z' \rVert_2^2 / d. Let variance be v=∑jmax⁡(0,1−Var(zj)+ϵ)/dv = \sum_j \max(0, 1-\sqrt{Var(z_j)+\epsilon})/d plus the same for z′z'. Let covariance be c=∑i≠jCov(z)ij2/dc = \sum_{i \ne j} Cov(z)_{ij}^2/d plus the same for z′z'. Total L=25s+25v+1cL = 25 s + 25 v + 1 c.

In plain words: dd is width, 2525 stresses matching and liveliness, and 11 gently decorrelates.

Worked example

Take d=2d = 2, z=[[1.2,0.1],[0.2,1.1]]z = [[1.2, 0.1],[0.2, 1.1]]. Slot stds are about 0.710.71 each, so each hinge pays 1−0.71=0.291 - 0.71 = 0.29, mean 0.290.29. If s=0.05s = 0.05 and c=0.03c = 0.03, total is 25×0.05+25×0.29+0.03=1.25+7.25+0.03=8.5325 \times 0.05 + 25 \times 0.29 + 0.03 = 1.25 + 7.25 + 0.03 = 8.53. Widening spread toward std 1.01.0 drops the 7.257.25 fast, which is why dead constants cannot win.

Watch Out For

Variance weight too low for narrow starts

Random starts have std near 0.40.4, so a weak variance weight lets invariance win by shrinking everything. Probes sit at chance while loss looks fine. Keep the published 2525 weight and log per-slot std during week one.

The Quick Version

  • VICReg joins invariance plus variance plus covariance in one loss.
  • Hinge at std one keeps each slot lively.
  • Covariance penalty decorrelates slots.
  • Weights 25, 25, 1 reflect the intended stress.
  • No negatives, queues, or Sinkhorn passes are needed.