Optimal Sketching for Trace Estimation

Shuli Jiang, Hai Pham, David P. Woodruff, Qiuyi, Zhang

TL;DR

This paper closes the theoretical gap between adaptive and non-adaptive algorithms for implicit matrix trace estimation. The authors provide a new analysis showing that non-adaptive "sketching" algorithms can achieve the same optimal query complexity as their adaptive counterparts in high-probability settings, enabling significantly faster parallel execution without sacrificing accuracy or confidence.

What Problem Does This Paper Address?

In many machine learning applications—such as calculating the log-determinant of a covariance matrix in Gaussian Processes or studying the Hessian of a neural network—we need to find the trace (the sum of diagonal elements) of a massive matrix $A$. Often, $A$ is too large to store or compute explicitly, but we can compute matrix-vector products $Aq$ (an "oracle" access).

The goal is to estimate $\text{tr}(A)$ within a $(1 \pm \epsilon)$ factor with a failure probability of at most $\delta$, using as few queries as possible.

  • Hutchinson’s method is the classic non-adaptive approach but requires $O(\log(1/\delta)/\epsilon^2)$ queries.
  • Hutch++ recently reduced this to $O(1/\epsilon)$ for constant probability, but its "adaptive" nature (choosing new queries based on previous results) makes it hard to parallelize.
  • Previous non-adaptive versions of Hutch++ were thought to require a significantly higher query overhead to achieve high confidence (low $\delta$).

This paper asks: Can we get the speed of Hutch++ with the parallelizability of a non-adaptive sketch, even when we demand very high confidence?

Methods

The authors focus on the NA-Hutch++ algorithm. The strategy involves splitting a fixed budget of queries into two parts:

  1. Low-Rank Approximation: Use a portion of the queries to find a low-rank approximation $\tilde{A}$ of the matrix $A$.
  2. Residual Estimation: Use the remaining queries to perform Hutchinson’s trace estimation on the residual matrix $(A - \tilde{A})$.

The core technical contribution is an improved analysis of the query complexity required for the low-rank approximation step. Previously, it was believed that $O(k \log(1/\delta))$ queries were necessary to get a good rank-$k$ approximation with probability $1-\delta$. The authors prove that $O(k + \log(1/\delta))$ queries actually suffice. By balancing the rank $k$ and the residual queries $l$, they arrive at a total query complexity of $O(\sqrt{\log(1/\delta)}/\epsilon + \log(1/\delta))$.

Datasets

The authors evaluated their algorithm across several synthetic and real-world scenarios:

  • Synthetic: A $5000 \times 5000$ matrix with a fast-decaying spectrum (eigenvalues $\lambda_i = 1/i^2$).
  • Graph Estrada Index: The roget dataset (a Thesaurus semantic graph with 1,022 nodes).
  • Graph Triangle Counting: The arxiv_cm dataset (Condense Matter collaboration network with ~23k nodes).
  • Gaussian Process MLE: The precipitation dataset (weather station data from 2010).
  • Log-Determinant Estimation: The bcsstk20 and bcsstm08 matrices from the UFL Sparse Matrix Collection.

Key Insights and Ideas

  • The Power of Non-Adaptivity: The most surprising insight is that non-adaptive algorithms are not fundamentally "weaker" than adaptive ones for this problem. You don't need to see the result of the first query to pick a good second query.
  • Concentration of Orthogonal Subspaces: The technical "aha moment" involves proving that the product of two random Gaussian matrices from orthogonal subspaces concentrates much better than previously thought. This allows for a much tighter bound on the error of the low-rank approximation step.
  • Parallelism is the Killer App: Because NA-Hutch++ is non-adaptive, all matrix-vector products can be computed simultaneously. In a multi-core or distributed environment, this leads to massive wall-clock time savings compared to the sequential steps required by the standard Hutch++.

Key Results

  • Theoretical Optimality: The authors proved a new upper bound of $O(\sqrt{\log(1/\delta)}/\epsilon + \log(1/\delta))$ queries and a matching lower bound (up to a $\log \log(1/\delta)$ factor), proving their method is essentially optimal.
  • Empirical Speedup: In parallel execution tests (using 40 CPU cores), NA-Hutch++ was significantly faster than the adaptive Hutch++. For example, on the arxiv_cm dataset, NA-Hutch++ maintained the low failure rate of Hutch++ while running nearly as fast as the much less accurate Hutchinson method.
  • Accuracy: NA-Hutch++ consistently produced fewer "failed" estimates (estimates outside the $1 \pm \epsilon$ range) than Hutchinson’s method for the same query budget.

Limitations and Future Work

  • PSD Assumption: The theoretical bounds primarily target positive semi-definite (PSD) matrices, though the authors note it works empirically on some non-PSD instances (like triangle counting).
  • Log-Log Gap: There remains a tiny theoretical gap—a factor of $\log \log(1/\delta)$—between the upper and lower bounds that future work could potentially close.
  • Sketching Types: The current work focuses on Gaussian random vectors. Exploring whether other types of sketches (like Sparse Sign matrices or SRHT) can achieve similar high-probability guarantees is a suggested direction.

Summary updated

BibTeX
@inproceedings{jiang2021optimal,
  author = {Shuli Jiang and Hai Pham and David P. Woodruff and Qiuyi and Zhang},
  title = {{Optimal Sketching for Trace Estimation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
  url = {https://openreview.net/forum?id=rxud5HYKX55},
}
Figure