Accelerating Diffusion Transformers with Token-wise Feature Caching

## Abstract

Abstract Diffusion transformers have shown significant effectiveness in both image and video synthesis at the expense of huge computation costs. To address this problem, feature caching methods have been introduced to accelerate diffusion transformers by caching the features in previous timesteps and reusing them in the following timesteps. However, previous caching methods ignore that different tokens exhibit different sensitivities to feature caching, and feature caching on some tokens may lead to 10 × \times × more destruction to the overall generation quality compared with other tokens.
In this paper, we introduce token-wise feature caching, allowing us to adaptively select the most suitable tokens for caching, and further enable us to apply different caching ratios to neural layers in different types and depths. Extensive experiments on PixArt- α 𝛼 \alpha italic_α , OpenSora, and DiT demonstrate our effectiveness in both image and video generation with no requirements for training. For instance, 2.36 × \times × and 1.93 × \times × acceleration are achieved on OpenSora and PixArt- α 𝛼 \alpha italic_α with almost no drop in generation quality.

## 1 Introduction

Diffusion models (DMs) have demonstrated impressive performance across a wide range of generative tasks such as image generation (Rombach et al., ) and video generation (Blattmann et al., ).
Recently, the popularity of diffusion transformers further extends the boundary of visual generation by scaling up the parameters and computations (Peebles & Xie, ).
However, a significant challenge for diffusion transformers lies in their high computational costs, leading to slow inference speeds, which hinder their practical application in real-time scenarios.
To address this, a series of acceleration methods have been proposed, focusing on reducing the sampling steps (Song et al., ) and accelerating the denoising networks (Bolya & Hoffman, ; Fang et al., ).

Among these, cache-based methods (Ma et al., ; Wimbauer et al., ), which accelerate the sampling process by reusing similar features across adjacent timesteps (*e.g.* reusing the features cached at timestep $t$ in timestep $t-1$), have obtained abundant attention in the industrial community thanks to their plug-and-play property.
As the pioneering works in this line, DeepCache (Ma et al., ) and Block Caching (Wimbauer et al., ) were proposed to reuse the cached features in certain layers of U-Net-like diffusion models
by leveraging the skip connections in the U-Net. However, the dependency on the U-Net architectures also makes them unsuitable for diffusion transformers, which have gradually become the most powerful models in visual generation. Most recently, FORA (Selvaraju et al., ) and $\Delta$-DiT (Chen et al., ) have been proposed as a direct application of previous cache methods to diffusion transformers, though still not fully analyzed and exploited the property of the transformer-architecture. To tackle this challenge, this paper begins by studying how feature caching influences diffusion transformers at the token level.

Difference in Temporal Redundancy: Figure 2 shows the distribution of the feature distance between the adjacent timesteps for different tokens, where a higher value indicates that this token exhibits a lower similarity in the adjacent timesteps. It is observed that there exist some tokens that show relatively lower distance (in light blue) while some tokens show extremely higher distance (in dark blue), almost 2.5$\times$ larger than the mean distance, indicating caching such tokens can lead to an overlarge negative influence. This observation indicates that *different tokens have different redundancy across the dimension of timesteps*, (*i.e.* different temporal redundancy).

Difference in Error Propagation: Figure 2 introduces the other interesting perspective of *error propagation* in diffusion transformers. Specifically, self-attention and cross-attention layers are widely utilized in diffusion transformers to formulate the dependency between different tokens. As a result, the error in one of the tokens may propagate to some other tokens by self-attention and finally result in the error in all of the tokens. To understand the error propagation in tokens of diffusion transformers, we apply Gaussian noise with the same intensity to each token and compute the resulting error in all the tokens in the output of the final layer. Surprisingly, Figure 2 shows that the same noise in different tokens leads to significantly different propagation errors, with the largest propagation error being more than 10$\times$ the smallest one. In the context of feature caching, this indicates that *the same error introduced by feature cache can result in vastly different errors in the final generation result due to error propagation.*

Moreover, we have also investigated the difference of the tokens in layers of different depths and types, which demonstrates significant differences, as introduced in the following sections. In summary, different tokens exhibit *significant differences* in their sensitivities to feature caching, indicating that they deserve different priorities during the caching process.
This motivates us to study the token-wise feature caching strategy, which aims to select the maximal number of tokens to maximize the acceleration ratio while minimizing the resulting error introduced by the feature caching by selecting the tokens that make the least caching error.

Figure: Figure 1: Temporal Redundancy: Distribution of the distance between the feature of tokens in the previous and the current timestep.
Refer to caption: x1.png

To tackle this challenge, this paper introduces Token-wise feature Caching ToCa for training-free acceleration of diffusion transformers, which provides a fine-grained caching strategy for different tokens in the same layer and the tokens in different layers.
The core challenge of ToCa is to accurately select the tokens that are suitable for feature caching with the computation-cheapest operations. Consistent with the two previous analyses, we mainly study this problem from the perspective of *temporal redundancy* and *error propagation* by defining four scores for token selection.
Specifically, for *temporal redundancy*, we try to select the tokens with the highest similarity (*i.e.* lowest difference) with their value in the previous timesteps by considering their frequency of being cached, as well as their distribution in the spatial dimension of the images. For *error propagation*, we attempt to cache the tokens which makes the least influence on other tokens based on their attendance in self-attention and cross-attention layers. Besides, all of these scores can be obtained without any additional computation costs.

Extensive experiments on text-to-image, text-to-video and class-to-image generation demonstrate the effectiveness of ToCa on PixArt-$\alpha$, OpenSora, and DiT over previous feature caching methods. For instance, 2.36$\times$ acceleration can be achieved on OpenSora without requirements for training, outperforming halving the number of timesteps directly by 1.56 on VBench. On PariPrompt, ToCa even leads to 1.13 improvements on CLIP Score, indicating higher consistency to the text conditions.

In summary, the contributions of this paper are as follows:

- 1.
We propose Token-wise Caching (ToCa) as
a fine-grained feature caching strategy tailored to acceleration for diffusion transformers. To the best of our knowledge, ToCa first introduces the perspective of error propagation in feature caching methods.
- 2.
We introduce four scores to select the most suitable tokens for feature caching in each layer with no additional computation costs. Besides, ToCa enables us to apply different caching ratios in layers of different depths and types, and also bring a bag of techniques for feature caching.
- 3.
Abundant experiments on PixArt-$\alpha$, OpenSora, and DiT have been conducted, which demonstrates that ToCa achieves a high acceleration ratio while maintaining nearly lossless generation quality. Our codes have been released for further exploration in this domain.

## 2 Related Work

Transformers in Diffusion Models
Diffusion models (DMs) (Ho et al., ; Sohl-Dickstein et al., ), which iteratively denoise an initial noise input through a series of diffusion steps, have achieved remarkable success across various generation applications (Rombach et al., ; Balaji et al., ). Early DMs (Ho et al., ; Rombach et al., ) are based on the U-Net architecture (Ronneberger et al., ), consistently achieving satisfactory generation results. Recently, Diffusion Transformer (DiT) (Peebles & Xie, ) has emerged as a major advancement by replacing the U-Net backbone with a Transformer architecture. This transition enhances the scalability and efficiency of DMs across various generative tasks (Chen et al., ; Brooks et al., ). For example, PixArt-$\alpha$ (Chen et al., ) utilizes DiT as a scalable foundational model, adapting it for text-to-image generation, while Sora (Brooks et al., ) demonstrates DiT’s potential in high-fidelity video generation, inspiring a series of related open-source projects (Zheng et al., ; Lab & etc., ). Despite their success, the iterative denoising process of these DMs is significantly time-consuming, making them less feasible for practical applications.

