PTQ4DiT: Post-training Quantization for Diffusion Transformers

The recent introduction of Diffusion Transformers (DiTs) has demonstrated exceptional capabilities in image generation by using a different backbone architecture, departing from traditional U-Nets and embracing the scalable nature of transformers. Despite their advanced capabilities, the wide deployment of DiTs, particularly for real-time applications, is currently hampered by considerable computational demands at the inference stage. Post-training Quantization (PTQ) has emerged as a fast and data-efficient solution that can significantly reduce computation and memory footprint by using low-bit weights and activations. However, its applicability to DiTs has not yet been explored and faces non-trivial difficulties due to the unique design of DiTs. In this paper, we propose PTQ4DiT, a specifically designed PTQ method for DiTs. We discover two primary quantization challenges inherent in DiTs, notably the presence of salient channels with extreme magnitudes and the temporal variability in distributions of salient activation over multiple timesteps. To tackle these challenges, we propose Channel-wise Salience Balancing (CSB) and Spearmen's $\rho$-guided Salience Calibration (SSC). CSB leverages the complementarity property of channel magnitudes to redistribute the extremes, alleviating quantization errors for both activations and weights. SSC extends this approach by dynamically adjusting the balanced salience to capture the temporal variations in activation. Additionally, to eliminate extra computational costs caused by PTQ4DiT during inference, we design an offline re-parameterization strategy for DiTs. Experiments demonstrate that our PTQ4DiT successfully quantizes DiTs to 8-bit precision (W8A8) while preserving comparable generation ability and further enables effective quantization to 4-bit weight precision (W4A8) for the first time.

Paper

References (65)

Scroll for more · 38 remaining

Similar papers

Peer review

Reviewer a8C35/10 · confidence 4/52024-06-14

Summary

This paper presents PTQ4DiT, a quantization method designed for diffusion transformers. The method focuses on addressing quantization challenges due to extreme magnitudes in salient channels and the temporal variability of activations across multiple timesteps. To combat these issues, it incorporates techniques like Channel-wise Salience Balancing (CSB) and Spearmen’s ρ-guided Salience Calibration (SSC). These strategies help in redistributing magnitudes to minimize quantization errors and adapt dynamically across different timesteps, significantly enhancing the performance of quantized DiTs without re-training the original models.

Strengths

- The method incorporates temporal information into the calibration process for salience balancing. - The experimental results are robust, covering a wide range of scenarios and effectively demonstrating the method's efficacy across different settings.

Weaknesses

- The classifier-free guidance scales used for sampling are not specified, which could impact the reproducibility and evaluation of the model's performance. - Under the W4A8 setting, the method exhibits significant degradation in performance, suggesting limitations in its effectiveness at lower bit-widths.

Questions

see weaknesses

Rating

5

Confidence

4

Soundness

3

Presentation

3

Contribution

3

Limitations

This work reasonably discussed the limitations and future work

Reviewer jrKh5/10 · confidence 5/52024-07-11

Summary

- The paper introduces PTQ4DiT, a post-training quantization method for Diffusion Transformers. This approach can facilitate the widespread deployment of DiTs. By investigating the distribution of activation and weight of DiTs, PTQ4DiT designs the Channel-wise Balancing and timestep-aware Salience Calibration. Through these, PTQ4DiT effectively quantizes DiTs to W4A8 and reduce computational costs while maintaining image generation quality.

Strengths

- The paper identifies the two key challenges associated with quantizing DiTs and provides simple but effective methodology for effective DiT quantization. - The description and illustration of the paper is clear and easy to follow. Detailed description of the reparamterization process of the quantization parameters are provide

Weaknesses

- **Effectiveness of Salience Calibration:** The methodology sections 4.1 and 4.3 of the paper resembles existing work on quantization [1]. The primary novel contribution of this paper is the 'Salience Calibration' technique, which addresses the specific challenge of activation timestep-variance in DiTs. It is critical to verify its importance. However, the evidence supporting the effectiveness of the Salience Calibration (SSC) is currently confined to Table 3, which presents results for ImageNet with 256x256 resolution, using a W4A8 configuration. The improvement observed with SSC is only moderate when compared to the CSB method. To more effectively emphasize the paper's unique contribution, additional evidence demonstrating the effectiveness of CSB would be beneficial." - **Overheads for Salience Calibration:** The 'Salience Calibration' technique introduces a timestep-wise correction coefficient to refine the activation $S(X(t))$ and weight $S(W)$ distributions, resulting in the adjusted binary matrices $B_{\rho}^x$ and $B_{\rho}^w$. This refinement implies that $B_{\rho}^w$ may differ for each timestep t. However, the weights are reparameterized offline prior to quantization. Introducing a time-varying $B_{\rho}^w$ could lead to the generation of distinct quantized integer (INT) weights for each timestep, which may complicate efforts to reduce the model's weight memory cost. This could involve either storing multiple sets of INT weights or repeatedly offloading weights for each timestep. [1] Xiao, Guangxuan, et al. "Smoothquant: Accurate and efficient post-training quantization for large language models." International Conference on Machine Learning. PMLR, 2023

Questions

- Is the 'Spearman’s ρ-guided Salience Calibration (SSC)' method capable of generalizing across a different timesteps and solvers? It seems that the calibration process depends on the number of timesteps. Does this imply that recalibration is necessary when employing SSC with different models, timesteps, or solvers? - In the context of reparameterization, the paper specifically addresses the 'Post-adaLN' and 'Post-Matrix-Multiplication' scenarios. However, within the Feed-Forward Network (FFN) layers of DiTs, there are instances where two consecutive linear layers do not conform to either of these cases. It raises the question of how to approach reparameterization in such circumstances." - Some unclear details about the quantization process: - Are all layers in the DiTs quantized? e.g., time embedding linear layers, attention matmuls. - In Line 237, the authors state that " the optimization of quantization parameters follows the implementation of Q-Diffusion". Does this mean that the quantization process involves gradient-based optimization of scaling factors, and Adaround of zero-points? What is the cost of the PTQ process. - The statement “the lower the correlation between activation salience s(X(t)) and weight salience s(W), the greater the reduction effect in overall channel salience” in Sec. 4.2 should be more clearly explained. What is the definition of "correlation salience"?

Rating

5

Confidence

5

Soundness

3

Presentation

3

Contribution

3

Limitations

- The authors have discussed the limitations in the appendix.

Authorsrebuttal2024-08-12

Thanks for your response

Dear Reviewer jrKh, Thank you for your thorough review and constructive suggestion. We are grateful for your acknowledgment of our efforts to address the concerns. Your expertise has significantly contributed to the enhancement of our work.

Reviewer USPH6/10 · confidence 4/52024-07-11

Summary

This paper proposes the first post-training quantization (PTQ) method for Diffusion Transformer (DiT). It addresses the presence of salient channels with extreme magnitudes and the temporal variability in the distributions of salient activations over multiple timesteps. Experimental results demonstrate comparable performance in low-bit scenarios.

Strengths

1. This paper is well-organized and includes clear illustrations. 2. It presents the first post-training quantization method for Diffusion Transformers. 3. In the W8A8 scenario, PTQ4DiT achieves lossless performance compared to full precision. 4. The paper also includes theoretical analysis.

Weaknesses

1. In line 158, the author proposes an important property: large values do not coincide in the same channels of activation and weight. This property is crucial for the proposed method but is only briefly illustrated by a sketch. We believe that such an important property should be demonstrated with statistical experiments. 2. In line 170, the author attempts to use the geometric mean to balance activation and weight channels. Is this approach well-designed? Could another type of mean be used? 3. PTQ4DiT is designed for Diffusion Transformers and is tested on traditional DiT. However, many new DiT-based models, such as pixart-alpha [1], pixart-sigma [2], SD3 [3], and Lumina [4], have emerged. To verify the generality of the method, it should be tested on a broader range of DiT-based models. 4. This method appears to work only with linear layers. [1] PixArt-$\alpha$: Fast Training of Diffusion Transformer for Photorealistic Text-to-Image Synthesis, ICLR24. [2] PixArt-\Sigma: Weak-to-Strong Training of Diffusion Transformer for 4K Text-to-Image Generation, arXiv. [3] Scaling Rectified Flow Transformers for High-Resolution Image Synthesis, arXiv. [4] Lumina-T2X: Transforming Text into Any Modality, Resolution, and Duration via Flow-based Large Diffusion Transformers, arXiv.

Questions

Please refer to the weaknesses part.

Rating

6

Confidence

4

Soundness

3

Presentation

3

Contribution

3

Limitations

Yes. The authors have addressed the limitations and broader impacts.

Reviewer N2VF5/10 · confidence 4/52024-07-13

Summary

This paper proposes a new PTQ method for DiTs. It develops a Channel-wise Salient Balancing method to suppress the outliers of linear layers in transformer blocks when applying activation quantization. Besides, it designs the Spearmen’s ρ-guided Salience Calibration to tackle the timestep dimension’s variety. It can improve the performance of the quantized models, comparing to directly applying the conventional quantization methods for Unet-based diffusion models, ViTs or traditional convolution networks to DiTs.

Strengths

+This paper proposes a new method for DiT quantization, which achieves relatively well performance on W8A8 and W4A8.

Weaknesses

-Lacks of experiments. This paper does not report the W8A8 results of ImageNet 512x512. Besides, it only conducts the experiment on one DiT model. The proposed method should be validated on more architectures. -Lack of novelty. The idea of Re-Parameterization activation range has already been used in PTQ of ViT and LLM, such as Rep-Q [1] or outlier suppression+ [2]. -Lack of direct evidence. It lacks direct evidence to display the effectiveness of the proposed method, such as the visualization of activation before and after CSB and SSC to verify it actually suppress the salience channel. -Lack of motivation. This paper proposes several modules, but there is no direct evidence to prove that these modules can solve the problems. For example, in RepQ’s, it chooses the mean value of activation range to scale the distribution, but this paper uses the equilibrium between weight and activation without explanation. Besides, it also not explains why using inverse Spear-man’s ρ statistic as the weigh. [1]Li Z, Xiao J, Yang L, et al. Repq-vit: Scale reparameterization for post-training quantization of vision transformers. In ICCV, 2023. [2]Wei X, Zhang Y, Li Y, et al. Outlier Suppression+: Accurate quantization of large language models by equivalent and effective shifting and scaling. In EMNLP, 2023.

Questions

1. Please see the weaknesses. 2. Did the authors quantize the post-softmax layer? 4. The SOTA DiT models can achieve a FID around 3 on ImageNet, why are the results reported in this paper not aligned with the origin paper? Why did the authors choose different settings?

Rating

5

Confidence

4

Soundness

3

Presentation

3

Contribution

2

Limitations

N/A

Reviewer jrKh2024-08-08

Thank the authors for the clarification, most of my concerns are addressed. I keep my scoring as acceptance.

Reviewer a8C32024-08-10

After reading the rebuttal and the comments from other reviewers, I keep my initial rating.

Authorsrebuttal2024-08-12

Summary of Authors' Responses

Dear Reviewers, We sincerely appreciate the time and effort you have dedicated to reviewing our paper. We have carefully considered all the points raised and would like to summarize our responses as follows: **(I) Additional experiments.** We conducted three additional experiments: (1) W8A8 ImageNet 512x512 generation, (2) PTQ4DiT on other DiT models, and (3) evaluation using 50K samples. These experiments further validate our method's effectiveness and generality. **(II) Novelty and motivation.** We highlighted the unique innovations and contributions of our PTQ4DiT and clarified the motivation of the equilibrium and inverse ρ. **(III) Direct evidence.** We supplemented two statistical experiments: (1) the Jaccard similarity of salient activation and weight channels, which provides direct evidence of the important property, and (2) the reduction in the percentage of salient channels when applying CSB and SSC, supporting their effectiveness. **(IV) Methodology and implementation.** We clarified the quantization of Post-softmax layers. Moreover, we justified the use of the geometric mean and discussed the extension of PTQ4DiT to other structures besides the linear layers. ***Thank you again for your valuable feedback. We would like to address any remaining concerns for further enhancement of our work.***

Authorsrebuttal2024-08-13

Sincere Thanks for Constructive Review and Support

Dear Reviewers, We would like to express our gratitude for your recognition of our work and your constructive feedback. Your insightful suggestions have significantly contributed to refining our research and enhancing its overall impact. We particularly appreciate the time and effort you invested in the review process. We look forward to any further feedback you may have and remain committed to addressing any additional concerns. Thank you. Sincerely, The Authors

Reviewer USPH2024-08-13

Thank you for the clarification, which addressed most of my concerns. I keep my initial rating.

Program Chairsdecision2024-09-25

Decision

Accept (poster)

© 2026 NYSGPT2525 LLC