---
title: Matrix-Free Diagonal Hessian Approximations
url: https://www.emergentmind.com/topics/matrix-free-diagonal-hessian-approximations
type: topic
---

# Matrix-Free Diagonal Hessian Approximations

Matrix-free diagonal Hessian approximations are computational techniques that provide estimates of the diagonal of the Hessian matrix of a scalar-valued function, using only vector operations or backpropagation passes, without ever forming, storing, or manipulating the full $n \times n$ Hessian. These approximations are extensively used in large-scale optimization, including deep learning, stochastic optimization, derivative-free optimization, and scientific inverse problems, where explicit Hessian formation is computationally infeasible. A range of algorithmic frameworks, including Curvature Propagation, randomized estimators, specialized backpropagation recursions, secant/interpolation models, and diagonal quasi-Newton updates, provide matrix-free access to curvature information for preconditioning, variance reduction, and adaptive step size control.

## 1. Principles and Motivation

The central motivation is to obtain curvature information sufficient for second-order optimization or uncertainty quantification at a computational and storage cost comparable to a gradient evaluation. The full Hessian $H=\nabla^2 f(x)$ scales quadratically with parameter dimension $n$, so explicit representation or even Hessian-vector product sweeps quickly become infeasible for large models. In many cases, however, only the diagonal entries $\operatorname{diag}(H)$ are needed. These entries encode per-coordinate curvature and can be exploited as preconditioners in stochastic optimization, adaptive step-size scaling in deep learning, or as a surrogate for trace estimators in statistics and machine learning (e.g., Score Matching).

Matrix-free diagonal Hessian approximations exploit the compositional structure of computational graphs, local block structures, or finite-difference/interpolation schemes to obtain either unbiased or highly accurate biased estimates, always using only vector storage and local operations. Compared to block-diagonal or low-rank approximations, they are strictly $O(n)$ in both complexity and memory, while still providing critical geometric information [1206.6464].

## 2. Algorithmic Techniques

A variety of algorithmic paradigms are used for matrix-free diagonal Hessian calculation:

### 2.1 Curvature Propagation (CP)

Curvature Propagation [1206.6464] is a general method built on the reverse-mode structure of computational graphs. It introduces random vectors $V$ sampled per node and computes a "curvature vector" through a modified backpropagation. For any scalar-valued function $f:\mathbb R^n \rightarrow \mathbb R$ with computation graph, a single CP sweep yields an unbiased rank-1 approximation $H \approx S(V)S(V)^\top$, with the $i$-th diagonal entry $\widehat{H}_{ii}=(S(V)_i)^2$ serving as an unbiased estimator for $H_{ii}$. Averaging $K$ independent samples reduces variance by $1/K$.

### 2.2 Diagonal Backpropagation (BL89, HesScale)

The Becker & LeCun 1989 (BL89) method, extended by HesScale [2406.03276, 2210.11639], uses a coupled two-recursion backpropagation to propagate only the diagonal of the second derivative. At each layer, the diagonal Hessian is updated via element-wise operations, neglecting off-diagonal terms, resulting in a deterministic, linear-complexity approximation. HesScale further improves quality by computing the exact diagonal at the output layer, producing empirical errors an order of magnitude lower than stochastic Hutchinson or BL89 methods at the same cost.

### 2.3 Hessian-Vector-Product (HVP)-Based Extraction

Channel-wise parameters in neural networks (e.g., BatchNorm scale/shift) have exactly diagonal Hessians due to separability. Their diagonal entries can be extracted directly using Hessian-vector products computed via automatic differentiation, requiring only one additional backward pass per parameter block [2403.02681].

### 2.4 Secant, Interpolation, and Derivative-Free Models

Secant-based and interpolation approaches use only function and/or gradient values along coordinate-aligned or simplex-defined directions to estimate the Hessian diagonal. For example, the two-sided finite difference approximation
$$(H_{ii})^{\text{approx}} = \frac{f(x+\Delta e_i) + f(x-\Delta e_i) - 2f(x)}{\Delta^2}$$
provides an $\mathcal{O}(\Delta^2)$-accurate, matrix-free estimate for smooth functions [2001.08355, 2104.11821]. Specialized positive basis or simplex sets allow for $O(n)$ cost diagonal estimation in derivative-free settings.

### 2.5 Diagonal Quasi-Newton and Barzilai–Borwein Updates

In large-scale nonconvex and multi-objective settings, diagonal-only quasi-Newton updates using Barzilai–Borwein or secant-type rules (elementwise $d_{k+1,i} = (s_k)_i/(y_k)_i$) provide positive definite diagonal curvature estimates with low overhead and global convergence guarantees [2512.18348]. 

## 3. Properties, Complexity, and Statistical Guarantees

The matrix-free nature of these diagonal schemes is achieved via three key properties:

- **Storage**: Only $O(n)$ vectors are maintained; no $n \times n$ matrices are stored or factored.
- **Computation**: Each diagonal estimate costs at most the equivalent of one or two gradient or function evaluations. For CP and BL89/HesScale, one or two reverse-mode passes suffice [1206.6464, 2406.03276].
- **Accuracy/Variance**: Curvature Propagation yields *unbiased* diagonal estimates, and among all unbiased rank-1 schemes, uses noise that minimizes the variance on the diagonal [1206.6464]. HesScale-type deterministic recursions achieve empirically superior bias at the cost of being slightly biased for nondiagonal Hessians, but exploit the fact that layer-block Hessians are nearly diagonal.