Acceleration of Diffusion Models
To improve the generation efficiency of DMs, numerous diffusion acceleration methods have been proposed, falling broadly into two categories: (1) reducing the number of sampling timesteps, and (2) accelerating the denoising networks. The first category aims to achieve high-quality generation results with fewer sampling steps. DDIM (Song et al., ) introduces a deterministic sampling process that reduces the number of denoising steps while preserving generation quality. DPM-Solver (Lu et al., ) and DPM-Solver++ (Lu et al., ) propose adaptive high-order solvers for a faster generation without compromising on generation results. Rectified flow (Liu et al., ) optimizes distribution transport in ODE models to facilitate efficient and high-quality generation, enabling sampling with fewer timesteps.
In the second category, various efforts have been paid to token reduction (Bolya & Hoffman, ), knowledge distillation (Li et al., ), and weight quantization (Shang et al., ) and pruning (Fang et al., ) on the denoising networks. Additionally, recent cache-based methods reduce redundant computations to accelerate inference for DMs. These cache-based methods have obtained abundant attention since they have no requirements for additional training. DeepCache (Ma et al., ) eliminates redundant computations in Stable Diffusion (Rombach et al., ) by reusing intermediate features of low-resolution layers in the U-Net. Faster Diffusion (Li et al., ) accelerates the sampling process of DMs by caching U-Net encoder features across timesteps, skipping encoder computations at certain steps. Unfortunately, DeepCache and Faster Diffusion are designed specifically for U-Net-based denoisers and can not be applied to DiT (Chen et al., ). Recently, FORA (Selvaraju et al., ) and $\Delta$-DiT (Chen et al., ) have been proposed to cache the features and the residual of features for DiT.
Learning-to-Cache (Ma et al., ) learns an optimal cache strategy, which achieves a slightly higher acceleration ratio but introduces the requirements of training.
However, these methods apply the identical cache solution to all the tokens and even all the layers, which leads to a significant performance degradation in generation quality.

## 3 Methodology

### 3.1 Preliminary

##### Diffusion Models

Diffusion models are formulated to contain two processes, including a forward process which adds Gaussian noise to a clean image, and a reverse process which gradually denoises a standard Gaussian noise to a real image. By denoting $t$ as the timestep and $\beta_{t}$ as the noise variance schedule, then the conditional probability in the reverse (denoise) process can be modeled as

$$ $p_{\theta}(x_{t-1}\mid x_{t})=\mathcal{N}\left(x_{t-1};\frac{1}{\sqrt{\alpha_{ t}}}\left(x_{t}-\frac{1-\alpha_{t}}{\sqrt{1-\bar{\alpha}_{t}}}\epsilon_{\theta }(x_{t},t)\right),\beta_{t}\mathbf{I}\right),$ (1) $$

where $\alpha_{t}=1-\beta_{t}$, $\bar{\alpha}_{t}=\prod_{i=1}^{T}\alpha_{i}$, and $T$ denotes the number of timesteps. Importantly, $\epsilon_{\theta}$ denotes a denoising network with its parameters $\theta$ that takes $x_{t}$ and $t$ as the input and then predicts the corresponding noise for denoising. For image generation with $\mathcal{T}$ timesteps, $\epsilon_{\theta}$ is required to infer for $\mathcal{T}$ times, which takes most of the computation costs in the diffusion models. Recently, fruitful works demonstrate that formulating $\epsilon_{\theta}$ as a transformer usually leads to better generation quality.

Diffusion Transformer
Diffusion transformer models are usually composed of stacking groups of self-attention layers $f_{\text{SA}}$, multilayer perceptron $f_{\text{MLP}}$, and cross-attention layers $f_{\text{CA}}$ (for conditional generation). It can be roughly formulated as $g_{1}\circ g_{2}\circ\dots g_{L}$ where $g^{i}=\{f_{\text{SA}}^{i},f_{\text{CA}}^{i},f_{\text{MLP}}^{i}\}$. The upper script denotes the index of layer groups and $L$ denotes its maximal number. We omit the other components such as layer norm and residual connections here for simplicity. For diffusion transformers, the input data $\mathbf{x}_{t}$ is a sequence of tokens corresponding to different patches in the generated images, which can be formulated as $\mathbf{x}_{t}=\{x_{i}\}_{i=1}^{H\times W}$, where $H$ and $W$ denote the height and width of the images or the latent code of images, respectively.

Figure: Figure 3: The overview of ToCa on the example of the first layer with caching ratio $R=$40%. (a) In the first timestep of the cache period, ToCa computes all the tokens and stores them in the cache for initialization. Then, in the next timestep, ToCa first computes the caching score of each token and selects the tokens for cache based on them. Then, ToCa fetches the features of cached tokens from the cache while performing real computations in the other tokens. Then, the features of tokens that have been computed are utilized to update their value in the cache. (b) ToCa applies a higher cache ratio in the deep layer and a relatively lower cache ratio in the shallow layers.
Refer to caption: x3.png

### 3.2 Naive Feature Caching for Diffusion Transformers

Following previous caching methods for U-Net-like diffusion denoisers, we introduce the naive scheme for feature caching.
Given a set of $\mathcal{N}$ adjacent timesteps $\{{t,t+1,\dots,t+\mathcal{N}-1\}}$,
native feature caching performs the complete computation at the first timestep $t$ and stores the intermediate features in all the layers, which can be formulated as $\mathcal{C}(\mathbf{x}_{t})\bm{:=}f(\mathbf{x}_{t}^{l}),$ for $\forall l\in[0,L]$, where “$\bm{:=}$” indicates the operation of assigning the value.
Then, in the next $\mathcal{N}-1$ timesteps, feature caching avoids the computation of self-attention, cross-attention, and MLP layers by reusing the feature cached at timestep $t$. By denoting the cache as $\mathcal{C}$ and the expected feature of the input $\mathbf{x}_{t}$ in the $l_{th}$ layer as $\mathcal{F}$$(\mathbf{x}_{t}^{l})$, then for $\forall l\in[1,L]$,
the naive feature caching can be formulated as

$$ $\displaystyle\mathcal{F}_{\text{}}(\mathbf{x}_{t+1}^{l-1})=\mathcal{F}_{\text{ }}(\mathbf{x}_{t+2}^{l-1})=\cdots=\mathcal{F}_{\text{}}(\mathbf{x}_{t+\mathcal {N}}^{l-1})\bm{:=}\mathcal{C}_{\text{}}(\mathbf{x}_{t}^{l}).$ (2) $$

In these $\mathcal{N}$ timesteps, naive feature caching avoids almost all the computation in $\mathcal{N}-1$ timesteps, leading to around $\mathcal{N}-1$ times acceleration. After the $\mathcal{N}$ timesteps, the feature cache then starts a new period from initializing the cache as aforementioned, again.
The effectiveness of feature caching can be explained by the extremely low difference between the tokens in the adjacent timesteps. However, as $\mathcal{N}$ increases, the difference between the feature value in the cache and their correct value can be exponentially increased, leading to degeneration in generation quality, which motivates us to study more fine-grained methods for feature caching.

### 3.3 Token-wise Feature Caching

The naive feature caching scheme caches all the tokens of the diffusion transformers with the same strategy. However, as demonstrated in Figure 2, 2 and 5, feature cache introduces significantly different influence to different tokens,
motivating us to design a more fine-grained caching method in the token-level. In this section, we begin with the overall framework of ToCa, then introduce our strategy for token selection and caching ratios.

### 3.4 Overall Framework

