SPARO: Selective Attention for Robust and Compositional Transformer Encodings for Vision

Ankit Vani, Bac Nguyen, Samuel Lavoie, Ranjay Krishna, Aaron C. Courville
2/14/2026

No official code found. Best implementation: ankitkv/sparo-clip (5 stars, last commit 2024-11-04).

Abstract

Selective attention helps us focus on task-relevant aspects in the constant flood of our sensory input. This constraint in our perception allows us to robustly generalize under distractions and to new compositions of perceivable concepts. Transformers employ a similar notion of attention in their architecture, but representation learning models with transformer backbones like CLIP and DINO often fail to demonstrate robustness and compositionality. We highlight a missing architectural prior: unlike human perception, transformer encodings do not separately attend over individual concepts. In response, we propose SPARO, a read-out mechanism that partitions encodings into separately-attended slots, each produced by a single attention head. Using SPARO with CLIP imparts an inductive bias that the vision and text modalities are different views of a shared compositional world with the same corresponding concepts. Using SPARO, we demonstrate improvements on downstream recognition, robustness, retrieval, and compositionality benchmarks with CLIP (up to +14% for ImageNet, +4% for SugarCrepe), and on nearest neighbors and linear probe for ImageNet with DINO (+3% each). We also showcase a powerful ability to intervene and select individual SPARO concepts to further improve downstream task performance (up from +4% to +9% for SugarCrepe) and use this ability to study the robustness of SPARO's representation structure. Finally, we provide insights through ablation experiments and visualization of learned concepts.

View on arXivView PDF

Code Implementations(1)

ankitkv/sparo-clipCommunity100%

Separate-head attention read-out

51Shell, PythonMar 16, 20241 years agoNOASSERTION

Similar Papers

Cite this paper

@article{vani2026sparo,
  title  = {SPARO: Selective Attention for Robust and Compositional Transformer Encodings for Vision},
  author = {Ankit Vani and Bac Nguyen and Samuel Lavoie and Ranjay Krishna and Aaron C. Courville},
  year   = {2026},
  eprint = {2404.15721},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2404.15721},
  journal = {ECCV 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2404.15721.svg)](https://codeofpaper.com/paper/2404.15721)

Discussion