2025-12-19 · 专家 · 计算机视觉 · 机器学习

Trainable Log-linear Sparse Attention for Efficient Diffusion Transformers

本文提出了一种名为Log-linear Sparse Attention (LLSA)的新颖注意力机制,通过利用分层结构和高效的GPU实现,将扩散Transformer(DiT)的注意力计算复杂度从二次方降低到对数线性,从而有效提升了长序列DiT的训练效率。

更新于 2026-11-18。作者:Yifan Zhou、Zeqi Xiao、Tianyi Wei、Shuai Yang、Xingang Pan。

中文摘要

扩散变换器(DiTs)在视觉生成领域达到了最先进的水平,但它们的二次自注意力成本从根本上限制了扩展到长标记序列。最近的一些Top-K稀疏注意力方法通过将标记压缩成块状表示并选择一小组相关键块来减少DiTs的计算量,但仍然存在(i)压缩标记上的二次选择成本和(ii)随着序列增长而增加的K值以维持模型质量的问题。我们确定其低效是由于单级设计,因为单级粗糙级别不足以表示全局结构。在这篇论文中,我们介绍了对数线性稀疏注意力(LLSA),这是一种用于极长标记序列的可训练稀疏注意力机制,通过利用分层结构将选择和注意力成本从二次降低到对数线性复杂度。LLSA执行分层Top-K选择,逐步采用在前一级别找到的索引进行稀疏Top-K选择,并引入了一种分层KV丰富机制,在注意力计算过程中使用更少的具有不同粒度的标记,同时保留全局上下文。为了支持高效训练,我们开发了一种高性能GPU实现,该实现仅使用稀疏索引进行正向和反向传播,消除了对密集注意力掩码的需求。我们在不使用补丁化和VAE编码的情况下,对高分辨率像素空间图像生成进行了LLSA的评估。LLSA在256x256像素标记序列上加速了注意力推理28.27倍,并加速了DiT训练6.09倍,同时保持了生成质量。结果表明,LLSA为高效训练长序列DiT提供了一种有前景的方向。代码可在以下网址获取:https://github.com/SingleZombie/LLSA

英文摘要

Diffusion Transformers (DiTs) set the state of the art in visual generation, yet their quadratic self-attention cost fundamentally limits scaling to long token sequences. Recent Top-K sparse attention approaches reduce the computation of DiTs by compressing tokens into block-wise representation and selecting a small set of relevant key blocks, but still suffer from (i) quadratic selection cost on compressed tokens and (ii) increasing K required to maintain model quality as sequences grow. We identify that their inefficiency is due to the single-level design, as a single coarse level is insufficient to represent the global structure. In this paper, we introduce Log-linear Sparse Attention (LLSA), a trainable sparse attention mechanism for extremely long token sequences that reduces both selection and attention costs from quadratic to log-linear complexity by utilizing a hierarchical structure. LLSA performs hierarchical Top-K selection, progressively adopting sparse Top-K selection with the indices found at the previous level, and introduces a Hierarchical KV Enrichment mechanism that preserves global context while using fewer tokens of different granularity during attention computation. To support efficient training, we develop a high-performance GPU implementation that uses only sparse indices for both the forward and backward passes, eliminating the need for dense attention masks. We evaluate LLSA on high-resolution pixel-space image generation without using patchification and VAE encoding. LLSA accelerates attention inference by 28.27x and DiT training by 6.09x on 256x256 pixel token sequences, while maintaining generation quality. The results demonstrate that LLSA offers a promising direction for training long-sequence DiTs efficiently. Code is available at: https://github.com/SingleZombie/LLSA

解读

一句话总结

本文提出了一种名为Log-linear Sparse Attention (LLSA)的新颖注意力机制,通过利用分层结构和高效的GPU实现,将扩散Transformer(DiT)的注意力计算复杂度从二次方降低到对数线性,从而有效提升了长序列DiT的训练效率。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源