Fast and Stable Gradient Approximation for Quadratic Forms of Hermitian Matrix Functions
Navjot Singh, Kipton Barros, Sherry Li
NeurIPS 2026
Abstract. Objectives involving quadratic forms for Hermitian arise widely in scientific computing and machine learning. Lanczos efficiently approximates these quantities, but differentiating through its recurrence can introduce numerical instability and costly reorthogonalization. Building on existing low-rank Krylov approximations of Fr'echet derivatives, we develop a matrix-free gradient implementation that reuses the forward Lanczos quantities without differentiating through the recurrence. We analyze its discrepancy from the exact gradient of the finite Lanczos approximation, deriving an exact residual-coupled error identity and a bound involving the best degree- uniform polynomial approximation error of , multiplied by a basis-sensitivity factor. The discrepancy vanishes when the Krylov subspace is invariant. Experiments demonstrate accurate gradients and runtime improvements over differentiated-Lanczos and modified-Arnoldi baselines. It remains numerically stable without reorthogonalization in all tested settings, including cases where adjoint-based Lanczos differentiation becomes unstable.
Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.
Claim this paperedit · history
NeurIPS 2026
Accept (poster) · 3 reviews · OpenReview
Updated 25 Nov 2026, 03:42 UTC.
- Decision
- Accept (poster)
Read decision
Meta-review
The paper introduces a forward-only method for approximating gradients of bilinear or quadratic forms , reusing a Lanczos decomposition rather than differentiating through the recurrence (this is technical, and looks narrow, but I believe this is relevant). It proves that the omitted basis-variation error is tied to the Lanczos residual and reports improved runtime and empirical stability on log-determinant, graph-sensitivity, and Hamiltonian-learning tasks.
On the positive side, this is a common primitive in machine learning. Moreover, the method is conceptually simple, matrix-free, and computationally efficient, with minimal overhead beyond the forward Lanczos pass. Its residual-based error decomposition is theoretically useful, and the experiments show substantial accuracy, stability, and speed advantages over existing approaches.
On the negative side, the paper does not clearly delimit the machine-learning problems or regimes where the approximation is preferable.
I am leaning towards acceptance, but I think that a positive response to the questions raised by the reviewers would finally convince all of them to accept and lead to a final paper with more impact (in particular related to relevance to ML, or "in which regimes is the proposed method preferable to differentiating through Lanczos or using Fréchet/adjoint-based methods in terms of accuracy, stability, memory, and runtime?").
Final justification
I recommend acceptance. The paper proposes a simple and practically relevant matrix-free gradient approximation that reuses the forward Lanczos computation and avoids differentiating through a long recurrence, a contribution reviewers viewed as useful for large-scale problems. The rebuttal strengthens the theory with an exact residual-boundary error identity, polynomial-approximation bounds, and an explicit factorially decaying bound for the matrix exponential; reviewers who raised these concerns remained positive after the response. The added experiments (that should make it to the final version) also clearly identify the favorable regime: at moderate Lanczos depth the method matches reference gradient accuracy while full-reorthogonalized AD is slower, and at larger depth full reorthogonalization runs out of memory while the proposed method remains accurate. Finally, the authors clarified the target applications and operating regime, addressing the main positioning concern raised during review.
-- All papers were submitted to a hallucinated reference checker, which highlighted at least two severe violations (see verbatim below). Inventing authors is a serious concern that reflects poorly on the scholarship of authors, but given the paper's contributions and positive opinions of the reviewers, I am still recommending acceptance. Please correct these mistakes.
List of Problematic References with Reasoning @article{Davies2021Computing, author = {Davies, Alexander and Higham, Nicholas J.}, title = {Computing f(a)b for matrix functions f}, journal = {SIAM Journal on Matrix Analysis and Applications}, volume = {42}, number = {2}, pages = {1084--1105}, year = {2021}, doi = {10.1137/20M1363868} } The paper titled 'Computing f(A)b for matrix functions f' was authored by Philip I. Davies (not Alexander Davies) and Nicholas J. Higham. It was published in 2005 in the edited volume 'QCD and Numerical Analysis III' (Lecture Notes in Computational Science and Engineering, Vol. 47, Springer, pp. 15–24), not in the 'SIAM Journal on Matrix Analysis and Applications' in 2021.
@article{haah2024practical, author = {Jeongwan Haah et al.}, title = {Practical hamiltonian learning with unitary dynamics and gibbs states}, journal = {Nature Communications}, year = {2024} } The paper 'Practical Hamiltonian learning with unitary dynamics and Gibbs states' was published in Nature Communications in 2024, but its actual authors are Andi Gu, Lukasz Cincio, and Patrick J. Coles, not Jeongwan Haah.
@article{huang2023robust, author = {Hsin-Yuan Huang et al.}, title = {Robust and efficient hamiltonian learning}, journal = {Quantum}, volume = {7}, pages = {1045}, year = {2023} } The paper titled 'Robust and Efficient Hamiltonian Learning' published in Quantum (Volume 7, page 1045, 2023) was authored by Wenjun Yu, Jinzhao Sun, Zeyao Han, and Xiao Yuan, not Hsin-Yuan Huang.
Read meta-review
Meta-review
The paper introduces a forward-only method for approximating gradients of bilinear or quadratic forms , reusing a Lanczos decomposition rather than differentiating through the recurrence (this is technical, and looks narrow, but I believe this is relevant). It proves that the omitted basis-variation error is tied to the Lanczos residual and reports improved runtime and empirical stability on log-determinant, graph-sensitivity, and Hamiltonian-learning tasks.
On the positive side, this is a common primitive in machine learning. Moreover, the method is conceptually simple, matrix-free, and computationally efficient, with minimal overhead beyond the forward Lanczos pass. Its residual-based error decomposition is theoretically useful, and the experiments show substantial accuracy, stability, and speed advantages over existing approaches.
On the negative side, the paper does not clearly delimit the machine-learning problems or regimes where the approximation is preferable.
I am leaning towards acceptance, but I think that a positive response to the questions raised by the reviewers would finally convince all of them to accept and lead to a final paper with more impact (in particular related to relevance to ML, or "in which regimes is the proposed method preferable to differentiating through Lanczos or using Fréchet/adjoint-based methods in terms of accuracy, stability, memory, and runtime?").
Final justification
I recommend acceptance. The paper proposes a simple and practically relevant matrix-free gradient approximation that reuses the forward Lanczos computation and avoids differentiating through a long recurrence, a contribution reviewers viewed as useful for large-scale problems. The rebuttal strengthens the theory with an exact residual-boundary error identity, polynomial-approximation bounds, and an explicit factorially decaying bound for the matrix exponential; reviewers who raised these concerns remained positive after the response. The added experiments (that should make it to the final version) also clearly identify the favorable regime: at moderate Lanczos depth the method matches reference gradient accuracy while full-reorthogonalized AD is slower, and at larger depth full reorthogonalization runs out of memory while the proposed method remains accurate. Finally, the authors clarified the target applications and operating regime, addressing the main positioning concern raised during review.
-- All papers were submitted to a hallucinated reference checker, which highlighted at least two severe violations (see verbatim below). Inventing authors is a serious concern that reflects poorly on the scholarship of authors, but given the paper's contributions and positive opinions of the reviewers, I am still recommending acceptance. Please correct these mistakes.
List of Problematic References with Reasoning @article{Davies2021Computing, author = {Davies, Alexander and Higham, Nicholas J.}, title = {Computing f(a)b for matrix functions f}, journal = {SIAM Journal on Matrix Analysis and Applications}, volume = {42}, number = {2}, pages = {1084--1105}, year = {2021}, doi = {10.1137/20M1363868} } The paper titled 'Computing f(A)b for matrix functions f' was authored by Philip I. Davies (not Alexander Davies) and Nicholas J. Higham. It was published in 2005 in the edited volume 'QCD and Numerical Analysis III' (Lecture Notes in Computational Science and Engineering, Vol. 47, Springer, pp. 15–24), not in the 'SIAM Journal on Matrix Analysis and Applications' in 2021.
@article{haah2024practical, author = {Jeongwan Haah et al.}, title = {Practical hamiltonian learning with unitary dynamics and gibbs states}, journal = {Nature Communications}, year = {2024} } The paper 'Practical Hamiltonian learning with unitary dynamics and Gibbs states' was published in Nature Communications in 2024, but its actual authors are Andi Gu, Lukasz Cincio, and Patrick J. Coles, not Jeongwan Haah.
@article{huang2023robust, author = {Hsin-Yuan Huang et al.}, title = {Robust and efficient hamiltonian learning}, journal = {Quantum}, volume = {7}, pages = {1045}, year = {2023} } The paper titled 'Robust and Efficient Hamiltonian Learning' published in Quantum (Volume 7, page 1045, 2023) was authored by Wenjun Yu, Jinzhao Sun, Zeyao Han, and Xiao Yuan, not Hsin-Yuan Huang.
1 comment
- Rating
- 4/6
- Confidence
- 3/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- theory
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper proposes a simple and practical method for approximating the gradient of quadratic form of Hermitian matrix functions via Lanczos. We assume that the parametrized matrix could be accessed via matrix-vector product, making Lanczos an attractive method, by Lanczos, we know that where is an orthonormal basis for the Krylov subspace of , ignoring the last term, we could approximate via for tridiagonal . Set , then where is a matrix that depends on the first row of and the divided-difference matrix common in matrix differentiation. Since , , the paper proposes to drop the non- terms, this gives a way to approximate through terms only, and yields an efficient, practical algorithm that first runs iterations of Lanczos to generate , then form the matrix, and let , the derivative of wrt can be written as a bilinear form of wrt the derivative of of . Experiments for several functions, including , network sensitivity and quantum Hamiltonian show the improvements over existing results.
Strengths and weaknesses
Strengths:
-
The proposed method is simple and practical, through extensive experiments, the efficiency improvements are quite significant. This is important when one wants to deploy this algorithm at scale.
-
The studied problem is important, approximating the gradient of bilinear or quadratic form of Hermitian matrix functions is a quite common use case, especially when one tries to use first-order methods to optimize this class of functions.
Weaknesses:
- One major weakness is the numerical stability is verified only through experiments, there are no formal statements proving the numerical stability of the proposed algorithm. This also holds for most of the results in this paper, the only theoretical piece Theorem 2, as Theorem 1 follows from a straightforward calculation. Though Theorem 2 spells out the error term explicitly, it deserves more discussions on the magnitude of the error for various functions.
Questions
Typos:
- Line 262: "We use their We run these..." should be "We run these...".
Questions:
- Can authors give some estimates on the error term of Theorem 2 for specific pairs of ?
Limitations
Yes.
Final justification
Authors' response gives a concrete example that clarifies my question, I'll keep my initial positive rating.
Formatting concerns
N/A.
2 comments
We thank the reviewer for their positive review and catching the typo. We have addressed it. For some intuition on scalar function, hermitian matrix, and
Consider the pair
and define the spectral midpoint and half-width
Since is a best-approximation error, any degree- polynomial bounds it from above. Taking the Taylor polynomial of
about , and using together with on , gives
Substituting this into Theorem 2 yields the explicit estimate
where
Thus, for the matrix exponential, the function-dependent factor decreases factorially with the Lanczos depth. The effective difficulty is governed by the product , i.e. the evolution scale multiplied by the spectral half-width. Indeed, the ratio between the bounds at two successive depths is
so the bound decreases rapidly once . Note that only the half-width enters the polynomial factor: the location of the spectrum enters solely through the scalar prefactor , which equals in the common case , .
For example, take , a unit-norm vector , and a matrix whose spectrum has been scaled to
so that and . If the residual-coupled sensitivity is bounded by uniformly over the depths considered, then
The corresponding upper bounds are approximately
and
These numerical values isolate the function- and spectrum-dependent part of the estimate; the constant represents the residual-coupled Lanczos sensitivity discussed in our response to the previous question. In the regular finite-step regime, where the Lanczos recurrence remains separated from an intermediate near-breakdown, this sensitivity is bounded. If the Krylov subspace becomes invariant, then , so and the discrepancy vanishes exactly.
This example also indicates when convergence may be slower: a wider spectral interval or larger increases , and therefore requires a larger Krylov depth before the factorial decay dominates (which is the regime we would prefer for our approximation as Lanczos loses orthogonality and AD becomes unstable).
The complete derivation is included in the revised appendix. For other functions, matrices, similar results can be derived.
I thank the authors for providing the example, and I don't have more questions. Since my initial rating is positive, I'll keep it as is.
- Rating
- 3/6
- Confidence
- 3/5
- Quality
- 3/4
- Clarity
- 2/4
- Significance
- 2/4
- Originality
- 3/4
- Contribution type
- theory
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper proposes a forward-only method for approximating gradients of scalar bilinear forms involving functions of large Hermitian matrices. The method uses Lanczos to project the large matrix problem onto a small tridiagonal matrix, differentiates the projected objective, and then lifts the sensitivity back to the original parameters using vector-Jacobian products. The authors provide an error analysis related to the Lanczos residual and evaluate the approach on matrix-logarithm derivatives, network sensitivity benchmarks, and quantum Hamiltonian learning.
Strengths and weaknesses
Strengths
The paper addresses a relevant computational problem: differentiating scalar objectives involving functions of large Hermitian matrices. The proposed method is conceptually clean, using Lanczos to reduce the large problem to a small tridiagonal projected problem and then computing gradients through vector-Jacobian products. This avoids backpropagating through the Lanczos recurrence, which can be costly and numerically delicate. The work also provides an error decomposition related to the Lanczos residual. The experiments on matrix-logarithm derivatives, network sensitivity benchmarks, and quantum Hamiltonian learning suggest that the method can be efficient and stable in several settings.
Weaknesses
The paper’s positioning could be clearer to a machine learning audience. While the theoretical and algorithmic contribution is interesting, the paper does not fully articulate which classes of learning problems are the primary targets of the proposed approximation. The error analysis is also informative but somewhat limited, since the residual-related term does not provide a complete a priori bound.
Questions
-
Could the authors clarify which learning problems are the main targets of the method?
-
Could the authors provide more intuition or conditions under which the residual-related error term in Theorem 2 is small?
-
In which regimes is the proposed method preferable to differentiating through Lanczos or using Fréchet/adjoint-based methods in terms of accuracy, stability, memory, and runtime?
Limitations
Yes
Final justification
The authors have addressed most of my concerns. However, incorporating all of these changes represents substantial additional work that we as reviewers won't have the opportunity to re-review before camera-ready. I will defer to the AC to judge whether a paper in this situation is appropriate to accept as is, or whether the authors should be asked to incorporate everything and resubmit to a future venue.
Formatting concerns
No concerns
2 comments
Clarification of which learning problems are the main targets of the method The main target is a more specific class of learning and inverse problems: objectives that contain one or more scalar, vector-specific matrix-function terms of the form
where is a large Hermitian operator available only through differentiable matrix-vector products, and Lanczos is already needed to evaluate the forward objective. During training, one then needs gradients of this Lanczos-computed scalar with respect to the parameters of . For a general matrix function , this derivative involves a Fréchet derivative and usually cannot be reduced to one ordinary linear solve.
The principal target problems are therefore:
-
PDE Hermitian Operator learning. PDE based operator are usual symmetric and the time stepping involves a fitting objective which boils down to the following
where is Hermitian, the exponential action is naturally evaluated by Lanczos, and parameter learning requires differentiating this quantity repeatedly. Our Hamiltonian-learning experiment directly instantiates this setting.
-
Graph and diffusion-operator learning. Learning edge weights or other graph parameters from node-specific diffusion, heat-kernel, communicability, or centrality objectives leads to terms such as
These are vector-specific rather than trace objectives. Our network-sensitivity experiments instantiate this class.
-
Fractional covariance, precision operators. For example, a fractional Matérn model may use
Its data-fit term contains . When the trainable exponent is noninteger, the forward term is a genuine fractional matrix function and cannot be evaluated by a single conjugate-gradient solve. Lanczos is therefore required in the forward pass, and its parameter gradient is required during hyperparameter learning. The new end-to-end Matérn experiment is intended to isolate precisely this regime.
These examples share the important property that the matrix function acts on particular vectors or states. This is where the Fréchet derivative cannot generally be replaced by simply applying to the matrix.
Pure trace objectives, including ordinary log-determinants, are a related but less distinctive use case. Our method applies to them after stochastic trace estimation reduces the trace to quadratic forms. However, for a pure trace, specialized stochastic estimators may avoid differentiating the finite Lanczos approximation altogether. We therefore view the log-determinant experiment primarily as a standard large-scale stability benchmark, rather than the setting in which our method is uniquely necessary.
We will revise the introduction and limitations section to state this scope explicitly.
more intuition or conditions under which the residual-related error term in Theorem 2 is small As mentioned in the above comment (about new theorem), we have added more mathematical details on how to bound the residual term. To give additional intuition, the bound is small in the regular regime where two conditions hold. First, Lanczos has been run for enough steps that is accurately approximated by a degree- polynomial over the relevant spectral interval. This makes the function-dependent factor in the bound small. Second, the Lanczos recurrence remains away from an intermediate near-breakdown, so the finite-step basis varies smoothly with the parameters and its sensitivity remains bounded. Under this condition, a small final Lanczos residual directly suppresses the remaining residual-coupled term.
In practice, convergence of the forward Lanczos approximation is a useful indicator that the Krylov depth is sufficient, although the theorem specifically depends on approximability of , which can be more demanding than approximability of . The guarantee can become weak in two distinct regimes. Poor spectral conditioning, for example when the spectrum approaches a singularity of , can make the polynomial approximation converge slowly. Separately, an intermediate near-breakdown can amplify the sensitivity of the normalized Lanczos basis.
The latter difficulty is not unique to our approximation: automatic differentiation and adjoint differentiation pass through the same Lanczos normalizations and can also become numerically unstable. In finite precision, loss of orthogonality is an additional issue and can be mitigated using full, partial, or selective reorthogonalization. Note that our method is much more amenable to selective orthogonalization as we do not need to differentiate through sophisticated procedures.
We will address this in the paper as well.
Regimes where proposed method preferable to differentiating through Lanczos or using Fréchet/adjoint-based methods in terms of accuracy, stability, memory, and runtime
We agree that this is the main clarification needed in the paper and therefore we spent the majority of time addressing this in the past week (sorry for the delay) with the following experiment. (Please see the comment above for spectral denoising case, but we compare only with Chebyshev in our framework as closed form derivatives are available, and PyTorch AD can be much slower)
Target Regime and Setup
We target large-scale matrix-function learning where the operator is available only through matvecs, and where storing or differentiating through a long Lanczos run is memory-prohibitive or communication-bound (e.g. CPU↔GPU transfers).
The testbed is Graph/SPDE Matérn Gaussian-process models,
for which learning requires gradients of
Controls. All methods share the same data, initialization, optimizer, and matrix-free GPU matvecs. The size of matrix . The term and its gradient are computed exactly for every method, so the comparison isolates the difficult matrix-function quadratic term.
Removing the eigensolver as a confound. For the AD baselines we differentiate a Fréchet derivative of the small tridiagonal rather than backpropagating through the PyTorch eigensolver. Raw eigensolver AD produces NaNs much earlier; by removing it we ensure the failures reported below come from differentiating the finite-precision Lanczos recurrence itself, not from an eigendecomposition artifact.
1. Small Depth — All Methods Stable
| method | mean sec/iter | max rel grad err | max data rel err | final scale | final alpha |
|---|---|---|---|---|---|
| full reorth AD | 1.42 | 2.72e-6 | 4.06e-6 | 5.52883 | 1.34008 |
| no-reorth AD | 0.852 | 5.10e-6 | 5.21e-6 | 5.52884 | 1.34008 |
| projected no-reorth (ours) | 0.474 | 3.75e-6 | 5.73e-6 | 5.52884 | 1.34008 |
| Chebyshev, deg. 128 | 0.349 | 8.53e-4 | 1.99e-3 | 5.52841 | 1.34007 |
No-reorthogonalization AD is entirely reliable here. This is explicitly not the regime our method is meant to dominate; we report it to establish that the projected rule loses nothing when AD is stable.
2. Moderate Depth () — AD Begins to Drift
| method | sec | rel grad err | rel data err |
|---|---|---|---|
| full reorth AD | 9.07 | 4.29e-8 | 2.90e-7 |
| no-reorth AD | 2.12 | 1.84e-4 | 2.86e-7 |
| projected no-reorth (ours) | 1.15 | 5.80e-8 | 2.86e-7 |
| Chebyshev, deg. 384 | 0.899 | 2.26e-5 | 1.79e-4 |
Full reorthogonalization remains accurate but is now ~8× slower than the projected rule. The key signature appears: the no-reorth forward value is still accurate (2.86e-7) while its gradient has degraded by four orders of magnitude. The projected gradient stays at reference accuracy.
3. Large Depth () — Full Reorthogonalization OOMs
Full-reorthogonalized AD fails on MPS before completing a single evaluation with one sample:
RuntimeError: MPS backend out of memory
MPS allocated: 30.13 GiB
max allowed: 30.19 GiB
| method | sec | rel grad err | rel data err |
|---|---|---|---|
| full reorth AD | OOM | OOM | OOM |
| no-reorth AD | 4.63 | 2.88e-2 | 2.89e-7 |
| projected no-reorth (ours) | 2.42 | 5.08e-8 | 2.89e-7 |
| Chebyshev, deg. 768 | 1.79 | 1.47e-5 | 1.88e-4 |
This is the intended operating regime, where full reorth becomes OOM and our method does not become unstable due to loss of orthogonality
4. End-to-End Fit at
| method | mean sec/iter | max rel grad err | final scale | final alpha |
|---|---|---|---|---|
| no-reorth AD | 9.15 | 2.72e+5 | 4.63522 | 1.34011 |
| projected no-reorth (ours) | 5.20 | 1.82e-7 | 5.52880 | 1.34008 |
| Chebyshev, deg. 4096 | 9.89 | 7.86e-5 | 5.52881 | 1.34007 |
*Full reorthogonalization is infeasible at this depth. No-reorth AD becoms unstable and drives the optimizer down a qualitatively wrong parameter path (final scale 4.635 vs. the 5.5288 recovered by every accurate method)
When the Proposed Method Is Preferable
The method is the right choice when all of the following hold:
- must be large for forward accuracy.
- Full reorthogonalization is too memory-intensive on GPU (see the OOM).
- No-reorthogonalized forward values remain useful, but AD through the recurrence is numerically unreliable due to loss in orthogonality (usuallly happens when is large).
- GPU↔CPU transfer or storing the full differentiated Lanczos program would dominate runtime/memory.
We will add this experiment in the paper. Please suggest if in the main text or appendix and address all of the above explicitly.
- Rating
- 5/6
- Confidence
- 3/5
- Quality
- 3/4
- Clarity
- 3/4
- Significance
- 3/4
- Originality
- 3/4
- Contribution type
- theory
- Ethical concerns
- NO or VERY MINOR ethics concerns only
Read review
Summary
This paper studies gradient computation for objectives involving bilinear or quadratic forms of Hermitian matrix functions, such as .
Main contributions:
- Proposes a forward-only gradient approximation that reuses the Lanczos pass instead of backpropagating through the Lanczos recurrence.
- Derives the gradient by differentiating the small projected tridiagonal problem and lifting the sensitivity back through matrix-vector-product VJPs.
- Proves that the error from ignoring Lanczos basis-variation terms is controlled by the final Lanczos residual coefficient .
- Shows empirically that the method is more stable than adjoint/backpropagation-based Lanczos gradients without requiring full reorthogonalization.
- Demonstrates speed and accuracy gains on log-determinant, graph-sensitivity, and Hamiltonian-learning experiments.
Strengths and weaknesses
Strengths.
-
The paper addresses an important matrix-free gradient computation problem for objectives such as .
-
The proposed method is simple and efficient: it avoids backpropagating through Lanczos and only differentiates the small projected tridiagonal problem.
-
The residual-based analysis is useful, showing that the ignored basis-variation term is controlled by .
Weaknesses.
-
The paper is framed around bilinear forms , but the main derivation is for quadratic forms, with bilinear forms handled indirectly.
-
The paper provides a useful residual-based approximation-error result, but the stronger numerical-stability claim is mainly empirical. A more formal finite-precision stability analysis, or a clearer characterization of failure cases, would strengthen the paper.
Questions
-
The error from ignoring basis variation is proportional to , but it also involves unobserved basis-variation terms. Can the authors provide a practical a posteriori gradient-error estimate, or clarify when a small Lanczos residual reliably implies an accurate gradient?
-
How should practitioners decide between the proposed forward-only gradient, adjoint/backprop-through-Lanczos, and block-Arnoldi Fréchet-derivative methods? Are there regimes of , spectra of , or accuracy requirements where the proposed approximation is expected to be less reliable than these alternatives?
Limitations
Yes
Final justification
N/A
Formatting concerns
No
1 comment
We thank the reviewer for their positive feedback and suggestions/insight to make the paper stronger. We agree with the reviewer and will change the title from bilinear to quadratic form and make the relevant changes in the main text to reflect that our algorithm tackles quadratic forms and turns bilinear and other scalar objectives into quadratic forms so that our theory is valid.
We have addressed the other concerns as below:
"The error from ignoring basis variation is proportional to , but it also involves unobserved basis-variation terms. Can the authors provide a practical a posteriori gradient-error estimate, or clarify when a small Lanczos residual reliably implies an accurate gradient?"
We agree that the previous bound was a bit ambiguous, and we have updated the theorem with new stricter bounds. It basically suggests that as long as the residual and variation of basis is bounded, our gradient estimate converges as the best polynomial approximation of the derivative of the scalar function over the ritz value spectrum. if needed we can provide more plots in the appendix to test the bound out
"How should practitioners decide between the proposed forward-only gradient, adjoint/backprop-through-Lanczos, and block-Arnoldi Fréchet-derivative methods? Are there regimes of , spectra of , or accuracy requirements where the proposed approximation is expected to be less reliable than these alternatives?"
This is a practical question and the case study mentioned below and in the official comment above answers this in detail. When a closed form or efficient way to compute is present (for example, Kernel methods in GPs, graph laplacians and sensitivity with respect to certain nodes), then these estimates outperform AD and chebyshev methods by big margins.
For a general case, in practice, we target the regime when the forward Lanczos depth required to reach atleast 5 digits of accuracy is more than 100, as this is when we observe loss of orthogonality and AD becomes unstable. Since reorthogonalization is much more expensive and needs explicit storage of the basis, our algorithm can just replay the Lanczos iteration block-by-block instead of storing to compute the approximation hence becomes very attractive in practice especially for GPU implementation (please see the matern GP case study below).
The case when estimates are slower to converge or less reliable is when ritz values are near the singularity of f', that is, more polynomial degree is needed to fit the oscillations. Similar argument holds for non smooth f', and directly follows from our new theorem 2.
The estimates become unreliable when the forward Lanczos becomes unreliable for which selective reorthogonalization procedures have been proposed and our algorithm can again shine as differentiation through these complicated procedures can get tricky and inefficient.
If a medium scale problem is targetted where storing Lanczos basis is not a problem or the depth of the Lanczos required for good accuracy is not much (no reorthogonalization needed), then the exact methods would be favourable.
Non-Hermitian cases and objective functions that are not scalar are not handled by our approximation and is a target for the future work.
We will clarify all of this in the updated manuscript.
Comments on the paper
2 comments
Initial response to reviewers
We would like to thank the reviewers and area chair for their well thought-out reviews. We agree with the overall comments of the reviewers and will add the following:
-
$\textbf{A theoretical proof and clarification of the error term in our gradient approximation (to be precise, in Theorem 2)}:$ We agree with the reviewers and will be adding a theorem to show that the gradient error is bounded by the best polynomial approximation of smooth scalar functions of eigenvalues of the hermitian matrix (so this nails down the convergence rate of our approximation). For a case study, we show exponential convergence for the derivatives with respect to matrix exponential in theory and practice. It is out of scope of this work to show theoretical bounds for how accurate our approximation is in finite precision (there are multiple math journal papers about accuracy of Lanczos), but this additional part provides an insight via polynomials and can be used as a stepping stone to bound the error.
-
: Our claim is that the approximation works without reorthogonalization which enables the method to be used in practice for large-scale problem where backprop and the adjoint method would fail. Reorthogonalization not only introduces overhead (can be 10-20x slowdown in time for medium scale (matrix dimension ~ 50k) problems, and would become a memory-bottleneck for large problems, leaving the existing methods intractable. To show this, we have implemented a version of our method that can use multiple passes (when required) of the Lanczos iteration and does not require storage of Lanczos basis making our method viable for large-scale applications. The current limitation is that the theoretical results are only valid for scalar objectives and the extension is left for future work. We will add experiments in the appendix where we show the reorthogonalization overhead in PyTorch.
-
: The major application areas in ML where gradients of quadratic/bilinear/fitting objectives involving matrix functions are learning with graphs and Gaussian processes (majorly sparse kernels) as mentioned in the 2024 NeurIPS paper (Gradients of Functions of Large Matrices by Krämer et al.). GraphML and SPDE kernels in GPs and other applications in Physics use Chebyshev polynomials as the baseline method for scalability purposes (for reasons mentioned above). We implement the Chebyshev polynomial method in our infrastructure that is built upon the PETSc and show that our method (which uses multiple passes for large scale problems) can be at least faster for a benchmark problem in image denoising using spectral graph filters while being same or better in accuracy. The Chebyshev method beats Lanczos method when the underlying matrix is well-conditioned but can struggle when the spectrum needs adaptive quadrature for resolution or is ill-conditioned (this is well-known in the applied math and physics literature) and we confirm this in our experiments.
We believe that the above additions make the paper much stronger and thank the reviewers and area chair again for highlighting these key points in the current manuscript. We will start adding the results and reply individually to reviewers in the forthcoming days.
New Theorem and Proof for clarifying the error term in gradient approximation
We have strengthened the theoretical result and completed a full proof for inclusion in the revised manuscript.
The revised theorem compares our forward-only gradient with the exact derivative of the finite -step Lanczos approximation. In exact arithmetic, their discrepancy is exactly the residual-boundary term
where is the final Lanczos residual and is the sensitivity of the projected scalar objective with respect to . We further prove
where is the best degree- uniform polynomial approximation error for on an interval containing the spectrum of . Thus the general sufficient condition for convergence is
In particular, uniformly bounded residual-coupled basis sensitivity is sufficient.
We also add a short lemma explaining when this sensitivity is bounded. By submultiplicativity,
Because , the final residual satisfies , and hence
For any prescribed finite Lanczos horizon , if is continuously differentiable on a compact parameter set and the intermediate Lanczos coefficients remain uniformly separated from an early breakdown,
then the finite-step Lanczos map is continuously differentiable and
The proof is short: the only potentially singular operation in the finite Lanczos recurrence is the normalization , whose derivative has norm at most . The lower bound therefore keeps every required normalization uniformly away from its singularity. A breakdown at the final step is benign, since then and the discrepancy vanishes exactly. Likewise, whenever the Krylov subspace is -invariant, , and the proposed gradient is exactly the derivative of the finite Lanczos approximation.
We have also derived an explicit example for . In this case the function-dependent factor admits a factorially decaying bound in . Finally, we clarify that the theorem is an exact-arithmetic result; finite-precision stability is studied empirically.
The complete derivation exceeds the OpenReview response-length limit, so we cannot reproduce it verbatim here. We have prepared it for inclusion in the revised appendix by reallocating space. The appendix proof contains the exact residual-boundary identity, the polynomial-annihilation argument leading to the -approximation bound, the finite-step sensitivity lemma above, and the explicit matrix-exponential example.
From OpenReview, CC BY 4.0. Authors as signed there; shown unedited.
Loading the discussion…
We thank the area chair for their positive review and constructive comments. We have addressed the reviewers concerns and added a new theorem to clarify the error term above^.
We also found via ChatGPT that a similar approximation is used in Computing low-rank approximations of the Fréchet derivative of a matrix function using Krylov subspace methods by Kandolf et. al., for other applications, and have a proof of convergence for this approximation converging to exact derivatives (not to Lanczos derivatives) for certain cases. However, their proof is much more involved as they need convergence to exact derivative of the objective and the applications used are more specific.
We also provide a case study for an end-to-end Matern kernel hyperparmater case study in reply to Reviewer yqqx where we incorporate a GPU implementation of our algorithm leveraging PyTorch and compare with AD. Naive AD fails miserably, and so for a fair baseline, we inject the frechet derivatives of the tridiagonal matrix (like done in Kramer et. al.) into the AD. This case study shows how reorthgonalization can be expensive and lead to memory bottlenecks and slow speed on modern hardware (run on our local Mac leveraging Metal for GPU). It also shows that Chebyshev needs much more polynomial depth to achieve similar accuracy as Lanczos (established in previous literature), and our approximation remains stable through the optimization procedure non reorth AD loses stability.
During the waiting process, we also developed a high performance library leveraging PETSc and SLEPc in C++ to get rapid fast derivatives through Lanczos when closed form expressions of derivatives are given (we currently do not support AD in the C++ interface) and have a Python wrapper around it. We plan to develop this library for future work and this is where we show margin of speedups against PyTorch (unfair comparison as we use the formulas and AD needs a gradient tape which has overhead)
The extreme large scale operators on GPUs or closed form derivatives available for efficient VTdAV computations are the regime where our approximation beats the available algorithms by big margins. More research is needed for incorporating selective orthogonalization for stabilizing forward Lanczos on GPUs which could benefit our algorithm even more, as differentiating through these procedures is slow and unstable.
We will also address some of the minor concerns about title and confusion of bilinear and quadratic forms and clarify exactly where the approximation will be beneficial