Token Lab検索

← 論文ライブラリ
Representations & contrastive learning / 2020

SimCLR: augmentation defines what similarity means

Follow two views through a shared encoder and projection head, then audit whether the invariance is valid.

A Simple Framework for Contrastive Learning of Visual Representations · Chen et al. · arXiv:2002.05709

Original editorial analysis by Token Lab · Source checked 2026-10-25 · Paper claims and synthetic examples are separated.

Detailed technical articles are available in English and Chinese. This locale shows the English article with localized navigation.

01 · What the paper establishes

SimCLR studies augmentation composition, a nonlinear projection head and contrastive training at scale. The paper reports representation quality through downstream evaluation, including linear evaluation, rather than treating training loss alone as success.

Primary source: paper abstract ↗
Study guide & lesson outlineLEARNING CONTRACT

Understand → implement → investigate

Goal: explain the mechanism in this lesson, reproduce one example and test a failure case. Reading alone does not mark mastery.

  • Understand: state assumptions, shapes/units and a counterexample.
  • Implement: reproduce a numerical example and inspect boundaries.
  • Investigate: compare one alternative under a matched budget.

02 · The mechanism

Text / 原始公式
x → augmentation₁ → f → h₁ → g → z₁
x → augmentation₂ → f → h₂ → g → z₂
Lᵢⱼ = −log[exp(sim(zᵢ,zⱼ)/τ) / Σₖ≠ᵢ exp(sim(zᵢ,zₖ)/τ)]
N original examples → 2N views → 2N−2 negatives/anchor

The positive-pair rule tells the representation which changes to ignore. Two crops may preserve object identity, but in another domain a crop can remove the only relevant signal. The projection head separates the contrastive objective’s representation from the encoder features used downstream. That separation should be tested, not assumed to help every dataset.

Notation and intuition are teaching explanations. Consult the original method for complete assumptions and implementation details.

Mechanism map & worked derivation

One source example → Two independently augmented views → Shared encoder → projection → Pair loss; evaluate encoder
Original schematic; read the steps from top to bottom. SVG ↓
Symbols and assumptions
SymbolMeaning
f, gShared encoder and projection head
h, zEncoder representation and projected representation
2N−2Negatives per anchor under the standard paired batch
  1. Generate two independently augmented views for each source example. Construct positive indices from source identity, not from incidental batch adjacency.
  2. For there are six views. Each anchor excludes itself, has one positive and four negatives. Verify that every anchor has exactly one intended positive.
  3. Evaluate encoder features h separately from projection z. A contrastive objective can remove nuisance information at z that is still useful in h for another downstream task.
Experiment checkpoint

Write a domain-specific augmentation validity table. Include at least one plausible-looking transformation that changes the label.

LOCAL / SYNTHETIC / INTERACTIVE

Change one variable. Explain what moves.

Original teaching calculation, not a reproduction of the paper’s benchmark. Bars are relative within this panel; numeric values and units are authoritative.

04 · Work through an example

Original counting example: produces eight views. For one anchor, exclude itself, retain one positive and six negatives. The denominator therefore has seven entries. At it has fifteen. This combinatorial view explains why a larger batch changes both computation and the discrimination task; it does not by itself predict quality.

05 · Design your experiment

Design an augmentation validity table for your domain before running experiments. Compare no projection head versus a nonlinear head under a matched compute budget. Evaluate h and z separately with separate trained linear classifiers on frozen features, with matched splits and tuning budgets. Include a label-preserving and a deliberately destructive augmentation, recording retrieval failures and class-specific accuracy.

Research deliverable

State one hypothesis; save the configuration and raw results; identify a competing explanation; report the narrowest supported conclusion. Use the linked lab as a local starting point, not a full paper reproduction.

Open related lesson / lab →

06 · Limits & reviewer questions

Editorial caution: batch size changes negative count, gradient noise and often optimizer behavior simultaneously. An ablation that changes all three does not isolate a single cause. Duplicate or semantically related examples may become false negatives even when they have different file names.

Should a medical-image augmentation automatically copy the natural-image recipe?

No. First identify which transformations preserve the downstream label and clinically relevant signal. A transformation can be visually plausible while erasing the evidence needed for the task.

07 · Read the original

Framework and augmentation/projection-head ablations, then the linear-evaluation protocol.

Year is the first arXiv submission year. Unversioned links follow revisions; record the exact version in your reproduction report. DeepSeek-R1 here is explicitly pinned to v1.

Continue this topic

MATHEMATICAL REVIEW · 2026-10-26

Assumptions, implementation & acceptance

Use cosine similarity and τ>0. Exclude the anchor itself, include its positive in the denominator, and average over 2N anchor directions. Freeze features and train separate linear probes for h/z with matched splits and tuning budgets.

Displayed formula, bilingual explanation and declared slider range. This code reproduces the scalar teaching calculation, not the paper training system.

Before running: predict a boundary case

Design an augmentation validity table for your domain before running experiments. Compare no projection head versus a nonlinear head under a matched compute budget. Evaluate h and z separately with separate trained linear classifiers on frozen features, with matched splits and tuning budgets. Include a label-preserving and a deliberately destructive augmentation, recording retrieval failures and class-specific accuracy.

Hint: isolate the assumption

Keep the baseline input fixed, change one parameter or boundary, and compare both the numerical result and the claimed units. A passing example verifies this fixture only.

Minimal executable example

Save the example and linked modules in one folder. Use Node.js 22 or newer, then run node simclr.mjs. No third-party runtime dependencies.

import {paperCalc} from './paper-core.mjs';
const result=paperCalc("simclr",4);
console.log(result);
Reference output — reveal after predicting
{
  "labels": [
    "Views",
    "Positive per anchor",
    "Negatives per anchor"
  ],
  "values": [
    8,
    1,
    6
  ],
  "unit": "count"
}

Test and transfer

Design an augmentation validity table for your domain before running experiments. Compare no projection head versus a nonlinear head under a matched compute budget. Evaluate h and z separately with separate trained linear classifiers on frozen features, with matched splits and tuning budgets. Include a label-preserving and a deliberately destructive augmentation, recording retrieval failures and class-specific accuracy.

Record input, code version, expected result and observed result in the notebook below. Then construct a counterexample that violates the assumption above and explain why the original conclusion no longer follows.

Download complete kit (.tar.gz) · Complete reference kit and regression checks

Predict, test and keep evidence

Before revealing an answer, predict one result. After the exercise, record the discrepancy and a transfer test. Saved locally across language editions.

Open notebook / export / clear →

The mathematical review scope is recorded per lesson. It does not establish empirical paper reproduction; report suspected errors in your notes. Review scope