BLIP-2
BLIP-2 bridges a frozen image encoder and a frozen language model with a lightweight Querying Transformer, making multimodal pretraining more modular and parameter-efficient.
Metadata
| Field | Value |
|---|---|
| Paper | BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models |
| Authors | Junnan Li, Dongxu Li, Silvio Savarese, Steven C. H. Hoi |
| Year | 2023 |
| Venue | ICML 2023 |
| arXiv | 2301.12597 |
| PMLR | v202/li23q |
| Implementation | salesforce/LAVIS |
| Status | seed note started |
One-Line Takeaway
BLIP-2 makes vision-language modeling modular: freeze a strong image encoder, freeze a strong LLM, and train a compact Q-Former bridge that extracts text-relevant visual tokens for representation learning and generation.
Question
End-to-end vision-language pretraining is expensive because it often updates large vision and language backbones together:
But strong unimodal models already exist:
BLIP-2 asks:
Can a small trainable bridge exploit frozen pretrained vision encoders and frozen LLMs without retraining the whole multimodal stack?
Architecture Contract
| Component | Trainable? | Input | Output | Role |
|---|---|---|---|---|
| image encoder | frozen | image | visual features | strong visual representation |
| Q-Former | trainable | learned queries, text, | query embeddings | extract language-relevant visual tokens |
| projection | trainable | LM-compatible embeddings | map bridge output into LLM space | |
| LLM | frozen | visual prefix plus text tokens | generated text | language generation and instruction behavior |
The core interface is:
Q-Former
The Querying Transformer contains learned query tokens:
The frozen image encoder returns visual features:
The Q-Former lets the learned queries attend to visual features:
A simplified cross-attention update is:
The bottleneck is intentional:
Instead of sending every image patch to the LLM, BLIP-2 asks a small set of query tokens to retrieve the visual information that language needs.
Two-Stage Pretraining
BLIP-2 trains the bridge in two stages.
| Stage | Frozen Modules | Trainable Module | Objective Role |
|---|---|---|---|
| vision-language representation learning | image encoder | Q-Former | align query output with text |
| vision-to-language generative learning | image encoder and LLM | Q-Former plus projection | make visual tokens interpretable by the LLM |
This separates two problems:
Stage 1: Representation Bridge
The first stage teaches query tokens to extract text-aligned visual evidence from a frozen image encoder.
A contrastive view is:
Then an image-to-text contrastive loss can be written as:
The paper also uses matching and language-modeling style objectives in the representation stage. The architecture point is that the Q-Former learns an image-text interface before it is attached to the LLM.
Stage 2: Generative Bridge
The second stage connects Q-Former outputs to a frozen LLM. Query embeddings are projected into the LLM input space:
The LLM then models text conditioned on this visual prefix:
Training minimizes:
The frozen LLM is not taught language from scratch. The bridge is taught to speak in a representation the LLM can use.
BLIP-2 vs Flamingo
Both models connect pretrained visual and language components, but the connector differs.
| Axis | Flamingo | BLIP-2 |
|---|---|---|
| Visual bridge | Perceiver resampler | Q-Former |
| LM access pattern | gated cross-attention inserted into LM layers | projected visual query tokens fed to frozen LLM |
| Main emphasis | interleaved few-shot multimodal prompting | modular compute-efficient VLP |
| Trainable path | multimodal connector and inserted attention | Q-Former and projection |
| Reusable lesson | condition an LM through visual cross-attention | learn a compact modality adapter |
The common pattern:
Why It Matters
BLIP-2 is architecture-relevant because it made the connector explicit. It is not just a new dataset recipe.
| Design Choice | Architectural Consequence |
|---|---|
| frozen image encoder | reuse strong visual features and reduce training cost |
| frozen LLM | preserve language generation and instruction ability |
| Q-Former bottleneck | control visual token budget and learn task-relevant extraction |
| two-stage bridge training | separate alignment from generation |
| modular adapters | allow different image encoders and LLMs to be swapped |
This pattern is central for later multimodal assistants: the expensive foundation models can remain mostly fixed while a relatively small bridge learns cross-modal grounding.
What To Watch
- Frozen components reduce trainable parameters but can limit domain adaptation.
- A small query bottleneck can discard details needed for dense visual reasoning.
- Text generation quality can hide visual grounding errors.
- Reported efficiency depends on which parameters are counted as trainable versus frozen.
- Image-text alignment and instruction-following generation are different claims and should be evaluated separately.