Kurtosis-calibrated gradient clipping
Implementation & benchmark of arXiv:2607.05226 — The Exact Worst-Case Tail Probability under Bounded Kurtosis
Source paper: The Exact Worst-Case Tail Probability under Bounded Kurtosis arXiv:2607.05226 ⓘ · analyzed Aug 30, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Choose gradient clipping thresholds from an explicit worst-case tail probability implied by an observed kurtosis bound, rather than using a fixed norm threshold or an empirical percentile. For a standardized centered gradient coordinate, the threshold achieving target outlier probability \(\delta\) is obtained by analytically inverting the paper's sharp tail formula.
Formulas
Mathematical statement
The paper studies \(\mathcal{C}(\kappa)=\{X:\mathbb{E}X=0,\ \mathbb{E}X^2=1,\ \mathbb{E}X^4\leq\kappa\}\), where \(\kappa\geq1\) is a kurtosis upper bound and the third moment is unconstrained. It defines \(V_1(t,\kappa)=\sup_{X\in\mathcal{C}(\kappa)}\mathbb{P}(X\geq t)\). In the tail regime \(t\geq c(\kappa)\), the exact worst-case bound is \(V_1(t,\kappa)=(\kappa-1)/((t^2-1)^2+\kappa-1)\). The transition threshold is the larger positive solution of equality with Cantelli's bound, satisfying \(c(\kappa)^4-(\kappa+1)c(\kappa)^2+1=0\), and therefore \(c(\kappa)^2=((\kappa+1)+\sqrt{(\kappa+1)^2-4})/2\) for \(\kappa>1\). Inverting the tail formula for target probability \(\delta\in(0,1)\) gives \(t_\delta^2=1+\sqrt{(\kappa-1)(1/\delta-1)}\). For a scalar gradient coordinate \(g\), estimate mean \(\mu\), standard deviation \(\sigma>0\), and kurtosis \(\kappa=\mathbb{E}[(g-\mu)^4]/\sigma^4\), then clip at \(\mu+t_\delta\sigma\). The guarantee is distribution-free only when \(\kappa\) is a valid upper bound, so empirical estimates require a safety factor.
Implementation notes
Integrate this into the per-layer optimizer immediately before the AdamW or SGD update, operating on each parameter tensor's gradient values. Maintain exponential moving averages of the batch gradient mean, variance, and fourth central moment: \(\mu\leftarrow\beta\mu+(1-\beta)\operatorname{mean}(g)\), \(v\leftarrow\beta v+(1-\beta)\operatorname{mean}((g-\mu)^2)\), and \(q\leftarrow\beta q+(1-\beta)\operatorname{mean}((g-\mu)^4)\). In practice use the current batch mean when computing central moments, because using the lagged \(\mu\) can inflate \(q\). Compute \(\hat\kappa=\max(1,q/(v^2+\epsilon))\), multiply it by a safety factor such as 1.5, and optionally cap it at a fixed maximum to prevent a single noisy batch from producing an unusably large threshold. For a target tail rate \(\delta\), calculate \(t_\delta\) from the displayed inversion. If \(t_\delta<c(\hat\kappa)\), replace it with \(c(\hat\kappa)\), since the closed-form expression is certified only in the tail regime. Set \(\tau=t_\delta\sqrt{v+\epsilon}\), and replace each gradient entry by \(\mu+\operatorname{clip}(g-\mu,-\tau,\tau)\); pass the resulting tensor to the unchanged optimizer. The paper supplies the tail formula, phase-transition equation, and inversion; the moving-moment estimator, safety factor, and clipping granularity are engineering choices. First test on a 2-layer MLP and a small Transformer on CIFAR-10 or WikiText-2, comparing AdamW or SGD with this method, fixed global-norm clipping, percentile clipping, and no clipping. Record gradient spikes, empirical tail probability above \(\tau\), kurtosis, update norm, training loss at equal optimizer steps, and validation accuracy. Success means fewer catastrophic gradient spikes and faster loss descent at equal FLOPs without harming final accuracy. Run an oracle variant using the true distributional kurtosis on synthetic heavy-tailed gradients to separate the mathematical effect from online estimation noise.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Confirmed ✓
Stage 2 · Practical benchmark result: Significant win ✓
Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works
Stage 1 — Mechanism check agent confidence 7/10
Built kurtosis-calibrated clipping with transition-regime protection, EMA moment estimation, and a safety factor. The inversion and transition polynomial were verified to near machine precision, and Student-t trials stayed below the requested tail probabilities. In the noisy quadratic, calibrated clipping reduced threshold-exceeding spike steps from 238.2 to 6.9 versus no clipping, but final loss was unchanged, so the demonstrated benefit is stability rather than faster optimization.
- Agent confidence
- 7/10
- Baseline
- No clipping: final loss 0.001323, mean last-50 loss 0.001370, max loss 27.04, 238.2 spike steps.
- Idea
- Kurtosis-calibrated clipping: final loss 0.001323, mean last-50 loss 0.001370, max loss 27.05, 6.9 spike steps, mean empirical tail above threshold 0.000656. Formula inversion error was 1.4e-17; Student-t observed tails were 0.00019-0.00377 for targets 0.01/0.05.
Limitations: Only a scalar noisy-quadratic toy optimizer was tested; no MLP, Transformer, CIFAR-10, WikiText-2, AdamW/SGD comparison, FLOP accounting, validation accuracy, online kurtosis-estimation calibration study, or adversarial extremal distribution was evaluated.
How to run: python3 experiment.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2607.05226)
Beats the tuned baseline by 0.1% (p=0.0147, wins 7 / 8 paired seeds; metric: lower is better).
- Benchmark
- Tabular regression (Friedman)
- Model
- mlp_tiny
- Paired seeds
- 8
- Baseline mean
- 10.9309
- Idea mean
- 10.9223
- Effect (Δ)
- -0.0087 (−0.1%; negative = idea better)
- Wins
- 7 / 8 paired seeds
- p-value
- 0.0147 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±0.0%
- Mechanism
- Confirmed ✓
- Practical effect
- Helps
- Baseline tuning
- swept over 3 configs
Only the structurally matched tabular track was tested; vision, sequence, and dynamics were not tested. The run did not compare fixed global-norm or percentile clipping baselines, measure wall-clock/FLOPs, or use catastrophic-loss spikes as the primary outcome. The MSE gain is small and may not generalize beyond this 400-sample Friedman#1 setup.
How to run: python3 bench_kurtosis.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Stage 2 — Benchmark latest Worked ✓
Agent confidence: 8/10
Implemented kurtosis-calibrated per-parameter gradient clipping as an Adam training-loop intervention on the matched tabular Friedman#1 regression benchmark using mlp_tiny. Across 8 paired seeds, test MSE improved from 10.93094 to 10.92225, with paired permutation p=0.01475 and 7/8 wins, satisfying the benchmark significant-win criterion. Formula checks passed and the trained-model gradient tail above the calibrated threshold averaged 0.00137 for target delta=0.02, confirming the mechanism prediction.
- Baseline
- Adam mlp_tiny, lr=0.006, 18 epochs: test MSE mean 10.930935978889465, std 1.3983305692789296.
- Idea
- Kurtosis-calibrated clipping with identical Adam/mlp_tiny/lr/epochs: test MSE mean 10.922250509262085, std 1.396535179145413; mean tail above threshold 0.0013686992548442773; clip fraction 0.0017396333491129594.
- Paired comparison
- delta_mean=-0.008685469627380371, p_value=0.01475, idea_wins=7/8.
Benchmark result
Beats the tuned baseline by 0.1% (p=0.0147, wins 7 / 8 paired seeds; metric: lower is better).
- Benchmark
- Tabular regression (Friedman)
- Model
- mlp_tiny
- Paired seeds
- 8
- Baseline mean
- 10.9309
- Idea mean
- 10.9223
- Effect (Δ)
- -0.0087 (−0.1%; negative = idea better)
- Wins
- 7 / 8 paired seeds
- p-value
- 0.0147 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±0.0%
- Mechanism
- Confirmed ✓
- Practical effect
- Helps
- Baseline tuning
- swept over 3 configs
Only the structurally matched tabular track was tested; vision, sequence, and dynamics were not tested. The run did not compare fixed global-norm or percentile clipping baselines, measure wall-clock/FLOPs, or use catastrophic-loss spikes as the primary outcome. The MSE gain is small and may not generalize beyond this 400-sample Friedman#1 setup.
How to run: python3 bench_kurtosis.py
Artifacts
- bench_kurtosis.py 6.3 KB View Raw
- bench_report.json 6.3 KB View Raw
- experiment.py 4.4 KB View Raw
- report.md 1.4 KB View
- report_bench_2026-09-04T124608.md 4.9 KB View
- results.json 3.3 KB View Raw