Cache Initialization Similar to previous caching methods, given a set of adjacent timesteps $\{{t,t+1,\dots,t+\mathcal{N}-1\}}$, our method begins with computing all the tokens at the first timestep $t$, and storing the computation result (intermediate features) of each self-attention, cross-attention, and MLP layer in a cache, denoted by $\mathcal{C}$, as shown in the left part in Figure 3. This can be considered as the initialization of $\mathcal{C}$, which has no difference compared with previous caching methods.

Computing with the Cache
In the following timesteps, we can skip the computation of some unimportant tokens by re-using their value in the cache $\mathcal{C}$.
We firstly pre-define the *cache ratio* $R$ of tokens in each layer, which indicates that the computation of $R\%$ of the tokens in this layer should be skipped by using their value in the cache, and the other $(1-R\%)$ tokens should still be computed. To achieve this, a caching score function $\mathcal{S}$ is introduced to decide whether a token should be cached, which will be detailed in the next section.
Then, with $\mathcal{S}$, we can select a set of cached tokens as $\mathcal{I}_{\text{~{}Cache}}$ and the other set of tokens for real computation as $\mathcal{I}_{\text{~{}Compute}}$=$\{x_{i}\}^{N}_{i=1}-\mathcal{I}_{\text{~{}Cache}}$.
Then, the computation of the layer $f$ for $i_{th}$ token $x_{i}$ can be formulated as
$\mathcal{F}(x_{i})=\gamma_{i}f(x_{i})+(1-\gamma_{i})\mathcal{C}(x_{i}),$
where $\gamma_{i}=0$ for $i\in\mathcal{I}_{\text{~{}Cache}}$ and $\gamma_{i}=1$ for $i\in\mathcal{I}_{\text{~{}Compute}}$. $\mathcal{C}(x_{i})$ denotes fetching the cached value of $x_{i}$ from $\mathcal{C}$, which has no computation costs and hence leads to overall acceleration in $f$.

Cache Updating As a significant difference between traditional cache methods and ToCa, traditional cache methods only update the feature in the cache at the first timestep for each caching period while ToCa can update the feature in the cache at all the timesteps, which helps to reduce the error introduced by feature reusing.
For the tokens $x_{i}\in\mathcal{I}_{\text{~{}Compute}}$ which are computed, we update their corresponding value in the cache $\mathcal{C}$, which can be formulated as
$\mathcal{C}(x_{i}):=\mathcal{F}(x_{i})\text{~{}~{}for~{}~{}}i\in\mathcal{I}_{
\text{~{}Compute}}.$

Figure: Figure 4: The computation of caching scores in ToCa, where a token with a lower cache score is encouraged to be cached: (I) Self-attention weights are utilized to measure the influence of each token on the other tokens, where a token with higher influence is considered not suitable for caching. (II) Cross-attention weights are utilized to measure the influence of each image token on the text (condition) tokens, where an image token with higher entropy is considered not suitable for caching. (III) Tokens that have been cached multiple times are encouraged to not be cached in the following layers. (IV) We increase the cache score for the token with the largest cache score in its neighboring pixels to make the cached tokens distributed uniformly in the spatial dimension.
Refer to caption: x4.png

### 3.5 Token Selection

Given a sequence of tokens $\mathbf{x}_{t}=\{x_{i}\}_{i=1}^{N}$, token selection aims to select the tokens that are suitable for caching. To this end, we define a caching score function $\mathcal{S}(x_{i})$ to decide whether the $i_{th}$ token $x_{i}$ should be cached, where a token with a higher score has a lower priority for caching and a higher priority to be actually computed.
The $\mathcal{S}(x_{i})$ is composed of four sub-scores $\{s_{1},s_{2},s_{3},s_{4}\}$, corresponding to the following four principals.

(I) Influence to Other Tokens:
If a token has a significant contribution to the value of other tokens, then the error caused by token caching on this token can easily propagate to the other tokens, ultimately leading to discrepancies between all tokens and their correct values. Consequently, we consider the contribution of each token to other tokens as one of the criteria for defining whether it should be cached, estimated with an attention score in self-attention.
Recall that the self-attention can be formulated as
$\mathbf{O}=\mathbf{AV}$, where $\mathbf{A}=\text{Softmax}(\mathbf{\frac{{QK}^{T}}{\sqrt{d}}})\in\mathbb{R}^{N
\times N}$ denotes the normalized attention map. $\mathbf{Q}$, $\mathbf{K}$, $\mathbf{V}$ and $\mathbf{O}\in\mathbb{R}^{N\times d}$ are query, key, value and output tokens respectively; $\mathbf{d}$ is the hidden size of each token and $N$ is the total number of tokens.
More specifically, the $i_{th}$ output token is obtained through
${o_{i}}=\sum_{j=1}^{N}\mathit{{\alpha_{ij}}{v_{j}}}$,
where $\alpha_{ij}$
is the $(i,j)$ element of the attention map $\mathbf{A}$, denoting the contribution of value token $v_{j}$ to the output token $o_{j}$.
With these notations, we define $s_{1}$ to measure the contribution of $x_{i}$ to other tokens as
$s_{1}(x_{i})=\lambda_{1}\sum_{i=1}^{N}\alpha_{ij},$ as shown in Figure 4(a).

(II) Influence to Control Ability:
The control ability of diffusion models in the text-to-image generation is usually achieved with a cross-attention layer which injects the control signal (*e.g.* text) into the image tokens. Hence, the cross-attention map reflects how each image token is influenced by the control signal. In this paper, we define the image tokens that are influenced by more tokens in the control signal as the tokens that are not suitable for caching, since the caching error on these tokens leads to more harm in the control ability.
Specifically, by denoting $c_{ij}$ as the $(i,j)$ element in the cross attention score $\mathbf{C}=\text{Softmax}(\frac{\mathbf{QK_{\text{text}}^{T}}}{\mathbf{\sqrt{d
}}})$, where $\mathbf{K}_{\text{text}}$ denotes the keys of text tokens (control tokens). Then, as shown in Figure 4(b), we employ the entropy $H(x_{i})$ of the cross-attention weight for each image token $x_{i}$ as its influence on the control-ability of diffusion models, which can be formulated as
$s_{2}(x_{i})=H(x_{i})=-\sum_{j=1}^{N}c_{ij}\log(c_{ij}).$

(III) Cache Frequency: We observe that when a token is cached across multiple adjacent layers, the error introduced by feature caching in this token can be quickly accumulated, and the difference between it and its correct value can be exponentially amplified, which significantly degrades the overall quality of images.
Hence, we define recently cached tokens as unsuitable for cache in the next layers and time steps.
Conversely, the tokens that have not been cached for multiple layers and timesteps are encouraged to be cached.
As shown in Figure 4(c), this selection rule is achieved by recording the times of being cached for each token after their last real computation, which can be formulated as
$\text{s}_{3}(x_{i})=\frac{n_{i}}{\mathcal{N}},$
where $n_{i}$ represents the number of times that $x_{i}$ has been cached after its last computation. $\mathcal{N}$ is the number of timesteps in each feature caching cycle.

(IV) Uniform Spatial Distribution:
The pixels in the neighboring patch of the images usually contain similar information. As discussed in previous works, overwhelmingly pruning the information in a local spatial region may result in significant performance degradation in the whole images (Bolya & Hoffman, ).
Hence, to guarantee that the errors introduced by caching are not densely distributed in the same spatial region, we define the following scoring function:
$s_{4}(x_{i})=\mathcal{I}(x_{i})\cdot\left(s_{1}(x_{i})+s_{2}(x_{i})+s_{3}(x_{i
})\right),$
where $\mathcal{I}(x_{i})$ is an indicator function which equals to 1 if $x_{i}$ has the highest score of $s_{1}(x_{i})+s_{2}(x_{i})+s_{3}(x_{i})$ in its neighboring $k\times k$ pixels and equals to 0 in the other settings.

