Paper commentary
Improved Baselines with Momentum Contrastive Learning
SimCLR's tweaks give MoCo stronger baselines
- Problem SimCLR gave strong unsupervised ImageNet features, but its best linear results needed batches of 4k to 8k, which need specialized hardware. That limits how many groups can reproduce them.
- Method MoCo gets SimCLR's MLP projection head and blur augmentation. Its queue of negatives means it does not need large batches, and the temperature is tuned for linear accuracy.
- Results MoCo v2 reaches 67.5% top-1 on ImageNet at 200 epochs with batch size 256. SimCLR reached 66.6% at 200 epochs with batch size 8192.
Why the MoCo baseline needed updating
MoCo showed that unsupervised pre-training can beat its ImageNet-supervised counterpart on several detection and segmentation tasks. SimCLR went further and narrowed the gap between unsupervised and supervised pre-training in linear classifier performance.
That hardware requirement limits how many groups can reproduce the strongest contrastive results.
The note asks whether two of SimCLR's design changes still help when MoCo, which keeps negatives in a queue, is the framework. If they do, MoCo can serve as a baseline that runs on a typical 8-GPU machine.
How MoCo supplies negatives
Contrastive learning is cast here as a dictionary look-up: a query should match its positive key and differ from the negative keys. The loss used is InfoNCE, written for a query q with one positive key k_+ and a set of negative keys {k_-}, with a temperature τ.
\\[ \\mathcal{L}_{q,k_+,\\{k_-\\}} = -\\log \\frac{\\exp(q\\cdot k_+/\\tau)}{\\exp(q\\cdot k_+/\\tau)+\\sum_{k_-}\\exp(q\\cdot k_-/\\tau)} \\] The loss is small when the dot product of the query with its positive key is large relative to its dot products with the negative keys, and the temperature sets how sharply those dot products are weighted.
In the instance discrimination pretext task, two augmented views of the same image form a positive pair, and views of different images form negative pairs.
In the end-to-end mechanism, the negative keys are taken from the same batch and both encoders are updated by back-propagation. SimCLR uses this mechanism, so the number of negatives it sees is tied to the batch size, which is why it needs large batches.
MoCo keeps the negative keys in a queue, and each training batch encodes only the queries and positive keys. A momentum encoder produces the keys, which keeps the keys stored across earlier batches consistent with the current ones. Because the queue is separate from the batch, MoCo can use many negatives without increasing the batch size.
Two SimCLR changes carried into MoCo
SimCLR changes the end-to-end form of instance discrimination in three ways: a much larger batch, an MLP head in place of the output fc projection head, and stronger data augmentation. The large batch is not carried over, because MoCo's queue already provides a large set of negatives. The MLP head and the stronger augmentation are kept, since they do not depend on how the contrastive learning is instantiated.
The MLP head is two layers, with a hidden layer of 2048 dimensions and ReLU, and it replaces the fc head during unsupervised pre-training. The linear classification and transfer stages do not use this head, so the head changes only what the pre-training learns.
The augmentation starts from MoCo's original pipeline and adds the blur augmentation used in SimCLR. The stronger color distortion from SimCLR was also considered, but its gains were small on the higher MoCo baselines.
Evaluation protocol
Unsupervised pre-training uses the 1.28M ImageNet training set. ImageNet linear classification freezes the features, trains a supervised linear classifier, and reports 1-crop 224×224 top-1 validation accuracy. All results use a standard-size ResNet-50.
For VOC object detection, a Faster R-CNN with a C4 backbone is fine-tuned end-to-end on the VOC 07+12 trainval set and evaluated on the VOC 07 test set with the COCO suite of metrics. The VOC fine-tuning runs 24k iterations, up from the 18k used in MoCo, and the detection entries are means over 5 trials. The same hyper-parameters and codebase as MoCo are used except where noted.
Temperature search and the MLP head
The temperature was searched over 0.07, 0.1, 0.2, 0.3, 0.4 and 0.5, with and without the MLP head. Without the MLP head, linear accuracy is 60.6 at 0.07 and falls to 56.4 at 0.5; with the MLP head it is 62.9 at 0.07 and peaks at 66.2 at 0.2.
At the default temperature 0.07, the MLP head raises ImageNet linear accuracy from 60.6% to 62.9%. Using the tuned temperature 0.2 for the MLP variant gives 66.2%.
In Table 1, the MLP variant with tuned temperature has AP50 82.0 and AP 56.4, compared with 81.5 and 55.9 for MoCo v1. The authors note that the detection gains are smaller than the large gain in ImageNet linear accuracy.
Augmentation effects on linear accuracy and detection
Blur augmentation alone, with no MLP head, raises the MoCo baseline by 2.8% to 63.4% linear accuracy. In Table 1, this variant has AP50 82.2, AP 56.8 and AP75 63.2.
The augmentation-only variant has lower linear accuracy than the MLP-only variant, 63.4% against 66.2%. Its detection AP is nonetheless higher, 56.8 against 56.4, so linear accuracy does not track detection transfer monotonically.
Adding the MLP head to the blur augmentation lifts linear accuracy to 67.3% and gives AP 57.2 with AP75 63.9. Adding the cosine schedule with 200 epochs gives 67.5% linear accuracy and AP 57.0, and 800 epochs gives 71.1% with AP 57.4. Across these configurations, the 800-epoch row has the highest AP of 57.4, against 55.9 for MoCo v1.
Comparison with SimCLR
The authors describe this as a 5.6% gap at matched epochs and batch size.
SimCLR with batch size 8192 reaches 66.6% at 200 epochs, which is still below MoCo v2 at batch size 256. The SimCLR values come from its own reported ablations rather than from new runs in this note.
With longer training, MoCo v2 reaches 71.1% at 800 epochs with batch size 256.
Memory and time at batch size 4096
The end-to-end variant at the same batch size uses 7.4G and 65 hrs.
The end-to-end variant at batch size 4096 is listed at 93.0G of memory, and no time is reported. That figure is the authors' estimate, and they describe batch size 4096 as intractable on a high-end 8-GPU machine.
The end-to-end variant is costlier at equal batch size because it back-propagates through both the query and the key encoders. MoCo back-propagates only through the query encoder, which accounts for the difference.
Limitations
The 93.0G memory for end-to-end training at batch size 4096 is an estimate, and no time is given for it.
The detection differences among the three-change rows are small, with AP at 57.2, 57.0 and 57.4. Linear accuracy was not a reliable proxy for detection in these ablations.
All reported results use ResNet-50. The SimCLR comparison uses SimCLR's numbers at 800 versus 1000 epochs, so it does not match training budgets. Other backbones and transfer tasks beyond ImageNet linear classification and VOC detection are not covered.
Paper info
- Authors
- Xinlei Chen, Haoqi Fan, Ross Girshick, Kaiming He
- Venue
- arXiv · Preprint
- First published
- 2020-3-9
- Added
- 2026-11-12
- Updated
- 2020-3-9
- Version
- v1
- arXiv
- 2003.04297
- Category
- cs.CV
- 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, Haoqi Fan, Ross Girshick, Kaiming He (2020). Improved Baselines with Momentum Contrastive Learning. arXiv:2003.04297v1. https://arxiv.org/abs/2003.04297v1
BibTeX
@misc{chen2020improved,
title = {{Improved Baselines with Momentum Contrastive Learning}},
author = {Xinlei Chen and Haoqi Fan and Ross Girshick and Kaiming He},
year = {2020},
eprint = {2003.04297},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2003.04297v1}
}