Token Pruning for Caching Better: 9 Times Acceleration on Stable Diffusion for Free
Zhang, Xiao, Tang et al.
Stable Diffusion has achieved remarkable success in the field of text-to-image generation, with its powerful generative capabilities and diverse generation results making a lasting impact. However, its iterative denoising introduces high computational costs and slows generation speed, limiting broader adoption. The community has made numerous efforts to reduce this computational burden, with methods like feature caching attracting attention due to their effectiveness and simplicity. Nonetheless, simply reusing features computed at previous timesteps causes the features across adjacent timesteps to become similar, reducing the dynamics of features over time and ultimately compromising the quality of generated images. In this paper, we introduce a dynamics-aware token pruning (DaTo) approach that addresses the limitations of feature caching. DaTo selectively prunes tokens with lower dynamics, allowing only high-dynamic tokens to participate in self-attention layers, thereby extending feature dynamics across timesteps. DaTo combines feature caching with token pruning in a training-free manner, achieving both temporal and token-wise information reuse. Applied to Stable Diffusion on the ImageNet, our approach delivered a 9$\times$ speedup while reducing FID by 0.33, indicating enhanced image quality. On the COCO-30k, we observed a 7$\times$ acceleration coupled with a notable FID reduction of 2.17.
Stable Diffusion은 텍스트-이미지 생성 분야에서 현저한 성공을 거두었으나, 반복적 노이즈 제거 메커니즘으로 인한 높은 계산 비용과 느린 생성 속도가 문제이다. 특징 캐싱 같은 방법들이 효과성과 단순성으로 주목받고 있지만, 이전 시간 단계에서 계산된 특징을 단순히 재사용하면 인접한 시간 단계의 특징이 유사해져 시간에 따른 특징의 동적성이 감소하고, 결국 생성된 이미지의 품질에 영향을 미친다. 본 논문은 동적 인식 토큰 프루닝(DaTo) 방법을 제안하여 특징 캐싱의 한계를 해결한다. DaTo는 동적성이 낮은 토큰을 선택적으로 제거하여 높은 동적성을 가진 토큰만 자기 주의 층에 참여하도록 함으로써 시간 단계 간 특징 동적성을 확장한다. ImageNet에 Stable Diffusion을 적용할 때 이 방법은 9배 가속화를 달성하면서 FID는 0.33 감소했고, COCO-30k에서는 7배 가속화와 FID 2.17의 현저한 감소를 관찰했다.
각 단계의 계산 비용 감소: 지식 증류, 구조 프루닝, 양자화, 토큰 프루닝 및 특징 캐싱
이 중 특징 캐싱은 효과성과 단순성으로 널리 인기를 얻고 있으며, 이전 시간 단계에서 계산된 특징을 저장하고 후속 시간 단계에서 재사용한다. 그러나 특징 재사용은 서로 다른 시간 단계의 특징이 유사한 값을 갖도록 강제하여 시간 단계에 따른 특징의 동적성을 감소시키고, 원래의 확산 과정을 손상시켜 생성 품질을 저하시킨다.