On the Efficacy of Co-Attention Transformer Layers in Visual Question Answering

Ankur Sikarwar, Gabriel KreimanarXiv 2022

Abstract

This paper investigates the internal mechanisms of multi-modal transformers in Visual Question Answering (VQA), specifically focusing on how co-attention layers facilitate the grounding of language in visual data. Through a series of diagnostic experiments on the ViLBERT architecture, we find that while co-attention is vital for performance, the model's visual attention is primarily driven by specific keywords (nouns) rather than complex grammatical structures. Furthermore, we demonstrate that the number of object proposals acts as a significant bottleneck for attention quality, and that higher VQA accuracy correlates with more human-like attention patterns.

Introduction

Visual Question Answering (VQA) represents a cornerstone challenge in AI, requiring the simultaneous understanding of visual scenes and natural language queries. While transformer-based models like ViLBERT have achieved state-of-the-art results, their internal decision-making processes remain largely opaque. This study seeks to demystify the "black box" of co-attention—the mechanism where linguistic features modulate visual processing. We address three primary questions: Do these models look where humans look? Does the linguistic structure of the question dictate visual attention? And does the initial object detection phase limit the model's reasoning capabilities?

Methodology

The researchers focused on ViLBERT, a dual-stream transformer model. The core of the investigation lies in the co-attention layers, where the visual and language streams interact.

Overview of the cross-modal interaction pipeline and attention map generation.

To probe these interactions, the following experimental setups were utilized:

  • Attention Mapping: Visual attention scores were extracted from co-attention layers and compared against human attention maps from the VQA-HAT dataset using rank-correlation ($\rho$).
  • Structural and Linguistic Perturbation: Questions were modified by shuffling word order or removing specific Parts of Speech (POS) tags (e.g., nouns, verbs) to determine which linguistic elements guide the model's "eyes."
  • Proposal Scaling: The number of region proposals from the Faster R-CNN backbone was varied (36, 72, and 108) to evaluate if the object detection stage constrains the transformer's visual field.

Key Results and Analysis

Keywords vs. Semantics

A striking finding of the study is that shuffling question word order (e.g., "What color is the floor?" to "Is color floor what the?") had a negligible impact on visual attention maps, despite causing a significant drop in final answer accuracy (from 76.6% to 60.2%). This suggests a functional decoupling: the model uses specific keywords (primarily nouns) to determine where to look, but requires the full grammatical structure to determine what the answer is.

The Human-AI Attention Gap

ViLBERT shows a significantly higher correlation with human attention ($\rho = 0.434$) compared to older architectures like SAN ($\rho \approx 0.25$). However, a gap remains compared to human-to-human correlation ($\rho = 0.618$). Interestingly, the model exhibits a "bottom-up bias"; even when paired with irrelevant questions, it maintains a correlation of ~0.3 with human attention, indicating an inherent preference for salient objects.

Rank-correlation with human attention across co-attention layers for varying region proposals.

The Object Proposal Bottleneck

As shown in the figure above, increasing the number of region proposals from 36 to 108 consistently improves the rank-correlation with human attention across all co-attention layers. This scaling also boosted final VQA accuracy from 76.57% to 80.83%, confirming that the initial object detection phase is a critical bottleneck for transformer-based visual reasoning.

Conclusion

This research highlights that while co-attention layers in transformers are effective at grounding language, they operate largely as keyword-driven filters for visual regions. The strong correlation between "human-like" attention and model accuracy suggests that improving visual grounding is a viable path toward more robust VQA systems. Future work should aim to move beyond fixed object proposals toward more integrated, global visual contexts to bridge the remaining gap between machine and human visual reasoning.

Summary updated

BibTeX
@misc{sikarwar2022efficacy,
  author = {Ankur Sikarwar and Gabriel Kreiman},
  title = {{On the Efficacy of Co-Attention Transformer Layers in Visual Question Answering}},
  year = {2022},
  eprint = {2201.03965},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2201.03965},
}
Figure