Paper commentary
Exploring Simple Siamese Representation Learning
Simple Siamese networks learn representations without collapse using stop-gradient
- Problem Siamese networks that match two augmented views of one image can collapse to constant outputs. Recent methods avoided this with negative pairs, large batches or momentum encoders.
- Method SimSiam passes two views through one shared encoder and predicts one branch from the other. It minimizes negative cosine similarity, with stop-gradient on the target branch.
- Results SimSiam reaches 67.7% linear evaluation accuracy on ImageNet. Removing the stop-gradient drops accuracy to 0.1%.
Why Siamese pre-training can collapse
Many recent unsupervised visual methods use a Siamese structure: two weight-sharing branches process two augmented views of one image, and training raises the similarity between their outputs. The risk is that both branches map every input to the same constant. Such an output makes the similarity objective trivially satisfied, and it is the failure the field has been guarding against.
Contrastive methods such as SimCLR prevent this by pushing apart views of different images, while SwAV avoids it by clustering the batch and predicting cluster assignments across views. BYOL uses only positive pairs and depends on a momentum encoder to avoid collapse, which raises the question of whether that extra machinery is needed at all.
The study asks whether a plain Siamese network can avoid collapse without negative pairs, without large batches and without a momentum encoder.
How the SimSiam loss is computed
Each image x yields two random augmentations, x1 and x2. Both pass through the same encoder f, which is a backbone with a projection MLP on top, so the two branches share weights. The default backbone is ResNet-50, and the projection MLP has three layers with BN on each fully-connected layer and no ReLU on its output layer.
A prediction MLP h is applied to the projection of one view, giving p1 = h(f(x1)), and this is compared with z2 = f(x2). The comparison is the negative cosine similarity between p1 and z2, that is \\( D(p_1,z_2) = -\\frac{p_1}{\\|p_1\\|_2}\\cdot\\frac{z_2}{\\|z_2\\|_2} \\). Up to a scale, this is the mean squared error between the l2-normalized vectors, and the symmetrized loss can reach a minimum of -1.
Stop-gradient is applied to the target side: the term \\( D(p_1, \\text{stopgrad}(z_2)) \\) treats z2 as a constant, and the symmetrized loss \\( L = \\tfrac{1}{2}D(p_1,\\text{stopgrad}(z_2)) + \\tfrac{1}{2}D(p_2,\\text{stopgrad}(z_1)) \\) is averaged over all images. Because of this, the encoder on x2 receives no gradient through z2 in the first term but does receive gradient through p2 in the second term, and the reverse holds for x1.
Pre-training uses SGD with weight decay 0.0001 and momentum 0.9, and no large-batch optimizer such as LARS is needed. The prediction MLP has two layers with input and output dimension d = 2048 and a hidden width of 512, which gives it a bottleneck shape.
What removing stop-gradient does
The comparison keeps the architecture and all hyper-parameters fixed, so the stop-gradient is the only difference between the two variants. Without stop-gradient, the training loss falls quickly to -1, the minimum possible value.
Loss alone does not show collapse, so the authors also track the per-channel standard deviation of the l2-normalized output. If the output is a zero-mean isotropic Gaussian, this standard deviation is approximately \\(1/\\sqrt{d}\\). With stop-gradient the measured value stays near that level, while without stop-gradient it goes to zero, which means the outputs have collapsed to a constant.
A kNN classifier on the validation set serves as a progress monitor during pre-training, and with stop-gradient its accuracy rises steadily. Linear evaluation gives 67.7% with stop-gradient, averaged over 5 trials with a std of 0.1, and 0.1% without it. The authors note that chance-level accuracy alone is not enough to indicate collapse, because a diverging loss can also produce it.
Since the architecture, BN and the l2-normalization are the same in both variants, the authors conclude that these design choices cannot prevent collapse by themselves.
A hypothesis about the underlying optimization problem
The authors hypothesize that SimSiam implements an Expectation-Maximization-like algorithm with two sets of variables, which is a hypothesis about the training objective rather than a result proved in the paper. The formulation uses a loss L(θ, η) = E over x and T of the squared norm of F_θ(T(x)) minus η_x, where θ are the encoder parameters, T is the augmentation and η_x is a vector per image.
The analogy is to k-means: θ plays the role of cluster centers, and each η_x plays the role of the assignment of image x.
Minimizing this loss by alternating between θ and η gives one subproblem for θ with η held fixed and one for η with θ held fixed. When θ is updated by SGD, the target η is a constant, so stop-gradient follows naturally from this subproblem. For η, the minimizer is the average representation of the image over the augmentation distribution.
Sampling the augmentation once in place of this expectation makes the η step a single forward pass, and the θ step then becomes a Siamese objective with stop-gradient. The predictor h is read as an attempt to learn the missing expectation over augmentations, and symmetrization is read as denser sampling of augmentation pairs.
Settings that change accuracy but not collapse
In the fixed-random case the training does not converge and the loss stays high, which the authors say is a different failure from collapse. The authors suggest h needs to track the latest representations, so forcing it to converge by lowering its learning rate may not help.
Across batch sizes from 64 to 4096, the accuracy values are 66.1, 67.3, 68.1, 68.1, 68.0, 67.9 and 64.0 in order. Batch size 128 is 0.8 lower than the best result and batch size 64 is 2.0 lower, and the authors observe that the standard SGD optimizer struggles at a 4096 batch. Unlike SimCLR and SwAV, which need large batches, SimSiam performs well at typical batch sizes without a specialized optimizer, and the authors note that this does not change whether collapse happens.
Removing BN from all MLP heads gives 34.6%, adding BN to the hidden layers gives 67.4%, and adding BN to the projection output as well gives 68.1%, which is the default. Adding BN to the output of the prediction MLP makes training unstable, and the authors report that disabling the affine transform in the projection output BN gives 68.2%.
The authors state that BN helps optimization but has no evident role in preventing collapse, since the collapse without stop-gradient occurs with the same BN configuration.
The authors conclude that collapse prevention does not depend specifically on the cosine similarity.
Proof-of-concept alternation experiments
The multi-step variant runs k SGD steps on the encoder per alternation, with the targets precomputed and cached, and uses the same architecture and hyper-parameters as SimSiam. The authors read this as support for treating alternating optimization as a valid formulation in which SimSiam is one special case, while noting the extra cost of precomputation.
The moving-average variant keeps a running average of the targets with momentum coefficient 0.8 and does not use the predictor h. This variant reaches 55.0% accuracy without h, while removing h without the moving average fails completely. The authors take this as evidence that the predictor is related to approximating the expectation over augmentations.
ImageNet and transfer comparisons
At 200, 400 and 800 epochs, SimSiam reaches 70.0, 70.8 and 71.3, while SimCLR reaches 68.3, 69.8 and 70.4, MoCo v2 reaches 69.9, 71.0 and 72.2, and BYOL reaches 70.6, 73.2 and 74.3. The competitors are the authors' reproductions, and the entries marked with a plus sign are improved over the original papers, with the gains in SimSiam's favor only at short schedules.
For transfer, all unsupervised models are pre-trained for 200 epochs on ImageNet and then fine-tuned end-to-end on the target task. The optimal recipe uses lr = 0.5 and wd = 1e-5, which gives a similar ImageNet accuracy and better transfer numbers in the authors' runs. The authors report that these Siamese methods match or exceed supervised pre-training across the reported tasks, and they attribute much of this to the shared Siamese structure.
Relation to SimCLR, SwAV and BYOL
The authors describe SimSiam as SimCLR without negative pairs, since it keeps the Siamese weight sharing but removes the repulsion term. The authors conclude that neither extra component helps SimCLR, which suggests the predictor and stop-gradient serve another optimization problem.
SwAV is treated as SimSiam with online clustering removed, and its Sinkhorn-Knopp transform on the target branch is what prevents collapse there.
The authors describe SimSiam as BYOL without the momentum encoder, and they say the momentum encoder may help accuracy in Table 4 without being needed to prevent collapse. They also suggest that the target update in the η subproblem could be done by another optimizer, which could give a smoother update, and leave this for future work.
Limitations
The authors state that the hypothesis does not explain why collapse is prevented, and that the non-collapsing behavior of SimSiam and its variants remains an empirical observation. Their tentative account is that the alternating optimizer follows a trajectory set by the random initialization, which makes it hard to reach a constant output for all images.
Most ablations use 100-epoch pre-training, so the ablation numbers reflect that schedule. The batch-size study covers 64 to 4096 with SGD only, and the 4096 result is lower, so the authors' batch-size claim is limited to this range. Transfer results cover VOC and COCO tasks only, with the fine-tuning learning rate searched for each method.
Paper info
- Authors
- Xinlei Chen, Kaiming He
- Venue
- arXiv · Preprint
- First published
- 2020-11-20
- Added
- 2026-11-12
- Updated
- 2020-11-20
- Version
- v1
- arXiv
- 2011.10566
- Category
- cs.CV · cs.LG
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Xinlei Chen, Kaiming He (2020). Exploring Simple Siamese Representation Learning. arXiv:2011.10566v1. https://arxiv.org/abs/2011.10566v1
BibTeX
@misc{chen2020exploring,
title = {{Exploring Simple Siamese Representation Learning}},
author = {Xinlei Chen and Kaiming He},
year = {2020},
eprint = {2011.10566},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2011.10566v1}
}