In summary, the overall caching score of $x_{i}$ can be formulated as
$\mathcal{S}(x_{i})=\mathop{\sum}_{j=1}^{4}\lambda_{j}\cdot s_{j}(x_{i})$, where $\lambda_{j}$ are hyper-parameters to balance each score. Then, with the cache ratio $R$, the index set for the cached tokens is obtained in the following form:

$$ $\mathcal{I}_{~{}\text{Cache}}=\mathop{\arg\min}_{\{i_{1},i_{2},\dots,i_{R\% \times N}\}\subseteq{\{1,2,\dots,n}\}}\{\mathcal{S}(x_{i_{1}}),\mathcal{S}(x_{ i_{2}}),\cdots,\mathcal{S}(x_{i_{n}})\}.$ (3) $$

Figure: Figure 5: (a) The distance between features at the last timestep and the current timestep for features in different layer depths. (b) The distribution of errors in the output of the final layer when the same Gaussian noise is applied to tokens in different layer depths. (c) The distribution of errors in the output of the final layer when the same Gaussian noise is applied to tokens in different layer types.
Refer to caption: x5.png

### 3.6 Different Cache Ratios in Different Layers

Figure 5 shows the difference in feature caching of different layers, where (a) shows that the output features of different layers have different distances compared with their value in the last step (*i.e.* different temporal redundancy). (b) and (c) show that when errors in the same density are applied to layers in different depths and types, the resulting error in the final layer exhibits extremely different magnitudes. Specifically, in the three studies, the disparity between the maximum and minimum error can be several orders of magnitude.
Fortunately, ToCa enables us to apply different caching ratios for layers in various depths and types. By denoting the overall caching ratio for all the layers and timesteps as $\mathcal{R}_{0}$, then two factors $r_{\text{depth}}\text{and}r_{\text{type}}$
are introduced to adjust the caching ratios. Then the final caching ratio of the layer in $l$ depth and type can be written as $R^{l}_{\text{type}}=R\times r_{l}\times r_{\text{type}}$.

${\mathbf{\emph{r}}_{l}}$:
As introduced in Figure 5(a) and (b)
, although the features of the shallow layers tend to exhibit lower differences than the deeper layers, the error introduced by the cached tokens in the shallow layers can be propagated to the other tokens and amplified during the computation in all the following layers, resulting in a much larger caching error.
Based on this observation, we set larger and smaller cache ratios for deeper and shallower layers, respectively, by setting $r_{l}=0.5+\lambda_{l}(\nicefrac{{l}}{{L}}-0.5)$, where 0.5 is utilized for 1-center and $L$ denotes the maximal depth and $\lambda_{l}$ controls the slope.

${\mathbf{\emph{r}}_{\text{type}}}$:
As shown in Figure 5(c), layers of different types have different sensitivities to feature caching. Especially, the error on the token in self-attention layers can quickly propagate to other tokens, due to the property that each token in self-attention layers can attend to all the tokens.
A naive solution is to set lower cache ratios for self-attention layers. However, we observe that even if only a smaller ratio of tokens is cached, the error introduced by these tokens still quickly propagates to all other tokens, and has almost the same negative influence as caching all the tokens. Based on this fact, we propose to cache all tokens in self-attention layers.
For MLP and cross-attention layers, $r_{\text{type}}$ is set to the ratio of their computation costs over the overall computation costs. This strategy encourages layers with more computation costs to have a higher cache ratio.

## 4 Experiment

### 4.1 Experiment Settings

Model Configurations
We conduct experiments on three commonly-used DiT-based models across different generation tasks, including PixArt-$\alpha$ (Chen et al., ) for text-to-image generation, OpenSora (Zheng et al., ) for text-to-video generation, and DiT-XL/2 (Peebles & Xie, ) for class-conditional image generation with NVIDIA A800 80GB GPUs. Each model utilizes its default sampling method: DPM-Solver++ (Lu et al., ) with 20 steps for PixArt-$\alpha$, rflow (Liu et al., ) with 30 steps for OpenSora and DDIM (Song et al., ) with 250 steps for DiT-XL/2. For each model, we configure different average forced activation cycles $\mathcal{N}$ and average caching ratios $R$ for ToCa as follows: PixArt-$\alpha$: $\mathcal{N}=3$ and $R=70\%$, OpenSora: $\mathcal{N}=3$ for temporal attention, spatial attention, MLP, and $\mathcal{N}=6$ for cross-attention, with $R=85\%$ exclusively for MLP, and DiT: $\mathcal{N}=4$ and $R=93\%$. Please refer to the appendix for more implementation details.

Evaluation and Metrics
For text-to-image generation, we utilize 30,000 captions randomly selected from COCO-2017 (Lin et al., ) to generate an equivalent number of images. FID-30k is computed to assess image quality, while the CLIP Score (Hessel et al., ) is used to evaluate the alignment between image content and captions. In the case of text-to-video generation, we leverage the VBench framework (Huang et al., ), generating 5 videos for each of the 950 benchmark prompts under different random seeds, resulting in a total of 4,750 videos. The generated videos are comprehensively evaluated across 16 aspects proposed in VBench.
For class-conditional image generation, we uniformly sample from 1,000 classes in ImageNet (Deng et al., ) to produce 50,000 images at a resolution of $256\times 256$, evaluating performance using FID-50k (Heusel et al., ). Additionally, we employ sFID, Precision, and Recall as supplementary metrics.

### 4.2 Results on Text-to-Image Generation

**Table 1: Qualitative comparison of text-to-image generation on MS-COC02017 and PartiPrompts with PixArt-$\alpha$ and 20 DPM++ sampling steps by default.**
| Method | Latency(s) $\downarrow$ | FLOPs $\downarrow$ | Speed $\uparrow$ | MS-COCO2017 | PartiPrompts |  |
| --- | --- | --- | --- | --- | --- | --- |
| FID-30k $\downarrow$ | CLIP $\uparrow$ | CLIP $\uparrow$ |  |  |  |  |
| PixArt-$\alpha$ (Chen et al., ) | 0.682 | 11.18 | 1.00$\times$ | 28.09 | 16.32 | 16.70 |
| $50\%$ steps | 0.391 | 5.59 | 2.00$\times$ | 37.46 | 15.85 | 16.37 |
| $\textbf{FORA}(\mathcal{N}=2)$ (Selvaraju et al., ) | 0.416 | 5.66 | 1.98$\times$ | 29.67 | 16.40 | 17.19 |
| $\textbf{FORA}(\mathcal{N}=3)$ (Selvaraju et al., ) | 0.342 | 4.01 | 2.79$\times$ | 29.88 | 16.42 | 17.15 |
| ToCa ($\mathcal{N}=3,R=60\%$) | 0.410 | 6.33 | 1.77$\times$ | 28.02 | 16.45 | 17.15 |
| ToCa ($\mathcal{N}=3,R=70\%$) | 0.390 | 5.78 | 1.93$\times$ | 28.33 | 16.44 | 17.75 |
| ToCa ($\mathcal{N}=3,R=80\%$) | 0.370 | 5.05 | 2.21$\times$ | 28.82 | 16.44 | 17.83 |
| ToCa ($\mathcal{N}=3,R=90\%$) | 0.347 | 4.26 | 2.62$\times$ | 29.73 | 16.45 | 17.82 |

