arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2510.01450cs.LGcs.AI
收藏

局部线性注意力:面向测试时回归的线性与Softmax注意力最优插值方法

Local Linear Attention: An Optimal Interpolation of Linear and Softmax Attention For Test-Time Regression

Snowflake AI Research(Snowflake AI研究机构);Northwestern University(西北大学);University of Washington(华盛顿大学)

Yifei Zuo, Yutong Yin, Zhichen Zeng, Ang Li, Banghua Zhu, Zhaoran Wang

AI总结:

本研究提出新型注意力机制局部线性注意力(LLA),从测试时回归视角推导,兼具理论优势,配套推出高效算法FlashLLA与定制内核,经实验验证在多项任务中性能优于基线,具备大模型应用潜力。

摘要:

Transformer架构已在诸多领域取得显著成果。尽管针对Softmax注意力的高效替代方案已被广泛研究,但探寻具备理论依据、表达能力更强的注意力机制(即便计算成本更高)的相关探索仍相对不足。本研究填补了这一空白,提出局部线性注意力(Local Linear Attention,LLA)——一种从非参数统计出发、以测试时回归视角推导的新型注意力机制。首先,我们通过偏差-方差权衡分析证明,在联想记忆任务上,LLA相比线性注意力与Softmax注意力具备理论优势。其次,我们针对其计算难题提出两种内存高效的基元操作,解决了Θ(n²d)与Θ(nd²)的复杂度问题。随后我们推出FlashLLA,这是一种硬件友好的分块算法,可在现代加速器上实现可扩展的并行计算。此外我们实现并实测了定制化推理内核,大幅降低了内存开销。最后我们在测试时回归、上下文内回归、联想回忆与状态追踪任务上,通过实验验证了LLA的优势与局限。实验结果表明,LLA能有效适配非平稳性,在测试时训练与上下文学习任务中表现优于强基线模型,同时展现出在大模型中具备可扩展性与应用潜力的积极证据。代码可在https://github.com/Yifei-Zuo/Flash-LLA获取。

英文摘要:

Transformer architectures have achieved remarkable success in various domains. While efficient alternatives to Softmax Attention have been widely studied, the search for more expressive mechanisms grounded in theoretical insight-even at greater computational cost-has been relatively underexplored. In this work, we bridge this gap by proposing Local Linear Attention (LLA), a novel attention mechanism derived from nonparametric statistics through the lens of test-time regression. First, we show that LLA offers theoretical advantages over Linear and Softmax Attention for associative memory via a bias-variance trade-off analysis. Next, we address its computational challenges and propose two memory-efficient primitives to tackle the $Θ(n^2 d)$ and $Θ(n d^2)$ complexity. We then introduce FlashLLA, a hardware-efficient, blockwise algorithm that enables scalable and parallel computation on modern accelerators. In addition, we implement and profile a customized inference kernel that significantly reduces memory overheads. Finally, we empirically validate the advantages and limitations of LLA on test-time regression, in-context regression, associative recall and state tracking tasks. Experiment results demonstrate that LLA effectively adapts to non-stationarity, outperforming strong baselines in test-time training and in-context learning, and exhibiting promising evidence for its scalability and applicability in large-scale models. Code is available at https://github.com/Yifei-Zuo/Flash-LLA.

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

↑