Skip to main content
QUICK REVIEW

[Paper Review] Token Merging: Your ViT But Faster

Daniel Bolya, Cheng-Yang Fu|arXiv (Cornell University)|Oct 17, 2022
Generative Adversarial Networks and Image SynthesisComputer Science62 citations
TL;DR

Token Merging (ToMe) speeds up Vision Transformers by merging similar tokens with a fast bipartite matching process, boosting throughput up to about 2x (and 2.2x for video) with minimal accuracy loss, usable with or without training across image, video, and audio tasks.

ABSTRACT

We introduce Token Merging (ToMe), a simple method to increase the throughput of existing ViT models without needing to train. ToMe gradually combines similar tokens in a transformer using a general and light-weight matching algorithm that is as fast as pruning while being more accurate. Off-the-shelf, ToMe can 2x the throughput of state-of-the-art ViT-L @ 512 and ViT-H @ 518 models on images and 2.2x the throughput of ViT-L on video with only a 0.2-0.3% accuracy drop in each case. ToMe can also easily be applied during training, improving in practice training speed up to 2x for MAE fine-tuning on video. Training with ToMe further minimizes accuracy drop, leading to 2x the throughput of ViT-B on audio for only a 0.4% mAP drop. Qualitatively, we find that ToMe merges object parts into one token, even over multiple frames of video. Overall, ToMe's accuracy and speed are competitive with state-of-the-art on images, video, and audio.

Motivation & Objective

  • Motivate faster ViT inference and training without heavy retraining or architecture changes.
  • Introduce a simple token-merging module that increases throughput by reducing tokens per transformer layer.
  • Enable applicability across images, video, and audio while maintaining competitive accuracy.
  • Provide a light-weight, parallelizable merging algorithm suitable for off-the-shelf models.

Proposed method

  • Insert a token merging step between the attention and MLP branches of each transformer block.
  • Define token similarity using dot-product similarity between attention keys to select candidates for merging.
  • Use a fast bipartite soft matching to merge tokens by averaging features weighted by token size.
  • Employ proportional attention to account for merged tokens representing multiple input patches.
  • Optionally train ToMe by treating merging as pooling and backpropagating through merged tokens.
  • Explore constant and decreasing merging schedules to control the total tokens removed across layers.

Experimental results

Research questions

  • RQ1Can a lightweight token-merge module significantly increase ViT throughput with minimal accuracy loss without retraining?
  • RQ2How should tokens be matched and merged to preserve information content across image, video, and audio modalities?
  • RQ3What are the effects of merging schedules and feature choices on speedups and accuracy across different ViT models and pretraining regimes?
  • RQ4Is ToMe effective both in inference only and during training, and across diverse modalities?

Key findings

  • ToMe can roughly double the throughput of state-of-the-art ViT-L@512 and ViT-H@518 on images with around 0.2–0.3% accuracy loss.
  • On video, ToMe achieves about 2.2x throughput for ViT-L with only 0.2–0.3% accuracy loss without training.
  • When trained with ToMe, training speedups up to about 2x are observed for MAE fine-tuning on video.
  • For audio, ToMe attains about 2x throughput with around 0.4% mAP drop on ViT-B with MAE pretraining.
  • ToMe merges object parts across frames and can perform part-tracking in video, while merging background and foreground information without large accuracy degradation.
  • ToMe is competitive with state-of-the-art methods across images, video, and audio, without requiring extra training tricks or new parameters.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.