Research Paper · TMLR Submission · 2026

Curvature-Weighted
Gradient Diversity:
A Noise Measure for Geometry-Adaptive SGD

Authors Muhammad Hamza
Status Under Review
Runtime ~15 min · CPU only
Scroll to read
⬡
Full Reproduction Notebook → github.com/Hamza-Faarooq/cwgd-optimizer
→

Stochastic Gradient Descent has a dirty secret: its standard convergence analysis treats all parameter directions as equally noisy. It doesn't matter whether you're in a direction with curvature $10^4$ or curvature $1$ — the classic bound charges the full gradient variance $\sigma^2/\mu$ everywhere, taking the worst case over the entire spectrum.

This paper argues that's a missed opportunity. A direction with large curvature $\lambda_k$ forces the optimizer to take a tiny step regardless — the noise-induced displacement ends up proportional to $\eta^2 \sigma^2 / \lambda_k^2$, which is small precisely because the curvature is large. The standard bound doesn't see this.

We introduce Curvature-Weighted Gradient Diversity (CWGD) — a scalar that measures how spread-out per-sample gradients are within a mini-batch, but after rescaling by the inverse square root of the Hessian. High-curvature directions are down-weighted. The result is a tighter proxy for the noise actually experienced by the optimizer — and a provably better learning rate schedule when used as a modulation signal.

20%
Lower Final Loss
20×
Independent Runs
p<10⁻⁴
Every Configuration
2×
Theoretical Floor Reduction
0.5%
Compute Overhead
Section 01

The Problem with
Uniform Noise Bounds

The cornerstone result for mini-batch SGD on a $\mu$-strongly-convex, $L$-smooth objective gives a residual floor proportional to $\eta\sigma^2/\mu$. Written out:

$$\mathbb{E}\!\left[f(x_T) - f(x^*)\right] \;\leq\; (1-\mu\eta)^T \!\left(f(x_0) - f(x^*)\right) + \frac{\eta\sigma^2}{2\mu}$$

The floor $\eta\sigma^2/(2\mu)$ uses $\sigma^2/\mu$ — the full per-sample gradient variance divided by the smallest eigenvalue of the Hessian. This is the same bound regardless of whether the noise falls in a high-curvature direction (where the optimizer already moves carefully) or a low-curvature direction (where it can take long strides).

Why Geometry Matters

Suppose the Hessian $H = \text{diag}(\lambda_1, \ldots, \lambda_d)$ is diagonal with eigenvalues spanning a range (the condition number $\kappa = L/\mu$). The step size constraint $\eta \leq 1/(2L)$ is driven by the largest eigenvalue $L$.

For a direction $k$ with curvature $\lambda_k$, the noise-induced displacement per step is at most $\eta^2 \sigma^2 / \lambda_k^2$. When $\lambda_k$ is large, this is tiny — the curvature is already protecting us. The standard bound, by charging $\sigma^2/\mu$ uniformly, dramatically overestimates the noise contribution of high-curvature directions.

📐
The curvature-weighted effective noise

Under isotropic noise, the true effective noise is $\sigma^2_{\text{eff}} = \sigma^2 \cdot \text{tr}(H^{-1})/d$. This is always $\leq \sigma^2/\mu$, with equality only when $H = \mu I$ (isotropic curvature). The improvement factor $\rho(\kappa) = d/(\mu \cdot \text{tr}(H^{-1}))$ grows roughly as $\kappa/\log\kappa$: at $\kappa = 5$ it is $2.0\times$, at $\kappa = 50$ it is $3.9\times$.

Section 02

Defining CWGD

Let $f: \mathbb{R}^d \to \mathbb{R}$ be twice differentiable with positive-definite Hessian $H(x) = \nabla^2 f(x)$. Let $\mathcal{B} = \{z_1, \ldots, z_B\}$ be a mini-batch with per-sample gradients $g_i = \nabla f(x; z_i)$.

$$\text{CWGD}(x, \mathcal{B}) = \frac{2}{B(B-1)} \sum_{1 \leq i < j \leq B} \left\| H(x)^{-1/2}(g_i - g_j) \right\|^2$$

Geometrically, this is the average squared pairwise distance between per-sample gradients, in the metric defined by the inverse Hessian. Directions that the Hessian makes steep are contracted; directions that are flat are amplified.

The Diagonal Case (What We Compute)

When $H = \text{diag}(\lambda_1, \ldots, \lambda_d)$, the formula simplifies dramatically:

$$\text{CWGD} = 2\sum_{k=1}^d \frac{\hat{\sigma}^2_k}{\lambda_k}, \quad \hat{\sigma}^2_k = \frac{1}{B-1}\sum_{i=1}^B (g_{ik} - \bar{g}_k)^2$$

This is a weighted sum of per-coordinate gradient variances, with weights $1/\lambda_k$. High-curvature directions (large $\lambda_k$) are down-weighted. This is exactly what we want: directions where the optimizer already takes small steps contribute less to the noise measure.

Under Isotropic Noise

If $g_i = \nabla f(x) + \varepsilon_i$ with $\varepsilon_i \sim \mathcal{N}(0, \sigma^2 I)$, then $\mathbb{E}[\hat{\sigma}^2_k] = \sigma^2$ for all $k$, and:

$$\mathbb{E}[\text{CWGD}] = 2\sigma^2 \text{tr}(H^{-1}) = 2\sigma^2 \sum_{k=1}^d \frac{1}{\lambda_k}$$

This gives us a clean connection to $\sigma^2_{\text{eff}}$: the CWGD is exactly $2d \cdot \sigma^2_{\text{eff}}$. High CWGD means the noise is hitting flat directions hard; low CWGD means the geometry is protecting the optimizer.

Section 03

Main Theorem:
Tighter Convergence

