Token Merging for Fast Stable Diffusion

Daniel Bolya, Judy Hoffman
3/30/2023
cs.CV

Official code: dbolya/tomesd (1,402 stars, MIT, last commit 2023-11-29).

Abstract

The landscape of image generation has been forever changed by open vocabulary diffusion models. However, at their core these models use transformers, which makes generation slow. Better implementations to increase the throughput of these transformers have emerged, but they still evaluate the entire model. In this paper, we instead speed up diffusion models by exploiting natural redundancy in generated images by merging redundant tokens. After making some diffusion-specific improvements to Token Merging (ToMe), our ToMe for Stable Diffusion can reduce the number of tokens in an existing Stable Diffusion model by up to 60% while still producing high quality images without any extra training. In the process, we speed up image generation by up to 2x and reduce memory consumption by up to 5.6x. Furthermore, this speed-up stacks with efficient implementations such as xFormers, minimally impacting quality while being up to 5.4x faster for large images. Code is available at https://github.com/dbolya/tomesd.

View on arXivView PDF

Code Implementations(1)

dbolya/tomesdOfficial100%
MIT

Speed up Stable Diffusion with this one simple trick!

1,40280PythonMar 28, 20232 years agoMIT

Similar Papers

Cite this paper

@article{bolya2023token,
  title  = {Token Merging for Fast Stable Diffusion},
  author = {Daniel Bolya and Judy Hoffman},
  year   = {2023},
  eprint = {2303.17604},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2303.17604v1}
}

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

Discussion