TL;DR
When optimizing models built on huge symmetric matrices—like Gaussian processes or quantum systems—taking gradients through the standard Lanczos approximation algorithm usually triggers numerical explosions unless you pay for expensive memory and compute fixes. The authors show that you can simply ignore how the Lanczos basis vectors shift with your parameters, differentiating only the tiny compressed matrix at the end. Not only does this bold shortcut become exact as the approximation converges, it yields a fast, rock-solid gradient estimator that never needs costly stabilization.
What Problem Does This Paper Address?
In machine learning and physics, we frequently encounter scalar objectives of the form $u^\top f(A(\theta))u$, where $A(\theta)$ is a massive symmetric (or Hermitian) matrix parameterized by $\theta$, $u$ is a vector, and $f$ is a matrix function like a logarithm (for log-determinants in Gaussian processes) or an exponential (for network dynamics and quantum time-evolution).
When $A(\theta)$ is too big to build or factorize directly, we rely on matrix-free methods—specifically the Lanczos algorithm. In $m$ steps, Lanczos uses fast matrix-vector products to compress the giant $n \times n$ matrix $A$ into a tiny $m \times m$ tridiagonal matrix $T$ via an orthonormal basis $V$ (such that $T = V^\top A V$). Evaluating $f(T)$ is cheap and easy.
The headache starts during optimization, when you need the gradient with respect to $\theta$. Backpropagating directly through the Lanczos loop—or even using custom reverse-mode adjoint rules—is notoriously touchy. In finite-precision computer arithmetic, Lanczos vectors naturally lose orthogonality over time. While the forward pass often shrugs this off, differentiating through that recurrence amplifies the numerical rot, causing gradients to blow up unless you force reorthogonalization at every step—turning a nimble algorithm into an $O(nm^2)$ compute and memory slog.
Methods
Instead of differentiating through the Lanczos recurrence, the authors side-step it entirely.
By the product rule, the change in the tiny projected matrix $dT$ depends on how $A$ changes directly ($V^\top dA \, V$) plus how the Lanczos basis $V$ shifts with $\theta$. The core method simply drops the basis-variation terms, holding $V$ fixed during differentiation ($dT \approx V^\top dA \, V$).
Here is what is standard versus what is new:
- Standard: Running $m$-step Lanczos on the forward pass, computing the sensitivity matrix $G$ of the small $m \times m$ objective using classical divided-difference Fréchet derivative formulas, and recognizing the resulting lifted structure from low-rank Krylov literature.
- New: Turning this fixed-basis projection into a practical, matrix-free parameter-gradient engine using vector-Jacobian products (VJPs) of the matrix-vector multiply, paired with a rigorous exact-arithmetic error analysis comparing this shortcut against the true derivative of finite Lanczos quadrature. They also introduce two flavors: a stored-basis version for speed, and a blockwise replay version that regenerates basis vectors on the fly to slash memory from $O(nm)$ to $O(nb)$ for block size $b$.
Datasets
No new benchmarks are introduced; the authors evaluate their method across three domains using synthetic setups and established public graph datasets:
- Gaussian Process (GP) Regression: A synthetic dataset of $n = 15,000$ 2D Gaussian inputs using an RBF kernel with diagonal noise.
- SNAP Network Collection: Real-world sparse undirected graphs—specifically
ca-HepTh(an arXiv high-energy physics coauthorship network) andcom-Amazon(an Amazon product co-purchasing network). - Quantum Hamiltonian Learning: Simulated noiseless quantum state pairs generated from an 8-site ($256 \times 256$) Ising-type spin-chain Hamiltonian.
Key Insights and Ideas
- Throwing away derivatives works—for a mathematical reason: Dropping $\partial V / \partial \theta$ sounds like a reckless hack, yet the authors prove an exact identity showing the error is coupled to the final Lanczos residual and bounded by how well a degree-$(m-1)$ polynomial approximates $f'$. When the Krylov subspace captures the action of $A$ (becoming invariant), the discrepancy vanishes to zero.
- Decoupling forward quirks from backward explosions: Because no gradients flow through the three-term Lanczos recurrence, the backward pass becomes immune to the loss of orthogonality that ruins adjoint methods. You can ditch reorthogonalization completely and still get trustworthy gradients.
- Symmetry beats augmentation: Competing matrix-free Fréchet methods often build a $2n \times 2n$ block-triangular matrix, which destroys symmetry and forces the use of slower Arnoldi iterations. Staying in the symmetric Lanczos world preserves speed and low memory.
Key Results
Gradient error comparison showing the authors' method staying stable while adjoint differentiation blows up.
- Rock-solid stability on Matrix Logs: On the $n = 15,000$ GP log-determinant probe task, custom adjoint Lanczos differentiation destabilizes at larger iteration depths $m$ (even with full reorthogonalization) and blows up badly without it. The authors' projected gradient smoothly converges to $<10^{-12}$ relative error with reorthogonalization, and steadily improves down to $\sim 10^{-8}$ without reorthogonalization.
- Faster Network Sensitivities: On
ca-HepThandcom-Amazongraph exponential tasks ($m = 16, 32$), a batched polarized implementation achieves 1.37× to 2.69× wall-clock speedups over the modified-Arnoldi baseline while matching high accuracy (reaching $10^{-10}$ to $10^{-14}$ relative error at $m=32$). - 10× Faster Quantum Learning: Recovering 23 parameters of an 8-site Ising Hamiltonian over 400 Adam steps at depth $m = 50$ recovers parameters within $1.05 \times 10^{-7}$ error while running 10.4× faster than dense Fréchet differentiation (and 14.8× faster at $m = 30$ with $5.43 \times 10^{-3}$ error).
Limitations and Future Work
- Hermitian matrices only: The algorithm relies on the symmetric three-term Lanczos recurrence; extending the approach and analysis to general non-Hermitian matrices remains open.
- Scalar forms, not vectors: The math targets scalar quadratic forms ($u^\top f(A)u$). If you need derivatives of full vector outputs ($f(A)u$), adjoint or derivative-Krylov methods may still be preferable.
- Memory vs. compute tradeoffs: Storing the basis $V$ gets memory-heavy at huge scales, while the memory-saving blockwise replay variant costs extra matrix-vector products.
- Exact-arithmetic theory: While experiments confirm remarkable finite-precision stability without reorthogonalization, the theoretical error bounds currently assume exact arithmetic.
Summary updated