无需训练即可加速双向注意力,适用于无结构输入。
ClusterAttention: A training-free speedup of bidirectional attention

- 用快速递归聚类自适应生成注意力块,可任意设定块大小。
- 在表格数据上提速2-6倍,精度保留99%以上,视频生成提速1.8倍。
- 首次实现单次前向传播下对无结构输入的高效加速,适合实测部署。
本文提出ClusterAttention,一种通用的、无需训练的双向注意力加速方法。现有稀疏注意力方法依赖输入结构(如语言顺序或图像空间邻近性),或使用耗时的聚类过程。ClusterAttention采用快速递归聚类,自适应各注意力头中键与查询的几何分布,生成有效聚类。通过将所有聚类固定为2的幂次大小,使块稀疏注意力在GPU上的每轮查询-键交互延迟与稠密注意力相同。我们推导出稀疏注意力的输出误差表达式,解释了为何紧密聚类反而误差更大;进一步推导出通过聚类中心补偿被排除项时的误差,并证明误差随聚类更紧而减小,已融入方法中。在大规模表格数据上,ClusterAttention使TabPFN-3提速2至6倍,精度保持在稠密模型的99%以上。在视频生成任务中,基于Wan 2.1-14B T2V模型,其输出更接近稠密注意力,且提速1.8倍,优于专门为此设计的SVOO方法(1.4倍),且无需离线校准。据我们所知,这是首个能在非结构化输入和单次前向传播下成功应用的免训练加速方法。
原文摘要 · Abstract (English)
This paper introduces ClusterAttention, a general training-free speedup of bidirectional attention layers. Existing sparse attention methods either rely on structure in the input, such as order in language or spatial proximity in images, or use slow clustering processes amortized over several forward passes. ClusterAttention instead uses a fast recursive clustering method that adapts to the geometry of the keys and queries in each attention head to produce useful clusters. This method allows setting the size of the clusters arbitrarily. We utilize this by setting all clusters to be a fixed size that is a power of two, allowing the block-sparse attention to run at the same latency per query-key interaction as dense attention on GPUs. We also derive an expression for the output error in sparse attention, that explains the counterintuitive experimental finding that tight clusters can lead to larger errors than random clusters. We then derive the error when excluded clusters are compensated through their centroids, and show that this error shrinks with tighter clusters. We integrate this compensation into the method. On large-scale tabular data ClusterAttention speeds up TabPFN-3 arXiv:2605.13986 by two to six times, while retaining at least 99% of the dense accuracy. To our knowledge, it is the first training-free method that can be successfully applied in the setting of unstructured input and a single forward pass. For video generation with Wan 2.1-14B T2V arXiv:2503.20314 , ClusterAttention achieves output closer to dense attention and a larger speedup (1.8x versus 1.4x) compared to SVOO arXiv:2603.18636 , a leading method developed specifically for this domain, both run without offline calibration.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。