Optimal Query Complexities for Dynamic Trace Estimation

David Woodruff, Fred Zhang, Qiuyi Zhang

This paper tackles a fundamental problem in numerical linear algebra: Dynamic Trace Estimation. When a large matrix changes over time—such as the Hessian during neural network training—how can we efficiently track its trace (the sum of its diagonal elements) using as few "probes" as possible?

The Challenge of Dynamic Environments

In many large-scale applications, we cannot afford to look at every entry of a massive matrix $A$. Instead, we interact with it via an "oracle" that computes matrix-vector products ($Ax$). Estimating the trace ($\text{Tr}(A)$) using these products is a core task in Gaussian processes, triangle counting in graphs, and analyzing the optimization landscapes of deep networks.

The challenge arises in dynamic settings, where we have a sequence of matrices $A_1, A_2, \dots, A_m$ that are "close" to each other (i.e., the difference between consecutive matrices is small). Naïve approaches either estimate each trace independently—ignoring the temporal correlation—or estimate the differences and sum them up, which leads to a massive accumulation of errors over time. This paper seeks the "Goldilocks" complexity: an algorithm that exploits the slow change of the matrix without succumbing to error drift.

Technical Contributions

The authors introduce several major technical innovations to solve this problem:

  1. Binary Tree Summation: Instead of a simple linear sum of differences, the algorithm organizes the sequence of matrices into a binary tree. Each node in the tree represents the difference between matrices at different time scales. By carefully allocating the "query budget" and error tolerances across the levels of this tree, they prevent the linear growth of error.
  2. Generalized Hutch++: They extend the state-of-the-art Hutch++ algorithm (originally designed for static matrices) to work with general Schatten-$p$ norms (where $p \in [1, 2]$). This allows the estimator to be robust across different types of matrix structures, from nuclear norm ($p=1$) to Frobenius norm ($p=2$).
  3. Information-Theoretic Lower Bounds: To prove their algorithm is optimal, the authors use reductions from communication complexity (specifically the "Gap-Equality" and "Augmented Indexing" problems) and information-theoretic analysis of Gaussian matrices.

Key Insights

  • Optimality of Hutchinson’s: A major breakthrough is the proof that the classic Hutchinson’s estimator is actually optimal for static trace estimation, even if you allow the algorithm to be "adaptive" (choosing its next probe based on previous results). This settles a significant open question in the field.
  • The Power of the Tree: The binary tree structure is the key to stability. It ensures that any single matrix estimate $t_i$ only depends on a logarithmic number of difference estimates, keeping the total variance in check.
  • Unconditional Bounds: Unlike previous work that relied on conditional assumptions, this paper provides the first unconditional lower bounds for dynamic trace estimation, showing exactly how the query complexity must scale with the rate of change ($\alpha$), the number of steps ($m$), and the desired error ($\epsilon$).

Key Results

The paper provides a comprehensive map of the complexity landscape for trace estimation, establishing tight bounds that resolve prior open questions.

Summary of upper and lower bounds for static trace estimation.

For the dynamic case with $p=1$, their algorithm achieves a complexity of: $$ \tilde{O}(m\alpha \sqrt{\log(1/\delta)}/\epsilon + m \log(1/\delta)) $$ This is a significant improvement over previous state-of-the-art methods, particularly in how it handles the failure probability ($\delta$) and the rate of change ($\alpha$).

In practical experiments, the theoretical gains translate to real-world performance:

  • Triangle Counting: On arXiv collaboration networks, the proposed "Tree" algorithm significantly outperformed standard Hutchinson and "DeltaShift" methods, maintaining much lower relative error for the same query budget.
  • Neural Networks: When tracking the trace of weight matrices during MNIST training, the algorithm achieved much smaller absolute errors than prior methods, especially during the early, volatile stages of training.

Limitations and Future Work

  • Schatten Norm Range: The current analysis and optimality proofs are restricted to $p \in [1, 2]$. Extending these results to $p > 2$ remains an open challenge.
  • Matrix Structure: While the algorithm is general, it does not explicitly exploit specific matrix structures like sparsity or low-rankness beyond what is captured by the Schatten norms.
  • Real-world Hessian Tracking: While the paper tests on weight matrices, applying this directly to the Hessian of a massive Transformer model would require further engineering to handle the implicit Hessian-vector products efficiently at scale.

Summary updated

BibTeX
@inproceedings{woodruff2022optimal,
  author = {David Woodruff and Fred Zhang and Qiuyi Zhang},
  title = {{Optimal Query Complexities for Dynamic Trace Estimation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=1wz-ksUupt2},
}
Figure