We use CWGD as a real-time signal to modulate a cosine annealing schedule. When the curvature-weighted diversity is high (noisy region), we pull back the learning rate. When it's low (geometry is protecting us), we let the cosine schedule run freely.

Formally, the modulated learning rate is:

$$\eta_t = \frac{\bar{\eta}}{1 + \alpha r_t}, \quad r_t = \frac{\text{CWGD}_t}{\text{CWGD}_0}, \quad \bar{\eta} \leq \frac{1}{2L}, \quad \alpha \geq 0$$

Theorem 4.1 (informal): For strongly-convex quadratics with diagonal Hessian, isotropic noise, and $B \geq 2$, running SGD with the modulated schedule above gives:

$$\mathbb{E}\!\left[f(x_T) - f(x^*)\right] \;\leq\; \underbrace{(1-\mu\bar{\eta})^T(f(x_0)-f(x^*))}_{\text{contraction}} + \underbrace{\frac{\bar{\eta}\sigma^2 \text{tr}(H)}{2\mu B(1+\alpha)}}_{\text{residual floor}}$$

The residual floor is smaller than plain cosine (the $\alpha = 0$ case) by a factor of exactly $1/(1+\alpha)$. At the recommended setting $\alpha = 1$, this is a factor of 2.

✓
Proof sketch

Near the optimum, $\text{CWGD}_t \approx \text{CWGD}_0$ (by Proposition 3.3), so $r_t \to 1$ and $\eta_t \to \eta_{\text{eff}} := \bar{\eta}/(1+\alpha)$. Setting the steady-state $\mathbb{E}[V_{t+1}] = \mathbb{E}[V_t]$ in the per-step recursion and solving gives $V^* \leq \eta_{\text{eff}} \sigma^2 \text{tr}(H)/(2\mu B)$. Substituting $\eta_{\text{eff}} = \bar{\eta}/(1+\alpha)$ gives the bound.

Two Gaps to Understand

The paper is transparent about two gaps that arise from the theorem:

Section 04

The Degenerate Estimator
We Fixed

An earlier version of this work computed a naive CWGD estimate by normalizing coordinate-wise variance by itself:

$$\widehat{\text{CWGD}}_{\text{naive}} = \sum_{k=1}^d \frac{\hat{\sigma}^2_k}{\hat{\sigma}^2_k} = d$$
⚠
This is completely useless

The ratio $\hat{\sigma}^2_k / \hat{\sigma}^2_k$ is identically 1 for every coordinate $k$ under any noise model. The estimator collapses to the constant $d$ regardless of actual curvature or mini-batch diversity. As a schedule signal it carries zero information. We flag this explicitly because similar constructions appear informally in the literature.

The Fix: Hutchinson Diagonal Estimator

The correct approach separates the curvature estimate from the diversity estimate. We use $P$ Rademacher probes $v^{(p)} \sim \{\pm 1\}^d$ to estimate $\text{diag}(H)$:

$$\hat{\lambda}_k = \frac{1}{P}\sum_{p=1}^P v^{(p)}_k [Hv^{(p)}]_k$$

where $[Hv]$ is approximated by the finite-difference $(\nabla f(x + \delta v) - \nabla f(x))/\delta$.

Proposition 5.1: For a diagonal quadratic, this estimator satisfies $\hat{\lambda}_k = \lambda_k$ exactly for any $P \geq 1$ and any $\delta > 0$. This is provable: $[Hv]_k = \lambda_k v_k$ (diagonal Hessian), so $v_k [Hv]_k = \lambda_k v_k^2 = \lambda_k$ (since $v_k \in \{\pm 1\}$). The average over probes is $\lambda_k$ exactly. Empirically, the relative error is less than $10^{-8}$ on diagonal quadratics — confirming the theory.

python · hutchinson_estimator.py
def cwgd_true_diagonal(gradients: np.ndarray,
                       lambda_diag: np.ndarray,
                       epsilon: float = 1e-12) -> float:
    # Down-weight high-curvature directions
    weights = 1.0 / (np.abs(lambda_diag) + epsilon)
    # Per-coordinate gradient variance within the mini-batch
    var_k   = np.var(gradients, axis=0, ddof=1)
    return float(2.0 * (var_k * weights).sum())
Section 05

CWGD-Cosine
Algorithm 1

The full algorithm is clean and practical. The Hutchinson diagonal is computed once at initialization (costs $P$ gradient evaluations), then cached for the entire run. The per-step CWGD computation is $O(dB)$ and negligible compared to the SGD update itself.

Algorithm 1 · CWGD-Cosine
  1. Require: $x_0$, $\eta_{\max}$, horizon $T$, $\alpha \in [0,1]$, probe count $P$
  2. Estimate $\hat{\lambda} \leftarrow \text{diag}(\hat{H}(x_0))$ via $P$ Hutchinson probes // One-time cost
  3. Sample first mini-batch, compute $\{g_i\}$
  4. $\text{CWGD}_0 \leftarrow \widehat{\text{CWGD}}(\{g_i\};\, \hat{\lambda})$
  5. for $t = 1$ to $T$ do
  6.     Sample mini-batch $\mathcal{B}_t$, compute $\{g_i^{(t)}\}$
  7.     $\text{CWGD}_t \leftarrow \widehat{\text{CWGD}}(\{g_i^{(t)}\};\, \hat{\lambda})$
  8.     $\eta_t \leftarrow \eta_{\cos}(t) \cdot \frac{1}{1 + \alpha \cdot \text{CWGD}_t / \text{CWGD}_0}$ // Modulated step
  9.     $x_{t+1} \leftarrow x_t - \eta_t \cdot \frac{1}{B}\sum_i g_i^{(t)}$
  10. end for

