Abstract
Visual attention mechanisms are widely used in multimodal tasks like Visual Question Answering (VQA). However, traditional softmax-based mechanisms suffer from being "strictly dense," assigning non-zero probability to all image regions regardless of relevance or spatial structure. We propose two alternative sparsity-promoting transformations: Sparsemax, which selects only relevant regions, and Total-Variation Sparse Attention (TVMAX), which encourages the selection of contiguous spatial regions. Our experiments demonstrate that TVMAX improves VQA accuracy and produces attention maps that align more closely with human visual focus, significantly enhancing model interpretability.
Introduction: The "Leaky" Attention Problem
In computer vision, attention mechanisms identify relevant image regions for a given task. Most current models rely on the softmax function to distribute attention weights. Softmax has a significant drawback: it is strictly dense, meaning it can never assign a weight of exactly zero. Consequently, the model always allocates some "focus" to irrelevant background noise, which can distract it from the correct answer.
Furthermore, standard attention treats image grid cells as independent entities. In reality, objects are composed of adjacent, connected regions. A truly effective attention mechanism should be both selective (ignoring irrelevant areas) and structured (recognizing contiguous objects rather than scattered pixels).
Proposed Methods: Sparsemax and TVMAX
To address these limitations, the researchers explore two alternatives to softmax:
- Sparsemax: This transformation can assign exactly zero weight to irrelevant regions, effectively "cropping" the model's focus to a subset of the image.
- TVMAX (Total-Variation Sparse Attention): While Sparsemax is selective, it can result in "speckled" attention maps where disconnected pixels are highlighted. TVMAX introduces a 2D Total Variation (TV) penalty, a mathematical constraint that encourages neighboring regions to share similar attention weights. This forces the model to select contiguous, object-like regions.
Technical Implementation
Implementing TVMAX requires solving a complex optimization problem during the forward pass. The authors demonstrate that TVMAX can be computed by composing a proximal operator with a sparsemax projection. To enable efficient training via backpropagation, they derived a closed-form expression for the Jacobian and utilized a specialized "flood-filling" style algorithm to handle the backward pass.
Experimental Evaluation
The approach was evaluated using two primary benchmarks: VQA-v2, to measure raw task accuracy, and VQA-HAT (Human Attention), to quantify how well the model's attention aligns with human eye movements.
Key Results
The results indicate that spatial structure is a critical component of visual attention, particularly when using grid-based features.
- Accuracy: On the VQA-v2 Test-Standard set, TVMAX achieved 70.70% accuracy, outperforming both softmax (70.56%) and sparsemax (70.40%).
- Human Alignment: TVMAX showed a significantly higher Spearman rank correlation (0.37) with human attention compared to softmax (0.33) and sparsemax (0.32).
- Qualitative Interpretability: Visualizing the attention maps reveals the stark differences between the methods.
As illustrated in Figure 1, when asked "Is anyone crossing the bridge?", softmax spreads focus across the sky and water. Sparsemax identifies relevant points but in a fragmented way. TVMAX clearly highlights the contiguous region of the bridge, mimicking how a human would look for a person.
Conclusion
By combining sparsity with structural constraints, TVMAX bridges the gap between raw image data and object-level reasoning. While computationally more intensive than softmax due to the iterative nature of the 2D Total Variation solver, the gains in both accuracy and interpretability are substantial. Future work may explore applying these structured sparsity principles to Transformer architectures and other domains like Natural Language Processing, where contiguous regions might represent multi-word phrases.
Summary updated