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

位置性LSH:用于带有线性偏置的注意机制的二进制块矩阵近似

Positional LSH: Binary Block Matrix Approximation for Attention with Linear Biases

Blavatnik School of Computer Science and AI(Blavatnik计算机科学与人工智能学院)

Daniel Wolfson, Tal Wagner

AI总结:

本文研究了通过局部敏感哈希(LSH)视角下的带有位置偏置的注意机制,证明了ALiBi偏置矩阵是连续块对角二进制掩码的期望,并展示了其在高概率下对块大小的谱范数和最大范数近似保证。

摘要:

transformers中的位置编码通常通过位置嵌入、注意力掩码或偏置项实现,但这些机制之间的正式联系仍然有限。我们通过局部敏感哈希(LSH)的视角研究带有位置偏置的注意机制,聚焦于带有线性偏置的注意(ALiBi)。我们证明ALiBi偏置矩阵是通过“位置性LSH”方案诱导的连续块对角二进制掩码的期望。从该方案中采样的掩码的实部在高概率下具有受控块大小的谱范数和最大范数近似保证。这一结构定理暗示了ALiBi偏置注意的统一近似定理:在高概率下,采样掩码的近似注意输出对所有查询-键-值输入都准确,并且可以在上下文长度的近线性时间内计算,将长上下文ALiBi减少为一组随机化的短上下文常规(位置无偏)注意操作。概念上,这将位置偏置、掩码和位置嵌入连接在一个正式框架中,并提出了一种高效ALiBi偏置注意的方法。在大型语言模型上的实验验证了我们的理论发现。

英文摘要:

Positional encoding in transformers is commonly implemented through positional embeddings, attention masks, or bias terms, but formal connections between these mechanisms remain limited. We study attention with positional bias through the lens of locality-sensitive hashing (LSH), focusing on Attention with Linear Biases (ALiBi). We show that the ALiBi bias matrix is the expectation of contiguous block-diagonal binary masks induced by a ``positional LSH'' scheme. The empirical mean of masks sampled from this scheme yields spectral norm and max-norm approximation guarantees with bounded block sizes with high probability. This structural theorem implies an efficient approximation algorithm for ALiBi-biased attention: with high probability over the sampled masks, the approximate attention output is accurate simultaneously for all query-key-value inputs and can be computed in near-linear time in the context length, reducing long-context ALiBi to a collection of randomized short-context regular (positionally unbiased) attention operations. Conceptually, this connects positional bias, masks, and positional embeddings in a single formal framework and suggests an approach to efficient ALiBi-biased attention. Experiments on large language models validate our theoretical findings.

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

↑