Unit 7 of 9 · about 4 hours · measure

Missing, corrupted and conflicting modalities, visual grounding and hallucination

A model can answer from language priors while ignoring the image, or change its answer when the image changes without becoming more accurate. Grounding needs both intervention evidence and independently checked answers.

You'll be able to

  • Measure answer changes under missing-image, corrupted-image and conflicting-text interventions on the same held-out items.
  • Evaluate one original POPE sampling slice with audited parsing, confusion counts and answer bias.
  • Distinguish image sensitivity, correct grounding and unsupported claims about safety.

Covers

Missing, corrupted and conflicting modality behaviorVisual grounding, hallucination and language-prior shortcuts
1

Read

In this order, only the parts listed

0 of 3 done

  1. Evaluating Object Hallucination in Large Vision-Language Models, EMNLP 2023POPE: Evaluating Object Hallucination in Large Vision-Language Models

    Sections 5.1 and 5.2, Figure 3 and Table 3: object probing, random/popular/adversarial negatives and reported metrics

    The Metrics paragraph on printed p. 298 misdescribes precision and recall as correct yes/no answers respectively. Use the positive-class formulas in the next item: recall is not specificity. Object presence is also narrower than general visual grounding.

  2. Original POPE evaluator at commit 08d957bPOPE: Evaluating Object Hallucination in Large Vision-Language Models

    Answer normalization, TP, TN, FP, FN, precision, recall, F1 and yes-ratio computation

    Inspect rather than run unchanged. It zips rows instead of joining ids, treats unrecognized answers as yes and does not guard zero denominators. Keep original POPE data separate from POPEv2.

  3. Original POPE COCO random-sampling questionsPOPE: Evaluating Object Hallucination in Large Vision-Language Models

    Records keyed by question_id, with image, text and label; image names identify COCO validation 2014

    Reserve 10 to 20 image ids before training and keep all their questions. Use this fixed random-negative slice on CPU or your GPU, not a full benchmark sweep; keep its images and caption derivatives out of adaptation.

2

Focus on

  • Fix model, question, decoding and evaluator; change only the declared modality condition. Missing-image removal, a blank image, a shuffled image and a conflicting caption are distinct interventions, not interchangeable controls.
  • For a conflicting-caption test, ask an image-grounded question whose answer you checked from pixels, then add contradictory text. A changed answer measures susceptibility only under that stated instruction and evidence policy.
  • On parsed binary predictions, use positive-class precision , recall and F1 . Declare zero-denominator handling before scoring.
  • Require a single yes/no answer for your local parser, with case and surrounding whitespace normalized. Mark other outputs invalid. Report parsed-subset confusion metrics and coverage, all-item accuracy with invalids incorrect, and yes count divided by all items. Disclose this departure from the original parser and hand-check a sample.
Common mistakes · 3
  • Calling a performance drop after image corruption proof of correct grounding. It establishes dependence on changed input, not that the intact answer was right.
  • Treating high F1 as freedom from hallucination. Always-yes already gets substantial F1 on a balanced presence test; report accuracy and yes ratio too.
  • Scoring missing-image runs after discarding failed generations. Failures belong in all-item accuracy and coverage, not outside the denominator.
3

Try it yourself

Closed-book, before checking anything

Without model inference, score four items whose labels are ['yes', 'yes', 'no', 'no'] with an always-yes predictor. Get accuracy 0.5, precision 0.5, recall 1, F1 and yes ratio 1. Repeat with mixed predictions, then permute prediction rows while preserving question_id: an id-based join must preserve the scores and reject duplicate or missing ids. Check this before scoring the image interventions.
4

Quiz yourself

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

0 got · 0 missed

  1. 1.Why can an always-no predictor have zero false-positive hallucinations but still fail this unit?Answer

    It misses every present object and may ignore the image completely. Negative errors, positive recall and image-sensitive correct answers must be considered together.

  2. 2.What does a model unchanged under every image intervention tell you?Answer

    Its answers show no measured image dependence on those items. Check assembly and modality wiring, then language shortcuts; do not claim the image pathway is universally unused.

  3. 3.Does passing a POPE slice establish spatial reasoning or multimodal safety?Answer

    No. It tests prompted object presence for its images, sampling strategy and parser. Spatial relations, instruction conflicts and harmful image content require separate evaluations.

You're done when

Your synthetic scorer and join tests pass, and your intervention report preserves invalids and separates correct grounding, image dependence and language-prior errors.

Only when you can do this without notes.

Leads to

Notes

Resources · 1 for this unit, 14 more in the section
  • 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.

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 _transform and tokenize, 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.

  • 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.

  • 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.

  • 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.

  • 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.

  • 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.