The cosine envelope provides the global annealing schedule, while the CWGD ratio $r_t = \text{CWGD}_t / \text{CWGD}_0$ provides the per-step adaptation. When $r_t > 1$ (noisier than baseline), the effective learning rate drops. When $r_t < 1$ (quieter region), the schedule is only lightly attenuated.

Implementation: The CWGD-Cosine Scheduler

The Python implementation mirrors Algorithm 1 closely. At construction, it accepts a reference to the Hutchinson-estimated eigenvalues (lambda_ref). The first call with gradients initializes cwgd_ref automatically.

python · cwgd_cosine_scheduler.py
class CWGDCosineScheduler:
    """One-Shot Hutchinson CWGD-Cosine (Algorithm 1)"""
    def __init__(self, eta_max, T, alpha=1.0,
                 lambda_ref=None, cwgd_ref=None,
                 eta_min=0.0, epsilon=1e-8):
        self.eta_max   = eta_max; self.T = T; self.alpha = alpha
        self.lambda_ref = lambda_ref; self.cwgd_ref = cwgd_ref
        self._step = 0; self._lr = eta_max
        self._init = cwgd_ref is not None

    def _cwgd(self, grads):
        if self.lambda_ref is None: return 0.0
        w     = 1.0 / (np.abs(self.lambda_ref) + self.epsilon)
        var_k = np.var(grads, axis=0, ddof=1)
        return float(2.0 * (var_k * w).sum())

    def step(self, gradients=None, cwgd=None):
        self._step += 1
        eta_cos = _cosine(self._step, self.eta_max, self.T)
        if self.alpha == 0.0 or self.lambda_ref is None:
            self._lr = eta_cos; return self._lr

        cwgd_t = self._cwgd(gradients) if gradients is not None else (cwgd or 0.0)
        if not self._init:
            self.cwgd_ref = cwgd_t; self._init = True

        gamma_t    = 1.0 / (1.0 + self.alpha * cwgd_t / self.cwgd_ref)
        self._lr   = eta_cos * gamma_t
        return self._lr
Section 06

Experiments:
Synthetic Quadratics

All experiments use synthetic strongly-convex quadratics where theory applies, making the results cleanly interpretable. The setup:

Objective
f(x) = ½xᵀHx − bᵀx
Diagonal H, log-spaced eigenvalues
Dimension
d = 50
Small but representative
Batch Size
B = 16
Default; ablated over 8–64
Noise
σ = 0.1
Isotropic; also aligned noise tested
Steps
T = 4000
Full cosine horizon
Runs
20 seeds
Paired t-tests throughout

Main Results

CWGD-Cosine consistently achieves ~20% lower final suboptimality than plain cosine annealing across all tested condition numbers ($p < 10^{-4}$ in every case). EigenCurve underperforms at high $\kappa$ because its fixed warm phase doesn't adapt to specific noise structure. LANTON tracks cosine closely in this setting.

κ CWGD-Cosine Cosine LANTON EigenCurve ρ_obs
51.07e−051.34e−051.32e−051.70e−041.25×
107.05e−068.89e−068.80e−064.22e−051.26×
204.74e−065.98e−065.91e−061.10e−051.26×
502.86e−063.60e−063.56e−063.61e−061.26×

Notice the observed improvement ratio $\rho_{\text{obs}}$ is stable at $1.25$–$1.26\times$ across all $\kappa$. This is consistent with the theory: the $1/(1+\alpha)$ floor reduction gives $2\times$ asymptotically, but finite-$T$ effects and transient slowing reduce the realized gain to ~20%.

Section 07

Ablations:
What Moves the Needle

Modulation Strength α

Sweeping $\alpha \in \{0.0, 0.25, 0.50, 0.75, 1.00\}$ at $\kappa = 20$ (10 runs each) shows final loss decreasing monotonically in $\alpha$, confirming Corollary 4.3. $\alpha = 0$ recovers plain cosine. $\alpha = 1.0$ gives the best finite-training performance.

αMean SuboptimalityStd
0.00 (Cosine)6.20 × 10⁻⁶1.48 × 10⁻⁶
0.255.73 × 10⁻⁶1.37 × 10⁻⁶
0.505.37 × 10⁻⁶1.28 × 10⁻⁶
0.755.08 × 10⁻⁶1.20 × 10⁻⁶
1.004.84 × 10⁻⁶1.14 × 10⁻⁶

Batch Size

Varying $B \in \{8, 16, 32, 64\}$ at $\kappa = 20$, $\alpha = 1.0$ (10 runs). The improvement is stable at 20–24% across all batch sizes, with all $p < 10^{-3}$. This is expected from theory: CWGD scales with gradient variance within the mini-batch, and $\rho(\kappa)$ depends only on Hessian structure.

BCWGD-CosineCosineImprovementp
81.01 × 10⁻⁵1.27 × 10⁻⁵+20.2%7.4 × 10⁻⁴
164.84 × 10⁻⁶6.20 × 10⁻⁶+21.9%2.7 × 10⁻⁴
322.51 × 10⁻⁶3.14 × 10⁻⁶+20.2%1.7 × 10⁻⁵
641.18 × 10⁻⁶1.54 × 10⁻⁶+23.8%1.2 × 10⁻⁶

Noise Structure

We test whether the benefit extends to aligned noise $\varepsilon_i \sim \mathcal{N}(0, \sigma^2 H^\gamma)$ with $\gamma \in \{1.0, 1.5\}$, modeling the empirical observation that gradient noise in deep networks often scales with curvature. CWGD-Cosine improves by 23–24% in both aligned-noise cases, slightly more than under isotropic noise. Intuition: when high-curvature directions also have more noise, down-weighting them in the CWGD signal is especially beneficial.

