Learning to Discover Iterative Spectral Algorithms

Zihang Liu, Oleg Balabanov, Yaoqing Yang, Michael W. Mahoney

TL;DR

AutoSpec is a novel self-supervised neural network framework that automatically discovers continuous, iterative spectral algorithms for large-scale numerical linear algebra (NLA). By mapping coarse, inexpensive spectral data to optimal recurrence coefficients, AutoSpec designs custom matrix polynomials for tasks like linear system solving and eigenvalue computation, delivering up to an order-of-magnitude speedup over classical baselines.

What Problem Does This Paper Address?

Most recent breakthroughs in machine learning-driven algorithm discovery (like AlphaDev or AlphaTensor) operate by searching over discrete spaces, such as program code or symbolic expressions. While highly effective for sorting or discrete matrix multiplication, this paradigm falls short in numerical linear algebra and continuous optimization.

In NLA, effective methods must be continuous and highly adaptive to the unique spectral structure (the distribution of eigenvalues) of the input matrix. Classical approaches, such as Chebyshev acceleration or Neumann series, are either entirely spectrum-agnostic or rely on rigid, hard-to-compute global spectral bounds. This often leads to suboptimal convergence or introduces numerical issues like eigenvalue clustering. The authors bridge this gap by creating a framework that allows neural networks to continuously design and tailor iterative numerical algorithms directly from coarse spectral data.

Methods

The core architecture of AutoSpec consists of an end-to-end differentiable framework designed to discover matrix-free iterative algorithms:

  1. Spectral Probing: Given a large input matrix $X$, a cheap warm-start routine (such as a few steps of a Lanczos or Krylov-Schur solver) extracts a "spectral probe"—a coarse set of eigenvalue estimates and their corresponding residual norms.
  2. Neural Network Engine: This probe is fed into an Embedding Layer that extracts essential spectral features, which are then passed to a Backbone Model. The backbone outputs the scalar coefficients for a short, executable NLA recurrence relation.
  3. State Recurrence: Instead of explicitly constructing a massive, dense matrix polynomial $P(X)$, the framework implements the algorithm as a matrix-free state recurrence. It computes the action of the polynomial on a vector ($z \mapsto P(X)z$) using only cheap matrix-vector multiplications.
  4. Self-Supervised Training: AutoSpec requires no human-labeled algorithmic targets. It trains entirely via unsupervised, task-specific NLA loss functions (e.g., minimizing condition numbers or maximizing eigenvalue gaps) optimized using a log-scale ratio relative to standard baselines.

Crucially, the network trains efficiently on tiny, synthetic diagonal matrices, yet the learned coefficient rules generalize perfectly to massive, real-world operators at inference time.

Figure 1: AutoSpec framework. (a) A trained neural network engine, paired with an executable recurrence, defines a discovered numerical algorithm for downstream NLA tasks. (b) An end-to-end differentiable algorithmic structure: given operator X, a spectral probe (bλ, br) consisting of eigenvalue estimates and residual norms, is extracted and fed to the neural engine to produce the coefficients of a degree-d polynomial P(·). The polynomial is implemented in a matrix-free manner via a short recurrence: starting from V0 = z, we iterate Vk+1 = Mk(X)Vk, where each Mk is parameterized by the engine. The terminal state returns the action Vd+1 = P(X)z of the polynomial to inputs z, which allows self-supervised training by backpropagating task-defined NLA losses on Vd+1.

Datasets

  • Training Data: A curated synthetic dataset of 50,000 diagonal matrices. The eigenvalues are generated using quasi-random Sobol sequences to create diverse spectral profiles, including combinations of flat, exponential, and power-law decay profiles, augmented with multiplicative noise to simulate non-idealized operators.
  • Evaluation Data: Real-world, large-scale sparse symmetric positive-definite (spd) matrices pulled from the SuiteSparse Matrix Collection. These test matrices span applications in finite-element modeling, structural mechanics, and circuit simulation, with dimensions ranging from $n = 468$ up to $n = 1.6 \times 10^6$.

Key Insights and Ideas

  • Continuous Discovery Paradigm: Shifting algorithm discovery from discrete code generation to continuous coefficient optimization unlocks the ability of ML to impact fundamental continuous mathematics and optimization.
  • Emergence of Classical Theory: When trained without structural constraints, AutoSpec naturally discovers polynomials that exhibit the "equioscillation" behavior characteristic of classical minimax Chebyshev polynomials—validating that the network independently rediscovers established mathematical principles.
  • Surpassing Classical Limitations: Unlike rigid classical constructions, AutoSpec can optimize multi-term objectives. By introducing a structural loss, the network learns to slightly trade off pure minimax error to prevent the harmful "eigenvalue clustering" that typically degrades the performance of standard Chebyshev preconditioners.
  • Dimension-Agnostic Generalization: Because the network conditions its predictions on dimension-independent spectral summaries rather than matrix size, models trained on matrices where $n \le 10^3$ extrapolate flawlessly to real-world matrices where $n \le 10^6$.

Key Results

AutoSpec was evaluated across three classical NLA tasks:

  • Preconditioned Linear Systems: As a second-level accelerator for Conjugate Gradient (CG) solvers, AutoSpec consistently reduced iteration counts by up to an order of magnitude compared to unpreconditioned baselines, significantly outperforming standard Neumann preconditioning.
Figure 2: Convergence of CG solver with polynomial preconditioning. Curves show the median error and the 20th/80th percentiles over five random seeds.
  • Eigenvalue Problems: For computing the smallest eigenpairs using eigs (Krylov-Schur), AutoSpec preconditioners drastically accelerated convergence. For example, on the SiO2 matrix, it reduced the required outer iterations from over 500 down to just 23.
  • Matrix Function Approximation: In computing the inverse square root ($X^{-1/2}$) for covariance whitening, AutoSpec achieved order-of-magnitude improvements in operator-norm error compared to truncated Neumann series.

Limitations and Future Work

The primary limitation of the current work is its restriction to symmetric positive-definite (spd) matrices, where classical polynomial theory is already well-understood. Extending AutoSpec to indefinite and non-symmetric systems is a vital next step. Additionally, the framework relies heavily on the diversity of its synthetic training spectra; if a test matrix features a unique spectral profile or an extreme eigengap not represented in training, performance can degrade.

The authors note that the underlying state-transition framework can naturally expand to support richer update classes, including higher-order polynomial recurrences, rational models (using resolvents for sharp variations), and non-linear transition maps for gradient-driven optimization.

Summary updated

BibTeX
@inproceedings{liu2026learning,
  author = {Zihang Liu and Oleg Balabanov and Yaoqing Yang and Michael W. Mahoney},
  title = {{Learning to Discover Iterative Spectral Algorithms}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=y7Sb7T9UI9},
}
Figure