Paper Breakdowns  /  SimCLR
Paper 55~11 min readICML 2020worked math + runnable code
Paper Breakdown

SimCLR,
explained.

How do you teach a model to see without ever telling it what anything is? SimCLR's answer is a single, almost obvious rule: two crops of the same photo should look alike to the model, and any two different photos should look different. Train hard on that one comparison, over millions of unlabeled images, and rich visual features fall out — enough to rival models trained with full supervision. Here's the contrastive loss that makes it happen, and the three ingredients it depends on.

Written breakdown
This one is a written deep-dive.
Paper, mechanism, worked math and a runnable version — all below ↓
01

Learning by comparison

Labels are expensive; raw images are nearly free. Self-supervised learning tries to build good representations from unlabeled data by inventing a task the data itself can grade. SimCLR's invented task is contrastive: given a representation, judge whether two inputs are "the same thing seen differently" or "different things." No categories, no annotations — just same-or-different.

The elegant part is where the supervision comes from. Take one image, apply two random transformations — crop it here, jitter its colors, blur it — and you have two views that you know depict the same content. That known relationship is the label the model never had. Learn to pull those two views together in representation space while pushing away every other image, and you have learned what makes an image what it is, invariant to the incidental stuff.

The one-sentence version

Two augmented views of one image should be close; all other images should be far — that single contrastive rule, trained at scale, learns visual features with no labels.

02

Positives and negatives

Concretely: take a batch of images. For each one, create two augmented views. The two views of the same image are a positive pair — they should end up close. Every view of a different image in the batch is a negative — it should end up far. So each anchor view has exactly one positive to attract and many negatives to repel, all supplied by the batch itself for free.

One contrastive step
AugmentTwo random views per image (crop, color, blur) → the positive pair.
EncodeA shared encoder + projection head maps each view to a vector.
CompareCosine similarity of the anchor to its positive and to all negatives.
ContrastPull the positive close, push negatives away — the NT-Xent loss.

Nothing here required a human to say "this is a dog." The batch is its own answer key: same image, positive; different image, negative. That is what makes it self-supervised, and why more images in a batch simply means more negatives to learn from.

03

The NT-Xent loss

