BLIP-2

Li (Salesforce) 2023 · Paper

One-line summary — BLIP-2 bridges a frozen pre-trained image encoder and a frozen large language model with a lightweight Querying Transformer (Q-Former), achieving strong vision-language capabilities at a fraction of the training cost of end-to-end multimodal models.

Problem

The cost of vision-and-language pre-training had become prohibitive because it meant end-to-end training of large-scale models — every new VLM re-trained billions of visual and language parameters. Yet powerful ingredients already existed off the shelf: large pre-trained image encoders and LLMs, each excellent in its own modality. The open question was whether a small trainable module could bridge the modality gap — feeding visual information into an LLM that has never seen an image — without unfreezing either giant, and without the catastrophic forgetting that unfreezing causes.

Method & architecture

Q-Former. The only trainable module (188M parameters, initialized from BERT-base) sits between the frozen image encoder and the frozen LLM. It has two transformer submodules sharing the same self-attention layers: an image transformer whose input is a fixed set of 32 learnable query embeddings (dim 768) that cross-attend to the frozen image encoder’s output features (cross-attention inserted every other block), and a text transformer that acts as text encoder or decoder. Whatever the input resolution, the queries compress the image to 32 output vectors ZZ — an information bottleneck forced to extract the visual content most relevant to language.

Stage 1 — vision-language representation learning (frozen image encoder + Q-Former, on image-text pairs), jointly optimizing three objectives that differ only in their attention masks:

Stage 2 — generative learning from a frozen LLM. A single fully-connected layer projects ZZ to the LLM’s embedding dimension; the projected queries are prepended to the text as soft visual prompts. Decoder LLMs (OPT 2.7B/6.7B) are trained with a language-modeling loss; encoder-decoder LLMs (FlanT5-XL/XXL) with a prefix-LM loss. Because stage 1 already made ZZ language-informative, the LLM’s burden of learning alignment is small, mitigating catastrophic forgetting.

Training. Frozen encoders: CLIP ViT-L/14 or EVA-CLIP ViT-g/14 (second-to-last layer features). Data: 129M images (COCO, Visual Genome, CC3M, CC12M, SBU, 115M from LAION-400M) with CapFilt synthetic captions. 250k steps (stage 1) + 80k steps (stage 2); the largest model (ViT-g + FlanT5-XXL) pre-trains in under 6 + 3 days on a single 16×A100(40G) machine.

Results

Zero-shot overview (BLIP-2 has 188M trainable parameters):

ModelTrainableVQAv2 (test-dev)NoCaps CIDErFlickr TR@1 / IR@1
Flamingo10.2B56.3
BLIP583M113.296.7 / 86.7
BLIP-2188M65.0121.697.6 / 89.7

Why it matters for SLAM

BLIP-2’s frozen-encoder + lightweight-adapter + frozen-LLM pattern became the standard recipe for building vision-language systems cheaply (InstructBLIP, MiniGPT-4, many robotics VLMs), and it defines the practical path for adding language-based reasoning to spatial systems: rather than retraining a giant model, a small bridge can connect a SLAM system’s visual (or rendered-map) features to an off-the-shelf LLM. In the VLM-to-VLA lineage that runs through this level, BLIP-2 is the efficiency milestone between CLIP’s contrastive embeddings and LLaVA/OpenVLA’s instruction-following stacks.