Unit 8 of 9 · about 5 hours · measure

Cross-modal leakage, modality slices, and text-only and corrupted-pair baselines

The Deep Learning unit on linear probes, transfer evaluation and pair leakage covered source splits. Research-depth evidence must also survive cross-modal derivatives, altered candidate sets and the possibility that a visual gain is just extra computation or answer leakage.

You'll be able to

  • Audit image, caption, question and synthetic-answer overlap without treating a clean local split as proof of clean pretraining.
  • Compare intact, text-only and corrupted-pair conditions on fixed held-out modality slices.
  • Report paired quality deltas with image-group uncertainty and measured modality-conditioned cost.

Covers

Cross-modal duplicates, benchmark contamination and pairing leakageObject, text-in-image, spatial, counting and resolution slicesText-only, shuffled-pair and corrupted-image baselines
1

Read

In this order, only the parts listed

0 of 3 done

  1. CLIP, ICML 2021 PMLR edition: overlap and limitationsCLIP Paper and Official Code

    Sections 4 and 6: Data Overlap Analysis and Limitations

  2. Flamingo, arXiv:2204.14198v1: deduplication scopeFlamingo: a Visual Language Model for Few-Shot Learning (Alayrac et al., 2022)

    Appendix A.3, Dataset deduplication against evaluation tasks

    Read the exceptions as well as the method: not every dataset or modality was deduplicated. Do not attempt to reproduce the internal search service.

  3. Qwen2-VL, arXiv:2409.12191v1: resolution ablationQwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolution (Wang et al., 2024)

    Section 3.3.1, Dynamic Resolution, Table 7 and Figure 4

    Use its task-dependent resolution behavior to motivate slices, not as a predicted gain for your encoder. Your frozen encoder must support the chosen input sizes.

2

Focus on

  • Audit raw and decoded-image hashes, source ids and caption/question/answer lineage. Review near-duplicate candidates across crops and re-encodings; a high feature similarity is a candidate, not proof of duplication. Record pretraining overlap as unknown when the encoder's training data cannot be audited.
  • Predeclare object presence, text-in-image, spatial relation, counting and resolution slices with checked answers. Add benign cases and harmless text-in-image instruction conflicts; score image-grounded utility separately from whether embedded instructions overrode the user's task.
  • Evaluate identical item ids and prompts with intact images, an absent visual prefix, shuffled image assignments and corrupted images. Use a derangement with no retained original pair and inspect accidental semantic matches. Separate inference interventions from separately trained shuffled-pair controls.
  • Hold candidate pools fixed for retrieval and decoding budgets fixed for generation. Report answer quality, valid-answer coverage, visual/text token counts, elapsed time and available peak-memory measurements by slice. A text-only baseline does less work; disclose that gap or add a length-matched blank-feature control instead of claiming exact compute matching.
Common mistakes · 3
  • Treating changed filenames or caption paraphrases as held-out evidence. Shared pixels or answer provenance can cross the split without any repeated text.
  • Expecting a shuffled-pair score to equal chance. Repeated objects, language priors and semantically similar images can retain useful information.
  • Bootstrapping questions as independent when several refer to one image. Resample image groups for paired uncertainty, and keep training-seed variation separate.
3

Try it yourself

Closed-book, before checking anything

Seed a manifest audit with an evaluation image that is a byte-identical training image under a new id, a re-encoded copy, and a new question derived from a training caption. Exact hashing must catch the first; parent lineage must catch the question; decoded-image comparison or reviewed near-duplicate search must catch the re-encoding. Quarantine the whole leaking source group and recompute the split report before examining model scores. Preserve the planted failures as regression fixtures.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Why can a higher resolution help OCR but not improve a counting or reasoning score?Answer

    It may preserve readable detail without fixing the model's reasoning or task representation. It also changes visual token count and computation, so measure each slice rather than asserting a universal gain.

  2. 2.Does a text-only score close to the intact score prove an assembly bug?Answer

    No. The data may be answerable from text or the trained model may use language shortcuts. Test controlled image-dependent items and inspect wiring before choosing an explanation.

  3. 3.Why is a random shuffle weaker than a checked derangement for an image intervention?Answer

    A random permutation may leave some original pairs intact. A derangement removes identity matches, although semantic matches still need inspection.

You're done when