Noise TypeCWGD-CosineCosineImprovement
Isotropic (σ²I)4.84 × 10⁻⁶6.20 × 10⁻⁶+21.9%
Aligned γ=1.0 (σ²H)1.95 × 10⁻⁵2.55 × 10⁻⁵+23.6%
Aligned γ=1.5 (σ²H¹·⁵)5.14 × 10⁻⁵6.73 × 10⁻⁵+23.6%
Section 08

Estimator Robustness
to Non-Diagonal Hessians

Our Hutchinson estimator assumes a diagonal Hessian. What happens when this is violated? We test by rotating the Hessian by angle $\theta$ (making it non-diagonal) and measuring the relative error in the resulting $\widehat{\text{CWGD}}$.

κθOff-diag fractionCWGD_trueRel. error
50°0.0000.2012< 10⁻⁸
545°0.0050.20120.14%
1045°0.0040.15980.27%
5015°0.0010.10570.28%
5045°0.0020.10720.68%

For the diagonal case ($\theta = 0$), error is below $10^{-8}$, confirming exact recovery on quadratics. Even at $\kappa = 50$ and $\theta = 45°$, the relative error is only $0.81\%$ — well within an acceptable range for a schedule modulator. The diagonal approximation is adequate for moderate off-diagonal structure.

Compute-Normalised Comparison

For a perfectly fair comparison, we run extended cosine annealing at $T = 4020$ steps (to match the 20 extra Hutchinson gradient evaluations) against CWGD-Cosine at $T = 4000$ steps.

✓
Result: 20.3% improvement at equal compute

At $\kappa = 20$, extended Cosine reaches $5.95 \times 10^{-6}$, compared to CWGD-Cosine at $4.74 \times 10^{-6}$ (a $20.3\%$ improvement, $p < 10^{-4}$). The Hutchinson overhead is $20/4000 = 0.5\%$ of total compute. The gains are structural, not an artifact of spending more compute.

Section 09

Honest
Limitations

The paper is unusually transparent about scope and failure modes. This is worth highlighting — it's a model for how to write limitations sections.

  1. Scope restricted to diagonal strongly-convex quadratics. Theorem 4.1 requires $H$ to be diagonal, the loss to be quadratic, and noise to be isotropic. None of these hold for real neural networks. Extending to non-diagonal Hessians requires either a full (expensive) Hutchinson estimator or an explicit bound on off-diagonal effects.
  2. Hessian staleness in nonconvex settings. On a nonconvex model (e.g., a small MLP), the Hessian changes quickly during training. A Hutchinson estimate at step $t_0$ can be nearly uncorrelated with $H(x_{t_0 + \Delta})$ after a few hundred steps. In nonconvex experiments, this leads to CWGD-Cosine underperforming plain cosine by 2–14%. The fix is an online EMA of per-coordinate gradient second moments (as Adam does) — but this changes the curvature proxy and hasn't been analyzed.
  3. Theory-practice gap. The theoretical $\rho(\kappa) \in [2.0, 3.9]$ is substantially larger than the observed ~1.25×. The gap comes from transient behaviour, the cosine envelope interacting non-trivially with the modulator, and asymptotic steady-state approximations in the proof.
  4. Statistical scope. All experiments use $d = 50$. Results at larger $d$ (e.g., $d = 10^3$) might differ, particularly for the estimator, which accumulates error with $d$ when the Hessian is non-diagonal.
⚡
Stress-test failures

At extreme ill-conditioning ($\kappa = 500$), CWGD-Cosine underperforms at $T = 4000$ — the landscape is so stretched that the optimizer is still in transient descent and hasn't reached the noise floor. On Rosenbrock (rapidly shifting coupled off-diagonal curvature), CWGD-Cosine fails to outperform cosine because the static diagonal proxy cannot capture the dominant geometry.

Section 10

Walking Through
the Code

The Colab notebook reproduces every experiment in the paper in about 15 minutes on a free CPU instance. Here's how the pieces fit together.

The Synthetic Quadratic Environment

The problem generator creates a diagonal Hessian with eigenvalues log-spaced in $[1, \kappa]$, a random linear term $b \sim \mathcal{N}(0, I)$, and the closed-form optimum $x^* = b/\text{eigs}$. The stochastic gradient adds isotropic (or aligned) noise to the true gradient.

python · synthetic_quadratic.py
def make_quadratic(d, kappa, seed=0):
    # Log-spaced eigenvalues: κ measures the condition number
    eigs   = np.logspace(0, np.log10(kappa), d)
    rng    = np.random.RandomState(seed)
    b      = rng.randn(d)
    x_star = b / eigs   # Closed-form optimum for diagonal quadratic
    return np.diag(eigs), b, x_star, eigs

def sample_grads(x, H_diag, b, sigma, B, rng,
                  noise_type='isotropic', gamma_noise=1.0):
    true_g = H_diag * x - b          # True gradient (diagonal H)
    noise  = rng.randn(B, len(x)) * sigma
    if noise_type == 'aligned':
        # Noise scales with curvature: mimics deep network behaviour
        noise *= (np.abs(H_diag) ** (gamma_noise / 2.0))[None, :]
    return true_g[None, :] + noise

The SGD Runner

A single, unified runner handles all schedulers. LANTON gets special treatment since it needs to update its internal noise estimate before stepping. Everything else just passes the current gradients to scheduler.step(gradients=grads).

python · run_sgd.py
def run_sgd(H_diag, b, x_star, scheduler, sigma, B, T, seed, ...):
    rng    = np.random.RandomState(seed)
    x      = np.random.RandomState(seed + 9999).randn(len(b)) * 0.5
    f_star = f_val(x_star, H_diag, b)
    losses = np.empty(T)

    for t in range(T):
        grads = sample_grads(x, H_diag, b, sigma, B, rng, ...)
        if is_lanton:
            scheduler.update_noise(grads)    # LANTON needs EMA of noise
            lr = scheduler.step()
        else:
            lr = scheduler.step(gradients=grads)   # CWGD reads grads here
        x = x - lr * grads.mean(axis=0)  # Mini-batch gradient step
        losses[t] = max(f_val(x, H_diag, b) - f_star, 1e-20)
    return losses

