TL;DR
BYOL is a way to learn image features from unlabelled pictures without comparing against other pictures. Two copies of one network look at two random crops of the same image; the online copy is trained to predict what the slowly updated target copy produces for the other crop. With a ResNet-50 it reaches 74.3% top-1 accuracy under linear evaluation on ImageNet, above the contrastive methods of its time.
Builds on: Self-Supervised Learning, Target Network, Stop-Gradient, Data Augmentation, Cosine Similarity · Leads to: the negative-free family of methods, whose main failure mode is Representation Collapse
Why it mattered
BYOL showed that a self-supervised image model did not need negative pairs, the other images in the batch that contrastive methods such as SimCLR push away. The paper reports that BYOL beat the previous best self-supervised result on ImageNet with a ResNet-50 (74.3% against 73.0% for InfoMin Augmentation, a 1.3-point gain), and that a ResNet-200 with twice the width reached 79.6%, against 76.8% for the previous state of the art, using 30% fewer parameters.
The practical consequence was that the field's accuracy no longer depended on large negative sets. The paper's batch-size study is the evidence: contrastive SimCLR drops sharply as the batch shrinks, while BYOL stays stable between batch sizes 256 and 4096. For anyone training on limited hardware, that is the main reason the paper is still cited.
The problem
Before BYOL, the best self-supervised image methods were contrastive. Contrastive Learning pulls the representations of two views of one image together and pushes the representations of views of different images apart. This works, but it has three costs that the paper names.
- Negatives need a big batch. The push-apart term draws its negatives from the minibatch, so fewer images means fewer negatives and weaker learning.
- Augmentations must be chosen carefully. Random crops alone let a contrastive model solve its task from colour histograms, which the paper argues is why SimCLR needs colour distortion.
- Clustering alternatives are costly. DeepCluster, the bootstrapping method the paper cites, avoids negatives but needs an expensive clustering step.
The paper's question is whether a method can use only positive pairs, two views of the same image, and still avoid the trivial solution where every image gets the same feature. That trivial solution is called collapse, and it is the central difficulty.
How it works
Take a tiny instance first: one image, two views, and feature vectors of length two. Follow one training step.
-
Two views. From one image x, draw two random augmentations: view v (a crop with colour changes) and view v' (a different crop). Both come from the same image, so they are a positive pair.
-
Online branch. The online network passes v through an encoder f, then a projector g, then a predictor q. Its output is q(g(f(v))). Here the encoder produces the representation y that is kept at the end of training.
-
Target branch. The target network, with its own weights, passes v' through its encoder and projector only. Its output is z' = g'(f'(v')). No predictor, and no gradient flows into it.
-
Compare. Compute the cosine similarity between the online prediction and the target output. Use the loss 2 - 2 times that similarity, so that identical directions give 0 and opposite directions give 4. Check: if the prediction is (1, 0) and the target is (1, 0), the cosine is 1 and the loss is 0. If the target is (0, 1), the cosine is 0 and the loss is 2.
-
Symmetrise. Repeat with the roles swapped, so v' goes through the online branch and v through the target. Add the two losses.
-
Update the online weights by gradient. Only the online weights θ get a gradient step. The target weights ξ are not updated by the gradient; the stop-gradient in the paper's Figure 2 marks this.
-
Update the target by moving average. After each step, ξ becomes a weighted average of its old value and the new online weights: ξ ← τξ + (1 - τ)θ. Check with numbers: if τ = 0.9, ξ starts at 0 and θ is 1, then after one step ξ = 0.9 · 0 + 0.1 · 1 = 0.1, and after two steps ξ = 0.9 · 0.1 + 0.1 · 1 = 0.19.
-
Output. At the end of training, keep only the encoder f_θ. Its output y is the representation used for downstream tasks.
flowchart LR I[image x] --> V[view v] I --> V2[view v'] V --> ON[online: encoder, projector, predictor] V2 --> TG[target: encoder, projector] ON --> L[loss: 2 - 2 cos] TG -->|stop-gradient| L L -->|gradient| ON ON -->|moving average| TG
Worked examples
- Let the online prediction be q = (1, 0) and the target output be z' = (0, 1).
- The dot product is 1 · 0 + 0 · 1 = 0.
- Both lengths are 1, so the cosine similarity is 0 / (1 · 1) = 0.
- The loss is 2 - 2 · 0 = 2.
- Now change the target to (1, 0). The dot product is 1, the cosine is 1, and the loss is 2 - 2 = 0.
- Interpretation: the loss is largest when the prediction and the target point in perpendicular directions, and zero when they point the same way. Length does not matter, only direction.
- Let τ = 0.9. Start with ξ = 0 and keep the online weight fixed at θ = 1.
- Step 1: ξ ← 0.9 · 0 + 0.1 · 1 = 0.1.
- Step 2: ξ ← 0.9 · 0.1 + 0.1 · 1 = 0.09 + 0.1 = 0.19.
- Step 3: ξ ← 0.9 · 0.19 + 0.1 · 1 = 0.171 + 0.1 = 0.271.
- Interpretation: the target creeps toward the online weight over many steps. Each step only 10% of the gap is closed. This is why the target lags behind the online network and gives a more stable prediction target.
- Repeat with τ = 0.996, which is the paper's starting value. Now each step closes only 0.4% of the gap, so the target changes far more slowly.
- The paper trains for 1000 epochs. Let K be the total number of training steps and k the current step, so k / K is the fraction of training done. Consider three points.
- At the start, k = 0. Then cos(0) = 1, so the fraction (cos(0) + 1) / 2 = 1, and τ = 1 - 0.004 · 1 = 0.996.
- At the midpoint, k = K / 2. Then cos(π / 2) = 0, so the fraction is (0 + 1) / 2 = 0.5, and τ = 1 - 0.004 · 0.5 = 0.998.
- At the end, k = K. Then cos(π) = -1, so the fraction is 0, and τ = 1 - 0.004 · 0 = 1.
- Interpretation: early in training the target follows the online network more closely, and late in training it almost stops moving. This is a schedule for the target's stability, not a pure constant.
- Try it: at the three points, how much of the gap between ξ and θ is closed in one step? Answer: 0.4% at the start, 0.2% at the midpoint, and 0% at the end.
The math
BYOL's online network has weights θ and three stages: encoder f_θ, projector g_θ, predictor q_θ. The target network has weights ξ and two stages, encoder f_ξ and projector g_ξ.
Step 4 in symbols: the loss
Let z_θ = g_θ(f_θ(v)) and z'_ξ = g_ξ(f_ξ(v')). Normalise both vectors to length one, written with a bar. The loss for one pair is
The two forms are equal because the squared distance between two unit vectors equals 2 minus twice their dot product. The second form is the one to remember: it is 2 minus twice a cosine similarity.
Step 5 in symbols: symmetric loss
Feeding the views the other way round gives a second loss, written with a tilde. The total loss is
Step 6 in symbols: the online update
The online weights take one optimiser step on the total loss, with the target held fixed. In the paper's notation, θ ← optimizer(θ, ∇_θ L^BYOL, η), where η is the learning rate. The gradient is taken with respect to θ only.
Step 7 in symbols: the target update
The target update is
with τ close to 1. The paper sets τ to start at τ_base = 0.996 and to rise to 1 during training, with the schedule
where k is the current step and K is the total number of steps.
Why a moving target at all
If τ = 1, the target never changes and stays at its random start. If τ = 0, the target copies the online weights each step. The paper's Table 5 measures both extremes: a constant random target gives 18.8% top-1 accuracy, and stopping the gradient through a target that copies the online weights exactly gives 0.3%. The moving average between them, at τ_base = 0.99, gives 72.5%.
Results
The paper's numbers are the ones below. Each is copied from the paper's tables or text, and each is the top-1 accuracy unless noted.
- Linear evaluation, ImageNet, ResNet-50 (1x): BYOL 74.3% (top-5 91.6%). SimCLR 69.3% in the same table. The best previous result in the table is InfoMin Augmentation at 73.0%, so the gain is 1.3 points.
- Linear evaluation, larger network: ResNet-200 (2x) reaches 79.6% (top-5 94.8%), against 76.8% for the previous state of the art, and uses 30% fewer parameters (conclusion).
- Semi-supervised, 1% of ImageNet labels: BYOL 53.2%, SimCLR 48.3% (top-1). At 10% of labels: BYOL 68.8%, SimCLR 65.6%.
- Batch size: SimCLR's accuracy drops sharply as the batch shrinks, while BYOL stays roughly stable from 256 to 4096. At batch size 4096, the paper reports BYOL 72.5% and SimCLR 67.9%.
- Augmentations: removing colour distortion costs BYOL 9.1 points and SimCLR 22.2 points. With random crops alone, BYOL gets 59.4%, while SimCLR gets 40.3%.
- Target network ablation (Table 5): a constant random target gives 18.8%, a moving average with τ_base = 0.999 gives 69.8%, τ_base = 0.99 gives 72.5%, τ_base = 0.9 gives 68.4%, and a stop-gradient on a target that copies the online weights gives 0.3%.
The limits matter as much as the numbers. The paper's ImageNet results are linear-probe accuracy, which measures how well a frozen representation separates classes with one linear layer. Transfer results are reported on several datasets, but the tables use each dataset's own protocol and are not all comparable to each other. The batch-size effect is shown with 256 to 4096 only; the paper attributes the drop at smaller batch sizes to the batch normalisation layers, the only place batch size enters its training pipeline.
Reading guide
The paper's sections, in order, and the lessons each one needs:
- 1 Introduction and 2 Related work: Self-Supervised Learning, Contrastive Learning, Momentum Contrast (the moving-average target idea that BYOL reuses), Knowledge Distillation (the teacher-student idea behind mean teacher).
- 3.1 Description of BYOL: Cosine Similarity for the loss, Stop-Gradient for the update rule, Target Network for the moving average.
- 3.2 Intuitions on BYOL's behaviour: Representation Collapse for why a constant output is the trap, and Siamese Network for the shared-weights setup that the paper relates BYOL to.
- 3.3 Implementation details: Deep Residual Learning for Image Recognition (ResNet) for the encoder, and Data Augmentation for the crop and colour settings.
- 4 Experimental evaluation: Representation Learning for what a learned representation is measured by, and the linear-probe and semi-supervised protocols.
- 5 Building intuitions with ablations: the batch-size and augmentation studies, and the target-network table. This is where the claims of the method are tested.
- 6 Conclusion: the headline numbers.
Check yourself
QuestionRecall: what is the difference between the online network and the target network in BYOL?Show answer
The online network has an encoder, a projector and a predictor, and it receives gradient updates. The target network has an encoder and a projector only, receives no gradient, and its weights are a moving average of the online weights.
QuestionCompute: the online prediction is (3, 4) and the target output is (6, 8). What is the BYOL loss for this pair? Use 2 - 2 times the cosine similarity.Show answer
The dot product is 3 · 6 + 4 · 8 = 18 + 32 = 50. The lengths are 5 and 10, so the cosine is 50 / 50 = 1. The loss is 2 - 2 · 1 = 0. The vectors point in the same direction, so the loss is zero even though their lengths differ.
QuestionWhy: the paper says BYOL avoids collapse without negative pairs. Why is a stop-gradient on the target and a slowly moving target important for this?Show answer
If both networks were updated by gradient, the loss could be driven to zero by making every output the same constant, which is the collapsed solution. The stop-gradient stops the gradient from pushing the target toward the prediction, and the slow moving average keeps the target from following the online network too fast. The paper argues that the target's update is not a gradient step on any joint loss, which changes the dynamics away from the collapsed fixed point, and it reports that a constant random target gives only 18.8% accuracy.
QuestionApplied: you have a batch size of 256 on a single GPU, too small for the 4096 used in the paper. Which method does the paper's batch-size study suggest will degrade less, SimCLR or BYOL, and why?Show answer
BYOL. SimCLR draws its negatives from the minibatch, so a batch of 256 gives it far fewer negatives and its accuracy drops sharply. BYOL uses no negatives, and the paper reports it stays roughly stable from 256 to 4096. The paper also notes that a remaining drop at small batches comes from the batch normalisation layers, so you should still check that layer's behaviour at batch size 256.
QuestionScenario: a colleague trains BYOL with only random crops and no colour changes, and finds that its accuracy is far below the paper's. Using the paper's augmentation numbers, what should they expect, and what should they change first?Show answer
The paper reports BYOL with random crops only at 59.4%, against 72.5% with the full augmentation set, a loss of 13.1 points. So a drop is expected, but it is smaller than for SimCLR. If the gap is much larger than 13 points, check the implementation before the augmentations, such as the target update and the stop-gradient. The first change to try is restoring colour distortion, since the paper's ablation shows it matters.
Sources
- Grill et al. Bootstrap Your Own Latent: A New Approach to Self-Supervised Learning. arXiv:2006.07733. https://arxiv.org/abs/2006.07733
- Chen et al. A Simple Framework for Contrastive Learning of Visual Representations (SimCLR). arXiv:2002.05709. https://arxiv.org/abs/2002.05709