Fast Inference Through The Reuse Of Attention Maps In Diffusion Models

Rosco Hunter, Lukasz Dudziak, Mohamed S. Abdelfattah, Abhinav Mehrotra, Sourav Bhattacharya, Hongkai Wen · DOI

Introduction

Text-to-image diffusion models have set new standards for generative quality, yet their iterative sampling process remains a significant computational hurdle. Models like Stable Diffusion require dozens of passes through a heavy U-Net, where the attention mechanism—responsible for modeling relationships between image regions and text prompts—consumes a disproportionate amount of time.

Current acceleration efforts generally fall into two categories: reducing the number of sampling steps (which often degrades image structure) or model distillation (which is computationally expensive and requires massive datasets). This paper proposes a novel, training-free alternative: accelerating pre-trained models by reusing attention maps across sampling steps.

Methodology: The "Later is Better" Principle

The authors observe that attention maps are highly redundant; maps generated at one step are often nearly identical to those in the preceding step. Instead of recalculating these maps at every iteration, they propose storing and "plugging in" existing maps for subsequent steps.

To determine when it is safe to reuse a map, the authors turn to the mathematical theory of Lyapunov exponents. By modeling the reverse diffusion process as an Ordinary Differential Equation (ODE), they analyze how errors propagate through the system. Their findings reveal a critical stability property: errors introduced early in the generation process (when the image is mostly noise) explode rapidly, while errors introduced later (as the image nears completion) have much less time to propagate and thus remain stable.

Based on this insight, two strategies are introduced:

  • HURRY (Heuristic Reuse StrategY): A simple heuristic that reuses maps as late as possible in the sampling sequence to minimize error growth.
  • PHAST (Perturbed Heuristic Attention STrategy): A more refined approach that uses a deterministic greedy search to find a locally optimal reuse pattern, maximizing the Peak Signal-to-Noise Ratio (PSNR) relative to the original high-latency model.

Experimental Results

The proposed methods were evaluated across several benchmarks, including ImageNet, MS-COCO, and PartiPrompts, using models like Stable Diffusion and SDXL.

Fidelity and Structural Integrity

A major drawback of simple step-reduction (e.g., reducing a 20-step DDIM process to 13 steps) is the emergence of "hallucinations"—structural distortions where the model loses the intended geometry. For example, a 13-step model might fail to correctly render human features or complex objects.

Structural artifacts and hallucinations in a 13-step DDIM generation (highlighted in red).

In contrast, attention reuse prioritizes fidelity. On the MS-COCO 2017 dataset, PHAST achieved a PSNR of 25.90, vastly outperforming the 17.50 PSNR of a step-reduced baseline at the same inference speed.

Latency and Efficiency

The computational gains from skipping attention calculations are substantial. The authors estimate that a full U-Net call takes approximately 152ms, while a "reuse" call (where attention calculation is skipped) takes only 47ms. This allows for significant overall speedups.

A high-fidelity futuristic city generated using the optimized inference strategy.

Conclusion

By leveraging the inherent stability of the late-stage reverse diffusion process, HURRY and PHAST provide a training-free, plug-and-play solution for accelerating diffusion models. This approach maintains high image fidelity where standard step-reduction fails, offering a practical path for deploying state-of-the-art generative models on resource-constrained hardware. Future work will investigate layer-wise reuse patterns to further push the boundaries of inference efficiency.

Summary updated

BibTeX
@article{hunter2025fast,
  author = {Rosco Hunter and Lukasz Dudziak and Mohamed S. Abdelfattah and Abhinav Mehrotra and Sourav Bhattacharya and Hongkai Wen},
  title = {{Fast Inference Through The Reuse Of Attention Maps In Diffusion Models}},
  journal = {Int. J. Comput. Vis.},
  year = {2025},
  doi = {10.1007/s11263-025-02463-x},
}
Figure