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

FieldValue
PaperBLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models
AuthorsJunnan Li, Dongxu Li, Silvio Savarese, Steven C. H. Hoi
Year2023
VenueICML 2023
arXiv2301.12597
PMLRv202/li23q
Implementationsalesforce/LAVIS
Statusseed 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

ComponentTrainable?InputOutputRole
image encoderfrozenimage visual features strong visual representation
Q-Formertrainablelearned queries, text, query embeddings extract language-relevant visual tokens
projectiontrainableLM-compatible embeddingsmap bridge output into LLM space
LLMfrozenvisual prefix plus text tokensgenerated textlanguage 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.

StageFrozen ModulesTrainable ModuleObjective Role
vision-language representation learningimage encoderQ-Formeralign query output with text
vision-to-language generative learningimage encoder and LLMQ-Former plus projectionmake 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.

AxisFlamingoBLIP-2
Visual bridgePerceiver resamplerQ-Former
LM access patterngated cross-attention inserted into LM layersprojected visual query tokens fed to frozen LLM
Main emphasisinterleaved few-shot multimodal promptingmodular compute-efficient VLP
Trainable pathmultimodal connector and inserted attentionQ-Former and projection
Reusable lessoncondition an LM through visual cross-attentionlearn 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 ChoiceArchitectural Consequence
frozen image encoderreuse strong visual features and reduce training cost
frozen LLMpreserve language generation and instruction ability
Q-Former bottleneckcontrol visual token budget and learn task-relevant extraction
two-stage bridge trainingseparate alignment from generation
modular adaptersallow 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.