通过协调采样进行矩阵乘积草图化
Matrix Product Sketching via Coordinated Sampling
AI总结:
针对独立计算矩阵草图以近似稀疏矩阵乘积的问题,提出基于共享随机种子的协调采样方法,在理论和实验上均证明其优于经典线性草图方法,在分布式回归和注意力矩阵近似中实现数量级提升。
摘要:
我们重新研究了基于小空间草图 $\mathcal{S}(\mathbf{A})$ 和 $\mathcal{S}(\mathbf{B})$ 来近似矩阵乘积 $\mathbf{A}^T\mathbf{B}$ 的问题,其中 $\mathbf{A} \in \R^{n \times d}$,$\mathbf{B}\in \R^{n \times m}$。我们关注的是草图必须彼此独立计算的设定,除了使用共享的随机种子。我们证明,当 $\mathbf{A}$ 和 $\mathbf{B}$ 稀疏时,基于协调随机采样的方法能够优于经典的线性草图方法,如 Johnson-Lindenstrauss Projection 或 CountSketch。例如,为了获得 Frobenius 范数误差 $ε\\|\mathbf{A}\\|_F\\|\mathbf{B}\\|_F$,当 $\mathbf{A}$ 和 $\mathbf{B}$ 每行最多有 $s \leq d,m$ 个非零元素时,协调采样需要大小为 $O(s/ε^2)$ 的草图。相比之下,线性草图导致 $\mathbf{A}$ 和 $\mathbf{B}$ 的草图大小分别为 $O(d/ε^2)$ 和 $O(m/ε^2)$。我们在两个应用上实证评估了我们的方法:1)数据库中的分布式线性回归,这是一个由数据集发现和增强等任务驱动的问题;2)在基于 transformer 的语言模型中近似注意力矩阵。在这两种情况下,我们的采样算法比线性草图产生了一个数量级的改进。
英文摘要:
We revisit the well-studied problem of approximating a matrix product, $\mathbf{A}^T\mathbf{B}$, based on small space sketches $\mathcal{S}(\mathbf{A})$ and $\mathcal{S}(\mathbf{B})$ of $\mathbf{A} \in \R^{n \times d}$ and $\mathbf{B}\in \R^{n \times m}$. We are interested in the setting where the sketches must be computed independently of each other, except for the use of a shared random seed. We prove that, when $\mathbf{A}$ and $\mathbf{B}$ are sparse, methods based on \emph{coordinated random sampling} can outperform classical linear sketching approaches, like Johnson-Lindenstrauss Projection or CountSketch. For example, to obtain Frobenius norm error $ε\|\mathbf{A}\|_F\|\mathbf{B}\|_F$, coordinated sampling requires sketches of size $O(s/ε^2)$ when $\mathbf{A}$ and $\mathbf{B}$ have at most $s \leq d,m$ non-zeros per row. In contrast, linear sketching leads to sketches of size $O(d/ε^2)$ and $O(m/ε^2)$ for $\mathbf{A}$ and $\mathbf{B}$. We empirically evaluate our approach on two applications: 1) distributed linear regression in databases, a problem motivated by tasks like dataset discovery and augmentation, and 2) approximating attention matrices in transformer-based language models. In both cases, our sampling algorithms yield an order of magnitude improvement over linear sketching.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。