Teaching a language model to see
Language models are general (any text → any text), but the world is multimodal. The North Star is an omni model: any combination of text/image/audio/video in, any combination out. This overview focuses on the input side — how do you feed images into a transformer? — building from CLIP up to modern VLMs and the all-discrete Chameleon.
The core problem: everything must become tokens
Transformers still win across every modality at scale, and they speak tokens — discrete or continuous embeddings, each representing a semantic unit. Text subwords are roughly meaningful; a single pixel is not. So the central challenge of multimodality is finding the image/audio equivalent of the BPE tokenizer: convert non-text into tokens a transformer can digest (input), and generate them back out (output). This lecture is almost entirely about the input side.
CLIP and SigLIP
CLIP — contrastive language-image pre-training (2021)
In the GPT-3 era, vision was still ImageNet/ResNet supervised learning. CLIP asked: can we leverage the web's noisy image-text pairs the way LMs leverage noisy text? The objective is simple — encode each image to a vector Iᵢ and each caption to Tᵢ, and make matched pairs align far more than mismatched ones (a 2N-way softmax classification over the batch):
Vision encoder: a ViT (beat ResNets) — chop the image into patches (14×14), treat each patch as a token, add positional embeddings, run a transformer, attention-pool to one vector. The best model is ViT-L/14 @ 336². Images are resized (short side to 336) and center-cropped — a heuristic that's fine for classification-centric work. Text encoder: a GPT-2-style transformer, using the EOS activation as the sequence vector. Data: 400M web pairs (CLIP, unreleased) / LAION-5B (OpenCLIP, which bootstrapped CLIP itself for filtering).
Zero-shot CLIP (dot-product the image against label texts) beat a ResNet trained on 1.2M hand-labeled ImageNet images — leveraging noisy organic web data instead of Mechanical Turk. Notably, a bag-of-words CLIP objective is more efficient than predicting the exact caption tokens (for classification, fine-grained token order doesn't matter). Downsides: CLIP needs huge batches (~32K) and a softmax over the whole batch (not decomposable like LM training).
SigLIP — sigmoid loss (Google)
SigLIP replaces CLIP's multi-class softmax with a per-pair binary classification (aligned or not): diagonal entries are +1, off-diagonal −1, with a log_sigmoid loss. This decouples the loss from batch size — so small batches actually work better (CLIP degrades), and it parallelizes cleanly (each device holds some pairs and rotates text shards around to cover the off-diagonal blocks, like DDP). Trained on WebLI (~billion pairs, plus OCR'd text-image pairs, multilingual), it's far more efficient than CLIP, with ~32K as its critical batch size.
| CLIP | SigLIP | |
|---|---|---|
| Loss | multi-class softmax over batch | per-pair sigmoid (binary) |
| Batch coupling | loss tied to batch size | decoupled — small batches OK |
| Parallelism | full-batch softmax | shard + rotate |
Inject image embeddings into an LM
The template
Every VLM follows the same recipe — take a pre-trained vision encoder + a pre-trained LM and stitch them with an adapter, then mid/post-train (not from scratch):
CLIP / SigLIP
project to LM space
→ text out
The image vectors get mapped into the LM's token-embedding space and concatenated with text embeddings; the whole sequence runs through a standard transformer. Output is always text (these models ingest images but don't generate them).
| Model | Encoder | LM | Adapter | Key addition |
|---|---|---|---|---|
| LLaVA (2023) | CLIP | Vicuna | linear W | GPT-4-synthesized instruction data (from MS-COCO) |
| LLaVA-OneVision (2024) | SigLIP | Qwen-2 | 2-layer MLP | multi-image + video; AnyRes |
| Qwen-VL (2023) | OpenCLIP | Qwen | cross-attn → 256 tokens | image/box/ref tags; trains encoder |
| Qwen2-VL (2024) | fine-tuned ViT | Qwen-2 | 2×2 compress → 66/patch | dynamic resolution; M-RoPE |
| Qwen3-VL (2025) | SigLIP-2 | Qwen-3 (dense/MoE) | DeepStack | 256K context, interleaved M-RoPE, video timestamps |
LLaVA → OneVision: data and resolution
LLaVA trains in two stages: (1) freeze encoder + LM, train only the projector W (alignment — make image vectors look like token embeddings); (2) freeze the encoder, fine-tune W + LM on the synthesized image→text data. OneVision upgrades the parts and adds multi-image/video, via the key resolution trick:
A fixed 336² encoder can't read a document. So split a high-res image into encoder-sized tiles, encode each separately, and concatenate the vectors (plus one downsampled global view); interpolate down if there are too many. Token budgets are then allocated by modality: a single image gets the full view + up to 9 crops; multiple images get base resolution each; video uses fewer tokens/frame (up to ~32 frames) to avoid context blow-up. A nice surprise: cross-modal transfer — single-image OCR training generalizes to multi-image, and single-image visual prompting generalizes to video.
Qwen-VL series: dynamic resolution & M-RoPE
Qwen2-VL made resolution truly dynamic (a big picture → ~11K tokens, a tiny equation → ~8), via AnyRes tiles + 2×2 compression to ~66 tokens/patch. It also introduced multimodal RoPE (M-RoPE): positions are now 3D (time, height, width), with RoPE computed per axis and concatenated. Qwen3-VL refines this:
Note: the vision encoder is far smaller than the LM (often <1B params) — patch encoding is a local operation with little knowledge/reasoning; the capability lives in the LM.
Chameleon: everything is a token
Map images to discrete tokens, then just train an LM
VLMs only generate text. Chameleon (Meta, 2024) instead maps everything to discrete tokens so you can analyze and generate images uniformly (interleaved text+image). The image tokenizer is a VQ-VAE: encode an image to a continuous vector, round to the nearest of ~8K codebook codes, decode to reconstruct (trained on reconstruction loss); a 512² image → 1024 tokens. Then training is just standard LM training — no adapter, no separate encoder.
~8K codes
like text → one LM
Calling image patches "tokens" doesn't hide that they behave differently from text: text is low-entropy (predictable next word), image tokens are high-entropy (which shade of blue?). Mixing them caused training instability (parameter norms blowing up), patched with QK-norm + z-loss. And discretization loses fine detail (bad for OCR), plus multimodal weighting is tricky. VQ-VAE generation faded once diffusion proved better.
Golden rules & takeaways
This rounds out the course: from tokenization and architecture through systems, scaling, data, alignment, reasoning — and now seeing.
References
Primary source is the lecture itself. Key works named:
- Radford et al. (2021) — CLIP · Dosovitskiy et al. (2020) — ViT
- Schuhmann et al. (2022) — LAION-5B / OpenCLIP
- Zhai et al. (2023) — SigLIP
- Liu et al. (2023) — LLaVA · Li et al. (2024) — LLaVA-OneVision
- Bai et al. (2023) — Qwen-VL · Wang et al. (2024) — Qwen2-VL
- Chameleon Team (2024) — Chameleon
- van den Oord et al. (2017) — VQ-VAE