arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.05175cs.LGcs.DMcs.DS
收藏

使用减少 10% 操作的精确因果注意力

Exact Causal Attention with 10% Fewer Operations

Dmitry Rybin, Yushun Zhang, Ding Tian, Zhihang Lin, Zhi-Quan Luo

AI总结:

提出精确因果注意力(ECA)算法,利用机器学习发现的代数恒等式,将因果注意力中的三角矩阵乘法操作减少 10%,为计算受限场景提供新方案。

摘要:

我们提出了精确因果注意力(ECA),这是一种 Strassen 风格的算法,使用减少 10% 的操作来计算精确的 Causal Attention。ECA 改进了一类特殊的矩阵乘法,其中某一个操作数或输出矩阵是上三角或下三角的。这包括 Causal Attention 前向和反向传播中的所有矩阵乘法操作,例如掩码乘积 $\mathrm{Mask}(QK^{T})$。ECA 基于通过机器学习和组合搜索发现的代数恒等式构建。我们注意到,ECA 无法加速 GPU 上的融合内核(如 FlashAttention)。这是因为 ECA 需要在内存中物化大型中间表达式,而 FlashAttention 则不需要。然而,它为计算受限的应用程序提供了一种替代方法,并且在有 FLOPs 考虑的场景中可能有用。

英文摘要:

We present Exact Causal Attention (ECA), a Strassen-style algorithm that computes exact Causal Attention using 10\% fewer operations. ECA improves a special class of matrix multiplications where either one operand or the output matrix is upper- or lower-triangular. This includes all matrix multiplication operations in the forward and backward pass of Causal Attention, such as masked product $\mathrm{Mask}(QK^{T})$. ECA is built upon algebraic identities discovered via machine learning and combinatorial search. We note that ECA cannot accelerate fused kernels such as FlashAttention on GPU. This is because ECA requires materialization of large intermediate expressions in the memory, while FlashAttention does not. However, it provides an alternative approach for compute-bound applications and can potentially be useful in scenarios with FLOPs considerations.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