Back to search

Chalmers University of Technology

On the Role of Attention Maps in Visual Transformers - A Clustering Perspective

Abstract

dc:description.abstract

This thesis delves into a novel area of research, exploring whether attention maps from a single-layer Vision Transformer model exhibit a clustering structure. The discover of such a structure would imply that tokens with similar semantic information tend to cluster together. We extract an attention map from a one-layer Vision Transformer model, which uses image patches as input data. Values below a set threshold are pruned from the attention map, and a graph is created from the remaining data. Various community detection algorithms are then applied to this graph and evaluated based on modularity. We visualize the patches belonging to each cluster and compare classification performance when removing salient and non-salient clusters. The method reveals a significant clustering structure, which was discovered by the Louvain algorithm. The tokens cluster to other objects with similar semantic information, effectively separating parts of the image. The classification logit values for specific images are improved when tokens belonging to unimportant clusters are removed while removing tokens from important clusters negatively impacts performance. This work suggests that a Vision Transformer’s attention layer clusters tokens based on their semantic information, but further research is needed to confirm the generality of this result.

Degree

thesis:*
Level thesis:degree_level
H
Department dc:contributor.department
Chalmers tekniska högskola / Institutionen för data och informationsteknik
Year dc:date.issued
2024

Author and committee

dc:creator, dc:contributor.*
Authors dc:creator
  • Anttila Ryderup, Erik
  • Hsu, Yu-Ping
Advisor dc:contributor.supervisor
  • Panahi, Ashkan
Committee member dc:contributor.committeemember
  • Mercado Oropeza, Rocío

Subjects

dc:subject × 7

Rights

Language dc:language.iso
eng

Identifiers

dc:identifier.*
Dc Identifier Coursecode
DATX05

Chain of custody

source
Harvested from
Chalmers University of Technology
Base URL
odr.chalmers.se/oai/request
Last updated
2026-11-19
Source record
OAI-PMH GetRecord
citation

Anttila Ryderup, Erik; Hsu, Yu-Ping. On the Role of Attention Maps in Visual Transformers - A Clustering Perspective. H thesis, 2024. https://hdl.handle.net/20.500.12380/310470