Accelerating Transformers with Spectrum-Preserving Token Merging

Hoai-Chau Tran, Duy M. H. Nguyen, Duy M. Nguyen, Trung-Tin Nguyen, Ngan Le +5 more
5/25/2024
cs.LG

No official code found. Best implementation: hchautran/PiToMe (56 stars, last commit 2026-04-30).

Abstract

Increasing the throughput of the Transformer architecture, a foundational component used in numerous state-of-the-art models for vision and language tasks (e.g., GPT, LLaVa), is an important problem in machine learning. One recent and effective strategy is to merge token representations within Transformer models, aiming to reduce computational and memory requirements while maintaining accuracy. Prior works have proposed algorithms based on Bipartite Soft Matching (BSM), which divides tokens into distinct sets and merges the top k similar tokens. However, these methods have significant drawbacks, such as sensitivity to token-splitting strategies and damage to informative tokens in later layers. This paper presents a novel paradigm called PiToMe, which prioritizes the preservation of informative tokens using an additional metric termed the energy score. This score identifies large clusters of similar tokens as high-energy, indicating potential candidates for merging, while smaller (unique and isolated) clusters are considered as low-energy and preserved. Experimental findings demonstrate that PiToMe saved from 40-60\% FLOPs of the base models while exhibiting superior off-the-shelf performance on image classification (0.5\% average performance drop of ViT-MAE-H compared to 2.6\% as baselines), image-text retrieval (0.3\% average performance drop of CLIP on Flickr30k compared to 4.5\% as others), and analogously in visual questions answering with LLaVa-7B. Furthermore, PiToMe is theoretically shown to preserve intrinsic spectral properties of the original token space under mild conditions

View on arXivView PDF

Code Implementations(1)

hchautran/PiToMeCommunity100%

Speed up Transformers With Spectrum-Preserving Token Merging

567CSS, HTMLOct 28, 20245 months agoNOASSERTION

Similar Papers

Cite this paper

@article{tran2024accelerating,
  title  = {Accelerating Transformers with Spectrum-Preserving Token Merging},
  author = {Hoai-Chau Tran and Duy M. H. Nguyen and Duy M. Nguyen and Trung-Tin Nguyen and Ngan Le and Pengtao Xie and Daniel Sonntag and James Y. Zou and Binh T. Nguyen and Mathias Niepert},
  year   = {2024},
  eprint = {2405.16148},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2405.16148},
  url    = {http://arxiv.org/abs/2405.16148v2},
  journal = {NEURIPS 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/2405.16148.svg)](https://codeofpaper.com/paper/2405.16148)

Discussion