LESSON 5.10 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW
Contrastive losses
Watch matching image and caption points pull together while the rest push apart.
Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 5.10 · LOSS BAYBATCH 4 · STEP 20 · τ 0.5
01
Stage 1 of 6 · The batch
A batch holds 4 image–caption pairs. Two encoders map each one to a point on a circle.
Explain it simply
Each dot is an image and each square is a caption. An encoder, a model that turns an input into numbers, places each one as a direction on the circle. A line joins each image to its own caption. Training wants each pair to point the same way.
4 images as dots and 4 captions as squares on a circle. Image 1 is at 63 degrees, caption 1 at 46 degrees.
image (dot) · caption (square)margin · stepscore s · softmax ploss · push and pulleven softmax log N
Toy: 2, 4 or 8 image–caption pairs on a circle
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
The score is the cosine of the angle between two points.
PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
- 5 more stages and 3 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.