Image Understanding › Visual Question Answering
Language AI HandbookAll chapters Image Understanding › Visual Question AnsweringOne section · Sections in this chapter2 / 9 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Visual question answering, commonly called VQA, is perhaps the most direct test of image understanding. Given an image and a natural language question about it, a model must produce a correct answer. The question might ask about color ("What color is the umbrella?"), count ("How many dogs are in the photo?"), spatial relationship ("Is the cup to the left or right of the plate?"), activity ("What sport is the person playing?"), or abstract reasoning ("Would it be safe to walk barefoot here?").
VQA requires integrating two fundamentally different information streams. The visual stream provides pixel-level detail about shapes and textures alongside positions and appearances. The textual stream provides the question: which aspect of the image matters, what concept to look for, what relationship to evaluate. Getting the answer right requires the model to identify the visually relevant region, apply the conceptual query from the text, and produce an output in the appropriate format.
What makes VQA especially demanding is that the question determines which parts of the image matter. "What is the person wearing?" requires focusing on the person's clothing. "How many windows are visible?" requires a systematic scan of the whole scene. "Is the light on or off?" requires locating a specific small object and reading its state. The model cannot know in advance what kind of attention the scene requires because that depends entirely on the question, which arrives alongside the image.
Early VQA Approaches
The original VQA dataset, introduced by Antol et al. in 2015, established the benchmark format that the field still uses today. Early models used CNN-extracted visual features combined with RNN-encoded question features, merged through element-wise multiplication or concatenation, and classified into one of the top-K answer classes. This framing treated VQA as a classification task: given a fixed vocabulary of answers, predict which one is correct.
The classification approach was natural for the era. CNNs trained on ImageNet had proven highly effective at encoding image content into fixed-size vectors. RNNs, particularly LSTMs, had become the standard tool for encoding variable-length question sequences into fixed-size context vectors. Combining these two vectors through a learned fusion function and predicting a class label was an elegant and direct application of existing technology to a new task.
The classification approach has a basic limitation, however: it cannot produce answers outside the vocabulary. Free-form VQA requires generative models. But classification VQA remains useful for benchmarking because it produces clean accuracy numbers, and the top-K answer vocabulary (typically around 3000 answers) covers the large majority of question types in standard datasets.
Closed-vocabulary VQA treats answering as multi-class classification, selecting from a fixed set of answers. Open-ended VQA treats it as a text generation problem, creating arbitrary natural language. Modern vision-language models typically use the generative formulation, which is more flexible but harder to evaluate automatically.
The Multimodal Fusion Challenge
The core challenge in VQA is not extracting good visual features or good text features in isolation. Both of those problems are largely solved by the time you reach a VQA system. The challenge is fusing them correctly so that the answer reflects both the image content and the question semantics jointly.
Consider the question "What is the person wearing?" asked over an image showing a woman in a red dress with a blue hat. To answer correctly, the model must:
- Locate the person in the image (visual localization)
- Identify the person's clothing (visual recognition of a category)
- Understand that "wearing" refers to clothing on the body (semantic disambiguation)
- Produce "a red dress and a blue hat" (multi-attribute generation)
Each step depends on the previous, and each step requires both modalities. A purely visual model cannot know which person to focus on if multiple people are present. A purely textual model knows nothing about what the woman is wearing. The fusion must happen in a way that is sensitive to the interaction between them.
Early fusion approaches were relatively shallow. Element-wise multiplication of a visual feature vector and a question feature vector creates a combined representation where each dimension of the output reflects both visual and linguistic information. But this global fusion is blind to spatial structure: the entire image is collapsed into a single vector before any question-specific reasoning happens. The question "Is the red ball to the left or right of the blue ball?" requires comparing two object locations, but a global fusion vector represents the whole image rather than individual objects or their spatial relationships.
Attention as the Fusion Mechanism
The breakthrough that dramatically improved VQA accuracy was applying cross-modal attention. Rather than fusing global image and text features once, attention allows the model to dynamically focus on the image regions most relevant to the question.
In the bottom-up and top-down attention model (Anderson et al., 2018), a bottom-up pathway uses an object detector (Faster R-CNN) to extract features for salient image regions: bounding boxes around objects and people as well as other visual entities. A top-down pathway processes the question and produces an attention query that selects which regions to attend to when creating the answer. This approach lets "What color is the apple?" focus attention on apple regions while "How many people are standing?" distributes attention across all person regions.
The attention query from the question changes what the visual representation emphasizes. For a question about a specific object, attention concentrates on that object. For a question about a scene-level property, attention distributes more broadly. This dynamic allocation of visual attention, guided by language, is exactly the kind of cross-modal reasoning VQA requires.
The mathematical structure mirrors the attention mechanism from transformers. Given region features and question encoding , attention weights are:
where:
- : the attention weight for region , showing how much this region contributes to the answer
- : a compatibility function between region feature and question encoding , often implemented as a dot product or a small neural network
- The softmax normalization ensures all weights are positive and sum to one across all regions
The attended visual context is the weighted sum , a soft aggregation of all region features weighted by their relevance to the question. This attended vector, combined with the question encoding , forms the joint representation used to predict the answer. The model learns what kind of attention to pay to each type of question entirely through gradient descent on the VQA training objective.
Bilinear Fusion and Higher-Order Interactions
Simple element-wise multiplication captures first-order interactions between visual and language features, but many visual questions require higher-order reasoning. "Is the person wearing the same color as the car?" requires comparing the person's clothing color to the car's color, an operation that cannot be reduced to a single attended region.
Bilinear fusion methods like MCB (Multimodal Compact Bilinear pooling) and MLB (Multi-modal Low-rank Bilinear) compute richer interactions between visual and question vectors by approximating the full outer product of the two feature vectors. The full outer product of a visual vector and a question vector has elements, which is far too large to be practical. Compact bilinear methods project both vectors into a shared high-dimensional space using random features, then compute element-wise products in that space. This approximates the full bilinear interaction at a fraction of the computational cost.
These richer fusion methods consistently outperformed simple concatenation or element-wise multiplication on VQA benchmarks, confirming that the nature of the multimodal interaction matters, not just which features are combined.
Language Priors and Dataset Bias
An important discovery in VQA research was that models could achieve surprisingly high accuracy by exploiting statistical regularities in the dataset, without reasoning about images at all. Questions starting with "Do you see a..." are answered "yes" much more often than "no" in the VQA v1 dataset. Questions about color are answered "white" more often than any other color. Counting questions rarely have answers above 5. A model that learned these priors could score reasonably well without looking at a single pixel.
This led to the creation of VQA v2 (Goyal et al., 2017), which pairs each question with two complementary images where the same question has different correct answers. "Is there a dog on the couch?" is paired with an image where there is a dog on the couch and an image where there is not. This pairing forces the model to distinguish between image contents rather than exploiting question-level statistics.
Even with balanced datasets, the language bias problem persists in subtler forms. The VQA-CP (changing priors) benchmark reorganizes VQA v2 so that the most common answer for each question type changes between training and test splits. A model that learned to answer color questions with "white" during training will fail on VQA-CP test questions where the correct color answers are primarily other colors. Many models that achieve strong performance on VQA v2 drop by 20-30 percentage points on VQA-CP, revealing how much of their "performance" depended on language priors rather than image reasoning.
Modern VQA with Vision-Language Models
Current state-of-the-art VQA systems are not specialized VQA architectures at all. They are large vision-language models, such as BLIP-2, LLaVA, or GPT-4V, that handle VQA as one of many tasks through instruction following. The model sees the image and the question as a combined input and generates the answer autoregressively.
This shift from classification to generation changes the training paradigm fundamentally. Instead of fine-tuning a VQA classification head, modern models are either pretrained on VQA-style data among many other tasks, or prompted at inference time with instructions like "Look at this image and answer the following question: {question}."
The advantage is generalization: a model trained this way can answer questions whose answers lie outside any predefined vocabulary, handle follow-up questions in a conversation, explain its reasoning, and express uncertainty. A VQA model based on a language model can also use the world knowledge encoded in its language pretraining to answer questions that require reasoning beyond the image itself. "What country was this flag designed in?" requires recognizing the flag visually and then retrieving the associated country from language model knowledge.
The disadvantage is evaluation complexity: comparing generated text to ground truth answers requires more sophisticated metrics than simple accuracy. "Two" and "2" should both be correct answers for a counting question. String matching fails on these cases; modern evaluation often uses language model judges to determine semantic equivalence.
VQA Evaluation
Standard VQA datasets use a specific accuracy metric that accounts for human disagreement. Each question has 10 human-provided answers. The model's answer receives a score:
This formula gives full credit if at least 3 of 10 annotators agree with the model, partial credit for 1-2 agreements, and zero credit for an answer nobody gave. This handles questions where multiple answers are valid: "What sport is this?" might receive "tennis" from 7 annotators and "playing tennis" from 3, both of which should be considered correct. The minimum-with-3 normalization means the score caps at 1 even if all 10 annotators agree, since the point is sufficiency rather than popularity.
This graded scoring matters practically. A model that always answers "cat" to any question would score 0 on questions where no annotator said "cat" but might score on questions where one annotator happened to say "cat." Average VQA accuracy on the validation set reflects the weighted sum of these per-question scores across the entire dataset.