**Table 2: Quantitative comparison in text-to-video generation on VBench. *Results are from PAB (Zhao et al., ). PAB^1-3 indicate PAB with different hyper-parameters.**
| Method | Latency(s) $\downarrow$ | FLOPs(T) $\downarrow$ | Speed $\uparrow$ | VBench(%) $\uparrow$ |
| --- | --- | --- | --- | --- |
| OpenSora (Zheng et al., ) | 81.18 | 3283.20 | 1.00$\times$ | 79.13 |
| $\textbf{$\Delta$-DiT}^{*}$ (Chen et al., ) | 79.14 | 3166.47 | 1.04$\times$ | 78.21 |
| $\textbf{T-GATE}^{*}$ (Zhang et al., ) | 67.98 | 2818.40 | 1.16$\times$ | 77.61 |
| PAB^1∗ (Zhao et al., ) | 60.78 | 2657.70 | 1.24$\times$ | 78.51 |
| PAB^2∗ (Zhao et al., ) | 59.16 | 2615.15 | 1.26$\times$ | 77.64 |
| PAB^3∗ (Zhao et al., ) | 56.64 | 2558.25 | 1.28$\times$ | 76.95 |
| $50\%$ steps | 42.72 | 1641.60 | 2.00$\times$ | 76.78 |
| FORA(Selvaraju et al., ) | 49.26 | 1751.32 | 1.87$\times$ | 76.91 |
| ToCa$(R=85\%)$ | 43.08 | 1394.03 | 2.36$\times$ | 78.34 |

In Table 1, we compare ToCa configured with parameters to achieve an acceleration ratio close to 2.0, against two other training-free acceleration approaches: FORA (Selvaraju et al., ), a recent cache-based high-acceleration method, and the 10-step DPM-Solver++ sampling (Lu et al., ). In terms of generation quality, the quantitative results demonstrate that ToCa achieves the lowest FID among the compared acceleration methods while maintaining a high acceleration ratio. Figure LABEL:fig:PixArt-vis also illustrates that our generated results most closely resemble those of the original PixArt-$\alpha$. Regarding generation consistency, Table 1 demonstrates that ToCa achieves the highest CLIP score on both MS-COCO2017 and the PartiPrompts. Figure LABEL:fig:PixArt-vis shows that ToCa generates images that align more closely with the text descriptions compared to other methods. This is particularly evident in the fourth case, where only ToCa successfully generates an image matching ”a small rowboat tied to a wooden dock”, while other methods fail to generate the content of ”a wooden dock”. This may be caused by cross-attention score $s_{2}$ in ToCa that ensures the frequent refreshing of tokens that are semantically relevant to the text descriptions, resulting in generated images with enhanced semantic consistency to the text prompts.

Notably, Table 1 shows that under similar acceleration ratios, ToCa exhibits a very marginal decrease in generation quality. In contrast, directly halving the number of timesteps leads to 9.37 increments in FID, indicating a significant performance drop. This observation indicates that when the number of sampling steps is already relatively low (*e.g.*, 20 steps), further reduction in the number of sampling steps may severely compromise the generation quality. In contrast, ToCa remains effective, demonstrating the distinct advantage of ToCa in the situation of low sampling steps.

