Multimodal Models·Question 2 of 67Basic

What is CLIP, how is it trained, and why did it become the foundation for so much multimodal work?

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

CLIP trains an image encoder and a text encoder jointly so that matching images and captions land close together in a shared embedding space. Training is contrastive: take a batch of N image-text pairs, compute all N×N cosine similarities between image and text embeddings, and optimise a symmetric cross-entropy loss so each image's highest similarity is with its own caption and vice versa. Every other pair in the batch serves as a negative, which is why CLIP training uses huge batches (~32k) - more negatives make the task harder and the embeddings sharper. The original model trained on ~400M web-scraped image-text pairs.

Full worked answer with diagram

CLIP trains an image encoder and a text encoder jointly so that matching images and captions land close together in a shared embedding space. Training is contrastive: take a batch of N image-text pairs, compute all N×N cosine similarities between image and text embeddings, and optimise a symmetric cross-entropy loss so each image's highest similarity is with its own caption and vice versa. Every other pair in the batch serves as a negative, which is why CLIP training uses huge batches (~32k) - more negatives make the task harder and the embeddings sharper. The original model trained on ~400M web-scraped image-text pairs.

Why it transfers: the supervision is open-vocabulary natural language rather than a fixed label set. An ImageNet classifier learns features sufficient to separate 1000 classes; CLIP has to organise visual features around anything humans write about images - objects, styles, scenes, text in the image, emotions. That yields three things. First, zero-shot classification: embed prompts like "a photo of a {class}" for each candidate class, embed the image, pick the nearest text embedding - the largest CLIP hits ~76% ImageNet top-1 with no ImageNet training. Second, cross-modal retrieval for free: text-to-image search is just nearest neighbours in the shared space. Third, and most consequentially, CLIP's image tower became the default vision encoder for VLMs - its language-aligned features are why gluing a ViT to an LLM with a small projector works at all.

Going further: follow-up territory

Caveats a strong candidate volunteers: CLIP is weak on compositional structure - word order, object-attribute binding, counting (it behaves somewhat bag-of-words); its text encoder truncates at 77 tokens; and the two modalities occupy measurably separated regions of the "shared" space (the modality gap). SigLIP, which replaces the softmax contrastive loss with a pairwise sigmoid loss, scales better with batch size and is the common modern substitute.

Worth sketching. The similarity matrix is the fastest way to show why batch size is a hyperparameter of the loss itself, not just of the optimiser.

flowchart LR
    A["Batch of N image-text pairs"] --> B["Image encoder"]
    A --> C["Text encoder"]
    B --> D["N x N cosine similarity matrix"]
    C --> D
    D --> E["Diagonal: the N true pairs,<br/>pulled together"]
    D --> F["Off-diagonal: N-1 negatives per row,<br/>pushed apart"]

What a good answer covers

  • CLIP trains an image encoder and a text encoder jointly so that matching images and captions land close…
  • Training is contrastive: take a batch of N image-text pairs, compute all N×N cosine similarities between…
  • Every other pair in the batch serves as a negative, which is why CLIP training uses huge batches (~32k)…
  • The original model trained on ~400M web-scraped image-text pairs
  • An ImageNet classifier learns features sufficient to separate 1000 classes; CLIP has to organise visual…

Key terms: contrastive · open-vocabulary natural language · zero-shot classification · cross-modal retrieval · vision encoder for VLMs

Interviewer follow-ups to expect

  1. Why do large batches matter so much for contrastive learning?

  2. How would you use CLIP to build a zero-shot content moderation filter, and where would it fail?

  3. What's the modality gap and when does it bite?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep