HarmoniCa: Harmonizing Training and Inference for Better Feature Cache in Diffusion Transformer Acceleration

Yushi Huang, Zining Wang, Ruihao Gong, Jing Liu, Xinjie Zhang, Jun Zhang · DOI

Abstract

Diffusion Transformers (DiTs) have become the standard for high-fidelity generative modeling but suffer from significant computational overhead. Feature caching offers a path to acceleration by reusing intermediate representations across denoising steps. However, existing learning-based caching strategies often suffer from a discrepancy between training and inference. We present HarmoniCa, a framework that harmonizes these phases using Step-Wise Denoising Training (SDT) and an Image Error Proxy-Guided Objective (IEPO). HarmoniCa achieves up to a 2.07× theoretical speedup with improved image quality, while remaining "image-free" during training.

Introduction

Diffusion Transformers (DiTs) are the backbone of modern high-quality image and video generation systems, such as Sora and PixArt. Despite their performance, generating a single high-resolution image can take over 10 seconds on high-end GPUs due to the repeated execution of heavy transformer blocks.

Feature caching is a popular acceleration strategy: if features in a specific layer do not change significantly between consecutive denoising steps, the model can reuse previous results instead of recomputing them. However, current learning-based methods face two major challenges:

  1. Prior Timestep Disregard: Models are typically trained on isolated timesteps, failing to account for the "drift" caused by error accumulation during multi-step inference.
  2. Objective Mismatch: Training often focuses on noise prediction accuracy, which does not always correlate with the final perceptual image quality.

Methods

HarmoniCa addresses these discrepancies by aligning the training of the caching strategy (the "Router") with actual inference behavior.

Step-Wise Denoising Training (SDT)

Instead of training on isolated timesteps, HarmoniCa simulates the entire denoising trajectory. It employs a student-teacher setup where the student model utilizes the cache and attempts to mimic a teacher performing full computation. This approach allows the model to learn how to mitigate the "exposure bias" inherent in sequential generation.

The HarmoniCa architecture showing the Router matrix, feature cache updates, and the step-wise denoising flow across timesteps.

Image Error Proxy-Guided Objective (IEPO)

Directly optimizing for final pixel error is computationally prohibitive. HarmoniCa introduces a proxy ($λ^{(t)}$) that approximates the impact of a caching decision at step $t$ on the final output. This proxy is updated periodically via gradient-free generation passes, ensuring the Router prioritizes computation where it most affects visual quality.

Image-Free Training

Notably, HarmoniCa can train its caching router using only random noise. This removes the need for massive datasets like LAION or ImageNet during the optimization phase, making the framework highly portable and reducing training time by 25%.

Results and Discussion

The framework was evaluated across ImageNet and MS-COCO benchmarks using DiT-XL/2 and PixArt models. HarmoniCa achieved a 1.73× real-world speedup on PixArt-Σ for 2K images with negligible visual degradation.

A side-by-side comparison demonstrating that HarmoniCa maintains high visual fidelity even with significant acceleration.

On DiT-XL/2, HarmoniCa improved the Inception Score (IS) by 6.74 and reduced the Frechet Inception Distance (FID) by 1.24 compared to previous state-of-the-art methods like Learning-to-Cache. The method proved robust across various samplers (DDIM, DPM-Solver++) and remained compatible with other acceleration techniques like quantization.

Conclusion

HarmoniCa successfully bridges the gap between training and inference for diffusion acceleration. By accounting for error accumulation and focusing on pixel-level fidelity, it provides a more efficient and effective caching mechanism. Future work will explore token-wise caching to further increase granularity and extending the framework to video and 3D generation modalities.

Summary updated

BibTeX
@inproceedings{huang2025harmonica,
  author = {Yushi Huang and Zining Wang and Ruihao Gong and Jing Liu and Xinjie Zhang and Jun Zhang},
  title = {{HarmoniCa: Harmonizing Training and Inference for Better Feature Cache in Diffusion Transformer Acceleration}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=NQyqpK6d72},
}
Figure