Learning-to-Cache: Accelerating Diffusion Transformer via Layer Caching
Authors: Xinyin Ma
Gongfan Fang
Michael Bi Mi
Xinchao Wang
Venue: NeurIPS 2024 poster (2024)
Keywords: efficient generative model; diffusion model; inference acceleration
Primary area: diffusion_based_models

Abstract: Diffusion Transformers have recently demonstrated unprecedented generative capabilities for various tasks. The encouraging results, however, come with the cost of slow inference, since each denoising step requires inference on a transformer model with a large scale of parameters. In this study, we make an interesting and somehow surprising observation: the computation of a large proportion of layers in the diffusion transformer, through introducing a caching mechanism, can be readily removed even without updating the model parameters. In the case of U-ViT-H/2, for example, we may remove up to 93.68% of the computation in the cache steps (46.84% for all steps), with less than 0.01 drop in FID. To achieve this, we introduce a novel scheme, named Learning-to-Cache (L2C), that learns to conduct caching in a dynamic manner for diffusion transformers. Specifically, by leveraging the identical structure of layers in transformers and the sequential nature of diffusion, we explore redundant computations between timesteps by treating each layer as the fundamental unit for caching. To address the challenge of the exponential search space in deep models for identifying layers to cache and remove, we propose a novel differentiable optimization objective. An input-invariant yet timestep-variant router is then optimized, which can finally produce a static computation graph. Experimental results show that L2C largely outperforms samplers such as DDIM and DPM-Solver, alongside prior cache-based methods at the same inference speed.

Learning-to-Cache:
Accelerating Diffusion Transformer via Layer Caching
Xinyin Ma
Gongfan Fang' Michael Bi Mi Xinchao Wang
National University of Singapore*
Huawei Technologies Ltd.
maxinyinou. mus.uusseec. .du, xinchaodnus edu.
100 UNIT-I22
BRS
Layers
Figure 1: (a) Generate 512x512 images using DiT-XL/2, sampled by DDIM with 50 NFEs. (b) Generate 256 images using U-ViT-H/2, sampled by DPM-Solver-2 with 50 NFEs.
Abstract
Diffusion Transformers have recently demonstrated unprecedented generative capabilities for various tasks. The encouraging results, however, come with the cost slow inference, since each demoising step requires inference on a transformer model with large scale of parameters. In this study, make interesting and somehow surprising observation: the computation of a large proportion of layers the diffusion transformer, through introducing caching mechanism, can be readily removed even without updating the model parameters. In the case of U-ViT-H/2, for example, we may remove up 93.68% of the computation in the cache steps (46.84% for all steps), with less than 0.01 drop in FID. To achieve this, we introduce novel scheme, named Learning-to to Cache (L2C), that learns conduct caching in dynamic manner for diffusion transformers. Specifically, by leveraging the identical structure layers in transformers and the sequential nature of diffusion, we explore redundant computations between timesteps by treating each layer as the fundamental unit for caching. To address the challenge of the exponential search space in deep models for identifying layers to cache and remove, we propose a novel differentiable optimization objective. An input-invariant yet timestep-variant router is then optimized, which can finally produce a static computation graph. Experimental results show that L2C largely outperforms samplers such as DDIM and DPM-Solver. alongside prior eache-based methods at the same inference speed.
"Corresponding author
38th Conference on Neural Information Processing Systems (NcurIPS 2024).

---

