Representation, Self-Supervision & Paired Modalities
Representation objectives need an explicit invariance, pairing contract and held-out evaluator. A falling pretraining loss alone does not show useful transfer.
Section 5 of 8 · 7 units · about 26 hours
By the end you can Derive a contrastive objective, build a compact representation learner, detect a seeded pair leak, and defend held-out retrieval or transfer evidence with explicit limits.
Units
- Embedding geometry and contrastive logits3h
- Temperature, negatives and positive construction4h
- Augmentation shortcuts, false negatives and collapse5h
- Linear probes, transfer evaluation and pair leakage5h
- Patch embeddings and positional information3h
- Paired modalities: projector heads, alignment and zero-shot retrieval4h
- Graph message passing and oversmoothing2h
Build it
Mini project · about 10 to 14 hours
Compact contrastive learner with a seeded leak audit
Train a small SimCLR-style encoder on a CIFAR-10 subset, evaluate it with a frozen linear probe and held-out retrieval against a random-encoder baseline, and show that your split audit catches a pair leak you planted yourself.
- 1Implement NT-Xent from your derivation. Pass Deep-ML 384 and the CS231n Assignment 3
simclr_loss_naiveandsimclr_loss_vectorizedchecks, and add tests for identical embeddings (), temperature extremes and unnormalized inputs. - 2Train a small encoder with a projector on a fixed CIFAR-10 subset at a stated temperature and batch size. Log loss, positive-pair accuracy and the collapse check (per-dimension spread of normalized embeddings and numerical rank) every epoch.
- 3Evaluate with a frozen linear probe on and on , and with nearest-neighbour retrieval on a held-out split, against a frozen random-encoder baseline with matched budgets, over two seeds.
- 4Split by source image before augmenting, and write a split audit that combines exact hashes with a near-duplicate check, such as cosine similarity of downsampled pixels above a stated threshold.
- 5Plant a leak: copy a few hundred test images, lightly augmented, into the training set. Show what the audit flags and misses, and measure how much the leak inflates retrieval and probe scores.
- 6Run one ablation, such as dropping color jitter, and report probe accuracy and the collapse check for both runs.
- 7Write the limits: what your subset, resolution and budget cannot show about large-scale pretraining or paired image-text alignment.
What you hand in
- Training and evaluation code with the loss tests, the collapse check and the split audit.
- A results table with seeds: probe on
handz, retrieval, the random-encoder baseline, the ablation, and leaked versus clean scores. - A one-page limits note.
How to check it
- Deep-ML 384: Contrastive Loss (InfoNCE / SimCLR-style)
- CS231n Assignment 3, `Self_Supervised_Learning.ipynb` loss and augmentation checks
Run the notebook cells locally; each prints a
rel_erroragainst stored values or numerical gradients. Gradescope is for enrolled students only, so these printed checks are the gate. - Self-grade with the rubric below
How it's graded
Objective
Pass: NT-Xent passes Deep-ML 384, the CS231n loss checks and your edge tests.
Great: Your tests also cover duplicate images in one batch and show how they change the loss.
Evaluation protocol
Pass: The frozen probe and retrieval beat the random-encoder baseline at matched budgets.
Great: The result holds on both seeds, and the gap between probing and is reported.
Leak detection
Pass: The audit flags the planted near-duplicates.
Great: You report the audit's misses and false alarms on the planted set, and the score inflation the leak caused.
Collapse
Pass: Spread and rank are logged for every run.
Great: A deliberately collapsed run, such as a constant projector output, trips the check.
Limits
Pass: The note names what the compact run cannot show.
Great: Each limit names the measurement that would settle it.
Resources
- Understanding Deep Learning - representation foundationsSimon J. D. Prince
Use 9.3.6-9.3.7 for transfer and self-supervision, 12.9-12.10 for image transformers, and 13.1-13.4 plus 13.10 for GNN vocabulary. Open notebooks 9.4, 12.4 and 13.1 only when a figure or mechanism is unclear.
- D2L - Vision TransformerD2L authors
Use vision-transformer.md for patch extraction, patch embeddings and a tested small encoder. Add a compact SimCLR-style or paired-data contrastive objective in the explicit training loop from Sections 2 and 3.
- SimCLR - A Simple Framework for Contrastive Learning of Visual RepresentationsChen, Kornblith, Norouzi and Hinton (ICML 2020)
Use Section 2.1 Eq. (1) and Algorithm 1 for NT-Xent, 2.3 for the linear-evaluation protocol, 3.1 with Figures 5-6 for augmentation composition and shortcuts, 4.2 for the projection head, and 5.1-5.2 with Table 5 and Figure 9 for temperature and batch-size effects.
- CLIP - Learning Transferable Visual Models From Natural Language SupervisionRadford et al. (OpenAI, ICML 2021)
Use Section 2.3 for the symmetric image-text objective and learned temperature, 2.5 for batch size and temperature limits, and 3.1.2 with 3.1.4 for zero-shot transfer and prompt ensembling.
- Stanford CS231n - transformer and self-supervised assignment sliceStanford University
Use only the Assignment 3 components for transformers, self-supervised learning, CLIP or DINO that directly test representation and pairing. Keep the controlled local evaluator as the gate.
- TensorTonic - patchify and symmetric CLIP lossTensorTonic
Solve only Patchify a Batch of Images and Implement Symmetric CLIP Contrastive Loss. Transfer both into the controlled experiment and preserve local leakage and collapse tests.
- SimSiam - Exploring Simple Siamese Representation LearningChen and He (CVPR 2021)
Use Figure 2 and Table 1 for collapse under removed stop-gradient or predictor, including the per-channel spread diagnostic.
- Deep-ML candidate - InfoNCE LossDeep-ML
If the platform admission check passes, use problem 384 once after deriving the objective. Add local tests for temperature extremes, missing positives, duplicate pairs and normalized versus unnormalized embeddings.