Unit 4 of 9 · about 4 hours · explain
Paired, interleaved, instruction and synthetic multimodal data with generator provenance
A fluent synthetic answer can contain claims the image never supported. Data lineage must preserve the evidence available to the generator, not just the final image-answer pair.
You'll be able to
- Explain how paired examples, interleaved documents and instruction conversations define different alignment contracts.
- Trace synthetic answers back to their image, captions or boxes, generator and prompt version.
- Specify source-group splits, rights and modality exposure in a versioned data manifest.
Covers
Read
In this order, only the parts listed
0 of 3 done
- Visual Instruction Tuning, arXiv:2304.08485v1LLaVA - Visual Instruction Tuning
Section 3, GPT-assisted Visual Instruction Data Generation, and Table 1: caption and box contexts, conversation, description and reasoning outputs
Study the construction and inspect its assumptions. Do not call the paid generator; use existing annotations and hand-written instruction templates for the small local route.
- Flamingo, arXiv:2204.14198v1: data mixturesFlamingo: a Visual Language Model for Few-Shot Learning (Alayrac et al., 2022)
Sections 3.2.1 to 3.2.3 and Figures 6 and 7: interleaved webpage records, paired records and dataset-weighted text likelihood
- COCO terms of useCOCO Captions Subset
Terms of Use: Annotations & Website, then Images (page read 2026-10-17)
Focus on
- A paired caption gives a designated correspondence. Interleaved webpage proximity is weaker supervision; preserve image order, surrounding text and source-document boundaries.
- LLaVA's original language-only generator received captions and boxes, not image pixels. Generated reasoning is not a new independent observation of the image.
- Keep source image id, content hash, parent annotation ids, split, license evidence, transformations and answer origin. For synthetic answers also retain generator checkpoint or service edition, prompt, decoding settings and review decisions; mark unavailable upstream details as unknown.
- Count both examples and supervised text tokens by modality and source. Repeating a caption as several instructions increases exposure without creating independent evidence. COCO annotation terms do not relicense the images.
Common mistakes · 3
- Moving synthetic paraphrases into evaluation because their text differs. The parent image and answer evidence can still be training data.
- Treating unpaired images and text as positive contrastive pairs. A shared batch or document does not establish semantic correspondence.
- Dropping missing-image or rejected examples without counts. Filtering changes the modality distribution and must remain visible in the manifest.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Can a caption-only generator certify a small object's color when the captions never mention it?Answer
No. It can guess, but has no pixel evidence. Review that claim against the image or exclude it from grounded supervision.
2.Why split by image or source group before instruction generation?Answer
Captions, crops, questions and synthetic answers derived from one source share evidence. Splitting derivatives independently leaks that evidence.
3.Do equal numbers of image-text and text-only examples imply equal objective weight?Answer
No. Lengths, loss masks, sampling frequency and reduction determine the supervised weight. Visual positions may provide conditioning without being prediction targets.
You're done when
You can trace each answer in a sample manifest to its actual evidence, explain every split decision and distinguish unknown generator details from verified provenance.
Only when you can do this without notes.
Leads to
Notes
Resources · 3 for this unit, 12 more in the section
- 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_projectorin the code. Build only a tiny frozen-encoder plus projector path and compare it with text-only and shuffled-pair controls. - 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.
- 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.
- 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_transformandtokenize, https://github.com/openai/CLIP). The README says logits are "times 100", but the model learns the scale. - 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.
- 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.
- 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.ipynbthrough 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.
- 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:
ClipLossandSigLipLossinsrc/open_clip/loss.pyas oracles for your losses, and the zero-shot classifier. OpenAI RN50 weights needforce_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.