Explore modules

Contrastive Learning

Visualize how contrastive learning pulls similar examples together and pushes dissimilar ones apart in embedding space.

Free theory article

Visualize how contrastive learning pulls similar examples together and pushes dissimilar ones apart in embedding space.

Concept & interpretation

How can a representation bring related examples together without giving every example a manually written category? Contrastive methods compare positive pairs with alternatives. Two augmented views of the same image can supply a positive pair; other images provide negatives. A learned encoder changes its representations through an objective, rather than through literal physical forces.

Change a rate, then take one step

Open the Contrastive Learning interactive module. Before each comparison predict whether the reference attraction or repulsion should change.

  1. Press Reset Embeddings. Set Temperature (τ) to 0.5, Pull Force (Positive) to 0.05 and Push Force (Negative) to 0.02. Confirm Steps is 0 and the reference readouts are 5.000 and 0.073576. Reset restores the seeded positions and stops motion; it preserves your chosen rates.
  2. While paused, change Temperature to 0.1. Observe the shorter push reference bar and 0.001348 readout. No point motion is implied by changing a rate while paused.
  3. Set Pull Force to 0.10. Attraction becomes 10.000; the repulsion readout is unchanged. Change Push Force to 0.10 with Temperature back at 0.5: repulsion becomes 0.367879.
  4. Press Step once. The cloud advances exactly one 1/60-second update and Steps becomes 1. Press again to inspect a second bounded update. Every force for an update uses the previous positions, so the array order does not turn the update into sequential point motion.
  5. Press Start Learning to run, and Pause Learning to stop. These are the visible states of the stable Toggle learning button. Step is disabled during continuous motion. Drag the embedding view or use its arrow keys to pan; Reset view or Home resets navigation without resetting Steps.

To compare rates fairly, reset positions before each run and use the same number of Steps. The fixed seed and fixed step remove two sources of variation, but a short trajectory still does not establish eventual cluster quality.

Read the full free theory article