Running All Experiments

The notebook runs every ablation in sequence. The total runtime on a free-tier Colab CPU is around 15 minutes. All results are saved as JSON files and plots as high-resolution PNGs.

python · run_all_experiments.py
print("Running Main Results...");       main_results     = run_main_experiment()
print("Running Compute Normalization..."); compute_results  = run_compute_normalised()
print("Running Alpha Ablation...");        alpha_results    = run_alpha_ablation()
print("Running Batch Ablation...");        batch_results    = run_batch_ablation()
print("Running Noise Ablation...");        noise_results    = run_noise_ablation()
print("Running Estimator Ablation...");    estimator_results= run_estimator_ablation()
print("Running Convergence Curves...");    curve_data       = run_convergence_curves()

# Generate all 3 paper figures as high-res PNGs
plot_convergence({int(k): v for k, v in curve_data.items()})
plot_ablations(alpha_results, batch_results)
plot_theory_vs_observed(main_results)
Section 12

Complete
Proofs

Every formal claim in the paper has a full proof. We reproduce all four here — Proposition 3.3, Theorem 4.1 (the complete Appendix A derivation), Proposition 5.1, and Corollary 4.3 — with step-by-step exposition so the mathematical flow is clear.

Proposition 3.3 CWGD Under Isotropic Noise

Statement. Suppose $g_i = \nabla f(x) + \varepsilon_i$ with $\varepsilon_i \overset{\text{iid}}{\sim} \mathcal{N}(0, \sigma^2 I)$ and $H = \mathrm{diag}(\lambda_1, \ldots, \lambda_d)$. Then:

$$\mathbb{E}[\mathrm{CWGD}] = 2\sigma^2 \,\mathrm{tr}(H^{-1}) = 2\sigma^2 \sum_{k=1}^d \frac{1}{\lambda_k}$$

Proof.

Step 1

Recall the diagonal-case CWGD formula (Remark 3.2):

$$\mathrm{CWGD} = 2\sum_{k=1}^d \frac{\hat{\sigma}^2_k}{\lambda_k}, \quad \hat{\sigma}^2_k = \frac{1}{B-1}\sum_{i=1}^B (g_{ik} - \bar{g}_k)^2$$

where $\bar{g}_k = \frac{1}{B}\sum_{i=1}^B g_{ik}$ is the sample mean of coordinate $k$ over the mini-batch.

Step 2

Under the isotropic noise model, write $g_{ik} = [\nabla f(x)]_k + \varepsilon_{ik}$ where $\varepsilon_{ik} \overset{\text{iid}}{\sim} \mathcal{N}(0, \sigma^2)$. The sample variance $\hat{\sigma}^2_k$ is the usual unbiased estimator of the variance of a single $g_{ik}$. Since the true gradient $[\nabla f(x)]_k$ is a constant (non-random at fixed $x$), the variance of $g_{ik}$ is precisely $\mathrm{Var}(\varepsilon_{ik}) = \sigma^2$. Therefore:

$$\mathbb{E}[\hat{\sigma}^2_k] = \sigma^2 \quad \text{for all } k = 1, \ldots, d$$
Step 3

Take expectations in the CWGD formula using linearity of expectation:

$$\mathbb{E}[\mathrm{CWGD}] = 2\sum_{k=1}^d \frac{\mathbb{E}[\hat{\sigma}^2_k]}{\lambda_k} = 2\sum_{k=1}^d \frac{\sigma^2}{\lambda_k} = 2\sigma^2 \sum_{k=1}^d \frac{1}{\lambda_k} = 2\sigma^2\,\mathrm{tr}(H^{-1})$$

The last equality uses the fact that for a diagonal matrix, $\mathrm{tr}(H^{-1}) = \sum_{k=1}^d 1/\lambda_k$.

□
Remark — Connection to the Standard Bound

The standard bound charges $\sigma^2/\mu$ per step (worst case over the spectrum). Proposition 3.3 shows $\mathbb{E}[\mathrm{CWGD}]/2 = \sigma^2\,\mathrm{tr}(H^{-1})$. Defining $\sigma^2_{\mathrm{eff}} = \sigma^2\,\mathrm{tr}(H^{-1})/d$, we have $\sigma^2_{\mathrm{eff}} \leq \sigma^2/\mu$ with equality only when $H = \mu I$. The improvement factor $\rho(\kappa) = d/(\mu\,\mathrm{tr}(H^{-1}))$ grows roughly as $\kappa/\log\kappa$ for log-spaced eigenvalues: $2.0\times$ at $\kappa=5$, $3.9\times$ at $\kappa=50$.

Theorem 4.1 Tighter Convergence Under CWGD Modulation — Complete Proof (Appendix A)

Setting. Let $f(x) = \frac{1}{2}x^\top H x - b^\top x$ with $H = \mathrm{diag}(\lambda_1,\ldots,\lambda_d)$, $0 < \mu \leq \lambda_k \leq L$. Stochastic gradients $g_i = Hx - b + \varepsilon_i$ with $\varepsilon_i \overset{\text{iid}}{\sim} \mathcal{N}(0, \sigma^2 I)$, $B \geq 2$. Run SGD with the modulated step size:

$$\eta_t = \frac{\bar{\eta}}{1 + \alpha r_t}, \quad r_t = \frac{\mathrm{CWGD}_t}{\mathrm{CWGD}_0}, \quad \bar{\eta} \leq \frac{1}{2L}, \quad \alpha \geq 0$$

Claim. For all $T \geq 1$:

$$\mathbb{E}\!\left[f(x_T) - f(x^*)\right] \leq \underbrace{(1 - \mu\bar{\eta})^T\!\left(f(x_0) - f(x^*)\right)}_{\text{contraction}} + \underbrace{\frac{\bar{\eta}\sigma^2\,\mathrm{tr}(H)}{2\mu B(1+\alpha)}}_{\text{residual floor}}$$

Proof. We work with the Lyapunov function $V_t = \|H^{1/2}(x_t - x^*)\|^2 = 2(f(x_t) - f(x^*))$, so bounding $V_t$ is equivalent to bounding the suboptimality.

Step 1
Per-step recursion

The SGD update is $x_{t+1} = x_t - \eta_t \hat{g}_t$ where $\hat{g}_t = \frac{1}{B}\sum_{i=1}^B g_i^{(t)} = Hx_t - b + \bar{\varepsilon}_t$ and $\bar{\varepsilon}_t = \frac{1}{B}\sum_i \varepsilon_i^{(t)} \sim \mathcal{N}(0, \frac{\sigma^2}{B}I)$.

Expand $V_{t+1}$:

$$V_{t+1} = \|H^{1/2}(x_{t+1} - x^*)\|^2 = \|H^{1/2}(x_t - \eta_t\hat{g}_t - x^*)\|^2$$

Expanding the square (with $e_t = x_t - x^*$):

$$V_{t+1} = \underbrace{\|H^{1/2}e_t\|^2}_{V_t} - 2\eta_t e_t^\top H^2 e_t + 2\eta_t e_t^\top H\bar{\varepsilon}_t + \eta_t^2 \|H^{1/2}\hat{g}_t\|^2$$

Since $f$ is quadratic with Hessian $H$, we have $He_t = \nabla f(x_t) - \nabla f(x^*) = \nabla f(x_t)$ (because $\nabla f(x^*) = 0$). Therefore $e_t^\top H^2 e_t = e_t^\top H \cdot He_t = \|He_t\|^2 \geq \mu \|H^{1/2}e_t\|^2 = \mu V_t$, giving:

$$V_{t+1} \leq V_t - 2\eta_t \mu V_t + 2\eta_t e_t^\top H\bar{\varepsilon}_t + \eta_t^2 \|H^{1/2}\hat{g}_t\|^2$$
Step 2
Taking expectations

Since $\bar{\varepsilon}_t \sim \mathcal{N}(0, \frac{\sigma^2}{B}I)$ is zero-mean and independent of $x_t$ (the iterate depends only on past noise), the cross term vanishes:

$$\mathbb{E}[e_t^\top H\bar{\varepsilon}_t] = e_t^\top H\,\mathbb{E}[\bar{\varepsilon}_t] = 0$$

For the last term, decompose $\hat{g}_t = He_t + \bar{\varepsilon}_t$ and expand:

$$\mathbb{E}\!\left[\|H^{1/2}\hat{g}_t\|^2\right] = \|H^{1/2}He_t\|^2 + \mathbb{E}\!\left[\|H^{1/2}\bar{\varepsilon}_t\|^2\right]$$

The cross term $2(He_t)^\top H\bar{\varepsilon}_t$ vanishes by independence. The noise term evaluates as $\mathbb{E}[\|H^{1/2}\bar{\varepsilon}_t\|^2] = \mathbb{E}[\bar{\varepsilon}_t^\top H\bar{\varepsilon}_t] = \frac{\sigma^2}{B}\mathrm{tr}(H)$. Combining:

$$\mathbb{E}[V_{t+1}] \leq (1 - 2\mu\eta_t)\mathbb{E}[V_t] + \eta_t^2\!\left(\|H^{3/2}e_t\|^2 + \frac{\sigma^2\,\mathrm{tr}(H)}{B}\right)$$

Using $\eta_t \leq \bar\eta \leq 1/(2L)$ and $\|H^{3/2}e_t\|^2 \leq L^2 V_t$, the $\eta_t^2 \|H^{3/2}e_t\|^2$ term is bounded by $\eta_t^2 L^2 V_t \leq \eta_t L V_t / 2 \leq \mu\eta_t V_t$, which absorbs into the contraction:

$$\mathbb{E}[V_{t+1}] \leq (1 - \mu\eta_t)\mathbb{E}[V_t] + \frac{\eta_t^2 \sigma^2\,\mathrm{tr}(H)}{B}$$
Step 3
Near-convergence: modulated step size

Near the optimum $x^*$, the mini-batch gradients concentrate around the true gradient. By Proposition 3.3, $\mathrm{CWGD}_t \approx 2\sigma^2\,\mathrm{tr}(H^{-1})$ when the stochastic noise dominates (i.e., near $x^*$ where the deterministic gradient is small). Thus $r_t = \mathrm{CWGD}_t / \mathrm{CWGD}_0 \to 1$, and:

$$\eta_t \to \eta_{\mathrm{eff}} := \frac{\bar\eta}{1 + \alpha}$$

Since $\eta_{\mathrm{eff}} \leq \bar\eta \leq 1/(2L)$, the stability condition $\eta_t \leq 1/(2L)$ holds throughout. Substituting $\eta_t = \eta_{\mathrm{eff}}$ into the recursion from Step 2:

$$\mathbb{E}[V_{t+1}] \leq (1 - \mu\eta_{\mathrm{eff}})\mathbb{E}[V_t] + \frac{\eta_{\mathrm{eff}}^2 \sigma^2\,\mathrm{tr}(H)}{B}$$

For the contraction bound in the theorem statement, note $1 - \mu\eta_{\mathrm{eff}} \leq 1 - \mu\bar\eta$ (since $\eta_{\mathrm{eff}} \leq \bar\eta$), giving $(1-\mu\bar\eta)^T$ for the transient term.