The loss that enforces all this is NT-Xent — normalized, temperature-scaled cross-entropy. For an anchor view i with positive partner j, it is a softmax classification where the "correct class" is the positive and every negative is a wrong class. Similarities are cosine (that's the "normalized"), scaled by a temperature τ:

Minimizing this maximizes the positive's share of the softmax — it rises as the positive similarity grows, and falls as any negative creeps closer, so one loss both attracts the positive and repels negatives. The temperature τ controls how sharply the model focuses on the hardest (closest) negatives — smaller τ, sharper focus. And because the denominator sums over every negative, a bigger batch makes the task harder and the features stronger. The runnable version below shows the loss dropping as the positive dominates and rising as negatives multiply.

04

Three ingredients

SimCLR's other contribution was measuring what actually matters. Three choices proved decisive:

IngredientWhy it matters
Strong augmentationThe augmentations define the invariances learned. The composition — especially random crop plus color distortion — was critical; weak augmentation gives weak features.
Projection headA small MLP applied before computing the loss. Contrasting in this projected space, then discarding the head and keeping the layer beneath, gave markedly better representations.
Large batchesMore images per batch = more and harder negatives per step. SimCLR benefited from very large batches (and long training) more than supervised learning does.

The projection-head finding is a subtle, influential one: the representation you train the contrastive loss on is not the best representation to use downstream. Keeping the pre-projection features — which retain more information the loss would have thrown away — is now standard practice.

RUN IT YOURSELF

Pull the positive, push the negatives

NT-Xent is a temperature-scaled softmax where the positive pair is the right answer. This computes it from cosine similarities: the loss falls as the positive pair gets more similar, rises when a negative creeps closer (a hard negative), rises as you add more negatives (the bigger-batch effect — 0.07 with one negative, 1.5 with fifty), and collapses toward zero once the positive dominates. Change the similarities, the temperature, or the number of negatives and watch the contrast respond.

CPython · WebAssembly
05

What it achieved

SimCLR closed much of the gap between self-supervised and supervised vision. Its headline results reset expectations for learning without labels:

ResultSignificance
Near-supervised linear probeA linear classifier on frozen SimCLR features approached fully-supervised accuracy on ImageNet — features that good, with no labels.
Great low-label fine-tuningWith only 1% of labels, fine-tuning the pre-trained encoder far outperformed training from those labels alone.
Scales with model and batchBigger encoders and larger batches kept helping — the recipe rewarded scale.
SimplicityNo memory bank, no momentum encoder (as in prior methods) — just augmentation, an encoder, a projection head, and NT-Xent.

The simplicity was itself a contribution: earlier contrastive methods leaned on extra machinery like memory banks. SimCLR showed that with enough negatives (big batch) and the right augmentations, you didn't need them — a cleaner recipe that others could build on.

06

Contrastive vs masked

SimCLR crystallized the contrastive family of self-supervised learning — learn by comparison, pull positives together and push negatives apart — and its influence runs straight into multimodal work: CLIP uses the same contrastive idea across images and text. The lineage of follow-ups (MoCo, BYOL, SimSiam) mostly explored how to keep the quality while dropping the need for huge batches of negatives.

It's illuminating to set it beside masked autoencoders, the other great self-supervised family. Contrastive methods need augmentations and negatives and learn invariances; masked methods need neither and learn by reconstruction. Two very different routes to the same destination — strong features without labels — and modern vision draws on both. SimCLR is the clearest statement of the contrastive route.

Worth knowing

The temperature τ is more important than it looks: too high and the model treats all negatives equally and learns loosely; too low and it obsesses over the single hardest negative. A well-tuned τ (often ~0.1–0.5) is part of every contrastive method's recipe.

07

Why it still matters

SimCLR gave contrastive self-supervised learning a clean, effective recipe for vision. Take an image, make two different augmented views of it, and train the model to pull those two views together in embedding space while pushing apart views of other images. No labels — the supervision comes entirely from "these two crops are the same picture, those are not."

The paper's contribution was showing which ingredients actually matter, and they were surprising. Strong data augmentation (especially the combination of random cropping and color distortion) is critical — weak augmentation makes the task too easy. A small projection head on top of the encoder during training substantially improves the learned representations. And contrastive learning benefits a lot from large batch sizes, because more negatives sharpen the signal.

Why it matters: it demonstrated that self-supervised representations could approach supervised ones on ImageNet, using only unlabeled images. That is enormous leverage — labels are the expensive bottleneck, and SimCLR showed you can learn strong visual features without them, then fine-tune on a small labeled set.

SimCLR became a reference point for the whole contrastive-learning wave (MoCo, BYOL, and beyond) and helped establish the augment-two-views-and-contrast paradigm that also underlies multimodal models like CLIP. Its durable lessons — augmentation design is central, and negatives/scale matter — still shape how self-supervised systems are built.

Frequently asked

Quick answers

What is SimCLR in one line?

A contrastive self-supervised method: two augmented views of an image are a positive pair against a batch of negatives, trained so same-image views are close and different images are far.

What is NT-Xent?

The loss — a temperature-scaled softmax over cosine similarities where the positive pair is the correct class. It pulls positives together and pushes negatives apart in one term.

Why do batch size and augmentation matter?

Every other image in the batch is a negative, so bigger batches give more/harder negatives; augmentations define the invariances the model learns, and their composition is critical.

Contrastive or masked pre-training?

Contrastive (SimCLR) learns by comparison with negatives and augmentation; masked (MAE) learns by reconstruction with neither. Both learn strong features without labels.

A Simple Framework for Contrastive Learning of Visual Representations · Chen, Kornblith, Norouzi, Hinton · ICML 2020 · read the original paper on arXiv → · Vibe Engines · 2026
Finished this one? 0 / 111 Paper Breakdowns done

Explore the topic

See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.

More Paper Breakdowns