Hardness of Low Rank Approximation of Entrywise Transformed Matrix Products

Tamas Sarlos, Xingyou Song, David Woodruff, Qiuyi, Zhang

This paper, presented at NeurIPS 2023, explores the fundamental computational limits of a technique widely used in modern machine learning: approximating transformed matrix products.

TL;DR

The authors prove that fast (subquadratic time) low-rank approximation of entrywise transformed matrix products $f(UV)$ is impossible for a broad class of functions unless very specific conditions are met, such as the matrix being symmetric and the function being a specific type of kernel. They provide new lower bounds based on the Strong Exponential Time Hypothesis (SETH) and introduce tight new algorithms for polynomial transformations that match these bounds.

What Problem Does This Paper Address?

Low-rank approximation (LRA) is a cornerstone of efficient computing. It involves taking a large, complex matrix and finding a much smaller, "low-rank" version that captures its most important features. This is crucial for speeding up computations and reducing memory usage.

In fields like Natural Language Processing (NLP), we often deal with matrices formed by an entrywise transformation of a product, denoted as $A = f(UV)$. A prime example is the attention mechanism in Transformers, which uses a softmax transformation on the product of "query" and "key" matrices.

While previous research found fast algorithms for LRA when $U = V^\top$ and $f$ is a positive semi-definite (PSD) kernel, it wasn't clear if these were special cases or if fast LRA was generally possible. This paper investigates the "hardness" of this problem—determining exactly when subquadratic time algorithms are theoretically possible and when they are not.

Methods

The paper employs two main approaches:

  1. Hardness Reductions: The authors prove lower bounds by reducing well-known hard problems in computer science to the LRA problem. Specifically, they use the Strong Exponential Time Hypothesis (SETH) via the Orthogonal Vectors Problem (OVP) and the Maximum Inner Product (Max-IP) problem. They show that if a fast LRA algorithm existed for certain functions $f$, it would imply a breakthrough in solving these notoriously difficult problems, which is considered unlikely.
  2. Algorithmic Design: To show their lower bounds are "tight," they develop new algorithms for the cases where $f(x) = x^p$. They use randomized sketching techniques, including Gaussian sketching for relative error and TensorSketch for additive error, to project high-dimensional matrices into lower-dimensional spaces where LRA can be performed efficiently.

Datasets

The paper is purely theoretical and does not use empirical datasets for training or evaluation. It focuses on proving complexity bounds and algorithmic guarantees.

Key Insights and Ideas

  • The Necessity of Symmetry and PSD Kernels: The authors demonstrate that the two conditions previously thought to enable fast LRA—symmetry ($U = V^\top$) and $f$ being a PSD kernel—are not just sufficient, but actually necessary for subquadratic time relative error LRA.
  • Relative vs. Additive Error Gap: A major finding is the sharp contrast between relative error and additive error LRA. For polynomial transformations $f(x) = x^p$, relative error LRA is exponentially hard in terms of the degree $p$, whereas additive error LRA only has a polynomial dependence on $p$.
  • Asymmetry Breeds Hardness: When $U \neq V^\top$ (the asymmetric case), the problem becomes significantly harder. Even for simple polynomials, the runtime lower bound becomes $\Omega(\min(n^{2-o(1)}, 2^{\Omega(p)}))$.
  • LRA vs. Matrix-Vector (MV) Products: The paper shows that LRA is inherently different from, and in some ways easier than, approximating the entire matrix or performing matrix-vector multiplication. However, their new lower bounds for LRA are strong enough to also provide new hardness results for MV products $f(UV)z$.

Key Results

The paper's contributions are best summarized by comparing them to prior work, as shown in the table below (extracted from page 3 of the paper).

Table 1: Overview of upper and lower bounds for LRA and related primitives.
  • New Lower Bounds: They establish $n^{2-o(1)}$ time lower bounds for a wide class of functions, including $f(x) = |x|^p$ and functions with dominant Taylor series terms like $\log(|x| + 1)$.
  • Tight Algorithms: For $f(x) = x^p$, they provide a relative error algorithm with $O(n \cdot \text{poly}(k, 2^p, 1/\epsilon))$ runtime and an additive error algorithm with $O(n \cdot \text{poly}(k, p, 1/\epsilon))$ runtime. These results show that the exponential dependence on $p$ for relative error is a fundamental limit, not a weakness of previous algorithms.

Limitations and Future Work

  • SETH Dependence: The lower bounds are "conditional," meaning they rely on the assumption that SETH is true. While widely believed, SETH remains unproven.
  • Function Scope: While the paper covers a broad class of functions (polynomials and those dominated by a single Taylor term), it doesn't provide a universal characterization for every possible scalar function $f$.
  • Softmax Complexity: A key future direction is extending these results to the full softmax function used in Transformers, which is more complex than the polynomial approximations studied here. The authors suggest their techniques regarding leverage scores of sparse vectors could be a starting point for this.

Summary updated

BibTeX
@inproceedings{sarlos2023hardness,
  author = {Tamas Sarlos and Xingyou Song and David Woodruff and Qiuyi and Zhang},
  title = {{Hardness of Low Rank Approximation of Entrywise Transformed Matrix Products}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=LCwToX315b},
}
Figure