Step 4
Asymptotic floor

Set $\mathbb{E}[V_{t+1}] = \mathbb{E}[V_t] = V^*$ in the steady-state recursion from Step 3. This gives:

$$V^* = (1 - \mu\eta_{\mathrm{eff}})V^* + \frac{\eta_{\mathrm{eff}}^2\sigma^2\,\mathrm{tr}(H)}{B}$$

Rearranging:

$$\mu\eta_{\mathrm{eff}} V^* = \frac{\eta_{\mathrm{eff}}^2\sigma^2\,\mathrm{tr}(H)}{B} \implies V^* = \frac{\eta_{\mathrm{eff}}\sigma^2\,\mathrm{tr}(H)}{\mu B}$$

Substituting $\eta_{\mathrm{eff}} = \bar\eta/(1+\alpha)$:

$$V^* = \frac{\bar\eta\sigma^2\,\mathrm{tr}(H)}{\mu B(1+\alpha)}$$
Step 5
Converting to suboptimality

Since $V_t = 2(f(x_t) - f(x^*))$, we have $f(x_t) - f(x^*) = V_t / 2$. Combining the transient contraction (Step 3) with the steady-state floor (Step 4):

$$\mathbb{E}[f(x_T) - f(x^*)] \leq (1-\mu\bar\eta)^T(f(x_0)-f(x^*)) + \frac{\bar\eta\sigma^2\,\mathrm{tr}(H)}{2\mu B(1+\alpha)}$$

This is the bound stated in Theorem 4.1. Note the residual floor for plain cosine annealing ($\alpha = 0$) is $\bar\eta\sigma^2\,\mathrm{tr}(H)/(2\mu B)$, which is larger by a factor of exactly $(1+\alpha)$. At $\alpha = 1$ the floor is halved.

□
Remark 4.2 — Two Gaps

Gap 1 (theorem vs. ρ(κ)). Theorem 4.1 guarantees a $1/(1+\alpha) = 2\times$ reduction at $\alpha=1$. The aspirational factor $\rho(\kappa)$ from Proposition 3.3 ranges from $2.0\times$ to $3.9\times$. For $\kappa = 5$ the two coincide; for $\kappa > 5$ the theorem's guarantee is weaker. Closing this gap would require an analysis tracking the full trajectory (not just the asymptotic floor), which the authors identify as the main open theoretical problem.

Gap 2 (theorem vs. empirical). The theorem proves $2\times$ floor reduction, yet experiments observe only $\sim 1.25\times$. This is expected: the floor is an asymptotic quantity; experiments measure finite-$T$ loss; and the modulation attenuates the learning rate during the transient phase, slowing early progress. The theorem is correct; the finite-$T$ benefit is more modest.

Corollary 4.3 Monotonicity in α

Statement. Under the assumptions of Theorem 4.1, the residual floor

$$F(\alpha) = \frac{\bar\eta\sigma^2\,\mathrm{tr}(H)}{2\mu B(1+\alpha)}$$

is strictly decreasing in $\alpha$ for all $\alpha \geq 0$. The floor is minimised as $\alpha \to \infty$. The practically useful range is $\alpha \in [0, 1]$; empirically $\alpha = 1$ performs best across all tested $\kappa$.

Proof.

Step 1

Differentiate $F(\alpha)$ with respect to $\alpha$:

$$\frac{dF}{d\alpha} = -\frac{\bar\eta\sigma^2\,\mathrm{tr}(H)}{2\mu B(1+\alpha)^2}$$

The numerator $\bar\eta\sigma^2\,\mathrm{tr}(H)$ is strictly positive (all quantities are positive by assumption: $\bar\eta > 0$, $\sigma^2 > 0$, $\mathrm{tr}(H) > 0$ since all eigenvalues $\lambda_k > 0$). The denominator $2\mu B(1+\alpha)^2 > 0$ for all $\alpha \geq 0$. Therefore $dF/d\alpha < 0$ for all $\alpha \geq 0$.

Step 2

As $\alpha \to \infty$, $F(\alpha) = \bar\eta\sigma^2\,\mathrm{tr}(H) / (2\mu B(1+\alpha)) \to 0$. So the floor is minimised in the limit $\alpha \to \infty$, which corresponds to effectively zeroing the learning rate at high-diversity steps.

However, $\alpha \to \infty$ is impractical: the effective learning rate $\eta_{\mathrm{eff}} = \bar\eta/(1+\alpha) \to 0$, which means the optimizer converges arbitrarily slowly in the transient phase (contraction factor $(1-\mu\bar\eta)^T$ worsens as $\bar\eta$ effectively decreases). The practical optimum balances floor reduction against transient speed — hence the recommendation $\alpha = 1$, confirmed empirically across all $\kappa$.

□
Proposition 5.1 Hutchinson Estimator Properties

Statement. Let $v^{(p)} \sim \{\pm 1\}^d$ be Rademacher probe vectors, and define the Hutchinson estimator of $\mathrm{diag}(H)$:

$$\hat\lambda_k = \frac{1}{P}\sum_{p=1}^P v_k^{(p)}\,[Hv^{(p)}]_k$$

where $[Hv]$ is approximated by $(\nabla f(x + \delta v) - \nabla f(x))/\delta$.

(i) For a quadratic $f$ with $H = \mathrm{diag}(\lambda)$: $\hat\lambda_k = \lambda_k$ exactly for any $P \geq 1$ and any $\delta > 0$.

(ii) For a near-diagonal Hessian $H = D + E$, $D = \mathrm{diag}(H)$: the bias satisfies $|\hat\lambda_k - \lambda_k| \leq \|E\|_F/\sqrt{d} + O(\delta)$.

Proof of (i): Diagonal quadratic.

Step 1

