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

04/10/2023
by   Yichuan Deng, et al.
0

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 ∈ℝ^n × d, suppose d ≫ n and X X^⊤_∞ < r with r ∈ (0,0.1), then we aim for finding Y ∈ℝ^n × m (where m≪ d) such that D(Y)^-1exp( Y Y^⊤ ) - D(X)^-1exp( X X^⊤) _∞≤ O(r) We provide two results for this problem. ∙ Our first result is a randomized algorithm. It runs in O(nnz(X) + n^ω ) time, has 1-δ succeed probability, and chooses m = O(n log(n/δ)). Here nnz(X) denotes the number of non-zero entries in X. We use ω to denote the exponent of matrix multiplication. Currently ω≈ 2.373. ∙ Our second result is a deterministic algorithm. It runs in O(min{∑_i∈[d]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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
03/28/2023

Solving Regularized Exp, Cosh and Sinh Regression Problems

In modern machine learning, attention computation is a fundamental task ...
research
04/05/2023

Algorithm and Hardness for Dynamic Attention Maintenance in Large Language Models

Large language models (LLMs) have made fundamental changes in human life...
research
05/12/2022

Bottleneck Matching in the Plane

We present an algorithm for computing a bottleneck matching in a set of ...
research
03/29/2023

Certified Hardness vs. Randomness for Log-Space

Let ℒ be a language that can be decided in linear space and let ϵ >0 be ...
research
12/24/2019

Counting the geodesic cycles of a given length

Assume that X is a connected regular undirected graph of finite order n....
research
05/29/2017

Coreset Construction via Randomized Matrix Multiplication

Coresets are small sets of points that approximate the properties of a l...

Please sign up or login with your details

Forgot password? Click here to reset