The planted leaks are detected, and your comparison table keeps item identities, budgets, invalids and image-group uncertainty visible while preserving at least one negative result.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 12 more in the section
  • CLIP Paper and Official CodeOpenAI · required

    Read Section 2.2 and the Figure 3 pseudocode (normalized embeddings, logits scaled by a learned temperature, the symmetric cross-entropy), then Section 2.3. Check preprocessing and tokenization in the official code (clip/clip.py _transform and tokenize, https://github.com/openai/CLIP). The README says logits are "times 100", but the model learns the scale.

  • Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolution (Wang et al., 2024)Alibaba Qwen · required

    Read Section 2.1 and Figure 3 (dynamic resolution, 2x2 token merging, M-RoPE with temporal, height and width components) and Section 3.3.2 (the M-RoPE ablation). Variable resolution means variable tokens and memory.

  • Flamingo: a Visual Language Model for Few-Shot Learning (Alayrac et al., 2022)DeepMind · support

    Read Sections 2.1 to 2.3 (details in Appendix A.1.1 to A.1.3): the Perceiver Resampler, gated cross-attention with tanh gates starting at zero, and multi-image masking. It is the cross-attention contrast to LLaVA's token concatenation.

Also in this section

  • CS336 2026 - Alignment and MultimodalityStanford University · primary

    Step through the Lecture 17 trace ("multimodal models": CLIP, SigLIP, LLaVA, LLaVA-OneVision, Qwen-VL, Qwen2-VL, Qwen3-VL, Chameleon). Reconstruct patching, projector, fusion, multimodal positions and the chosen objective before implementing the bounded image-text path.

  • Sigmoid Loss for Language Image Pre-Training (Zhai et al., 2023)Google DeepMind · required

    Read Sections 3.1 and 3.2 and Algorithm 1: a pairwise sigmoid loss with a learned temperature and bias instead of a softmax over the batch. Negatives still matter; keep the reduction convention explicit.

  • LLaVA - Visual Instruction TuningLLaVA Team · required

    Read Section 3 (GPT-assisted instruction data built from captions and boxes) and Sections 4.1 and 4.2 (a linear projection, then two-stage training). LLaVA-1.5 (https://arxiv.org/abs/2310.03744) swaps in a two-layer MLP; see build_vision_projector in the code. Build only a tiny frozen-encoder plus projector path and compare it with text-only and shuffled-pair controls.

  • POPE: Evaluating Object Hallucination in Large Vision-Language ModelsRenmin University · required

    Read Sections 5.1 and 5.2 of the paper (https://aclanthology.org/2023.emnlp-main.20.pdf), then evaluate one negative-sampling slice (random, popular or adversarial) with accuracy, F1 and the yes ratio. Join answers by question id, not row order, and keep the original files apart from POPEv2.

  • Modern LLM Notebook - Vision-Language ModelsWalking Labs · support

    Complete notebooks-en/part4-frontiers/29-vlm.ipynb through the minimal VLM. Add missing-image, conflicting-caption, resolution and serialization tests that the walkthrough does not supply.

  • smol-course Unit 3 - Vision Language ModelsHugging Face · support

    Work through Unit 3 for a runnable VLM fine-tuning path on SmolVLM2. Check its memory notes against your GPU and shrink the model, image resolution or batch before running.

  • COCO Captions SubsetCOCO Consortium · support

    Select 50 to 200 image ids from one annotation split with all their captions, record each image's license, and keep every caption of an evaluation image out of training. The annotations are CC BY 4.0; the images keep their own terms.

  • TensorTonic - Alignment and Multimodality SetTensorTonic · support

    Solve Patchify a Batch of Images (cs336-l17-vision-transformer-patchify), Implement Symmetric CLIP Contrastive Loss (cs336-l17-symmetric-clip-loss), Implement the SigLIP Pairwise Loss (cs336-l17-siglip-pairwise-loss) and Assign Multimodal RoPE Coordinates (cs336-l17-multimodal-rope-coordinates). Its SigLIP loss averages over all B squared pairs while OpenCLIP divides the sum by B, so multiply by B before comparing. Public test cases check the listed edge cases, not gradients or the hidden grader, so keep your own tests beside each solution.

  • OpenCLIPML Foundations · reference

    Use release 3.3.0 for one small comparison: ClipLoss and SigLipLoss in src/open_clip/loss.py as oracles for your losses, and the zero-shot classifier. OpenAI RN50 weights need force_quick_gelu=True. The main branch has a refactored training stack; do not adopt the distributed trainer.

  • Chameleon: Mixed-Modal Early-Fusion Foundation Models (Chameleon Team, 2024)Meta FAIR · reference

    Read Sections 2.1 to 2.3: images as 1024 discrete tokens from an 8192-entry codebook, interleaved data and the stability fixes. Early fusion still depends on the image tokenizer.

  • LLM Post-Training Laboratory - Multimodal ModuleRoadmap-Final · support

    Use the optional multimodal evidence module for versioned aligned data, projector or fusion tests, retrieval and generation evaluation, and modality-specific safety checks.

  • High Fidelity Neural Audio Compression (EnCodec)Meta AI · reference

    Sections 3.1 to 3.4 of arXiv:2210.13438v1: temporal downsampling, residual codebooks, code prediction and codec reconstruction objectives. Read for audio-token vocabulary and rate accounting, not a codec training run.