Cache Me if You Can: Accelerating Diffusion Models through Block Caching

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Wimbauer, Felix, Wu, Bichen, Schoenfeld, Edgar, Dai, Xiaoliang, Hou, Ji, He, Zijian, Sanakoyeu, Artsiom, Zhang, Peizhao, Tsai, Sam, Kohler, Jonas, Rupprecht, Christian, Cremers, Daniel, Vajda, Peter, Wang, Jialiang
Format: Preprint
Veröffentlicht: 2023
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866929207402037248
author Wimbauer, Felix
Wu, Bichen
Schoenfeld, Edgar
Dai, Xiaoliang
Hou, Ji
He, Zijian
Sanakoyeu, Artsiom
Zhang, Peizhao
Tsai, Sam
Kohler, Jonas
Rupprecht, Christian
Cremers, Daniel
Vajda, Peter
Wang, Jialiang
author_facet Wimbauer, Felix
Wu, Bichen
Schoenfeld, Edgar
Dai, Xiaoliang
Hou, Ji
He, Zijian
Sanakoyeu, Artsiom
Zhang, Peizhao
Tsai, Sam
Kohler, Jonas
Rupprecht, Christian
Cremers, Daniel
Vajda, Peter
Wang, Jialiang
contents Diffusion models have recently revolutionized the field of image synthesis due to their ability to generate photorealistic images. However, one of the major drawbacks of diffusion models is that the image generation process is costly. A large image-to-image network has to be applied many times to iteratively refine an image from random noise. While many recent works propose techniques to reduce the number of required steps, they generally treat the underlying denoising network as a black box. In this work, we investigate the behavior of the layers within the network and find that 1) the layers' output changes smoothly over time, 2) the layers show distinct patterns of change, and 3) the change from step to step is often very small. We hypothesize that many layer computations in the denoising network are redundant. Leveraging this, we introduce block caching, in which we reuse outputs from layer blocks of previous steps to speed up inference. Furthermore, we propose a technique to automatically determine caching schedules based on each block's changes over timesteps. In our experiments, we show through FID, human evaluation and qualitative analysis that Block Caching allows to generate images with higher visual quality at the same computational cost. We demonstrate this for different state-of-the-art models (LDM and EMU) and solvers (DDIM and DPM).
format Preprint
id arxiv_https___arxiv_org_abs_2312_03209
institution arXiv
publishDate 2023
record_format arxiv
spellingShingle Cache Me if You Can: Accelerating Diffusion Models through Block Caching
Wimbauer, Felix
Wu, Bichen
Schoenfeld, Edgar
Dai, Xiaoliang
Hou, Ji
He, Zijian
Sanakoyeu, Artsiom
Zhang, Peizhao
Tsai, Sam
Kohler, Jonas
Rupprecht, Christian
Cremers, Daniel
Vajda, Peter
Wang, Jialiang
Computer Vision and Pattern Recognition
Diffusion models have recently revolutionized the field of image synthesis due to their ability to generate photorealistic images. However, one of the major drawbacks of diffusion models is that the image generation process is costly. A large image-to-image network has to be applied many times to iteratively refine an image from random noise. While many recent works propose techniques to reduce the number of required steps, they generally treat the underlying denoising network as a black box. In this work, we investigate the behavior of the layers within the network and find that 1) the layers' output changes smoothly over time, 2) the layers show distinct patterns of change, and 3) the change from step to step is often very small. We hypothesize that many layer computations in the denoising network are redundant. Leveraging this, we introduce block caching, in which we reuse outputs from layer blocks of previous steps to speed up inference. Furthermore, we propose a technique to automatically determine caching schedules based on each block's changes over timesteps. In our experiments, we show through FID, human evaluation and qualitative analysis that Block Caching allows to generate images with higher visual quality at the same computational cost. We demonstrate this for different state-of-the-art models (LDM and EMU) and solvers (DDIM and DPM).
title Cache Me if You Can: Accelerating Diffusion Models through Block Caching
topic Computer Vision and Pattern Recognition
url https://arxiv.org/abs/2312.03209