Introduction
have achieved remarkable performance as powerful Among the various backbone designs for diffusion models, transformers [62 have emerged as a strong contender, showing its exceptional capabilities
In recent years, diffusion models 600
[59
19
generative models for image generation 49 10.
not only in synthesizing high-fidelity images [46] 3 but also in video generation [8] 7 text-to-
speech synthesis [33 61 and 3D generation [41 5]. The diffusion transformer, while benefiting
greatly from the great property of scalability of the transformer architecture, however, also brings about significant challenges in efficiency, including high deployment costs and slow inference speed.
Since the cost of sampling increases proportionally with the number of timesteps and the model size per timestep, naturally, current methods for increasing the sampling efficiency entail two branches: reducing the sampling steps [57] 19 34 2 or reducing the inference cost per step [6 677. The methods to reduce the number of timesteps include distilling the trajectory into fewer steps [22 58 39
discretizing the reverse-time SDE or the probability flow ODE 57
73 37 Methods in another branch
are mainly about compressing the model size (25 30 or using low www-preciionn data format [8
A new method in the dynamic inference of diffusion is special cache mechanism in the denoising process [40, 64). These methods leverage the high similarity between the two steps and the special property of U-Net to cache some of the computations, which would be directly used in the next step. Some other dynamic inference methods employ a spectrum of diffusion models and allocate different
networks for different steps 665 44).
Previous approaches. especially those aimed at reducing model size, have predominantly targeted the compression of the U-Net architecture [50]. Our objective is to explore paradigm for inference acceleration that more suitable for transformer- based diffusion models. Unlike other architectures, transformers are distinctively composed of several layers with consistent structure. Based on this property, previous compression work on transformers mainly focuses on layer pruning [7] and optimizing at the layer level tends to achieve higher speedup ratios compared to width pruning 24 15 S. However, for diffusion transformers, we observed that dropping layers without retraining is not feasible. Removing even few layers significantly degrades image quality (see Section 4.3). This observation highlights that the redundancy among layers at varying depths is not evident in DiT. Therefore, we consider another perspective of redundancy: the redundancy across layers situated at the same depths but occurring at different timesteps.
random layer dropping [14
48
Motivated by cache-based methods [40 64 28), we aim to explore the existence and limitations of layer redundancy between timesteps within the diffusion transformer. straightforward approach involves an exhaustive search where each layer is either cached or not, resulting in an exponentially growing search space with the depth of the layers. Additionally, heuristic-based layer selection cannot adequately address the mutual dependencies between layers. To overcome these challenges, we designed a framework that makes the problem of layer selection differentiable. Specifically, we interpolate predictions between two adjacent steps. This interpolation spans two extremes: a fast configuration where all layers are cached at the expense of image quality, and a slow configuration where all layers are retained, achieving optimal performance. We then search this interpolation space to identify an optimal caching scheme, optimizing a specialized router. This router is time-dependent but input- invarinnvarian,, allowing the creation of static computation graph for inference. We train this router by formulating an optimization problem that does not require updating model parameters, making it both cost-effective and easy optimize.
Our results indicate that different percentages of layers can be cached in DiT 41 and U-ViT Notably, for U-ViT-H/2 on ImageNet, approximately 93. 93.68% of layers are cacheable in the cache step, whereas for DiT-XL/2, the cacheable ratio is 47.43%, both with an almost negligible performance loss (AFID 0.01). By comparison, with the same acceleration ratio, a sampler with fewer steps would compromise image quality. Our method L2C can significantly outperform the fast sampler, as well as previous based methods. Additionally, we observed distinct sparsity patterns for layers between these two models, suggesting significant behavioral variations between different architecture designs for diffusion transformers.
In summary, our contribution is the proposal of novel acceleration method, learning-to-oe to-ccche (L2CC), specifically for diffusion transformers. We convert the non-differentiable layer selection problem into differentiable optimization problem by interpolation, facilitating the learning of layer caching. Our results demonstrate that large proportion of layers in the diffusion trans-

---

former can be cached without compromising performance. Furthermore, our approach significantly outperforms samplers with fewer steps and other cache-based methods. The code is available at http://gtth..commoossss////nnnno
2
Related Work
Transformers in Diffusion Models. Diffusion models have demonstrated broad applicability
across various domains 13 4 [69] Transformer [62 is applied in diffusion models as alternative
to UNet[50]. GenViT 68) integrates the [2] architecture into DDPM. U-ViT [3] employs the
long skip connections between shallow and deep layers. DiT 46) shows the scalability of diffusion transformers and is further used as a general architecture for text-to-video generation 38 speech
synthesis 33 and 3D generation [5]
Acceleration of Diffusiin Models. Generating images by diffusion models requires several rounds of model evaluation which is timeexxpensive. Some works focus on reducing the number of sampling steps in a training-fin -fee manner. DDIM[57] extends the original DDPM to non-Markovian cases. DPM- Solver 36 37 further approximates the solution of diffusion ODES by the exponential integrators. EDM 23 finds that the Heun'2 2 2nd order method provides an excellent tradeoff between truncation
in more distill and half the sampling steps. [58 39 learns to map any point on the ODE trajectory its origin. Another line of work reduces the workload per step. The model per step is compressed by reducing the parameter size [6
error and NFE. More works try to solve either SDEs 22
11
ODEs 34
73 72
accurate and fast way. Other training-based methods [52
6 71 63
using reduced precision [29 18] and re-design the structure of the diffusion model [67
30
75
25
35
In addition to static model inference, dynamic model inference has also been extensively explored within diffusion models, which employs different models for inference at varying steps. [32 45
switch between different sizes of models in model zoo. 42 designs a time-dependent exit schedule to skip subset of parameters. Other works focus on denoising diffusion models in parallel either through iterative optimization [54] or image splitting|22) (27]. In addition to inference acceleration, some works also show how to train a diffusion model more efficiently by employing different training paradigm [17 76 or from the data perspective [47]
Cache in Diffusion Models Cache 555] is used in computer systems to hold temporarily those portions of contents in the main memory which is believed to be used in a short time. Recently, explores the cache mechanism in diffusion models. Based on the observations that the similarities of high-level features [70] is typically very high in consecutive steps, they propose to reuse the feature maps. By utilizing the computation flow U-Net, [40] reuse the high-level features while updating the low-level features. [64] 28 further discovers the better position in U-Net to be cached. [20 proposes to reuse the attention map. [64 [6 40) adjust the lifetime for each caching features and (64) further scales and shifts the reused features. [74] finds the cross-attentie is redundant in the fidelity-imrroiing stage and can be cached. [66] hashes and caches the images rendered from camera positions and diffusion timesteps to improve the efficiency of 3D generative modeling.
40 64
3 Method
3.1
Preliminary
The forward diffusion process starts at the starting point Te, where wo is sampled from the data distribution g(wo) to be learned. mo is degenerated with gradually added Gaussian noise, with:
xt ~ (x (.o) = N (x:; ayto o²I)
where a2 and oe is the noise coefficient. We can quickly sample o, at arbitrary timestep by reparame- terization trick. And for the reverse process, given two timesteps s and t, where s >> 0 and < zt calculated [36)
On x. Oi S.a
- (Fa,))) dd
33
0gg
where >, = log (o)/o.). (A) the inverse function of X that satisfies (x())) = eg (-) often represents the learned model, which, in our case, is the diffusion transformer. Previous methods
3

---

(Z,, 8)
(mm, ml
Es (20m m)
Feadforusrd
Feadfonward
Foedforward
MSHA
Feedforward
Feodfooward
Feadforward
MHSA
MHSA
MSHA
Activate
Timanie::
Timadao
Condition
Disable
CondiTion
Condition
Illustration of Learning-to-Cache When a layer is activated, the calculation proceeds as usual. In contrast, when layer is disabled, the computation of the non-residual path is bypassed, and the results from the previous step are utilized instead. The router 3 smoothly controls the transition between two endpoints eo (x s: 8) and co (2 m).
Figure 2:
show that this integral term can be approximated by adopting Taylor expansion at A. adopting the first-order (57) higher-order approximation of this (36). Take the first-order one an example, the update of æ,, would be:
02 v2 de (e^ Eg (2),8)
3t
3.2 Approximating weth) lightweight substitute
The question falls into how to efficiently calculate the term Jx e~>oo (A)) (x)) dX. Our core
idea that we want keep more updates between s and while the overall inference time would not increase too much. Suppose that we have three timesteps: and i and one step m between and t, the calculation æt, in the case of Eq would become:
at 3m (edr-Am - 1) Eo (Xm, m), where amm
1) Eg (I,,
Ct.
C. Fm 0s
Om
If we directly set 6g (æm, m) = Eg (æ., 8), it would be equivalent to the results in Equation take step directly from s to (see the derivation in Appendix A. I. This approach results in faster computation, as it eliminates the need to compute ey (æm: m) however, it compromises the quality of the resulting image. In contrast, another time-consuming but optimal way calculate Eg (Im, m) as usual, which necessitates full model evaluation but yields superior image quality.
Recognizing that eg (I,: represents rapid yet suboptimal solution and Eø (æm., m) represents slower but optimal solution when calculating 2t, we want to find a model ě(æm, m), which the interpolation of these two models. We first define the interpolation as follows:
(5) slider that can smoothly transition between the two endpoints Eg (x,, s) and Eş (Im, m). Eg (0( m) needs to meet two criteria: it should approximate the output of (æm, m) and be faster for inference compared to 6o (Im, m). By creating the interpolation I, we generate large collection of models, allowing us to search within this set find if there exists an ēg (m,, m) that satisfies requirements.
Eg (mm, m; 3) = Eeeg (x,, s) , Eg (xm: m).
where ēø (Im, m) is controlled by set of variables (3, functioning
3.3 Caching the Layer: A Feasible Choice for the Interpolation I
In this section, we specifically define an interpolation I and explore the possibility of the existence of éa (mm, m) within it. Given the transformer architecture, propose interpolation schema

---

MHSA DITXOL2
Feedforwerd DITAL22
H+SA VNITIM
UNTT
Lapel Iil
Loyal' 1il0
Liyer da
Figure Approximation Error for DiT and U-ViT in different timesteps and different layers
by leveraging the layers of the transformer model. Here we take the computation of DiT 46 as an illustrative example. The transformer model can be decomposed into sequence of basic layers (h, t) where (h, t) h g(t) f: (h, t), consisting of a residual connection. Here, h is the input feature, and D denotes the depth of the model. is the time condition. fi(h, t) can represent either multi-head self-attention (MHSA) block or pointwise feedforward block, and g is time-conditioned scalar. We omit the condition / in fe(h, I) for simplicity. Then we can construct a linear interpolation within the layers, and this interpolation of layer satisfies the model interpolation (See Appendix (
(6) where hy and hTth is the input to the block L, at timestep and m respectively. B, is a coefficient in layer& to control the proximity to fh!"") or f (x²) and a; is to used as an control for the input. Both of these variables are constrained within the range [0, 1].
Li(hT", m.; 04, B.) h,T (1 - a.)) (h."" hh]) + ( (3: [(hTT) +1 3.) f(h))
This interpolation provides a special mechanism for inference. If 33 in layer i is set to 0, the output be directly taken from the layer in the previous timestep, allowing the computation cost in this layer to be skipped. Non-zero 3 would trigger the original computation of layer i. A discretized 31 be seen
router, which selects the layers be activated or disabled. And for og, it can be
set to any value since there is almost no computation cost for a combination of ht" and hg and we choose a; 0. By setting more 3; in different layers Therefore, we can calculate the total computational cost based on the number of non-zero B,, and our goal ég (a m) can be interpreted as finding as many zeros in ( possible with the minimal approximation eтror between Eo (Im, m. and Eg (Im: m..
the acceleration ratio can be cumulative.
One key observation. One greedy way for finding the Bi in each layer is taking the approximation error of each layer into account:
E ||((-) - -
= (1- 3.) -1))
s(h))1
and taking 3, in those layer with smallest [g(m) [l f(ht) to be In Figure in two types of models: DiT and U-ViT. We find that performance varies significantly across different timesteps, even at the same layer. Particularly in the DiT model, the error is markedly higher in the later steps compared to the early denoising steps. Additionally, the performance of
analyze [ - [
self-attention differs substantially from that of feedforward layers. Based on this, we assign each timestep with its own (2 Thus, B becomes time-variant, where 3= (3, i 1, 2, ... j = 1,2,.... D} and is the total denoising steps.
In addition, we directly use this metric as the criterion for 3:y and employ it during inference. From the experimental results 4 we observe that it cannot effectively handle a combination of layers. This limitation arises because the approximation error for each layer is influenced by changes in the preceding layer. However, exhaustively evaluating all possible configurations is impractical, as the number of trials increases exponentially with the depth of the model.
3.4 Learning to Cache
To address this, we propose the following method: Learning to Cache. Recall that our goal is to find a éø (Xm, m) that is (1) as close as Ey (xm, m) and (2) with minimal computation cost. We can reformulate this as optimization problem as:
arg min (wmm m; 3) e(xm, m)ll s.t. Σ 88 SC
(8)
3
5

---

Algorithm Training
Algorithm Sampling
I: Input:
Data distribution p(ao). diffusion model co (,))), learning rate ODE solver (P)), total steps
1: Input: solver ((.). threshold 0, total steps and the step schedule {ta ) in (r(-)
Diffusion model Es(-). router B, ODE
T and the step schedule {t, V (-(-)
2: G (O)
2: æT ~ ~=(00,1)
3: repeat
3: for n. T...., do
4:
~ p(#o), U11,T//1
4: h E-
// Step for calculating states for caching
5: for ....., do
luv2
if Sigmoid( 0 and step n
6:
a. ~N (2.; 1
cache step then
6, f- co(2,, 5) and cache (SO)2
7:
9. + else
// Step m for using cached states
8:
8:
2n-2-1
9:
3
9:
We.., m.)
end
3m + -igmoid
11:
1.21 <- Li 0n by Eq
I/ Optimize
12:
end for
11:
Calculate é( m; 9m by Eq
13: ē(znn In) l1
12:
C +- 1-=((mm m) mm;
m A
14: #n-1 <- ((((nn bn), Lns bn-1)
13:
3.n 8m VVVa,..
15: end for
until converged
16:
return
where C' is the constraint for the total cost. dg.y1 is the Kronecker delta function, which is 1 if Bij Though Bij the final solution needs to be discrete, 9i is designed to continuous to make the computation differentiable when optimized. And when inference, threshold 0 would be set to discretize the 3ij to be either 0 or I, where 3Gg turned to become a router. The only trained variables in our algorithm are B. Thus, the parameters in the diffusion model would remain unchanged. With the help of Lagrange duality to transform the optimization problem into an unconstrained one, the loss would be:
L(e, c, Fm, m: B) ||((#m, m: B) c(Ei, m)l12 A Σ Bij
where À is the Lagrangian multiplier that governs the regularization. We show the algorithm for training and inference in Coforithmaandie To ensure 3 remains within the range [0, 1J. sigmoid operation is performed before ,3 is passed into the model. In these algorithms, we adopt layer caching every two steps, representing that only half of the steps would inference in faster speed. For simplicity, the image encoder and decoder are omitted.
Experiments
4.1 Experimental Setup
Models and Datasets. We explore methods two commonly used transformer architectures in diffusion models: DiT (46) and U-ViT 3] Specifically, we use DiT-XL/2 (256x256) DiT-XI/22 (512x512), DÍT-L/2 and U-ViT-H/2. Except for DiT-L/2, trained a DiT-L/2 for one million steps, which used to investigate if layer redundancy exists in smaller models that may not be fully converged. Most of the results are presented under the resolution x56x256 and we also show the results on models that generate high resolution 512x512 images.
the officially released models. We
Implementations. Since the parameters of the diffusion model would not be updated, the only parameters that require optimization are B3 resulting in a very limited number of variables. For example, for DiT-XL- with 20 denoising steps, the number of trainable variables is 560. We take the training set of ImageNet to train 3 for epoch. The learning rate is set to 0.01 and AdamW W optimizer is used to optimize B. The training is conducted upon 8 A5000 GPUs with global batch size equal 64. To train with classifier-free guidance, we randomly drop some labels and assign a null token to the label. The dropping rates for labels follow the original training pipeline.

---

Table Accelerating imgge generation on ImageNet for the DiT model family.
Methods
NFE
MACs(T)
Latency(s)
Speedup
1St
FID,
sPID
Precision
Recall
DiT-XL/2 (ImageNet 256x256) (cfg=1.5)
DDPM
250
28.61
36.55
280.1
2.27
4.54
82.73
57.95
DDIM
250
28.61
36.45
243.4
2.14
4.55
80.70
60.57
DDIM
50
5.72
7.25
1.00x
238.6
2.26
4.29
80.16
59.89
DDIM
40
4.57
5.82
1.24x
239.8
2.39
4.28
80.36
59.13
Ours
50
4.36
5.57
1.30x
244.1
2.27
4.23
80.94
58.76
DDIM
20
2.29
2,87
1.00x
223.5
3,48
4.89
78.76
57.07
DDIM
16
1.83
2.30
1.25
210.9
4.68
5.71
76.78
56,20
Ours
20
1.78
2.26
1.27x
227.0
3,46
4.64
79.15
55.62
DDIM
10
1.14
1,43
1.00
158.3
12.38
11.22
66,78
52.82
DDIM
9
1.03
1.29
1.11x
140.9
16.57
14.21
62.28
49.98
Ours
10
1.04
1.30
1.10x
156.3
12.79
10.42
66.21
52.15
DIT-XL/2 (ImageNet 512x512) (cfg=1.5)
DDIM
22.85
37.73
1.00
204.1
3.28
4.50
83.33
54.80
DDIM
30
13.71
22.51
1.68x
198.3
3.85
4.92
83.01
56.00
Ours
50
14.19
22.57
1.67
202.1
3.69
5.03
82.90
54.60
DiT-L/2 (ImageNet 256x256) (cfg=1.5)
DDIM
50
3.88
5.06
1.00
167.6
4.82
4.40
78.72
54.66
DDIM
40
3.10
4.06
1,25x
168.2
4.99
4.43
79.01
54.71
Ours
50
2.95
4.01
1.26x
168.3
4.82
4.41
78.97
54.73
DDIM
20
1.55
2.01
1.00x
160.16
6,45
5.26
77.13
53,65
DDIM
16
1.24
1.63
1,23x
151.70
7.91
6.24
75.93
51.71
Ours
1.20
1.26x
160.53
6.55
5.08
77.47
52.22
Table 2: Results with U-VIT-H/2 ImageNet dataset. The resolution here is 256x256. We adopt the DPM-Solver-2, which has function evaluations per step. The total NFE (instead of steps) is reported below. Guidance strength is 0.4.
Methods
NFF
MACs
Latency
Speedup
FID
NFF
MACs
Latency
Speedup
FID,
50
6.44
19.37
1,00x
2.3728
20
2,58
7.69
1.00x
2.5739
DPM-Solver
30
3,86
11.55
1,68x
2.4644
16
2,06
6.08
1.26x
2.7005
Ours
50
3.79
11.16
1.74x
2,3625
20
1.92
5.64
1.35
2,5809
Evaluation. We tested our method upon two samplers, DDIM and DPM-Solver(36) with sampling steps from 10 to 50. For the DiT model, we use the DDIM sampler. And for U-ViT, use the DPM-Solver-2. All the experiments here use classifier-free guidance. To evaluate the image quality, 50k images are generated per trial. We measure the image quality with Frechet Inception Distance(FID) [43, s sFID [3), Inception Score[51], Precision and Recall[26] Besides, we reported the total MACs and the latency to make comparison of the acceleration ratio. The MACs is evaluated using pytorch-OpCounce
and the latency is tested when generating a batch of images(8 images) with classifier-free free guidance single A5000, which we conducted five tests and took the average.
4.2 Main Results
We present the results DiT in [and comparing our algorithms with samplers of comparable inference speed. Our method requires denoising steps, but each step takes less average time. In contrast, samplers require fewer steps, but each step takes more time. Our experiments demonstrate that methods significantly outperform DDIM and DPM-Solver. For instance, with the 20-step DDIM on DiT-XL/2, our method achieves an FID of 3.46, nearly identical to the unaccelerated one. In comparison, the DDIM achieves an FID of 4.68. When generating high-resolution images, sampling with fewer steps, or using relatively smaller model, our method still outperforms baselines.

---

10
DDIM
D194-Solor22
Manual: from Bottom
3.0
from
Marust: Ep
Manual from
Manual:
Kanual: Random
Marual: Metrics
Learring to Cache
2.9
Nanual Metrics
to-ming-o--Cache
2.8
2.7
2.-
1.6
2.4
2.5
5.0
4.5
5.0
5.5
6.5
7.0
5.0
Figure 4: Speed-Quality Tradeoff DiT-XL/2 and U-ViT-H/2 with 20 denosing steps as the basis. The dashed line indicates the performance without applying inference acceleration.
Table 3: Comparison with other cache- based method on V-VIT
Table 4: Maximum cacheable layers for DiT and U-ViT with different steps.
Methods
NFE
Latency
Speedup
FID.
Model
DiT-XL/2
U-ViT-H/22
DPM-Solver
NFE
50
20
50
20
Cach
40
20
4.68
1.64x
2.70
Ours
4.62
1.67x
2.64
Remove Ratio
47.43%
44.29%
93.68%
63.79%
Faster Diffusion
2M
20
5.95
1.29x
2.82
Remove Ratio
47.85%
44.64%
94.11%
60.54%
Ours
5.93
1.30x
2.57
MHSA Remove Ratio
47.00%
43.93%
93.25%
67.05%
However, we observe that achieving nearly lossless compression under these conditions is challenging. We argue that this difficulty arises because layer redundancy is less apparent these scenarios.
Quality-Lateney Tradeoff. We show the trade-off curve between FID and Latency in Figure These figures offer more comprehensive comparison with two types of baselines: (1) Heuristic Methods for Selecting Layers. We designed several methods for selecting layers cache, including rule-based approaches such caching from top to bottom or from bottom to top, randomly selecting layers, and metric- based selection as described 7 We found that when the dependency between layers must be considered, they fail to select the optimal layers, leading to a degradation in image quality. contrast, our method consistently achieves improved quality across various acceleration ratios. (2) Sampler with fewer steps. Our method significantly outperforms DDIM and DPM-Solver, as evidenced by the detailed comparison provided.
Maximum Cacheable Layers for diffusion transformer. From the trade-off curve, we found that there exists an upper limit for the number of cacheable layers. Below this limit, image quality remains almost unaffected, as indicated by FID degradation of less than 0.01. This limit detailed in Table 4 Notably, caching does not occur at every step: step involves full model inference, while only step m caches layers. With a significant proportion of layers can be cached and the computation of these layers to be saved, notable differences emerge between the U-VIT and DiT models. For instance, in U-VIT, up to 94% of layers can be discarded for the cache step during the denoising process, whereas this proportion is considerably lower for DIT. Furthermore, observed that the cacheable ratios for FFN and MHSA vary.
Comparison with other cache-based methods We also compared our method with other cache- based methods. Notably, previous cache-based methods are strongly coupled to the U-Net structure and cannot be applied to models without the U-structure, such as DIT. ensure a fair comparison, we selected U-VIT, which incorporates both the U-structure and transformers, to implement these methods as baselines alongside our method. Table the comparison results. The findings demonstrate that our method achieves better quality than the basclines.

---

Attention
Denoua
Cache
Layen: Shallow - Deep (a) Self Attention
Layer: Shallow Deep
(b) MLP
Not Cache
Denoising
Layer: Shallow
Deep
Layer: Shallow
Deep
Figure 5: Learned Router 3 for DiT-XL/2 (Top) and U-ViT-H/2 (Bottom). Different caching patterns observed in different types of diffusion transformers.
Table 5: Comparison with layer dropout. The removal ratio corresponds the percentage of sub- layers being removed, including both MHSA and MLP blocks, for total of 28 layers and 10 steps.
Methods
Remove Ratio
Latency(s)
Specdup
1S1
FID]
sFID.
Precisionf
Recallf
Random Drop
170/660
2,439
1.18x
3.36
277.42
171.83
1.23
0.24
Learning-to-Der
179/560
2.421
1.19x
113.93
17.35
28.46
60.25
$2.68
Learning to-Cache
176/560
2.438
1.18x
226.13
3.47
4.58
79.19
$6.47
4.3 Analysis
The Learned Pattern of [ We present the learned pattern in Figure 5 The two different archi- tectures produce distinct patterns. For U-ViT, the entire middle section is almost entirely cacheable, allowing it to be replaced with the results from the previous step's calculations. However, the compu- tations at both ends of the model are crucial and cannot be discarded. This observation explains why DeepCache outperforms faster-diffusion designed approach of DeepCache. However, this phenomenon is not clearly observed DiT-XL. Additionally, we found consistent tendency across models to retain stages while discarding calculations in the earlier stages. This observation aligns with our findings in Figure 3 When comparing the impact of different steps within the same layer, removing parts with smaller timestep has a greater effect on the changes in the output.
V-V as the learned patterns resemble the manually
computation in the later
Comparison between Layer Cache and Layer Dropout Layer dropout involves directly removing Jı(), retaining only the computation in the skip path. We compare our method with layer dropout, where the layers are either randomly dropped or optimized using our algorithm (named Learning-te -oo Drop). The results, presented in Table indicate that layer caching significantly outperforms layer dropout. Interestingly, when we learn the layers to be dropped, the models still produce acceptable images, although the quality is not as high. Illustrative examples are provided in Appendix B.2
Choice of threshold We investigated the effect of different thresholds on the image quality. Results are shown in Figure 6, where the model here is trained with six different À (cor- responding points on one curve). We show the effect of different in Appendix B.3] Our results reveal that for higher acceleration ratios, a larger threshold improves image quality, Conversely, for lower acceleration ratios, smaller threshold is more effective. These also findings suggest that ranking layers by importance is not reliable approach, since the selection of layers does not follow strict sequential order. Otherwise, one threshold would win all.
ThareC3
Labency(s))
Figure 6: Effect of threshold 8.

---

Limitation
The primary limitation of this work arises from its dependence on the trained diffusion models. For instance, when applied to DiT-XL/2 at resolution of 512, our method encounters slight drop in FID. Although it still surpasses the baseline, this indicates that the lossless caching of the layers does not uniformly exist across all models. It highlights significant variations between different models, and thus our method is strongly dependent on the structure design of the trained diffusion models. Another limitation of our method is that the acceleration is capped at 2x because every two steps consist one full model inference step and one cheaper step. This inherently restricts the maximum achievable acceleration ratio. However, we believe that this approach can be expanded to more than two steps, potentially improving the overall efficiency.
Conclusion
In this paper, propose novel acceleration method for diffusion transformers. By interpolating between the computationally inexpensive solution but suboptimal model, and the optimal solution but expensive model, find there exist some models which would infer much faster and also produce high-fidelity images. To find this we train the router which is continuous when training and would be discretized when inference. Experiments show that our method largely outperforms baselines such as DDIM, DPM-Solver and other cache-based methods.
Acknowledgement
This project is supported by the National Research Foundation, Singapore, under its Medium Sized Center for Advanced Robotics Technology Innovation.
10

---

References
[1] Shubham Agarwal, Subrata Mitra, Sarthak Chakraborty, Srikrishna Karanam, Koyel Mukherjee, and Shiv Kumar Saini. Approximate caching for efficiently serving (Text-to-Image) diffusion models. 21st USENIX Symposium on Networked Systems Design and Implementation (NSDI 24), pages 1173-1189, 2024.
[2] Fan Bao, Chongxuan Li, Jun Zhu, and Bo Zhang. Analytic-dpm: an analytic estimate of the optimal reverse variance in diffusion probahilistic models. arXiv preprint arXi::220..0650 2022.
[3] Fan Bao, Shen Nic, Kaiwen Xue, Yue Cao, Chongxuan Li, Hang Su, and Jun Zhu. All are worth words: A vit backbone for diffusion models. In Proceedings of the IEEE/CVF Conference Computer Vision and Pattern Recognition, pages 22669-22679, 2023.
[4] Tim Brooks, Bill Peebles, Connor Holmes, Will DePue, Yufei Guo, Li Jing, David Schnurr, Joe Taylor, Troy Luhman, Eric Luhman, Clarence Ng, Ricky Wang, and Aditya Ramesh. Video generation models as world simulators. 2024.
[5] Ziang Cao, Fangzhou Hong, Tong Wu, Liang Pan, and Ziwei Liu. Large-vocabulary 3d diffusion model with transformer. arXiv preprint arXir:2309.07920 2023.
[6] Thibault Castells, Hyoung- Kyu Song, Bo-Kyeong Kim, and Shinkook Choi. Ld-prumer: Efficient pruning of latent diffusion models using task-agnostic insights. arXiv preprint arXiv:2404.J 1936, 2024.
Sen He, Yanping Xie, Animesh Sinha, Ping Luo, Tao Xiang, and Juan-Manuel Rua. Gentron: Delving deep into diffusion transformers for image and video generation. arXiv preprint 231.:223., 2023.
Shoufa Chen, Mengmeng Xu, Jiawei Ren, Yuren Cong.
[8] Zigeng Chen, Gongfan Fang. Xinyin Ma, and Xinchao Wang. 0.1% data makes segment anything slim. arXiv preprint arXiv:2312.05284 2023.
[9] Zigeng Chen, Xinyin Ma, Gongfan Fang, Zhenxiong Tan, and Xinchao Wang. Asynediff: Parallelizing diffusion models by asynchronous denoising. arXiv preprint arXiv:2406.06611, 2024.
[10] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 34:8780-8794, 2021.
[11] Tim Dackhorn, Arash Vahdat, and Karsten Kreis. Score-based generative modeling with critically- langevin diffusion. arXiv preprint vrXiv:2112.07060 2021.
[12] Alexey Dosovitskiy. Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai Thomas Unterthiner. Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words:
Transformers for image recognition at scale. arXiv preprint arXiv:2010. /929, 2020.
[13] Patrick Esser, Sumith Kulal, Andreas Blattmann, Rahim Entezari, Jonas Müller, Harry Saini, Yam Levi, Dominik Lorenz, Axel Sauer, Frederic Boesel, et al. Scaling rectified flow transformers for high-resolution image synthesis. In Forty-first International Conference on Machine Learning, 2024.
[14] Angela Fan, Edouard Grave, and Armand Joulin. Reducing transformer depth on demand with structured dropout. In International Conference on Learning Representations, 2020.
[15] Gongfan Fang, Xinyin Ma, Michael Mi, and Xinchao Wang. Isomorphic pruning for vision models. arXiv preprint arXiv:2407.0461 2024.
[16] Gongfan Fang, Xinyin Ma, and Xinchao Wang. Structural pruning for difffusion models. Advances in neural information processing systems, 36, 2024.
[17] Shanghua Gao, Pan Zhou, Ming-Ming Cheng, and Shuicheng Yan. Masked diffusion transformer is strong image synthesizer. In Proceedings of the IEEF/CVF International Conference Computer Vision, pages 23 23164-23173 2023.
[18] Yefei He, Luping Liu, Jing Liu, Weijia Wu, Hong Zhou, and Bohan Zhuang. Ptgd: Accurate post-training guantization for diffusion models. In Oh. Naumann, A. Globerson, Saenko, M. Hardt, and S. Levine, editors, Advances in Neural Information Processing Syxtems, volume 36, pages 13237-13249. Curran Associates, Inc., 2023.
[19] Jonathan Ho, Ajay Jain, and Pieter Abbeel, Denoising diffusion probabilistic models. Advances in neural information processing systems, 13:6540-6851, 2020.

---

[20] Rosco Hunter, Lukasz Dudziak, Mohamed S Abdelfattah, Abhinav Mehrotra. Sourav Bhattacharya, and Hongkai Wen. Fast inference through the reuse of attention maps in diffusion models. arXiv preprint arXiv:2401.0100 2023.
[21] Xin Jing, Yi Chang, Zijiang Yang. Jiangjian Xie, Andreas Triantafyllopoulos,, and Bjoem W Schuller. U-dit uts: U-diffusion vision transformer for text-to-speech. In Speech Communication; 15th ITG Conference, pages 56-60. VDE, 2023.
[22] Alexia Marttnna,, Ke Li, Rémi fast when generating data with score-based models. arXiv preprint arXiv:2105. 14080, 2021.
Tal Kachman, and loannis Mitliagkas. Gotta go
[23] Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusion-based generative models. Advances in Neural Information Processing Systems, 35:26565-26577, 2022.
[24] Bo- Kim, Geonmin Kim, Tac-Ho Kim, Thibault Castells, Shinkook Choi, Junho Shin, and Hyoung- Kyu Song. Shortened Ilama: A simple depth pruning for large language models. arXiv preprint arXiv:2402.0256 2024.
[25] Bo-Kyeong Kim, Hyoung- Kyu Song, Thibault Castells, and Shinkook Choi. Bk-sdm: Architecturally compressed stable difflusion for efficient text-to-image generation. Workshop on Efficient Systems for Foundation Models@ ICML2023, 2023.
[26] Tuomas Kynkäänniemi, Tero Karras, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Improved precision and recall metric for assessing generative models. Advances in neural information processing systems, 32, 2019.
[27] Muyang Li, Tianle Cai, Jiaxin Cao, Qinsheng Zhang, Han Cai, Junjie Bai, Yangqing Jia, Ming- Yu Liu, Kai Li, and Song Han. Distrifusion: Distributed parallel inference for high-resolution diffusion models. arXiv preprint arXiv:2402. 19481, 2024.
[28] Senmao Li, Taihang Hu, Fahad Shahbaz Khan, Linxuan Li, Shiqi Yang, Yaxing Wang, Ming-Ming Cheng, and Jian Yang. Faster diffusion: Rethinking the role of unet encoder in diffusion models. arXiv preprint arXiv:2312. 096688, 2023.
[29] Xiuyu Li, Yijiang Liu, Long Lian, Huanrui Yang, Zhen Dong, Daniel Kang, Shanghang Zhang, and Kurt Keutzer. Q didifuusion: Quantizing diffusion models. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 17535 17535-17545, October 2023.
[30] Yanyu Li, Huan Wang, Qing Jin, Ju Hu, Pavlo Chemerys. Yun Fu, Yanzhi Wang, Sergey Tulyakov, and Jian Ren. Snapfusion: Text-to-image difffusion model mobile devices within two seconds. Advances in Neural Information Processing Systems, 36, 2024.
[31] Shanchuan Lin, Anran Wang, and Xiao Yang. Sdxl-lightmin:: Progressive adversarial diffusion distillation. arXiv preprint arXiv:2402. /3929, 2024.
[32] Enshu Liu, Xuefei Ning. Zinan Lin, Huazhong Yang, and Yu Wang. Oms-dpm: Optimizing the model schedule for diffusion probabilistic models. arXiv preprint arXiv:2306.08860. 2023.
[33] Huadai Liu, Rongjie Huang, Xuan Lin, Wenqiang Xu, Manzong Zheng, Hong Chen, Jinzheng He, and 7hou Zhao. Vit-tts: visual texe-to-speech with scalable diffusion transformer. arXiv preprint 2i3: 12708, 2023.
[34] Luping Liu, Yi Ren, Zhijie Lin, and Zhou Zhao Pseudo numerical methods for diffusion models on manifolds. arXiv preprint arXiv:2202.099 09778, 2022.
[35] Songhua Liu, Weihao Yu, Zhenxiong Tan, and Xinchao Wang. Linfusion: 1 gpu, minute, 16k image. arXiv preprint arXiv:2409.0 409002997 2024.
[36] Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. Dpm-solver: A fast ode solver for diffusion probabilistic model sampling in around 10 steps. Advances in Neural Informaionn Processing Systems, 35:5775 5787,, 2022.
[37] Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu, Dpm-solver++: Fast solver for guided sampling of diffission probabilistic models. arXiv preprint arXiv:221 2022.
[38] Haoyu Lu, Guoxing Yang. Nanyi Fei, Yugi Huo, Zhiwu Lu, Ping Luo, and Mingyu Ding. Vdt General- purpose video diffusion transformers via mask modeling. In The Twelfth International Conference on Learning Representations, 2023.
12

---

[39] Simian Luo. Yiqin Tan, Longbo Huang, Jian Li, and Hang Zhao. Latent consistency models: Synthesizing high-resolution images with few-step inference. arXiv preprini urXiv:2310.04377, 2023.
[40] Xinyin Ma, Gongfan Fang, and Xinchao Wang. Deepeache: Accelerating diffusion models for free. arXiv preprint arXiv:2312.00855 2023.
[41] Shentong Mo, Enze Xie, Ruihang Chu, Lanqing Hong, Matthias Niessner, and Zhenguo Li. Dit-3d: Exploring plain diffusion transformers for shape generation. Advances Neural Information Processing Systems, 36, 2024.
[42] Tachong Moon, Moonseok Choi, EungGu Yun, Jongmin Yoon, Gayoung Lee, and Juho Lee. Early exiting for accelerated inference in diffusion models. In ICML 2023 Workshop on Structured Probabilistic Inference {(&} Generative Modeling, 2023.
[43] Charlie Nash, Jacob Menick, Sander Dieleman, and Peter W Battaglia. Generating images with sparse representations. arXiv preprint arXiv:2103.03884 2021.
[44] Zizheng Pan, Bohan Zhuang, De-An Huang. Weili Nie. Zhiding Yu, Chaowei Xiao, Jianfei Cai, and Anima Anandkumar. T-stitch: Accelerating sampling pre-trained diffusion models with trajectory stitching. arXiv preprint arXiv:2402. 167 2024.
[45] Zizheng Pan, Bohan Zhuang, De-An Huang, Weili Nie, Zhiding Yu, Chaowei Xiao, Jianfei Cai, and Anima Anandkumar. T-stitch: Accelerating sampling in pre-trained diffusion models with trajectory stitching, 2024.
[46] William Peebles and Saining Xie. Scalable diffusion models with transformers. In Proceedings of the IEEE/CVF International Conference Computer Vision, pages 4195-4205, 2023.
[47] Ziheng Qin, Kai Wang, Zangwei Zheng. Jianyang Gu, Xiangyu Peng, Zhaopan Xu, Daquan Zhou, Lei Shang, Baigui Sun, Xuansong Xie, et al. Infobatch: Lossless training speed up by unbiased dynamic data pruning. arXiv preprint ar wwxx::2:330000 04947, 2023.
[48] David Raposo, Sam Ritter, Blake Richards, Timothy Lillicrap, Peter Conway Humphreys, and Adam Santoro. Mixture-of-depths: Dynamically allocating compute in transformer-basel language models. arXiv preprint Xr:: 2024.
[49] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björ Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEF/CVF conference on computer vision and pattern recognition, pages 10684-10695, 2022.
[50] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. Medical Image Computing and Computer-Asse Assisted Intervention MICCAI 2015: 18th International Conference, Munich, Germany, October 5-9 2015, Proceedings. Part III 18, pages 234 241. Springer, 2015.
[51] Tim Salimans, Ian Goodfellow, Wajeiech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. Advances in neural information processing systems, 29, 2016.
[52] Tim Salimans and Jonathan Ho. Progressive distillation for fast sampling of diffusion models. arXiv preprint arXiv:2202.00512 2022.
[53] Yuzhang Shang, Zhihang Yuan, Bin Xie, Bingzhe Wu, and Yan Yan. Post-training quantization on diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1972-1981, 2023.
[54] Andy Shih, Suneel Belkhale, Stefano Ermon, Dorsa Sadigh, and Nima Anari. Parallel sampling diffusion models. arxiv preprint arXiv:2305.166 16317, 2023.
[55] Alan Jay Smith. Cache memories. ACM Computing Surveys (CSUR), 14(3y473-530, 1982.
[56] Junhyuk So, Jungwon Lee, and Funhyeok Park. Frdiff: Feature reuse for exquisite zero-shot acceleration of diffusion models. arXiv preprint arX1v:2112.03517, 2023.
[57] Jiaming Song. Chenlin Meng, and Stefano Ermon. Denoising diffusson implicit models. arXiv preprint arXiv:2010.00 02502, 2020.
[58] Yang Song. Prafulla Dhariwal, Mark Chen, and Ilya Sutskever. Consistency models. arXiv preprint arXiv:2303.0144 2023,
13

---

[59] Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in neural information processing systems, 32, 2019.
[60] Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.1355.. 2020.
[61] Zhenxiong Tan, Xinyin Ma, Gongfan Fang, and Xinchao Wang. Litefocus: Accelerated diffusion inference for long audio synthesis. arXiv preprint arXiv:2407. 10468, 2024.
[62] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention all you need. Advances neural information processing systems. 30, 2017.
[63] Kafeng Wang, Jianfei Chen, He Li, Zhenpeng Mi, and Jun Zhu. Sparsedm: Toward sparse efficient diffusion models, 2024.
[64] Felix Wimbauer, Bichen Wu, Edgar Schoenfeld, Xiaoliang Dai, Hou, Zijian He, Artsiom Sanakoyeu. Peizhao Zhang, Sam Tsai, Jonas Kohler, et al. Cache me if you can: Accelerating diffusion models through block caching. arXiv preprint arXiv:2312.0322 2023.
[65] Shuai Yang. Yukang Chen, Luozhou Wang. Shu Liu, and Yingcong Chen, Denoising diffusion step-aware models. arXiv preprini urXiv:2310.03337, 2023.
[66] Xingyi Yang and Xinchao Wang. Hash3d: Training-free acceleration for 3d generation. arXiv preprint arXiv:2404.080 060691 2024.
[67] Xingyi Yang, Daquan Zhou, Jiashi Feng, and Xinchao Wang. Diffusion probabilistic model made slim. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 22552- 22562, 2023.
[68] Xiulong Yang. Sheng-Min Shih, Yinlin Fu, Xiaoting Zhao, and Shihao Ji. Your vit is secretly a hybrid discriminative-gnnzzaae diffusion model. arXiv preprint vrXiv:2208.0779/ 2022.
[69] Runpeng Yu, Songhua Liu, Xingyi Yang, and Xinchao Wang. Distribution shift inversion for out-of- distribution prediction. In Proceedings the IEEE/CVF Conference Computer Vision and Pattenn Recognition, pages 3592-3602, 2023.
[70] Rumpeng Yu and Xinchao Wang. Neural lineage. In Proceedings the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4797-4807, 2024.
[71] Dingkun Zhang, Sijia Li. Chen Chen, Qingsong Xie. and Haonan Lu. Laptop-diff: Layer pruning and normalized distillation for compressing diffusion models, arXiv preprint arXiv:2404.11098 2024.
[72] Qinsheng Zhang and Yongxin Chen. Fast sampling of diffusion models with exponential integrator. arXiv preprint arx::22044. 13902, 2022.
[73] Qinsheng Zhang, Molei Tao, and Yongxin Chen. gddim: Generalized denoising diffuusin implicit models. arXiv preprint arXiv:2206.0585 055664 2022.
[74] Wentian Zhang, Haozhe Liu, Jinheng Xie, Francesco Faccio, Mike Zheng Shou, and Jürgen Schmidhuber. Cross-attention makes inference cumbersome text-to-image diffusion models, 2024.
[75] Yang Zhao, Yanwu Xu, Zhisheng Xiao, and Tingbo Hou. Mobilediffusion: Subsecond text-to-image generation on mobile devices. arXiv preprint arXiv:2311. 2023.
[76] Hongkai Zheng, Weili Nie, Arash Vahdat, and Anima Anandkumar. Fast training of diffusion models with masked transformers. arXiv preprint arXiv:2306.000 300.0930,, 2023.
14

---

A
Proof
A.1 Two equivalent solutions to obtain #;
To got the solution of æ,, the following two approaches yield equivalent results:
1. Directly update æt from By the definition, the solution at time / would be:
D2 0 oz (e^--h, - 1) ca (Z)..
(10)
2. First compute Im from a. and then compute æ, from om with Eg (Ims m) Eo (x)..
Proof. First, consider the solution of mm from Ez:
Oin Ws om (E 1) Eg (x),
2m
(11)
as
And for the calculation of 24 with Eo (Im, m) Eo (I.: we have
0t
Im - de (c - 1) cB (Im; m)
It =
a'm U.
Om (eAm-de -1 en (1)s; os (edr-Am -1) Eo (x),
0lm
(O's
at
at om (c (d 1) os (e-r-Am -1) Eg (2r:: 8)
(12)
0ig
Om
Note that d = log (at/or).
We obtain:
ai 0m
am Ts
-1) +
at Fm
-1) Eo (x..
a2s
a'm
Om as
0z am
De
Oxs
oe
EB (I.1
ws ae (e - 1) ED (x.18)
(13)
a3s
ass
as
A.2 Layer interpolation and Interpolation I
We next show that the following interpolation of the layer would satisfy the interpolation I between eo (Ix,, 8) and eo (Im, m. as we define:
La m) = h - (1 - a:)) (h."" - -h²) + g(m) (8, f(h?) + B.).
(14)
To prove this, we need to show these three things: (1) Interpolation condition, where the function passes through the given two models eg (æ., s) and (æ m): (2) Continuity, where the interpola- tion function is continuous and (3) Differentiability, where the function is differentiable. Since 3, and a are continuous and the model also satisfies these conditions. the only thing that needs to be proved is the first property.
Proof. We show Eq 14 satisfies the interpolation condition of I
With {a and (3,) set to O, the output of the transformer would be ea (x., 8)
If for i E D), ag = and 3, = then
La(h"" m) hū + g(m) f(hī)
(15)
The output of the transformer after D layer given by:
L. (L.D-1 ( (x.,, 8) )).) Eg (2t,, 8)
(16)
Therefor, get eg (x.,8). one of the endpoint in the interpolation I.
With { and [ set to 1, the output would be (Im, m). If for E (1,
0; and B then
L m) = hT" + ( f(A(m)
(17)
The same above, would get eq (æm, m), the other endpoint in the interpolation I.
15

---

B
Additional Experiments
B.1
Shifted cache step for DPM-Solver
Table DPM-Solver with and without Shifted Cache Steps. Here we cache all the layers.
Method
NFE
Latency
Speedup
IS
FID
sFID
Precision
Recall
DPM-Solver-2
20
7.69
1.00x
263.76
2.57
5.01
82.77
55.71
Cache
20
4.25
1,81 x
222.64
5,30
7.87
76.17
54.59
Cache shifted
20
4.54
1,70x
254.48
2.80
4.70
81.14
55.48
One important trick used in our experiment with DPM-Solver involves shifting the cache step. Specifically, when employing DPM-Solver-2, the cache steps (step here is the model evaluation) are shifted from [2.4.6,8,10....] to [3,5,7,9,1 I,..], This adjustment is necessary because the DPM-Solver-2 requires the first-order derivative of the model c at the current timestep. which computed by subtracting the output at timestep i from the output at timestep i + 1. If the cache steps were taken at timestep + 1, it would result an incorrect estimation of the derivative. By shifting the cache step, we ensure the accurate calculation of the derivative of (-). This adjustment significantly impacts the results, as demonstrated in 6
B.2 Layer Dropout Layer Cache
Here we present further comparisons between layer dropout and layer caching. As illustrated in Figure layer caching significantly outperforms layer dropout, maintaining pixel-wise consistency with the original pipeline. Conversely, when the layers to be dropped are selected by our algorithm, the model can still generate images with correct semantics. However, randomly dropping layers severely compromises the model's ability to produce acceptable images. Table 7 demonstrates that even small proportion of layer dropout (around 10%) results in a substantial performance degradation.
Figure 7: The quantitative results for layer dropping and layer caching in Section 4.3 (a) DDIM
Pipeline with 20 NFE. (2) Our method L2C with 20 NFE (3) Learn to drop the layers by algorithm. (4) Randomly drop layers. The results here, except the first line as the baseline, all speed up the inference by around 1.18x-1.19x.
B.3 Effeet of the hyper-parameter À and
We find in our experiments that the router we learned is not sensitive the hyper-parameters, including the learning rate, the training epoch, and the hyperparameters in the optimizer. The only
16

---

Table Comparison with Layer Dropout
Methods
Remove Ratio
Latency(s)
Speedup
IS1
FIDL
sFID
Precisiont
Recall
Random Drop
60/560
2.718
1.06x
9.66
112.93
153.48
10.56
65.57
Random Drop
170/560
2,439
1.18x
3.36
277.42
171.83
1.23
0.24
Learrnng--to Broiinggtt--ropg Drop
179/560
2.421
1.19x
113.93
17.35
28.46
60.25
52.68
Learning-bo -t-Cachh
176/560
2.438
1.18x
226.13
3.47
4.58
79.19
56.47
Table 8: À and 0 for training the router
Model
XLJ2
DIT-XL/2
DIT-XI./2
DIT-X1/2
DIT-1/22
DFT-L//2
U-VIT-H/2
U-VIT-H/2
NFE Resolution
50
20
50
50
20
20
256
256
256
512
256
256
256
256
Sampler
DPM-Solver-2
DPM-Solver-2
for train
Ic-6
5o-6
lo-6
5c-6
Ic-6
5c-6
0 for inference
0.1
0.1
0.1
0.9
0.1
0.1
0.9
0,9
Training Cost (Hour)
7.2
5.0
2,5
8.1
7.0
1.5
5.7
3.0
Table Performance with different Threshold is set 0.1.
Remove Ratio
Latency(s)
Speedup
Ist
FID
sFID
Precisiont
Recallf
0
0/560
2.87
1.00
223.49
3.48
4.89
78.76
57.07
5e-7
129/560
2.55
1.13
222.15
3.49
4.79
78.47
57.36
le-6
176/560
2.45
1.17
226.13
3.47
4.58
79.19
56.47
5e-6
248/560
2.28
1.26 x
226.95
3.45
4.64
79.20
55.82
le-5
300/560
2.15
1.33
223.41
3.70
4.91
78.88
56.36
5e-5
404/560
1.92
1.49 x
200.60
5.43
6.55
75.06
57.54
le-4
460/560
1.79
1.60
193.75
6.51
7.71
73.55
56.55
one that would affect the À for training and the threshold 0 for inference. We list in Table the use that could reproduce the results in Table I Here the difference between DiT and U-ViT for comes from the difference in implementation.
The results of using different À values are presented in Table Note that À serves the regularization strength to control the sparsity of the router, and thus there would not exist an optimal for all settings. It functions trade-off between latency and quality, balancing the speed of inference with the fidelity the generated images.
C Social Impact
The acceleration of diffusion transformers provides several positive social impacts, such as reducing the latency and resources required for deploying diffusion models. This enhancement improves the real-time applicability of diffusion transformers and promotes environmental sustainability. By making diffusion models more efficient, our method reduces the computational power needed for both training and inference, leading lower energy consumption and reduced carbon footprint. However, is important to note that our method does not address privacy concerns, nor does it mitigate issues related to bias and fairness in diffusion models. These challenges remain when applying our method.
17

---

NeurIPS Paper Checklist
1. Claims
Question: Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?
Answer: [Yes]
Justification:
The abstract and introduction clearly state the claims made.
Guidelines:
The answer NA means that the abstract and introduction do not include the claims made in the paper.
The abstract and/or introduction should clearly state the claims made, including the contributions made in the paper and important assumptions and limitations. A No or
NA answer to this question will not perceived well by the reviewers.
The claims made should match theoretical and experimental results, and reflect how much the results
be expected to generalize other settings.
is fine to include aspirational goals as motivation as long is clear that these goals are not attained by the paper.
2. Limitations
Question: Does the paper discuss the limitations of the work performed by the authors?
Answer: [Yes]
Justification: Section SectionSSiiie discuss the limitation.
Guidelines:
The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those not discussed in the paper.
The authors are encouraged to create separate "Limitations" section in their paper.
The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification. asymptotic approximations only holding locally). The authors should reflect how these assumptions might be violated in practice and what the implications would be.
The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on few datasets or with few runs. In general, empirical results often depend on implicit assumptions, which should be articulated.
The authors should reflect the factors that influence the performance of the approach. For example, facial recognition algorithm may perform poorly when image resolution low images are taken in low lighting. Or speech-to-text system might be used reliably to provide closed captions for online lectures because it fails to handle technical jargon.
The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size.
If applicable, the authors should discuss possible limitations of their approach address problems of privacy and faimess.
While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren't 't acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an impor- tant role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations.
3. Theory Assumptions and Proofs
Question:
For each theoretical result, does the paper provide the full set of assumptions and complete (and correct) proof?
Answer: [Yes]
18

---

Justification:
In Appendix A
Guidelines:
The answer NA means that the paper does not include theoretical results.
All the theorems, formulas, and proofs in the paper should be numbered and cross- referenced.
All assumptions should be clearly stated referenced in the statement of any theorems.
The proofs can either appear in the main paper or the supplemental material, but they appear in the supplemental material, the authors are encouraged to provide short proof sketch provide intuition.
Inversely, any informal proof provided in the core of the paper should complemented by formal proofs provided in appendix or supplemental material.
Theorems and Lemmas that the proof relies upon should be properly referenced.
4. Experimental Result Reproducibility
Question: Does the paper fully disclose all the information needed to reproduce the main ex- perimental results of the paper to the extent that affects the main claims and/or conclusions of the paper (regardless whether the code and data are provided or not)?
Answer: [Yes]
Justification: In Section 4.1
Guidelines:
The answer NA means that the paper does not include experiments.
If the paper includes experiments, a No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.
If the contribution is dataset and/or model, the authors should describe the steps taken to make their results reproducible or verifiable.
Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is a novel architecture, describing the architecture fully might suffice, or if the contribution is a specific model and empirical evaluation, it may be necessary to either make possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data is often one good way accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g.. in the case of large language model), releasing of a model checkpoint, or other means that are appropriate to the research performed.
While NeurIPS does not require releasing code, the conference does require all submis- sions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example
(a) the contribution is primarily a new algorithm, the paper should make clear how to reproduce that algorithm.
(b) the contribution is primarily a new model architecture, the paper should describe the architccture clearly and fully.
(c) If the contribution is new model (e.g., a large language model), then there should either way to access this model for reproducing the results or way to reproduce the model (e.g., with an open-source dataset instructions for how to construct the dataset).
(d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome to describe the particular way they provide for reprodueibility. the case of closed-source models, may be that access to the model is limited in some way (e.g., to registered users), but it should be possible for other researchers have some path to reproducing or verifying the results.
5. Open access to data and code
Question: Does the paper provide open access to the data and code, with sufficient instruc- tions to faithfully reproduce the main experimental results, as described in supplemental material?
19

---

Answer: [Yes]
Justification:
We would release the code and the code is submitted in the supplemental
material
Guidelines:
The answer NA means that paper does not include experiments requiring code.
Please see the NeurIPS code and data submission guidelines (https://nips.cm cc/
for more details.
While encourage the release of code and data, understand that this might not be possible, so "No" is an acceptable answer. Papers cannot be rejected simply for not including code, unless this is central to the contribution (e.g., for new open-source benchmark).
The instructions should contain the exact command and environment needed to run to reproduce the results. See the NeurlPS code and data submission guidelines (https for more details.
//nips. //nips.cc/pil wwcppbblc/guuiicuccccccc
The authors should provide instructions data access and preparation, including how to access the raw data, preprocessed data, intermediate data, and generated data, etc.
The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. only subset of experiments are reproducible, they should state which ones are omitted from the script and why.
At submission time, preserve anonymity, the authors should release anonymized versions (if applicable).
Providing as much information as possible in supplemental material (appended to the paper) recommended, but including URLs to data and code permitted.
6. Experimental Setting/Details
Question: Does the paper specify all the training and test details (e.g., data splits, hyper- parameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?
Answer: [Yes]
Justification: In Section 4.1 and Appendix
Guidelines:
The answer NA means that the paper does not include experiments.
The experimental setting should be presented in the core of the paper level of detail that is necessary to appreciate the results and make sense of them.
The full details can be provided either with the code, in appendix, as supplemental material.
7. Experiment Statistical Significance
Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?
Question:
Answer:
[No]
Justification:
We don't report error bars.
Guidelines:
The answer NA means that the paper does not include experiments.
The authors should answer "Yes" if the results are accompanied by error bars, confi- dence intervals, statistical significance tests, least for the experiments that support the main claims of the paper.
The factors of variability that the enror bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall with given experimental conditions).
The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)
The assumptions made should be given (e.g., Normally distributed errors).
20

---

It should be clear whether the error bar is the standard deviation or the standard error of the mean.
is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have 96% CI, if the hypothesis of Normality of errors is not verified.
For asymmetric distributions, the authors should be careful not to show in tables figures symmetric error bars that would yield results that are out range (e.g. negative error rates).
If error bars are reported in tables or plots, The authors should explain the text how they were calculated and reference the corresponding figures tables in the text.
8. Experiments Compute Resources
For each experiment, does the paper provide sufficient information on the com- puter resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?
Question:
Answer: [Yes]
Justification:
In Section 4.1 Implementations
Guidelines:
The answer NA means that the paper does not include experiments.
The paper should indicate the type of compute workers CPU GPU, internal cluster, or cloud provider, including relevant memory and storage.
The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute.
The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn't make it into the paper).
9. Code Of Ethics
Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics
Answer: [Yes]
Justification:
Our research conform to the NeurlPS Code of Ethics
Guidelines:
The answer NA means that the authors have reviewed the NeurlPS Code of Ethics.
If the authors answer No, they should explain the special circumstances that require deviation from the Code of Ethics.
The authors should make sure to preserve anonymity (e.g., there a special consid- eration due to laws or regulations in their jurisdiction).
10. Broader Impacts
Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?
Answer: [Yes]
Justification:
We discuss it in Appendix C
Guidelines:
The answer NA means that there no societal impact of the work performed.
If the authors answer NA or No. they should explain why their work has no socictal impact why the paper does not address societal impact.
Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.
21

---

The conference expects that many papers will be foundational research and not tied particular applications, let alone deployments. However, if there is direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster.
The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology.
If there negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms monitor how system learns from feedback over time, improving the efficiency and accessibility of MI..
11. Safeguards
Does the paper describe safeguards that have been put in place for responsible release of data models that have high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?
Question:
Answer: [NA]
Justification:
We have no new models/datasets.
Guidelines:
The answer NA means that the paper poses such risks.
Released models that have high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere usage guidelines or restrictions to access the model or implementing safety filters.
Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.
We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make best faith effort.
12. Lieenses for existing assets
Are the creators or original owners of assets (e.g., code, data, models), used in the paper. properly credited and are the license and terms of use explicitly mentioned and properly respected?
Question:
Answer: [Yes]
Justification: All assets used in our paper is cited or marked in the code.
Guidelines:
The answer NA means that the paper does not existing assets.
The authors should cite the original paper that produced the code package or dataset.
The authors should state which version of the asset is used and, if possible, include URL.
The name of the license (c.g., CC-BY 4.0) should be included for each asset.
For scraped data from a particular source (c.g., website), the copyright and terms of service of that source should be provided.
If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswi thcode. com com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of dataset.
For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided.
22

---

If this information is not available online, the authors are encouraged to reach out to the asset's 's creators.
13. New Assets
Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?
Answer: [Yes]
Justification: Would release the code and the trained router.
Guidelines:
The answer NA means that the paper does not release new assets.
Researchers should communicate the details of the dataset/code/moodl as part of their submissions via structured templates. This includes details about training, license, limitations, etc.
The paper should discuss whether and how consent was obtained from people whose asset is used.
At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file.
14. Crowdsourcing and Research with Human Subjects
Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well details about compensation (if any)?
Answer: [NA]
Justification:
Does not involve crowdsourcing nor research with human subjects.
Guidelines:
The answer NA means that the paper does not involve crowdsoureing nor research with human subjects.
Including this information in the supplemental material is fine, but if the main contribu- tion of the paper involves human subjects, then as much detail as possible should be included in the main paper.
According the NeurIPS Code of Ethies, workers involved in data collection, curation, or other labor should be paid at least the minimum wage in the country of the data collector.
15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects
Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?
Answer: [NA]
Justification:
Does not involve crowdsourcing nor research with human subjects
Guidelines:
The answer NA means that the paper does involve crowdsourcing research with human subjects.
Depending on the country in which research is conducted, IRB approval (or equivalent) may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper.
We recognize that the procedures for this may vary significantly between institutions and locations, and we expect authors to adhere to the NeurlPS Code of Ethics and the guidelines for their institution.
For initial submissions, do not include any information that would break anonymity (if applicable), such as the institution conducting the review.
23


Reviews:
[{"review_id": "ZdZhMkaT66", "reviewer": "Reviewer_FT6Q", "summary": "The paper presents Learning-to-Cache (L2C), a method to accelerate diffusion transformers' inference by caching redundant computations across timesteps. A learnable router dynamically determines which layers can reuse calculations from previous timesteps. L2C can eliminate up to 93.68% of computations in specific steps (46.84% overall) in models like U-ViT-H/2 with minimal performance loss.", "questions": "- Step distillation techniques, which typically involve few or just one step, have successfully accelerated the diffusion process with minimal impact on output quality. Can the proposed model be integrated with distilled models to achieve additional speed-up on top of the improvements gained from distillation?\n- You have proposed training only the router parameters while freezing the model parameters. Is there any benefit to fine-tuning and optimizing both the model parameters and the router parameters together?\n- What are the implications if the diffusion main loss function is used to train the router?", "limitations": "Since the goal is to speed up inference, it should be discussed whether this method can be combined with other acceleration techniques, such as step distillation.", "rating": 6, "confidence": 5, "soundness": 4, "presentation": 4, "contribution": 3, "strengths": "- The proposed caching method for the diffusion process is novel and provides acceptable speed-up without requiring retraining or fine-tuning of the model weights, only adding a few learnable parameters.\n- The paper introduces a straightforward learnable optimization process to identify redundancies in the diffusion process.\n- The proposed router is time-dependent but input-invariant, enabling the formation of a static computation graph for inference.\n- The paper is well-written and easy to understand. The figures and result tables are easy to follow and comprehensive, offering clear visual representations and supporting the text.", "weaknesses": "- The paper's contribution is incremental, primarily introducing a learnable router that determines what computations to reuse from previous timesteps. It would benefit from offering more innovations and deeper insights to significantly advance the field.\n- The improvement in speed-up is very similar to DeepCache, which does not require any training.\nThere are some minor mistakes in the text, such as a typo in line 233 where \"maximum\" is misspelled as \"mamimum.\"", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We extend our gratitude for your insightful feedback and suggestions\n\n> **W1: The paper's contribution is incremental. It would benefit from offering more innovations and deeper insights**\n\nWe greatly value your suggestion that we need to offer more profound insights in this paper. Beyond introducing a new method, we aim to share the following key insights to advance the field:\n\n(1) **Theoretical explanation of the caching-based method**: In Section 3.2\\&3.3 and Appendix, we reveal that fast samplers and cache mechanisms represent different levels of reuse. Unlike previous heuristic-based approaches like DeepCache, our work establishes a theoretical connection and build the clear relationship between cache and fast solvers. This not only clarifies their relationship but also enhances the reliability of caching-based methods by providing theoretical support.\n\n(2) **Insights from the special patterns in the learned routers**: L2C reveals intriguing patterns in the learned routers (refer to Figures 1, 2, 3 and 4 in the attached PDF).  In U-ViT (Figure 2), the intermediate layers can be entirely cached, whereas the early and later layers play a crucial role. We also add one experiment on PixArt-XL-2 and for PixArt, the temporal redundancy in the cross-attention layer (Figure 1.b) is notably pronounced, with over 94\\% of layers (265 out of 280) being eligible for caching.These findings can be leveraged not only to accelerate model inference but also to guide the design of model architectures.\n\nTo summarize, we aim to move beyond heuristic methods in designing the cache mechanism, incorporating performance guarantees and providing more theoretical interpretability for this special cache mechanism in accelerating the diffusion models. This has not been explored before and we think is important for this area.\n___\n\n> **W2: The improvement in speed-up is very similar to DeepCache.**\n\nThanks for your insightful quesion. We compare our approach with DeepCache, focusing primarily on **generation quality** under the same acceleration ratio. Our method improves the FID from 2.70 to 2.64, using the same model and parameters, indicating a superior caching mechanism compared to DeepCache. Additionally, DeepCache is limited to U-ViT due to it is bound to the u-shaped structure, making it inapplicable to models like DiT and PixArt. However, L2C is versatile and can be applied to all these models.\n\n| Methods | NFE | Latency(s) |Speedup |FID↓ |\n|--|--|--|--|--|\n| DPM-Solver | 20 |7.60 |1.00x | 2.57 | \n| DeepCache | 20 |4.68 |1.64x | 2.70 |\n| Faster Diffusion | 20 |5.95 | 1.29x | 2.82 |\n| L2C (ours) | 20 | 4.62 |1.67x | 2.64 |\n___\n\n> **Q1\\&Limitation: Can the proposed method be combined with step distillation?**\n\nThank you for your constructive suggestion. We built our algorithm on the distilled PixArt-XL-2-512x512, employing a 4-step LCM scheduler. The table below presents our results, which are compared against the 3-step LCM. The learned router is visualized in Figure 4 of the attached PDF. From our experiments, our method achieves approximately 1.28x acceleration, successfully caching 78 out of 168 blocks. Consistent with the results on PixArt with 20 NFEs, cross-attention remains the most redundant component in the denosing sequence.\n\n| Method | NFE | Cache Layer Ratio | Latency(s) | Speedup | FID (COCO2017)↓ | FID(COCO2014)↓ |\n|--|--|--|--|--|--|--|\n| PixArt-XL-2 + LCM | 4 | - |0.96 | 1.00x | 34.52 | 29.60|\n| PixArt-XL-2 + LCM | 3 | - |0.73 | 1.32x | **34.77**| **29.72**|\n| PixArt-XL-2 + LCM + L2C|4|78/168 |0.75|1.28x | **34.45** | **29.26** |\n____\n\n> **Q2: Optimizing both the model parameters and the router parameters**\n\nThanks for your great suggestion. We show the comparison results if optimizing the model parameters and the routers together:\n\n| Method  | Cache Layer Ratio | Latency(s) | Speedup | IS  | FID↓  | sFID↓  | Precision | Recall | Training Cost↓ |\n|--|--|--|--|--|--|--|--|--|--|\n| DDIM20 | - | 2.87 |  1.00x | 223.49 | 3.48   | 4.89  | 78.76 | 57.07  | - |\n| DDIM15 | -  | 2.17| 1.32x | 205.97 | 5.07   | 6.07  | 76.26 | 55.65  |\n| Router | 333/560 | 2.09 | 1.37x | 219.85 | **4.01**   | 5.22  | 78.28 | 55.73  | ~40 GPU Hour |\n| Router&Model   | 331/560 | 2.09 | 1.37x   | 213.34 | **3.87**  | 5.00  | 77.83  | 57.84 | ~66 GPU Hour |\n|||\n| DDIM10 | - | 1.43 | 1.00x | 158.31 | 12.38  | 11.22 | 66.78  | 52.82  | - |\n| DDIM9  | - | 1.29 | 1.11x | 140.85 | 16.57  | 14.21 | 62.28   | 49.98 | -   |\n| Router  | 107/280 | 1.17 | 1.22x| 147.77 | **14.63**  | 10.96 | 64.30  | 51.65  | ~20 GPU Hour  |\n| Router&Model   | 107/280 | 1.17 | 1.22x| 134.87 | **14.02** | 12.43  | 64.92  | 52.37 | ~41 GPU Hour |\n||\n\nThe conclusion is that, yes, optimizing both the model and the router enhances the model's performance, as evidenced by slight improvements in FID and sFID. However, this optimization process requires additional time to train and fine-tune both components. We will include this experiment in our revised manuscript and thanks again for your inspiring suggestion.\n____\n\n> **Q3: what if the diffusion main loss function is used to train the router?**\n\nThank you for your insightful question. We have adjusted the training loss accordingly, and the results are presented in the table below. We selected baselines with a very similar acceleration ratio for comparison. The results indicate that using the original diffusion loss makes it more challenging for the router to learn, resulting in slightly worse image quality compared to the distillation loss used in our submission.\n\n| Method | Cache Layer Ratio   | Latency | Speedup | IS | FID↓| sFID↓|Precision | Recall |\n|--|--|--|--|--|--|--|--|--|\n| DDIM-20 | -  | 2.87| 1.00x   | 223.49 | 3.48 | 4.89   | 78.76 | 57.07  |\n| DDIM-15  | -  | 2.17 | 1.32x   | 205.97 | 5.07 | 6.07   | 76.26| 55.65  |\n| Original Loss | 295/560 | 2.18 | 1.32x   | 217.23 | **3.97** | 5.11 | 77.83  | 57.05  |\n| Our Loss | 300/560 | 2.16 | 1.33x   | 223.41 | **3.70** | 4.91 | 78.88  | 56.36  |", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "COc1v55A8g", "reviewer": "Reviewer_faWt", "summary": "This paper introduces L2C, a novel approach that dynamically caches computations in diffusion transformers, significantly reducing the computational load. L2C leverages the repetitive structure of transformer layers and the sequential nature of diffusion, optimizing caching decisions to produce a static computation graph. Experimental results show that L2C outperforms existing methods like DDIM and DPM-Solver, as well as prior cache-based techniques, at the same inference speed.", "questions": "See Weaknesses", "limitations": "See Weaknesses", "rating": 6, "confidence": 2, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "- The writing is easy-to-follow\n\n\n- The motivation is strong. There exists many redundancy and the authors bypass it in a smart way", "weaknesses": "I am not an expert in this area. There is no obvious weakness as far as I can tell", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "Thank you very much for your review of our manuscript. We appreciate your time and effort in evaluating our work.\n\nIt is encouraging to hear that you like our work and that no obvious weaknesses have been found. If you have any questions where you think further detail or explanation might be beneficial, we would be happy to address them.\n\nThank you again for your valuable time and feedback.", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "UuekclUeVR", "reviewer": "Reviewer_NP2z", "summary": "This paper proposes a method to accelerate DiT model inference using layer caching strategy. By utilizing feature interpolation, the non-differentiable layer selection problem is transformed into a differentiable optimization problem. The routing matrix $\\beta$ is learned to indicate whether the features of a certain layer at the current timestep can be reused from the cached features of the same position in the previous timestep. Extensive experimental results demonstrate the effectiveness of this method in accelerating DiT model inference and also shed light on the redundancy of layers in current DiT models.", "questions": "see weakness", "limitations": "Limitations are discussed briefly, but could be touched upon in more detail.", "rating": 6, "confidence": 4, "soundness": 3, "presentation": 3, "contribution": 2, "strengths": "1. Learning-to-Cache (L2C) transforms the non-differentiable layer selection problem into a differentiable optimization problem through interpolation, which is a clever transformation and forms the basis for optimizing the subsequent routing matrix $\\beta$.\n2. It is meaningful to explore how to apply feature caching mechanisms to DiT models for inference acceleration. The experimental results of the paper also demonstrate the effectiveness of the method. Compared with simply reducing NFE and previous feature caching methods, L2C achieves better performance.\n3. This paper is well-organized and well-written;", "weaknesses": "My main concern lies in the scalability of this method:\n1. L2C requires training for different DiT models and diffusion schedulers, which limits the potential applications of this method;\n2. This paper reports experimental results on DiT and U-ViT series models, but does not experiment on text-to-image models based on the DiT architecture (e.g., Pixart-$\\alpha$[1]). Is it because training on large-scale text-image pairs dataset is too costly? \n3. The paper does not report specific training costs time;\n4. Compared to the original inference process, will L2C increase additional memory due to routing matrix $\\beta$ overhead and feature caching?\n\n[1] Chen, Junsong, et al. \"PixArt-$\\alpha $: Fast Training of Diffusion Transformer for Photorealistic Text-to-Image Synthesis.\" arXiv preprint arXiv:2310.00426 (2023).", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "We sincerely appreciate the valuable feedback and constructive suggestions. Thanks so much for taking time and effort to review our paper. \n\n> **W1: L2C requires training for different DiT models and diffusion schedulers, which limits the potential applications of this method**\n\nThank you for your insightful question. The training cost of L2C is low because only the router matrix is updated, leaving the model parameters unchanged. For example, in PixArt-XL-2 with a 512 resolution, only 840 parameters need to be trained, taking just 3 hours on 8 A5000 GPUs. We consider this training overhead to be relatively small; using a distillation approach to compress a small model typically requires significantly more resources, such as 4 A100 GPU days for BK-SDM [1].\n\n[1] BK-SDM: A Lightweight, Fast, and Cheap Version of Stable Diffusion. ECCV24.  \n\n_________________\n\n> **W2: No experiment on text-to-image models based on the DiT architecture (e.g., Pixart). Is it because training on large-scale text-image pairs datasets is too costly?**\n\nThanks for the valuable suggestion. Here we show the experimental results on PixArt-XL-2-512x512. \n\n* **Training Cost**: \nThe training cost for this experiment is approximately 3 hours on 8 A5000 GPUs, using around 200,000 images for training. We utilized the first 200,000 samples from the SAM-LLaVA-Captions10M dataset. The router matrix converges and achieves optimal performance with 200,000 samples. We also tested with 400,000 samples but observed no performance gain, as the router does not change with additional training samples.\n\n* **Generation Quality**:\nWe test our method on the validation set of COCO2014 (30k) and COCO2017 (5k). The results, shown in the table below, indicate that our method outperforms the approach using fewer steps in DPM-Solver. We provide some qualitative examples in Figure 5 of the attached PDF.\n\n* **What the router learns**: \nWe have observed some intriguing patterns in the router, as illustrated in Figure 1 of the attached PDF. The cross-attention block displays significantly more temporal redundancy compared to other types of modules, such as self-attention and MLP. In addition, this router has the unique feature of not being cacheable at intermediate steps. We believe these specific patterns can also guide the future design of model architecture, helping to eliminate unnecessary computations.\n\n| Method     | NFE | Activate Layer Ratio in Cache Steps | Latency(s) | SpeedUp | Training Cost(h) | FID (COCO2017)↓ | FID (COCO2014)↓ |\n|------------|-----|----------------------|---------|---------|------------------|-----------------|-----------------|\n| DPM-Solver | 20  | 100\\%                | 2.14    | 1.00x   | -                | 32.51           | 27.14           |\n| DPM-Solver | 14  | 100\\%                | 1.51    | 1.41x   | -                | **33.79**           | **28.40**         |\n| L2C        | 20  | 31.3\\%               | 1.52    | 1.41x   | 3.3              | **32.36**           | **27.39**           |\n\n_________________\n\n> **W3: The paper does not report specific training costs time;**\n\nWe apologize for missing this important experimental detail. Here, we report the training cost for each experiment. We use ImageNet for training, and in all cases, convergence is achieved in less than one epoch. The experiments are conducted on 8 A5000 GPUs. We would add this training cost to our next version of the manuscript. Thanks so much for pointing this out.\n\n| Model                | DiT-XL/2 | DiT-XL/2 | DiT-XL/2 | DiT-XL/2 | DiT-L/2 | DiT-L/2 | U-ViT-H/2    | U-ViT-H/2    |\n|----------------------|----------|----------|----------|----------|---------|---------|--------------|--------------|\n| NFE                  | 50       | 20       | 10       | 50       | 50      | 20      | 50           | 20           |\n| Resolution           | 256      | 256      | 256      | 512      | 256     | 256     | 256          | 256          |\n| Sampler              | DDIM     | DDIM     | DDIM     | DDIM     | DDIM    | DDIM    | DPM-Solver-2 | DPM-Solver-2 |\n| Training Cost (Hour) | 7.2      | 5.0      | 2.5      | 8.1      | 7.0     | 1.5     | 5.7          | 3.0          |\n\n_________________\n\n>  **W4: Compared to the original inference process, will L2C increase additional memory due to routing matrix overhead and feature caching?**\n\n* For Routing Matrix: \n\nThe routing matrix has a very small number of parameters, calculated as $steps \\times layers \\times block\\\\_per\\\\_layer$. In our experiments, the largest router, used for DiT-XL/2 with 50 sampling steps, contains 1,400 parameters ($25 \\times 28 \\times 2$), resulting in an extra memory overhead of just 2.8KB (using FP16 for inference).\n\n* For Feature Caching: \n\nYes, L2C needs extra overhead for feature caching. As the cache in the computer system and KV-Cache in LLM, L2C trades space for time by storing intermediate results in VRAM, leading to additional memory overhead. Below is the additional overhead observed in the DiT model. We believe there is still room for optimization of the memory overhead in feature caching. Thanks for raising this critical issue.\n\n| Method | Memory |\n| -- | -- |\n| DiT-XL/2 | 3905 MiB |\n| DiT-XL/2 with L2C| 4831MiB |", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}]

Author rebuttal:
Dear Chairs and Reviewers,

We deeply appreciate your thoughtful comments and the time you have dedicated to reviewing our paper. Attached is a pdf containing the following:

* Visualizations of learned routers in different models
* Generated images compared with the baseline.

We look forward to the opportunity to discuss this further with you. Many thanks for your kind attention.

Best regards,   
Authors of submission 1630

Meta-review: The paper presents Learning-to-Cache (L2C), a method to accelerate diffusion transformers' inference by caching redundant computations across timesteps. Particularly, by leveraging the repetitive structure of transformer layers and the sequential nature of diffusion, L2C dynamically caches the computations in diffusion transformers for saving computational load. The main concerns were well addressed during rebuttal. I recommend to accept the manuscript and the authors should incorporate the discussions in the final version.
Decision: Accept (poster)