Figure: Figure 7: Visualization examples for different acceleration methods on OpenSora. Please kindly refer to the supplementary material or the anonymous [web page](https://toca2024.github.io/ToCa/) for viewing these videos.
Refer to caption: x6.png

### 4.3 Results on Text-to-Video Generation

Figure: Figure 8: VBench metrics and acceleration ratio of proposed ToCa and other methods
Refer to caption: x7.png

We compare ToCa with adjusted rflow sampling steps from 20 to 10, alongside other acceleration methods including FORA, PAB (Zhao et al., ), $\Delta$-DiT (Chen et al., ), and T-GATE (Zhang et al., ) using OpenSora (Zheng et al., ) for text-to-video generation. As presented in Table 2, the experimental results show that ToCa achieves an impressive VBench score offering the lowest computational cost and highest inference speed among all methods tested. The VBench score of the $2.36\times$ accelerated ToCa scheme drops by only 0.79 compared to the non-accelerated scheme, while FORA’s score decreases by 2.22, resulting in a $64.4\%$ reduction in quality loss. Additionally, more VBench metrics results are presented in Figure 8, which illustrate that ToCa significantly speeds up the original OpenSora with only slight performance degradation on a few metrics. Notably, ToCa stands out as the sole acceleration method achieving nearly overall consistency performance with the original OpenSora, clearly outperforming another cache-based acceleration method FORA. This again highlights the effectiveness of our proposed cross-attention-based token selection strategy, ensuring that the generated videos are highly aligned with the text descriptions. We further present some video generation results in Figure 7, where we observe that the visual fidelity, and overall consistency of ToCa are closest to the original OpenSora. Please kindly refer to our video demos in the supplementary material or the anonymous [web page](https://toca2024.github.io/ToCa/) for viewing the video demo.

### 4.4 Results on Class-Conditional Image Generation

**Table 3: Quantitative comparison on class-to-image generation on ImageNet with DiT-XL/2.**
| Method | Latency(s) $\downarrow$ | FLOPs(T) $\downarrow$ | Speed $\uparrow$ | sFID $\downarrow$ | FID $\downarrow$ | Precision $\uparrow$ | Recall $\uparrow$ |
| --- | --- | --- | --- | --- | --- | --- | --- |
| DiT-XL/2-G (cfg $=1.50$) | 2.012 | 59.36 | 1.00$\times$ | 4.98 | 2.31 | 0.82 | 0.58 |
| $33\%$ steps | 0.681 | 19.71 | 3.01$\times$ | 6.31 | 2.76 | 0.81 | 0.57 |
| $37\%$ steps | 0.748 | 22.08 | 2.69$\times$ | 6.04 | 2.64 | 0.81 | 0.58 |
| $\textbf{FORA}(\mathcal{N}=3)$ | 0.807 | 20.02 | 2.97$\times$ | 6.21 | 2.80 | 0.80 | 0.59 |
| $\textbf{FORA}(\mathcal{N}=2.8)$ | 0.815 | 21.68 | 2.74$\times$ | 6.13 | 2.80 | 0.80 | 0.59 |
| ToCa ($\mathcal{N}=4,R=93\%$) | 0.820 | 21.61 | 2.75$\times$ | 5.74 | 2.58 | 0.81 | 0.59 |

Quantitative comparison between ToCa with other training-free DiT acceleration methods is shown in
Table 3, which demonstrates that ToCa outperforms other methods in terms of both FID and sFID by a clear margin under the similar acceleration ratio. For instance, ToCa leads to 0.39 and 0.22 lower values in sFID and FID compared with FORA with a similar acceleration ratio, respectively.

**Table 4: Ablation studies with DiT-XL/2-G (cfg-1.50). $s_{1}$ is used in all experiments. $s_{2}$ is not used since DiT does not have cross-attention layers.**
| $R$ Schedule | Uniform Spatial | Cache | ImageNet |  |
| --- | --- | --- | --- | --- |
| $\mathit{r_{{l}}}$ | $\mathit{r_{type}}$ | Distribution $s_{3}$ | Frequency $s_{4}$ | FID-5k $\downarrow$ |
| ✓ | ✓ | ✓ | ✓ | 9.32 |
| ✗ | ✓ | ✓ | ✓ | 9.60 |
| ✓ | ✗ | ✓ | ✓ | 9.67 |
| ✓ | ✓ | ✗ | ✓ | 9.35 |
| ✓ | ✓ | ✓ | ✗ | 9.65 |

Ablation Study
Table 5 presents the effect of the two factors on adjusting the caching ratio in different layers, where applying different caching ratios to layers in different types ($r_{\text{type}}$) and different depths ($r_{l}$) leads to 0.28 and 0.35 FID reduction, respectively.
Besides, using the score of uniform spatial distribution ($s_{3}$) and cache frequency ($s_{4}$) reduces FID by 0.02 and 0.33, respectively. Table 5 compares the influence of selecting tokens with the self-attention weights ($s_{1}$) and the cross-attention weights ($s_{2}$). The other ToCa modules including $s_{3},s_{4},r_{l},r_{\text{type}}$ are utilized in these experiments.
It is observed that $s_{1}$ tends to achieve a lower FID while $s_{2}$ tends to reach a higher CLIP score, which is reasonable since self-attention is mainly utilized for the generation of the overall images while cross-attention is utilized to inject the conditional signals. In summary, these results demonstrate that all the cache scores in ToCa have their benefits in different dimensions.

Figure: Figure 9: Visualization of cached tokens selected with and without ${s}_{3}$ (cache frequency). The pixel with a darker color indicates the corresponding tokens are more frequently cached. (c) The distribution of the number of being cached for each token w/ and w/o $s_{3}$.
Refer to caption: x8.png

Visualization on the Cached Tokens
Figure 9 (a-b) show the number of times that each token is cached during generation, where darker colors indicate more frequent caching. It is observed that both the two schemes perform more cache in the unimportant background tokens while performing more real computations in the tokens of the Arctic fox.
However, the image without $s_{3}$ has a bad quality in the background since the background tokens have been cached too many times. In contrast,
applying the score of cache frequency $s_{3}$, which aims to stop caching the tokens that have been cached in the previous layers, can reduce the gap between the important and unimportant tokens, and prevent the background tokens from overlarge caching frequency.This observation has also been verified in Figure 9(c) that $s_{3}$ reduces the number of tokens cached by more than 4.5k times.

## 5 Conclusion

Motivated by the observation that different tokens exhibit different temporal redundancy and different error propagation, this paper introduces ToCa, a token-wise feature caching method, which adaptively skips the computation of some tokens by resuing their features in previous timesteps. By leveraging the difference in different tokens, ToCa achieves better acceleration performance compared with previous caching methods by a clear margin in both image and video generation, providing insights for token-wise optimization in diffusion transformers.

## Appendix A Appendix

### A.1 Engineering Details

This section introduces some engineering techniques in our work.

#### A.1.1 Step-Wise caching scheduling

In section 3.6, we propose a method for dynamically adjusting the caching ratio $R$ based on the time redundancy and noise diffusion speed across different depths and types of layers, which constitutes a key part of our contributions. In the following section, we further explore the dynamic adjustment of $R$ along the timestep dimension, as well as strategies for dynamically adjusting the forced activation cycle $\mathcal{N}$.

At the initial stages of image generation, the model primarily focuses on generating contours, while in the later stages, it pays more attention to details. In the early contour generation phase, it is not necessary for too many tokens to be fully computed with high precision. By multiplying by a term $r_{t}$, we achieve dynamic adjustment of $R$ along the timestep dimension, where $r_{t}=0.5+\lambda_{t}(0.5-t/T)$, $\lambda_{t}$ is a positive parameter controlling the slope, $t$ is the number of timesteps already processed, and $T$ is the total number of timesteps. By adjusting $R$ in this way, we shift some of the computational load from earlier timesteps to later ones, improving the quality of the generated images. Finally, the caching ratio is determined as $R^{l,t}_{\text{type}}=R\times r_{l}\times r_{\text{type}}\times r_{t}$.

Similarly, we set a larger forced activation cycle $\mathcal{N}$ during the earlier stages, while a smaller $\mathcal{N}$ is used during the later detail generation phase to enhance the quality of the details.
To ensure that the adjustment of $\mathcal{N}$ has minimal impact on the theoretical speedup, we define it as follows: $\mathcal{N}_{t}=\mathcal{N}_{0}/(0.5+w_{t}(t/T-0.5))$, where $\mathcal{N}_{0}$ corresponds to the expected theoretical speedup induced by $\mathcal{N}$, and $w_{t}$ is a hyperparameter controlling the slope.

#### A.1.2 Partially Computation on Self-Attention

In the previous section, we mentioned that partial computation in the Self-Attention module can lead to rapid propagation and accumulation of errors. Therefore, we considered avoiding partial computation in the Self-Attention module, meaning that during the non-forced activation phase, the Self-Attention module has $r_{type}=0$. In the subsequent Sensitivity Study, we explored a trade-off scheme between Self-Attention and MLP modules, with the corresponding formulas for allocation being $r_{type}=1-0.4\lambda_{type}$ for the Self-Attention module, and $r_{type}=1+0.6\lambda_{type}$ for the MLP module. The factors 0.6 and 0.4 are derived from the approximate computational ratio between these two modules in the DiT model.

#### A.1.3 Token Selection for CFG and non-CFG

In the series of DiT-based models, the tensors of cfg (class-free guidance) and non-cfg are concatenated along the batch dimension. A pertinent question in token selection is whether the same token selection strategy should be applied to both the cfg and non-cfg parts for the same image (i.e., if a token is cached in the cfg part, it should also be cached in the corresponding non-cfg part). We have observed significant sensitivity differences among models with different types of conditioning regarding whether the same selection strategy is used. For instance, in the text-to-image and text-to-video models, such as PixArt-$\alpha$ and OpenSora, if independent selection schemes are applied for the cfg and non-cfg parts, the model performance degrades substantially. Thus, it is necessary to enforce a consistent token selection scheme between the cfg and non-cfg parts.

However, in the class-to-image DiT model, this sensitivity issue is considerably reduced. Using independent or identical schemes for the cfg and non-cfg parts results in only minor differences. This can be attributed to the fact that, in text-conditional models, the cross-attention module injects the conditioning information into the cfg and non-cfg parts unevenly, leading to a significant disparity in attention distribution between the two. Conversely, in class-conditional models, the influence on both parts is relatively uniform, causing no noticeable changes in token attention distribution.

### A.2 More Implementation Details on Experimental Settings

For the DiT-XL/2 model, we uniformly sampled from 1,000 classes in ImageNet (Deng et al., ) and generated 50,000 images with a resolution of $256\times 256$. We explored the optimal solution for DiT-XL/2 using FID-5k (Heusel et al., ) and evaluated its performance with FID-50k. Additionally, sFID, Inception Score, and Precision and Recall were used as secondary metrics. For the PixArt-$\alpha$ model, we used 30,000 captions randomly selected from COCO-2017 (Lin et al., ) to generate 30,000 images. We computed FID-30k to assess image quality and used the CLIP Score between the images and prompts to evaluate the alignment between image content and the prompts. For the OpenSora model, we used the VBench framework (Huang et al., ), generating 5 videos for each of the 950 VBench benchmark prompts under different random seeds, resulting in a total of 4,750 videos. These videos have a resolution of 480p, an aspect ratio of 16:9, a duration of 2 seconds, and consist of 51 frames saved at a frame rate of 24 frames per second. The model was comprehensively evaluated across 16 aspects: subject consistency, imaging quality, background consistency, motion smoothness, overall consistency, human action, multiple objects, spatial relationships, object class, color, aesthetic quality, appearance style, temporal flickering, scene, temporal style, and dynamic degree.

PixArt-$\alpha$: We set the average forced activation cycle of ToCa to $\mathcal{N}=2$, supplemented with a dynamic adjustment parameter $w_{t}=0.1$. The parameter $\lambda_{t}=0.4$ adjusts $R$ at different time steps, and the average caching ratio is $R=70\%$. The parameter $r_{l}=0.3$ adjusts $R$ at different depth layers. The module preference weight $r_{type}=1.0$ shifts part of the computation from cross-attention layers to MLP layers.

OpenSora: For OpenSora, we fixed the forced activation cycle for temporal attention, spatial attention, and MLP at 3, and set the forced activation cycle for cross-attention to 6. The ToCa strategy ensures that a portion of token computations is conducted solely in the MLP, with $R_{mlp}$ fixed at $85\%$.

DiT: We set the average forced activation cycle of ToCa to $\mathcal{N}=3$, supplemented with a dynamic adjustment parameter $w_{t}=0.03$ to gradually increase the density of forced activations as the sampling steps progress. The parameter $\lambda_{t}=0.03$ adjusts $R$ at different time steps. Additionally, during the sampling steps in the interval $t\in[50,100]$, the forced activation cycle is fixed at $\mathcal{N}=2$ to promote more thorough computation in sensitive regions. The average caching ratio is $R=93\%$, and the parameter $\lambda_{l}=0.06$ adjusts $R$ at different depth layers. The module preference weight $r_{type}=0.8$ means that during steps outside the forced activation ones, no extra computations are performed in attention layers, but additional computations are performed in the MLP layers.

All of our experiments were conducted on 6 A800 GPUs, each with 80GB of memory, running CUDA version 12.1. The DiT model was executed in Python 3.12 with PyTorch version 2.4.0, while PixArt-$\alpha$ and OpenSora were run in Python 3.9. The PyTorch version for PixArt-$\alpha$ was 2.4.0, and for OpenSora it was 2.2.2. The CPUs used across all experiments were 84 vCPUs from an Intel(R) Xeon(R) Gold 6348 CPU @ 2.60GHz.

Figure: Figure 10: Visualization examples for different acceleration methods on DiT.
Refer to caption: x9.png

### A.3 Sensitivity Study

We explored the optimal parameter configuration for the ToCa acceleration scheme on DiT and analyzed the sensitivity of each parameter. The experiments used FID-5k and sFID-5k as evaluation metrics. From Figure 11 (a) to (f), we respectively investigated the effects of the caching ratio weights $\lambda_{l}$, $\lambda_{type}$, $\lambda_{t}$, the weight of Cache Frequency score $\lambda_{3}$, Uniform Spatial Distribution $\lambda_{4}$, and the dynamic adjustment weight for forced activation $w_{t}$. It is observed that:
(a) The optimal parameter is $\lambda_{l}=0.06$, where the corresponding cache ratio shows approximately $6\%$ variation at both the last and first layers.
(b) The optimal parameter is $\lambda_{type}=2.5$, at which point the Self-Attention layer does not perform any partial computation, with the entire computational load shifted to the MLP layer. It is also noted that as the computation load decreases in the Self-Attention layer and increases in the MLP layer, the generation quality shows a steady improvement.
(c) The optimal parameter in the figure is $\lambda_{t}=0.03$, and at this point, there is little difference between the best and worst methods, suggesting that the model is not particularly sensitive to the adjustment of cache ratio along the timesteps.
(d) The optimal weight for the Cache Frequency score is $\lambda_{3}=0.25$. We observe that as $\lambda_{3}$ increases, the model’s generation quality initially shows a noticeable improvement, but beyond a weight value of 0.25, the fluctuation is minimal. This indicates that the Cache Frequency has reached a relatively uniform state, achieving a dynamic balance in caching among different tokens.
(e) We conducted a search for the Uniform Spatial Distribution score with grid sizes of 2 and 4, and the experimental results show that the generation quality with a grid size of 2 is generally better than that with a grid size of 4. This suggests that a finer-grained spatial uniformity indeed contributes to an improvement in generation quality.
(f) We explored the impact of dynamically adjusting the forced activation cycle on the model’s generation quality and analyzed the effect of fixing the Force activation cycle $\beta$ at 2 for the relatively more sensitive 50–100 timesteps. The experimental results show that enforcing this fixed cycle in the 50–100 timesteps significantly improves generation quality, with the optimal parameter configuration being $w_{t}=0.4$.

In summary, these observations indicate that our method is not sensitive to the choice of hyper-parameters. Actually, our experiment results demonstrate that stable performance can be observed when directly transferring hyper-parameters from one model to another model in the same model family such as DiT in different sizes.

Figure: Figure 11: Sensitivity study on different weights. From (a) to (f), the caching ratio weights $\lambda_{l}$, $\lambda_{type}$, $\lambda_{t}$, the Cache Frequency score weight $\lambda_{3}$, the Uniform Spatial Distribution weight $\lambda_{4}$, and the dynamic schedule weight for forced activation $w_{t}$ are presented.
Refer to caption: x10.png

## Peer Reviews

confidence: 5
contribution: 2
initial_rating: 5
presentation: 3
questions: - In table 2, ToCa does not outperform PAB with 1.24x speedup (78.34 vs 78.51). Although ToCA achieves a more significant speed-up, it is crucial to preserve the generation quality. I am wondering if ToCa can have better generation quality using a more conservative setting that has similar speed-up to PAB?
soundness: 3
strengths: - The visualizations of temporal redundancy and error propagation illustrate the motivation of ToCa in an intuitive way, making the design choices relatively well motivated.
- The four token selection scoring functions and layer-specific cache ratios are natural design choices that enable the caching strategy to be more fine-grained
- ToCa achieves more than 2x acceleration ratios on both text-to-image and text-to-video tasks, while having better quality than baselines.
- ToCa’s training-free nature makes it more practical for real-world application.
summary: The paper introduces ToCa (Token-wise feature Caching), a training-free feature caching method tailored to accelerate diffusion transformers. ToCa allows for adaptive token selection, which aims to cache tokens with minimal caching error based on various criterions. Experiments have been conducted on PixArt-α, OpenSora, and DiT models to show the speedup and quality trade-off of ToCa.
weaknesses: - While ToCa achieves reasonable benchmark results, some artifacts remain in the generated images compared to the originals. For instance, in Figure 6, the moon is missing from the "wolf howling at the full moon" prompt, and the background forests appear blurred in the "tranquil beach" prompt. It is necessary to demonstrate how ToCa performs with high-resolution images (1024x1024) generated by more advanced models like FLUX.1-dev [1].
- Another important direction in accelerating diffusion models involves reducing the required sampling steps. However, this might compromise ToCa's effectiveness since fewer steps may result in greater feature variations between steps, potentially making them less suitable for caching. Please include experimental results using models with reduced sampling steps, such as FLUX.1-schnell [2] with 4 steps.
- For advanced model evaluation, FID and CLIP scores may not adequately reflect human preferences. Please provide quantitative results using more recent metrics, such as image reward [3].
- The method involves numerous hyperparameters, including four token selection scoring metrics ($\lambda_1$, $\lambda_2$, $\lambda_3$, $\lambda_4$) and caching ratios for different layers and timesteps ($\lambda_l$, $\lambda_{type}$, $\lambda_t$). While A.3 provides a sensitivity analysis, it remains unclear how these parameters should be determined for new models or tasks. The authors should elaborate on hyperparameter selection and impacts, particularly addressing whether an automatic selection method (e.g., a calibration procedure) exists. The complexity of hyperparameters could limit the method's generalizability and practical application.
- The "Acceleration of Diffusion Models" section lacks references to key fundamental works. Specifically, step distillation [4, 5] and consistency models [6] should be cited under "reducing the number of sampling timesteps," and Q-Diffusion [7] should be cited under "weight quantization."
- Notation inconsistencies: s3 is generally defined as cache frequency but appears as spatial distribution in Table 4, which uses s4 for cache frequency.

[1] https://huggingface.co/black-forest-labs/FLUX.1-dev  
[2] https://huggingface.co/black-forest-labs/FLUX.1-schnell   
[3] Xu et al. ImageReward: Learning and Evaluating Human Preferences for Text-to-image Generation. NeurIPS 2023.  
[4] Salimans et al. Progressive Distillation for Fast Sampling of Diffusion Models. ICLR 2022.  
[5] Meng et al. On Distillation of Guided Diffusion Models. CVPR 2023.  
[6] Song et al. Consistency Models. ICML 2023.  
[7] Li et al. Q-Diffusion: Quantizing Diffusion Models. ICCV 2023.

---

confidence: 4
contribution: 3
initial_rating: 6
presentation: 3
questions: 1. The introductory paragraph of the methods section should be rephrased to clarify the concept of the "naive scheme" for feature caching. This naive scheme is actually no different from existing approaches, such as DeepCache, FORA, and delta-DiT, which should not be "we propose". 

2. It should be noted that Figure 3(b) does not depict any low-ratio caching scenarios. 

3. There is a discrepancy regarding the application of the scores s1, s2, and s3 across the layers. Specifically, s1 is applicable only to self-attention layers, while s2 pertains solely to cross-attention layers. However, the current definition combines these scores, which raises questions about how this aggregation functions across the different types of layers.

4. Clarification is needed regarding the additional time cost associated with computing the selection scores. Given that the scoring relies on rank computation, there remains a need to calculate and distribute the cached tokens among the uncached tokens. This process is somewhat ambiguous, particularly concerning how the acceleration time is achieved. Presenting the actual extra costs incurred for selecting scores alongside the resulting speedup from the caching process would provide valuable insights.
soundness: 3
strengths: 1. The motivation behind the proposed approach is both technically sound and clearly explained, supported by two informative figures illustrating the varying levels of similarity among different tokens and the accumulation of error across these tokens. These visual aids effectively convey the rationale for the proposed method.

2. The methodology for selecting scores and making decisions for each layer is novel, offering valuable insights into the acceleration of transformer models. This innovative approach not only enhances the efficiency of the models but also contributes to a deeper understanding of feature caching strategies within the context of transformers.
summary: Token-wise Caching (ToCa) is introduced as a fine-grained feature caching strategy designed to accelerate diffusion transformers. It uniquely considers error propagation in caching, utilizing four selection scores to determine the best tokens for caching without incurring extra computational costs. ToCa also allows for variable caching ratios across different layers and integrates multiple techniques to enhance caching efficiency. Extensive experiments on models like PixArt-α, OpenSora, and DiT show that ToCa achieves significant speedups while preserving nearly lossless generation quality.
weaknesses: 1. There appears to be a lack of a complete algorithmic description within the manuscript. Specifically, a detailed explanation is needed for the token selection process at each layer and each timestep, as well as the procedure for redistributing the cached tokens back into the overall framework. This omission could lead to misunderstandings regarding the efficacy and functionality of the proposed method.

2. The manuscript does not adequately illustrate the computation costs associated with the proposed approach, making it challenging to comprehend the additional expenses involved. A clearer breakdown of these costs would enhance the reader's understanding of the method's efficiency.

3. Including a token diagram for specific layers during both early and late timesteps, across various layer types, may provide additional clarity. Such visual representations could effectively illustrate how tokens are managed and utilized within the different stages of the computation, facilitating a better grasp of the overall caching strategy.

---

confidence: 4
contribution: 3
initial_rating: 6
presentation: 3
questions: Same with my Weakness 1.
soundness: 3
strengths: - The paper is well-written and easy to understand. 
- The observation that the similarity and propagated error differ for each token in DiT is very insightful.
- Various metrics were proposed to measure the importance of tokens on reusing. 
- Experiments were conducted on a variety of datasets, including not only text-to-image but also text-to-video.
summary: This paper presents a method called ToCa, which utilizes token-wise feature caching to accelerate the denoising process of DiT. Unlike existing DiT acceleration methods, ToCa offers a fine-grained, token-wise acceleration approach, demonstrating improved performance compared to previous methods.
weaknesses: - It's difficult to understand how token-wise caching leads to actual acceleration. Since the attention layer calculates the similarity among all inputs through matrix multiplication, even if one output token is not computed, there won't be a significant difference in the overall computational cost (similar to unstructured pruning). A more detailed explanation of where this acceleration comes from or breakdown is required. 
- Evaluation is performed with just single Latency/FID point. An evaluation of the Pareto curve with latency/FID would provide more insightful information. 
- There seems to be a color error in Fig 3(b). The yellow arrow indicating low cache ratio is missing.

---

confidence: 4
contribution: 2
initial_rating: 6
presentation: 3
questions: Please refer to the questions in the weakness part.
soundness: 3
strengths: 1.	The author provides two insightful observations that improve my understanding of diffusion transformers. Firstly, different tokens exhibit varying levels of temporal redundancy across different timesteps. Secondly, the authors highlight that due to error propagation in transformer architectures, the same caching error can lead to vastly different impacts on the final generation result. These observations are the basis of the proposed token-wise feature caching method.
2.	Unlike previous works that primarily focused on U-Net architectures, the authors shift their attention to the transformer architecture. This is meaningful as existing methods have not fully exploited the unique properties of transformers, which are increasingly popular for visual generation tasks.
3.	The experimental results demonstrate the performance improvements with high inference speedups.
4.	The authors select the most suitable tokens for caching by leveraging both temporal redundancy and error propagation. The proposed method adaptively caches the tokens that minimize the resulting error while maximizing the acceleration ratio.
summary: The authors aim to accelerate DiT inference by caching features and reusing them in future steps. The authors observe the limitations of existing methods that ignore the sensitivities to feature caching among different tokens, thus leading to potential degradation of generation quality. Based on this observation, the main idea of this work is to selectively cache suitable tokens and adjust the caching ratios by considering layer types and depths. Evaluations based on three typical DiT models show the performance of model accuracy and overhead saving.
weaknesses: 1.	In Figure 1, the authors use the Frobenius distance to measure the temporal redundancy of tokens across timesteps. However, it is unclear how this distance is exactly calculated. Providing more details on the calculation process would help readers better understand the experiments.
2.	I cannot find a clear formulation for the cache score used in token selection. The authors mention the cache score in Figure 4, but no explicit equation is provided. 
3.	The authors update the cache at all timesteps to reduce the error introduced by feature reusing. However, it is unclear how this procedure affects the computation complexity, especially about I/O overhead and cache selection efficiency.
4.	The experiments report the inference speedups but lack a comprehensive analysis of the trade-off between speedups and model accuracy. While FID and CLIP scores are provided in Table 1, these metrics do not fully reflect model accuracy. In addition, Table 3 shows that the proposed method has no significant improvements over existing methods in terms of accuracy and speedups.

Meta-review: Summary: 
Proposes a token-wise feature caching (ToCa) mechanism for inference-time acceleration of diffusion transformers. ToCa presents an adaptive token selection algorithm, which dynamically selects tokens for caching based on various error criteria. The method is well motivated and supported by strong results, and detailed analysis, showing speedups and preservation of image quality.
Strength: 
The problem formulation. The temporal redundancy and error propagation illustrations clearly motivate the design choices. The proposed method for token selection score has substantial novelty, and provides insights into the distribution of features in denoising transformers. Strong results (2x speedup) and a highly desirable achievement for inference-time acceleration, which is another avenue that’s less explored than distillation-based approaches.   
Weakness: 
The paper at times can be a bit hard to follow with the main contributions distributed over the paper. An overview section (first paragraph of method section) that summarizes the selection criteria used will better orient the reader. 
Acceptance Reason: 
Strong results. The problem statement and motivation are clearly stated and illustrated, making it easy to follow the design choices. Substantial novelty in methodology. Explores an important direction for inference-time acceleration of diffusion models.

Decision: Accept (Poster)