ML Systems Lab Open interactive version →
Advanced 60 min read BYOLBarlow TwinsVICRegcollapsestop-gradient

Collapse-free SSL Without Negatives

BYOL, Barlow Twins, VICReg — why they don't collapse, scale limitations

Contrastive methods need negatives to prevent representational collapse, but negatives introduce the false negative problem—treating same-class images as push-away targets. BYOL's 2020 paper claimed to remove negatives entirely by using a stop-gradient and a momentum EMA target network, with an asymmetric predictor. The paper could not explain analytically why this did not collapse. The real answer arrived in the follow-up literature: BYOL prevents collapse because BatchNorm computes statistics across the batch, making each sample's representation a function of all other samples in the batch. This implicit cross-sample interaction acts as an implicit negative mechanism. Replace BatchNorm with LayerNorm—per-sample normalization, no cross-batch interaction—and BYOL collapses immediately.

The running example makes this concrete. BYOL uses an online network updated by backprop plus a target network updated by EMA (m≈0.996). An additional predictor MLP maps online representations to target representations. The loss minimizes L2 distance between predictor(online(view1)) and stop_gradient(target(view2)). Stop-gradient on the target branch is necessary—without it both networks collapse together by setting everything to zero. But stop-gradient alone is not sufficient: the collapse resistance comes from BatchNorm, and removing it with a larger batch (65,536) actually breaks BYOL because BatchNorm statistics converge to population statistics, eliminating the noisy cross-sample interaction that provides the implicit negative mechanism.

Barlow Twins takes a more direct approach: push the cross-correlation matrix between two views' normalized feature vectors toward identity. The invariance term (diagonal → 1) makes each feature dimension correlate with itself across views. The redundancy reduction term (off-diagonal → 0) forces different feature dimensions to decorrelate with each other—this is the explicit collapse-prevention mechanism, directly enforcing dimensional diversity without any negatives, stop-gradients, or momentum.

NOT this. "Removing negatives means you can use smaller batches freely" is incomplete. BYOL does work at batch size 256–512, unlike SimCLR. But at very large batches—65,536—BYOL collapses because BatchNorm statistics stabilize and the implicit negative mechanism disappears. The batch size freedom is real within a range; it does not extend to arbitrarily large batches.

Key points

Takeaway

BYOL does not prevent collapse via stop-gradient alone—it prevents collapse because BatchNorm creates implicit cross-sample interactions that act as implicit negatives. Replace BatchNorm with LayerNorm and BYOL collapses immediately. This mechanism also explains BYOL's large-batch failure: at batch size 65,536, BatchNorm statistics stabilize and the implicit negative mechanism disappears. Barlow Twins makes the collapse-prevention mechanism explicit and interpretable, which is why it remains the right default when the BatchNorm mechanism is unavailable.

Recap

Check your understanding

Q1. Remove BatchNorm from BYOL and replace it with LayerNorm throughout. What happens and why?

Q2. Barlow Twins pushes the cross-correlation matrix toward identity. What would happen if you only optimise the invariance term (diagonal → 1) without the redundancy reduction term (off-diagonal → 0)?

Q3. A team trains BYOL on a dataset with very large batch size (65536) and finds it suddenly collapses. They had used batch size 512 successfully before. Explain the mechanism.

Q4. Select the two scenarios where you would prefer Barlow Twins over BYOL for a production pretraining run.

Try it interactively

ML Systems Lab is a free interview-prep platform for ML engineers — work through the full interactive module, quizzes, and drills.

Open ML Systems Lab →