The Bootstrap Problem
Training large vision-language models end-to-end requires massive compute - updating both a vision encoder and an LLM simultaneously. BLIP-2 from Salesforce avoids this by keeping both components frozen and training only a small bridge module: the Q-Former.
The Q-Former (Querying Transformer) contains 32 learned query tokens that attend to frozen image features from CLIP and produce a fixed-size representation passed to the frozen LLM. Only the Q-Former (~188M parameters) is trained during both pre-training stages.
Two-Stage Training
Stage 1 (vision-language alignment): Q-Former learns to extract relevant visual information through three objectives:
- Image-text contrastive learning
- Image-grounded text generation
- Image-text matching
Stage 2 (generative learning): Q-Former output is projected into the LLM's embedding space, and the model learns to generate text conditioned on visual features.
This separation means you can swap LLM backends without retraining the vision alignment.