Which Transformer to Favor: A Comparative Analysis of Efficiency in Vision Transformers

Tobias Christian Nauen, Sebastian Palacio, Federico Raue, Andreas Dengel
8/18/2023
21 citations
cs.CVcs.AIcs.LG
transformer-attention

Official code: tobna/WhatTransformerToFavor (33 stars, Python, MIT, last commit 2026-02-25).

Abstract

Self-attention in Transformers comes with a high computational cost because of their quadratic computational complexity, but their effectiveness in addressing problems in language and vision has sparked extensive research aimed at enhancing their efficiency. However, diverse experimental conditions, spanning multiple input domains, prevent a fair comparison based solely on reported results, posing challenges for model selection.

Show full abstract

To address this gap in comparability, we perform a large-scale benchmark of more than 45 models for image classification, evaluating key efficiency aspects, including accuracy, speed, and memory usage. Our benchmark provides a standardized baseline for efficiency-oriented transformers. We analyze the results based on the Pareto front -- the boundary of optimal models. Surprisingly, despite claims of other models being more efficient, ViT remains Pareto optimal across multiple metrics. We observe that hybrid attention-CNN models exhibit remarkable inference memory- and parameter-efficiency. Moreover, our benchmark shows that using a larger model in general is more efficient than using higher resolution images. Thanks to our holistic evaluation, we provide a centralized resource for practitioners and researchers, facilitating informed decisions when selecting or developing efficient transformers.

View on arXivView PDF

Code Implementations(1)

MIT

Github repository for the paper Which Transformer to Favor: A Comparative Analysis of Efficiency in Vision Transformers.

336PythonJun 27, 20239 months agoMIT
benchmarkdeep-learningefficient-deep-learningtransformer-models

Similar Papers

Cite this paper

@article{nauen2023which,
  title  = {Which Transformer to Favor: A Comparative Analysis of Efficiency in Vision Transformers},
  author = {Tobias Christian Nauen and Sebastian Palacio and Federico Raue and Andreas Dengel},
  year   = {2023},
  eprint = {2308.09372},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2308.09372v4}
}

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

Discussion