TL;DR
InstructBLIP takes a pretrained BLIP-2 model, which pairs a frozen image encoder and a frozen language model through a small trainable bridge, and tunes only the bridge, using 13 of 26 public vision-language datasets rewritten as natural-language instructions. Its main change is that the bridge, the Q-Former, also reads the instruction, so the visual features it passes on depend on the task. Trained on 13 datasets, it reaches state-of-the-art zero-shot results on 13 held-out datasets, ahead of BLIP-2 and of the larger Flamingo models.
Builds on: BLIP-2: Bootstrapping Language-Image Pre-training, Instruction Tuning · Leads to: Vision-Language Model
Why it mattered
Instruction tuning had already made text-only language models follow new tasks described in plain words. Vision-language models were less flexible: most were built for one task family, and the instruction-tuning step had been studied little for images. The paper states this gap directly: vision-language instruction tuning "remains under-explored."
The work gave the field a concrete, open recipe. The authors released a family of InstructBLIP models through the LAVIS library, with two language-model backbones (FlanT5 and Vicuna), so other groups could run, test and extend the same method. Its evaluation style, which holds some datasets out of training and scores zero-shot, is a direct way to ask whether a vision-language model generalises.
The problem
Two problems came up before this paper.
The first is that putting many vision-language tasks into one training mix does not by itself give a general model. The paper's own experiment shows that multitask training without instructions does not generalise well to unseen datasets and tasks. The model learns the training formats, not the idea of following a request.
The second is that a visual encoder that ignores the request produces the same picture features for every question. BLIP-2 feeds the language model a fixed set of visual vectors, whatever the instruction asks. If the question is "what colour is the bag?" and the next one is "what does the sign say?", the model gets the same summary of the image both times. The paper calls this an instruction-agnostic approach and proposes to change it.
How it works
A trained InstructBLIP model answers a question about an image in the following steps. The training run uses the same pieces, plus a loss on the answer.
- Start from a BLIP-2 checkpoint. It has three parts: a frozen image encoder (the paper uses a ViT-g/14 model), a Q-Former that is a small Transformer with learnable query vectors, and a frozen language model. The paper uses four variants: FlanT5-XL (3B), FlanT5-XXL (11B), Vicuna-7B and Vicuna-13B.
- Turn each dataset into instructions. Every task gets 10 to 15 hand-written instruction templates. A caption dataset gets templates such as "Briefly describe the content of the image." A question-answering dataset gets templates that wrap the question. One example is then one image, one instruction and one target answer.
- Trace one example. Take a photo of a brown dog on a beach, the instruction "Briefly describe the content of the image.", and the target "A brown dog on a beach." The image goes through the frozen image encoder and produces a list of patch features.
- Let the Q-Former read the instruction. The Q-Former has learnable query vectors. The instruction tokens are fed into its self-attention layers together with the queries, so the queries can take on the task. The queries then cross-attend to the image features. The output is vectors that carry the image content the instruction asks about.
- Project into the language model. A linear layer maps the output vectors into the language model's embedding space. The language model reads them as a sequence of soft visual tokens, placed before the instruction text.
- Generate and score the answer. The language model is trained to produce the target tokens. The loss is the usual language-modelling loss on those tokens, so the model learns to predict "A brown dog on a beach."
- Balance the datasets. Training samples come from the 13 held-in datasets with probabilities that grow with the square root of dataset size, so small datasets are not drowned out by large ones.
- Update only the Q-Former. The image encoder and the language model are frozen throughout. Only the Q-Former is finetuned during instruction tuning.
flowchart LR I["Image"] --> E["Frozen image encoder"] T["Instruction text"] --> Q["Q-Former (trainable), queries + instruction"] E --> Q Q --> P["Linear projection"] P --> L["Frozen language model"] T --> L L --> A["Answer tokens"]
The math
Step 4 in symbols: instruction-aware queries
Let be the learnable query embeddings, let be the frozen image-encoder features, and let be the instruction tokens. The Q-Former returns
The index denotes the Q-Former's trainable weights. The word "instruction-aware" means the input is part of the function, not only the image. The paper's own comparison, in the ablation below, shows that removing this input lowers scores on every dataset in the ablation table.
Step 5 in symbols: projection to the language model
A linear map sends each output vector to the language model's embedding size:
The rows of act as soft tokens prepended to the instruction. The language model is frozen, and the paper finetunes only the Q-Former, so only the weights receive gradients.
Step 6 in symbols: the training loss
Let be the target answer tokens. The standard language-modelling loss is the negative log-likelihood of the answer, given the visual tokens and the instruction:
Here is the frozen language model's next-token distribution, and is the answer prefix before token .
Step 7 in symbols: balanced sampling
For datasets with sizes , the probability of drawing a sample from dataset is
Taking the square root flattens the difference between large and small datasets. The paper then adjusts a few weights by hand, lowering the weight of the multiple-choice A-OKVQA and raising that of open-ended OKVQA.
Suppose one dataset has samples and another has (illustrative sizes, not from the paper).
- Square roots: and .
- Sum: .
- Probabilities: and .
- Compare with uniform mixing over all samples, which would give and .
Interpretation: the small dataset gets about of the draws instead of , and the large dataset gets instead of . The gap between them shrinks, which is the point of the scheme.
Inference by ranking candidates (paper section 2.5)
For tasks with a fixed set of answers, such as classification or multiple choice, the model does not generate freely. For each candidate answer in a candidate set , the model computes its log-likelihood, and the prediction is the candidate with the highest value:
The paper uses this ranking for datasets including ScienceQA, IconQA, HatefulMemes and the multiple-choice part of A-OKVQA. It also widens the positive and negative labels for binary tasks into several verbalisers, such as "yes" and "true", to match how words occur in text.
Results
The main zero-shot comparison is on held-out datasets the model never trained on. The table gives the paper's reported numbers for four held-out datasets. A "-" marks a dataset where Flamingo-80B has no score in the paper.
| Model | TextVQA | VizWiz | iVQA | ScienceQA (image context) |
|---|---|---|---|---|
| Flamingo-80B | 35.0 | 31.6 | 40.7 | - |
| BLIP-2 (FlanT5-XL) | 43.1 | 29.8 | 40.4 | 54.9 |
| InstructBLIP (FlanT5-XL) | 46.6 | 32.7 | 53.1 | 70.4 |
The paper reports that the FlanT5-XL InstructBLIP model, which has about 4B parameters, beats the 80B Flamingo on all six datasets they share, with an average relative gain of 24.8%. Against its own backbone, BLIP-2 FlanT5-XL, it reports an average relative gain of 15.0% over the held-out set. On MSRVTT-QA, the largest of its video gains, the paper reports up to 47.1% relative improvement over the previous best. In Table 1 that is 25.6 for the FlanT5-XXL variant against 17.4 for Flamingo-80B.
Ablations. Table 2 of the paper removes one component at a time and reports scores on the held-in and held-out sets.
| Variant | Held-in average | ScienceQA (image context) | iVQA |
|---|---|---|---|
| FlanT5-XL, full | 94.1 | 70.4 | 53.1 |
| FlanT5-XL, no instruction-aware features | 89.8 | 63.4 | 47.5 |
| FlanT5-XL, no data balancing | 92.6 | 66.0 | 51.1 |
| Vicuna-7B, full | 100.8 | 60.5 | 52.2 |
| Vicuna-7B, no instruction-aware features | 98.9 | 55.2 | 36.8 |
| Vicuna-7B, no data balancing | 98.8 | 59.4 | 50.3 |
Removing instruction-aware features costs the most, and the paper says the drop is largest on tasks needing spatial reasoning (ScienceQA) and temporal reasoning (iVQA). Removing data balancing causes uneven training, with different datasets peaking at very different steps.
Instruction tuning versus multitask training. With the same FlanT5-XL backbone and the same settings, the paper compares instruction tuning with plain multitask training. The two perform similarly on held-in datasets. On unseen held-out datasets, multitask training stays about where BLIP-2 was, while instruction tuning improves. The paper concludes that the instruction format, not the mere mixing of tasks, drives the gain in zero-shot generalisation.
Limits the paper states or shows. The image resolution stays at 224 by 224 during instruction tuning and the image encoder stays frozen, which keeps training cheap but limits fine detail. The authors say the model inherits hallucination and bias from its frozen language model, and they do not recommend deployment without a safety and fairness check for the specific use. Several held-out sets come from datasets close to held-in tasks, so the zero-shot gains are strongest on tasks the model has seen in some form. The balancing weights are partly set by hand.
Reading guide
The paper is short, and its sections map onto the lessons a reader needs.
- Section 1 (Introduction). Needs Instruction Tuning and the idea of a Vision-Language Model. The argument is that multitask training is not enough.
- Section 2.1 and 2.2 (datasets and protocols). Needs Zero-Shot Learning to follow the held-in and held-out split, and visual question answering and Image Captioning for the task families.
- Section 2.3 (instruction-aware features). Needs BLIP-2: Bootstrapping Language-Image Pre-training and Q-Former, plus Attention Mechanism for the self- and cross-attention in the Q-Former.
- Section 2.4 (balancing). Needs only the square-root formula above and a sense of why mixing unequal datasets is hard.
- Section 2.5 (inference). Needs Language Model and log-likelihood. Ranking candidates by log-likelihood is the same idea as Perplexity for text.
- Section 2.6 (implementation). Needs AdamW Optimizer and the notion of Fine-Tuning a frozen model.
- Section 3 (results). Needs the metrics it reports: CIDEr for captions (the older BLEU Score family is a different n-gram measure), accuracy and AUC for classification, and mean reciprocal rank for dialogue.
Check yourself
QuestionWhich two components of BLIP-2 are frozen during InstructBLIP instruction tuning, and which part is trained?Show answer
The image encoder and the language model are frozen. The Q-Former is the part that is finetuned.
QuestionIn the balanced sampling scheme, a dataset of 900 samples and one of 100 samples are mixed. What is the sampling probability of the 900-sample dataset?Show answer
The square roots are and , which sum to . The probability for the large dataset is . Uniform mixing would give , so the square-root rule lowers its share.
QuestionWhy does the paper make the Q-Former read the instruction, and what does the ablation show?Show answer
BLIP-2 gives the language model the same visual features whatever the task. Letting the Q-Former read the instruction lets it extract the image content the task needs. The ablation shows that removing this lowers the held-in average from to for FlanT5-XL, and lowers iVQA from to for Vicuna-7B.
QuestionA model is evaluated on datasets it trained on and on datasets it never saw. Why does the paper hold out datasets, and what is the risk of reading the held-in score as a measure of generalisation?Show answer
Held-out datasets test zero-shot generalisation, which is the claim of the paper. Held-in scores measure fit to the training mix, which can be high even when the model has only memorised the formats of those datasets. The risk is reading held-in results as generalisation; the held-out results are the evidence for that claim, and even they are strongest on tasks close to ones seen in training.