Fusion and Vision-Language Models
A contrastive model compares modalities but never lets one read another. This second part builds the fusion route: early, late, and cross-attention fusion, then the three designs that connect a frozen vision encoder to a frozen language model — Flamingo's zero-initialized gated cross-attention, BLIP-2's Q-Former, and LLaVA's linear projector.
╌╌╌╌
This builds on Multimodal Contrastive Learning, which put images and text in one space with a dual encoder and a symmetric contrastive loss, giving a picture and its caption a high dot product. A contrastive model can compare modalities but cannot let one read another: nothing in CLIP lets a text token pull information from a specific image region. For captioning and visual question answering the modalities have to fuse inside the network. This lesson builds that fusion, then uses it to connect a frozen language model to vision.
Fusion strategies
Contrastive models compare modalities; they do not let one modality read another. For tasks that need interaction, captioning, visual question answering, the modalities must fuse inside the network. Where the fusion happens defines the strategy.
The middle ground, and the one that powers modern vision-language models, is cross-attention: keep separate encoders but let one modality's queries attend to the other modality's keys and values.
| Strategy | Where modalities meet | Cross-modal interaction | Cost |
|---|---|---|---|
| Late (CLIP) | only at the final similarity | none inside the net | cheap, modular |
| Early | concatenate at the input | full, from layer | expensive |
| Cross-attention | dedicated attention layers | rich, controllable | moderate |
Vision-language models: feeding images into an LLM
The dominant design does not train a multimodal model from scratch; it connects a strong frozen vision encoder to a strong frozen LLM with a small trainable bridge, so the language model gains visual input without losing its language ability. Three designs span the space.
Flamingo: perceiver resampler and gated cross-attention
Flamingo keeps a frozen vision encoder and a frozen LLM and inserts two trained pieces.2 A perceiver resampler maps a variable number of image features to a fixed small set of latent tokens, and gated cross-attention layers interleaved into the frozen LLM let text tokens attend to those visual latents.
The cross-attention is gated with a gate initialized at zero, so at the start of training the visual stream contributes nothing and the model is exactly the original LLM; the gate opens as training proceeds. This is what lets a frozen language model absorb a new modality without destabilizing.
BLIP-2: the Q-Former
BLIP-2 bridges a frozen image encoder and a frozen LLM with a lightweight
querying Transformer (Q-Former).3 A small set of learned query
tokens extracts a fixed number of visual features through cross-attention, and a
linear layer projects them into the LLM's input space as soft visual tokens
.
The Q-Former is the only trained module, and it is trained in two stages,
inheriting the vision-language objectives of the earlier BLIP.4
LLaVA: a linear projector
LLaVA is the minimal design.5 A frozen ViT (from CLIP) produces patch features; a single trainable linear (or two-layer MLP) projector maps each patch feature into the frozen LLM's token-embedding space; the projected patches are prepended to the text and the LLM does the rest. There is no resampler and no Q-Former: the projector is the entire bridge, and it makes visual instruction tuning cheap enough to run on modest hardware.
The three differ mainly in the bridge between vision and language, and in how many visual tokens reach the LLM.
| Model | How vision meets language | Bridge module | What is trained | Frozen |
|---|---|---|---|---|
| CLIP | shared space, no fusion | none (dual encoder) | both encoders | nothing |
| Flamingo | gated cross-attention in the LLM | perceiver resampler gates | resampler, gates | vision, LLM |
| BLIP-2 | soft tokens from a Q-Former | Q-Former linear | Q-Former, projection | vision, LLM |
| LLaVA | soft tokens from a projector | linear / MLP projector | projector (then LLM) | vision (LLM partly) |
The token budget is the practical difference. LLaVA's projector emits one soft token per patch, so a image at patch gives visual tokens prepended to the prompt; the LLM pays attention for a text length . Flamingo's resampler and BLIP-2's Q-Former instead fix the count at - latents regardless of resolution, trading some spatial detail for a constant, small prefix. That is the reason to prefer a resampler at high resolution or over video: it caps the sequence the LLM must read.
Two failure modes recur across these designs, and both trace back to the bridge. Object hallucination, the model confidently naming things not in the image, worsens when too few visual tokens or a weak projector let the language prior override the visual evidence; the LLM falls back on what captions usually say. And fine-detail blindness, missing small text or counts, follows directly from patch size and token budget: a resampler that compresses patches to latents discards exactly the high-frequency detail an OCR or counting question needs. Raising input resolution or the visual-token count mitigates both, at quadratic attention cost.
Training recipe and evaluation
The modern pipeline has two phases, and they map onto the two halves of this lesson: align the spaces, then teach the model to follow instructions.
LLaVA's stage 2 is visual instruction tuning: it bootstraps the triples by prompting a text-only LLM to generate questions and answers about images from their captions and bounding boxes, then trains on the synthetic conversations. This is instruction tuning lifted from language alignment into the visual setting.
Three benchmark families score the result, and each isolates a different ability.
| Task | Input | Output | Metric | Tests |
|---|---|---|---|---|
| Image-text retrieval | image or caption | ranked list | Recall@ | shared-space alignment |
| Captioning | image | sentence | CIDEr, BLEU | grounded generation |
| VQA | image question | answer | accuracy | cross-modal reasoning |
Retrieval rewards the contrastive models (CLIP, ALIGN) because their whole training objective is retrieval; captioning and VQA reward the fusion models (Flamingo, BLIP-2, LLaVA) because answering requires the language model to read the image, not merely score it.
Natively multimodal models
Flamingo, BLIP-2, and LLaVA all bolt vision onto a language model trained on text: a frozen LLM gains sight through a trained bridge. The frontier since has moved toward models that are multimodal from the start, and two ideas reframe the bridge designs above.
Any-to-any token models. If every modality can be turned into discrete tokens — text by a tokenizer, images by a vision quantizer, audio by a codec — then a single decoder-only Transformer can read and write all of them in one sequence, with no separate encoders or projectors.6 The bridge disappears because there is nothing to bridge: an image is just more tokens in the same stream. This is the multimodal endpoint of the same turn it into tokens
move that recurred in the speech and language lessons, and it lets one model both answer questions about an image and generate one, in a single autoregressive pass.
Native mixed-modal pretraining. Rather than freeze a text LLM and attach vision, a natively multimodal model interleaves image and text data throughout pretraining, so the two modalities are represented jointly from the first step and the modality gap
of part one never opens as widely. The token-budget arithmetic of this lesson still governs the cost — images are expensive because they are many tokens, and high resolution or video multiplies the count — so the resampler-versus-projector trade (a small fixed prefix versus one token per patch) survives even when there is no frozen LLM to protect.
In short, the bridge modules — resampler, Q-Former, projector — were a transitional design for the era when a strong LLM existed and a strong vision encoder existed and the cheapest move was to connect them. As multimodal pretraining matures, the trend is to dissolve the bridge into a single token stream, but the constraints this lesson isolated (how many visual tokens the model must read, and whether the language prior overrides weak visual evidence) are properties of the token budget, not of any particular bridge, so they persist.
Takeaways
- Fusion ranges from late (CLIP, similarity only) through early (concatenate at the input) to cross-attention, where one modality's queries read another's keys and values at every layer — the middle ground that powers modern vision-language models.
- Vision-language models connect a frozen vision encoder to a frozen LLM with a small trained bridge: Flamingo (perceiver resampler zero-initialized gated cross-attention that starts as the identity), BLIP-2 (Q-Former soft tokens), LLaVA (a linear projector, the minimal design).
- The token budget is the practical difference: LLaVA emits one soft token per patch ( for a image), so attention costs , while a resampler or Q-Former fixes the count at – latents, trading spatial detail for a small constant prefix — the reason to prefer a resampler at high resolution or over video.
- Two failure modes trace to the bridge: object hallucination (too few visual tokens let the language prior override the image) and fine-detail blindness (compression discards the high-frequency detail OCR and counting need); both ease with more resolution or tokens, at quadratic attention cost.
- The recipe is contrastive or feature-alignment pretraining, then instruction tuning on (image, instruction, response) triples; LLaVA bootstraps those triples from a text-only LLM. Evaluation splits by ability: retrieval (Recall@) scores alignment, captioning (CIDEr) scores grounded generation, VQA (accuracy) scores cross-modal reasoning.
- Frontier direction: natively multimodal models turn every modality into tokens and dissolve the bridge into one decoder stream (any-to-any), but the token-budget constraints this lesson isolated persist regardless of bridge.
Footnotes
- Chollet, Deep Learning with Python, Ch. 11 — combining modalities and multimodal architectures: how text and image branches are encoded and fused for joint tasks. ↩
- Alayrac et al., Flamingo: a Visual Language Model for Few-Shot Learning, NeurIPS 2022 — a frozen vision encoder and LLM bridged by a perceiver resampler and zero-initialized gated cross-attention layers. ↩
- Li et al., BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models, ICML 2023 — the Q-Former: learned query tokens that extract a fixed set of visual features for a frozen LLM. ↩
- Li et al., BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation, ICML 2022 — the captioning/filtering bootstrap and the image-text contrastive, matching, and generation objectives BLIP-2 builds on. ↩
- Liu et al., Visual Instruction Tuning (LLaVA), NeurIPS 2023 — a single linear/MLP projector from a frozen CLIP vision encoder into a frozen LLM, trained on instruction triples bootstrapped from a text-only model. ↩
- Chameleon Team (Meta), Chameleon: Mixed-Modal Early-Fusion Foundation Models, 2024 — a single decoder-only Transformer over interleaved image and text tokens, reading and generating both modalities without separate encoders or projectors. ↩
╌╌ END ╌╌