Inherently Faithful Attention Maps for Vision Transformers

Ananthu Aniraj, Cassio F. Dantas, Dino Ienco, Diego Marcos
6/10/2025
cs.CVcs.AI

Official code: ananthu-aniraj/ifam (0 stars, last commit 2026-04-03). 1 more implementation below.

Abstract

We introduce an attention-based method that uses learned binary attention masks to ensure that only attended image regions influence the prediction. Context can strongly affect object perception, sometimes leading to biased representations, particularly when objects appear in out-of-distribution backgrounds. At the same time, many image-level object-centric tasks require identifying relevant regions, often requiring context. To address this conundrum, we propose a two-stage framework: stage 1 processes the full image to discover object parts and identify task-relevant regions, while stage 2 leverages input attention masking to restrict its receptive field to these regions, enabling a focused analysis while filtering out potentially spurious information. Both stages are trained jointly, allowing stage 2 to refine stage 1. Extensive experiments across diverse benchmarks demonstrate that our approach significantly improves robustness against spurious correlations and out-of-distribution backgrounds. Code: https://github.com/ananthu-aniraj/ifam

View on arXivView PDF

Code Implementations(2)

[ICPR 2026] Implementation of paper "Two-stage Vision Transformers and Hard Masking offer Robust Object Representations"

00PythonNov 14, 20246 months ago
whuhxb/ifamCommunity56%

Implementation of paper "Inherently Faithful Attention Maps for Vision Transformers"

00PythonJun 12, 20251 years ago

Similar Papers

Cite this paper

@article{aniraj2025inherently,
  title  = {Inherently Faithful Attention Maps for Vision Transformers},
  author = {Ananthu Aniraj and Cassio F. Dantas and Dino Ienco and Diego Marcos},
  year   = {2025},
  eprint = {2506.08915},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.08915v3}
}

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/2506.08915.svg)](https://codeofpaper.com/paper/2506.08915)

Discussion