arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2304.04397cs.DScs.LG
收藏

针对过参数化特征维度的随机与确定性注意力稀疏化算法

Randomized and Deterministic Attention Sparsification Algorithms for Over-parameterized Feature Dimension

The University of Washington(华盛顿大学);Adobe Research(奥多比研究院)

Yichuan Deng, Sridhar Mahadevan, Zhao Song

AI总结:

本文研究过参数化特征维度下的注意力稀疏化问题,在logit矩阵对称的假设下,分别提出了运行高效的随机化和确定性算法,可将超大特征维度降至与句子长度近线性的规模。

摘要:

大型语言模型(LLMs)在不同领域展现了其强大的能力。作为 LLMs 的一个重要子例程,注意力计算在理论上也引起了关注。最近,[Alman and Song 2023] 和 [Brand, Song and Zhou 2023] 从算法复杂度和硬度两个角度研究了注意力矩阵的静态计算与动态维护。在本工作中,我们考虑注意力问题的稀疏化。我们做了一个简化,即 logit 矩阵是对称的。设 $n$ 表示句子长度,$d$ 表示嵌入维度。给定矩阵 $X \in \mathbb{R}^{n \times d}$,假设 $d \gg n$ 且 $\\| X X^\top \\|_{\infty} < r$(其中 $r \in (0,0.1)$),我们的目标是寻找 $Y \in \mathbb{R}^{n \times m}$(其中 $m\ll d$),使得 \begin{align*} \\| D(Y)^{-1} \exp( Y Y^\top ) - D(X)^{-1} \exp( X X^\top) \\|_{\infty} \leq O(r) \end{align*} 我们为该问题提供了两个结果。\n $\bullet$ 第一个结果是随机化算法。其运行时间为 $\widetilde{O}(\mathrm{nnz}(X) + n^\omega )$,成功概率为 $1-\delta$,并选择 $m = O(n \log(n/\delta))$。这里 $\mathrm{nnz}(X)$ 表示 $X$ 中非零项的数量。我们用 $\omega$ 表示矩阵乘法的指数。目前 $\omega\approx 2.373$。\n $\bullet$ 第二个结果是确定性算法。其运行时间为 $\widetilde{O}(\min\{\sum_{i\in[d]}\mathrm{nnz}(X_i)^2, dn^{\omega-1}\} + n^{\omega+1})$,并选择 $m = O(n)$。这里 $X_i$ 表示矩阵 $X$ 的第 $i$ 列。\n 我们的主要发现对应用 LLMs 任务具有如下启示:对于任意超大的特征维度,我们都可以将其降至与句子长度近乎呈线性关系的规模。

英文摘要:

Large language models (LLMs) have shown their power in different areas. Attention computation, as an important subroutine of LLMs, has also attracted interests in theory. Recently the static computation and dynamic maintenance of attention matrix has been studied by [Alman and Song 2023] and [Brand, Song and Zhou 2023] from both algorithmic perspective and hardness perspective. In this work, we consider the sparsification of the attention problem. We make one simplification which is the logit matrix is symmetric. Let $n$ denote the length of sentence, let $d$ denote the embedding dimension. Given a matrix $X \in \mathbb{R}^{n \times d}$, suppose $d \gg n$ and $\| X X^\top \|_{\infty} < r$ with $r \in (0,0.1)$, then we aim for finding $Y \in \mathbb{R}^{n \times m}$ (where $m\ll d$) such that \begin{align*} \| D(Y)^{-1} \exp( Y Y^\top ) - D(X)^{-1} \exp( X X^\top) \|_{\infty} \leq O(r) \end{align*} We provide two results for this problem. $\bullet$ Our first result is a randomized algorithm. It runs in $\widetilde{O}(\mathrm{nnz}(X) + n^ω ) $ time, has $1-δ$ succeed probability, and chooses $m = O(n \log(n/δ))$. Here $\mathrm{nnz}(X)$ denotes the number of non-zero entries in $X$. We use $ω$ to denote the exponent of matrix multiplication. Currently $ω\approx 2.373$. $\bullet$ Our second result is a deterministic algorithm. It runs in $\widetilde{O}(\min\{\sum_{i\in[d]}\mathrm{nnz}(X_i)^2, dn^{ω-1}\} + n^{ω+1})$ time and chooses $m = O(n)$. Here $X_i$ denote the $i$-th column of matrix $X$. Our main findings have the following implication for applied LLMs task: for any super large feature dimension, we can reduce it down to the size nearly linear in length of sentence.

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

↑