Ask what should change when the equation is manipulated, then let the visualization test that expectation.
Foundation Lab
Contrastive Learning & InfoNCE
Powers CLIP, which enabled zero-shot image classification and text-to-image (via embeddings)
\mathcal{L} = -\log \frac{\exp(\text{sim}(z_i, z_j^+) / \tau)}{\sum_k \exp(\text{sim}(z_i, z_k) / \tau)}Selected Foundation Object
Keep the equation fixed; move through the evidence.
Temperature τ controls "hardness": low τ → focuses on hard negatives, high τ → uniform over negatives
\mathcal{L} = -\log \frac{\exp(\text{sim}(z_i, z_j^+) / \tau)}{\sum_k \exp(\text{sim}(z_i, z_k) / \tau)}Use the runnable panel, the key equation, and canonical papers as separate forms of evidence for the same object.
The useful learning product is the reusable mechanism you can carry into another model, paper, or engineering tradeoff.
Use prerequisites, dependents, and semantic links to repair the next gap without leaving the object behind.
Why It Matters for Modern Models
- Powers CLIP, which enabled zero-shot image classification and text-to-image (via embeddings)
- Self-supervised learning breakthrough: learned ImageNet-quality features without labels
- Same framework underlies sentence embeddings, audio-text models, and multimodal foundation models
What Tutorials Skip
What is still poorly explained in textbooks and papers:
- Temperature τ controls "hardness": low τ → focuses on hard negatives, high τ → uniform over negatives
- Batch size matters: more negatives = better approximation of true InfoNCE = better representations
- False negatives (same class treated as negative) hurt less than expected—contrastive is robust
Interactive Visualization
Core Math (Optional Deep Dive)
If you want intuition first, start with the key equation and the visualization. Come back here for the full walkthrough.
InfoNCE loss maximizes agreement between positive pairs while pushing negatives apart:
where is a positive (augmented view), others are negatives, and is temperature.
CLIP extends this to image-text pairs:
matching images to their captions and vice versa in a batch.