For a diagonal quadratic $f(x) = \frac{1}{2}x^\top Hx - b^\top x$ with $H = \mathrm{diag}(\lambda_1,\ldots,\lambda_d)$, the Hessian-vector product is:

$$[Hv]_k = \lambda_k v_k$$

This is exact (no approximation error) regardless of $\delta$, since the finite difference $(\nabla f(x + \delta v) - \nabla f(x))/\delta = Hv$ exactly for a quadratic.

Step 2

Substitute into the Hutchinson estimator. For each probe $p$ and each coordinate $k$:

$$v_k^{(p)}\,[Hv^{(p)}]_k = v_k^{(p)} \cdot \lambda_k v_k^{(p)} = \lambda_k (v_k^{(p)})^2 = \lambda_k$$

since $v_k^{(p)} \in \{\pm 1\}$ implies $(v_k^{(p)})^2 = 1$. This holds for every probe $p$.

Step 3

Averaging over $P$ probes:

$$\hat\lambda_k = \frac{1}{P}\sum_{p=1}^P \lambda_k = \lambda_k$$

The estimate is exactly $\lambda_k$ for any $P \geq 1$. This confirms the claim. Empirically, the relative error is $< 10^{-8}$, consistent with floating-point arithmetic.

Proof of (ii): Near-diagonal Hessian.

Step 1

Write $H = D + E$ where $D = \mathrm{diag}(\lambda_1,\ldots,\lambda_d)$ and $E$ has zero diagonal. Then:

$$[Hv^{(p)}]_k = [Dv^{(p)}]_k + [Ev^{(p)}]_k = \lambda_k v_k^{(p)} + \sum_{j \neq k} E_{kj} v_j^{(p)}$$
Step 2

The estimator becomes:

$$v_k^{(p)}[Hv^{(p)}]_k = \lambda_k + v_k^{(p)}\sum_{j \neq k} E_{kj} v_j^{(p)}$$

The cross term $c_p := v_k^{(p)}\sum_{j \neq k} E_{kj}v_j^{(p)}$ has mean zero: $\mathbb{E}[c_p] = \sum_{j \neq k} E_{kj}\mathbb{E}[v_k^{(p)}v_j^{(p)}] = 0$ since the components of $v^{(p)}$ are independent Rademacher variables with $\mathbb{E}[v_k v_j] = 0$ for $k \neq j$.

Step 3

The variance of $c_p$ is $\mathrm{Var}(c_p) = \sum_{j \neq k} E_{kj}^2 \leq \|E\|_F^2$ (using independence and $\mathrm{Var}(v_k v_j) = 1$ for Rademacher). Averaging over $P$ probes, the standard deviation of $\hat\lambda_k - \lambda_k$ is:

$$\mathrm{Std}\!\left[\hat\lambda_k - \lambda_k\right] = \frac{\|E_k\|_2}{\sqrt{P}} \leq \frac{\|E\|_F}{\sqrt{P}}$$

where $E_k$ denotes row $k$ of $E$ (off-diagonal). Summing over $d$ coordinates (or bounding per coordinate), the per-coordinate error is $O(\|E\|_F/\sqrt{Pd})$, giving the stated bound $|\hat\lambda_k - \lambda_k| \leq \|E\|_F/\sqrt{d} + O(\delta)$ for the $P=1$ case (the paper's bound as stated). The $O(\delta)$ term comes from finite-difference approximation error for non-quadratic $f$; it vanishes exactly for quadratics.

□
Empirical confirmation

Part (i) is confirmed to floating-point precision in the experiments: for diagonal quadratics the relative error is $< 10^{-8}$. Part (ii) is tested by rotating the Hessian by angle $\theta$, introducing controlled off-diagonal structure. The worst case ($\kappa = 50$, $\theta = 45°$) gives only $0.81\%$ relative error in $\widehat{\mathrm{CWGD}}$, confirming the diagonal approximation is adequate for moderate off-diagonal terms.

Section 13

Discussion &
Future Directions

CWGD captures something that standard gradient variance does not: the geometry of the loss landscape shapes how much noise in each direction actually matters for convergence. This is not a small correction — the improvement factor $\rho(\kappa)$ scales as $\kappa/\log\kappa$, potentially 3–4× better than standard bounds for moderately ill-conditioned problems.

The specific scheduler proposed here exploits this in a narrow but well-defined setting, and the 20% improvement it achieves is reproducible, statistically robust, and persists across batch sizes and noise structures within that setting. The overhead is minimal: 0.5% extra compute for a one-time Hutchinson pass.

Beyond Learning Rate Adaptation

CWGD has potential uses beyond schedule modulation. A sudden spike in CWGD during training might signal a change in the loss landscape — entering a region of high curvature — that would benefit from a learning rate pause or a warm restart. This diagnostic use doesn't require the Hessian to be diagonal or the loss to be quadratic.

The Path to Nonconvex Settings

The most natural fix for nonconvex tasks is replacing the periodic Hutchinson refresh with an online EMA of per-coordinate gradient second moments, as Adam does. This would eliminate staleness at the cost of a different (and possibly weaker) curvature proxy. Designing this proxy without reintroducing the degeneracy of the naive estimator remains an open problem.

🔬
Open problems

Three concrete open questions: (1) A tighter convergence analysis tracking the full trajectory, not just the asymptotic floor, to close the gap between the $2\times$ theorem guarantee and the $3.9\times$ aspirational target at $\kappa = 50$. (2) An online curvature proxy for nonconvex settings that avoids staleness without reintroducing the constant-$d$ degeneracy. (3) Scaling experiments to $d = 10^3$–$10^4$ to understand estimator error accumulation.

⬡
Run the experiments yourself — free Colab CPU, ~15 minutes → github.com/Hamza-Faarooq/cwgd-optimizer
→