The choice of randomization, sample averaging, or exactness can be tailored to application:

| Method            | Bias/Variance               | Cost               |
|-------------------|----------------------------|--------------------|
| Curvature Propagation | Unbiased, $1/K$ variance decay | $\sim1$–2 $\,\times\,$grad |
| BL89/HesScale     | Biased, zero variance      | $\sim1$–2 $\,\times\,$grad |
| HVP extraction    | Exact for diagonal blocks  | $\sim2$ $\,\times\,$grad for block |
| Finite differences| Biased, $O(h^2)$           | $2n$–$2n{+}2$ function evals |

Finite-difference and interpolation-based models have $O(h^2)$ error bounds and inherit the numerical stability and scaling of their underlying sampling patterns [2001.08355, 2104.11821].

## 4. Empirical Performance and Applications

Empirical results demonstrate that matrix-free diagonal Hessian schemes deliver:

- Near-exact diagonal estimates on neural nets with tens to thousands of parameters using only tens to hundreds of samples (CP), or single backward passes (HesScale, BL89).
- Superior optimization performance when used to precondition or scale Newton-like or adaptive updates, with wall-clock time speedups and faster convergence versus first-order or block methods [1206.6464, 2406.03276, 2210.11639].
- In DNN optimization, channel-wise preconditioning via exact diagonal Hessian blocks (SGD-PH) yields systematic improvements on image classification tasks with only a $\sim$2$\times$ time and $\sim$1.2$\times$ memory cost over SGD, outperforming full-block or MC-based approximations in both performance and generalization [2403.02681].
- In derivative-free optimization, diagonal conjugacy-based update mechanisms maintain regularized, well-conditioned scaling in high-noise regimes, outperforming limited-memory full-matrix methods in large benchmark suites [2606.20304].

Typical performance metrics report a 2–3$\times$ reduction in data passes or wall-clock time to a given accuracy over first-order baselines, with essentially no failure cases due to breakdown of curvature estimation.

## 5. Variants in Structured and Derivative-Free Regimes

Matrix-free diagonal Hessian estimation extends to a variety of specialized settings:

- **Structured Least Squares**: For $f(x)=\frac12\|F(x)\|^2$, block-diagonal or pure-diagonal secant approximations use only Jacobian-vector products and can be safeguarded for positive definiteness, yielding globally convergent matrix-free algorithms for $n$ up to $10^4$ [2002.01871].
- **Multiobjective/Nonconvex Optimization**: Diagonal Barzilai–Borwein quasi-Newton updates furnish low-cost preconditioners shared across all objectives, achieving R-linear convergence and zero failures in large-scale tests [2512.18348].
- **Derivative-Free Optimization**: Positive basis or simplex-geometry-based finite-difference/interpolation exploits the O(n) decoupling of coordinate updates, providing accurate Hessian diagonal approximations even when only function queries are available [2001.08355, 2104.11821].

Sophisticated penalty-based diagonal updates using normalized displacement vectors and conjugacy constraints provide robust, noise-insensitive scaling for evolutionary strategies in noisy, high-dimensions [2606.20304].

## 6. Limitations, Limiters, and Theoretical Considerations

All matrix-free diagonal Hessian approximations systematically ignore off-diagonal entries. This diagonal restriction is theoretically justified when the parameter coupling is weak, block structures are truly separable (as in channel-wise normalization), or the diagonal dominates (as for many standard network architectures after random initialization or at early optimization stages). In scenarios with strong nonlocal curvature coupling, neglecting off-diagonals can slow convergence or render the preconditioner ineffective. Some methods, such as robustified secant or conjugacy-penalty updates, employ explicit safeguarding, clamping, or regularization to ensure positive definiteness and maintain convergence.

Curvature Propagation is theoretically provable to yield unbiased diagonal (and full) Hessian estimates, with minimal variance among unbiased rank-1 schemes [1206.6464]. HesScale is the leading deterministic approach for DNNs, with deterministic bias but empirically best $\ell^1$-diagonal error at trivial computational overhead [2210.11639, 2406.03276]. All methods are fundamentally limited by the quality of the local model, the suitability of their stochastic or coordinate sampling, and the scale of inter-parameter correlation.

## 7. Impact and Ongoing Developments

Matrix-free diagonal Hessian approximation is pervasive across large-scale optimization and inverse problems, including but not limited to stochastic training of deep nets [1206.6464, 2406.03276, 2210.11639], multi-objective optimization [2512.18348], nonlinear least squares [2002.01871], derivative-free and evolutionary strategies [2001.08355, 2606.20304], and physical inverse problems with diagonalization via weighting (e.g., ultrasound tomography inversion) [2211.00316]. Their impact is manifest in the scalability of second-order preconditioning, the democratization of curvature-based adaptation to large neural networks, and the feasibility of robust optimization in noise-dominated or model-free scenarios. Ongoing research addresses better interpolation in derivative-free settings, variance-minimized randomized schemes, coupling with block-diagonal or low-rank updates in mixed schemes, and further application to reinforcement learning and large-scale scientific inverse problems [2406.03276, 2211.00316].

The principal advantage across all settings remains the capacity to extract curvature information at $O(n)$ complexity, without matrix inversion or storage, delivering strong global convergence guarantees or empirical practical speedups in previously inaccessible problem scales.

Source: https://www.emergentmind.com/topics/matrix-free-diagonal-hessian-approximations