Stacked Attention Networks for Image Question Answering

Zichao Yang, Xiaodong He, Jianfeng Gao, Li Deng, Alex Smola

TL;DR

Stacked Attention Networks (SANs) introduce a multi-layer attention mechanism for Visual Question Answering (VQA) that mimics multi-step human reasoning. By progressively querying image regions using refined question-context vectors, SANs filter out background noise and pinpoint fine-grained visual clues layer-by-layer. This architecture significantly outperformed previous global-feature approaches across four major VQA benchmarks.

What Problem Does This Paper Address?

Visual Question Answering (VQA) requires a system to answer natural language questions about an image. Early approaches typically extracted a single global feature vector from the entire image using a Convolutional Neural Network (CNN) and combined it with a question vector encoded by a Long Short-Term Memory (LSTM) network.

However, many questions depend on fine-grained details or complex spatial relationships (e.g., "What is sitting in the basket on a bicycle?"). Global features introduce significant background noise from irrelevant regions and fail to capture localized relationships. The authors address this gap by introducing a mechanism for multi-step reasoning, allowing the model to locate relevant image regions progressively and filter out irrelevant visual information.

Methods

The SAN architecture consists of three main components:

  1. Image Model: Unlike standard approaches that use the final fully connected layer of a CNN, SAN extracts features from the last pooling layer of a VGGNet. This preserves spatial information, mapping a $448 \times 448$ image into a $512 \times 14 \times 14$ feature map (196 distinct regions).
  2. Question Model: The authors explore two architectures to encode the question into a semantic vector: an LSTM-based model and a CNN-based model utilizing unigram, bigram, and trigram filters with max-pooling over time.
  3. Stacked Attention Network: This is the core novelty. In the first layer, the question vector acts as a query to compute an attention distribution over the image regions. A weighted sum of these regions is combined with the original question vector to form a refined query vector. In the subsequent layer, this refined query vector queries the image regions again. This multi-layer stacking allows the model to progressively narrow its focus.
Overall SAN Architecture and Attention Visualization

Datasets

The model was evaluated on four distinct benchmarks:

  • DAQUAR-ALL: Indoor scenes with questions categorized into Object, Color, and Number.
  • DAQUAR-REDUCED: A smaller subset of DAQUAR constrained to 37 object categories and 25 test images.
  • COCO-QA: Automatically generated questions (Object, Number, Color, Location) based on MS-COCO image captions.
  • VQA: A large human-annotated dataset based on MS-COCO, featuring 10 open-ended human answers per question.

Key Insights and Ideas

  • Multi-step Reasoning via Residual Queries: Instead of replacing the query at each step, SAN adds the retrieved visual features back to the previous query vector ($u^k = \tilde{v}_k^I + u^{k-1}$). This residual connection ensures the model retains the original question context while incorporating new visual insights.
  • Progressive Sharpening: Visualizations reveal that the first attention layer acts as a broad filter, identifying all concepts mentioned in the question (e.g., finding a person or a bicycle). The second layer acts as a fine-grained locator, pinpointing the exact region needed for the answer (e.g., focusing specifically on the object inside the bicycle basket).
  • Two Layers are the Sweet Spot: The authors found that performance improves significantly from one to two attention layers, but adding a third layer yields no further performance gains.

Key Results

The two-layer SAN achieved state-of-the-art results across all datasets, with the LSTM and CNN question encoders performing comparably:

  • DAQUAR-ALL: Achieved 29.3% accuracy, outperforming the previous best baseline (IMG-CNN at 23.4%) by 5.9% absolute.
  • COCO-QA: Reached 61.6% accuracy, a 6.6% absolute improvement over previous state-of-the-art models.
  • VQA: On the official test-standard server, SAN achieved 58.9% overall accuracy, significantly outperforming the standard LSTM Q+I baseline (54.1%). The largest gains were found in the "Other" question category (e.g., "what color", "where"), which requires complex visual localization.

Limitations and Future Work

Through a random error analysis of 100 mistaken cases from the COCO-QA dataset, the authors categorized SAN's failures into four buckets:

  • Predictive Errors (42%): The model successfully focused on the correct image region but still predicted the wrong answer label.
  • Attention Errors (22%): The attention mechanism failed, focusing on the wrong region entirely.
  • Ambiguity (31%): The model's prediction was visually reasonable (e.g., predicting "vase" instead of the ground-truth "pot"), highlighting the inherent ambiguity in open-ended VQA evaluation metrics.
  • Label Noise (5%): The dataset ground-truth labels themselves were incorrect.

The high percentage of predictive errors (42%) suggests that while the attention mechanism successfully localizes relevant regions, future work is needed to improve the final answer-generation and multi-modal fusion modules.

Summary updated

Abstract

This paper presents stacked attention networks (SANs) that learn to answer natural language questions from images. SANs use semantic representation of a question as query to search for the regions in an image that are related to the answer. We argue that image question answering (QA) often requires multiple steps of reasoning. Thus, we develop a multiple-layer SAN in which we query an image multiple times to infer the answer progressively. Experiments conducted on four image QA data sets demonstrate that the proposed SANs significantly outperform previous state-of-the-art approaches. The visualization of the attention layers illustrates the progress that the SAN locates the relevant visual clues that lead to the answer of the question layer-by-layer.
BibTeX
@inproceedings{yang2016stacked,
  author = {Zichao Yang and Xiaodong He and Jianfeng Gao and Li Deng and Alex Smola},
  title = {{Stacked Attention Networks for Image Question Answering}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2016},
  url = {https://openreview.net/forum?id=HkbRFT-_-H},
}
Figure