Vanishing-Perturbation SAM
Implementation & benchmark of arXiv:2608.06692 — Stationarity Floors and Vanishing Perturbations in Sharpness-Aware Minimization
Source paper: Stationarity Floors and Vanishing Perturbations in Sharpness-Aware Minimization arXiv:2608.06692 ⓘ · analyzed Aug 31, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Replace constant-radius SAM by a clipped radius that equals the usual radius when the gradient is large but shrinks quickly enough near stationary points. This preserves SAM's sharpness-aware behavior during most training while removing the nonzero stationarity floor caused by a fixed perturbation.
Formulas
Mathematical statement
Let $f:\mathbb{R}^n\to\mathbb{R}$ have an $L$-Lipschitz gradient, meaning $\|\nabla f(x)-\nabla f(z)\|\le L\|x-z\|$, and let $g_k=\nabla f(x_k)$. The paper studies $y_k=x_k+\rho g_k/\|g_k\|^\alpha$ for $0\le\alpha\le1$; its displacement norm is $\|y_k-x_k\|=\rho\|g_k\|^{1-\alpha}$. Lipschitz smoothness therefore gives the perturbation-gradient error $\|\nabla f(y_k)-g_k\|\le L\rho\|g_k\|^{1-\alpha}$. Comparing this error with $\|g_k\|$ produces the stationarity scale $(L\rho)^{1/\alpha}$ for $0<\alpha\le1$. We use the clipped radius $\rho_k=\min(\rho,\tau\|g_k\|^\alpha)$, where $\tau>0$ has units of inverse curvature. Then $\|y_k-x_k\|=\rho_k\|g_k\|^{1-\alpha}\le\tau\|g_k\|$, so the perturbation vanishes linearly with the gradient. The resulting update is $x_{k+1}=x_k-h\nabla f(y_k)$, with $h$ chosen below the smoothness stability limit. The constant-radius rule is recovered whenever $\|g_k\|\ge(\rho/\tau)^{1/\alpha}$.
Implementation notes
Integrate this into the SAM optimizer immediately before the perturbed forward/backward pass. For each minibatch, compute the ordinary parameter gradient $g$ at parameters $x$; use a global norm across all trainable parameters, with an epsilon only for numerical safety. Choose $\alpha=1$ for standard SAM or test $\alpha\in\{0.5,1\}$, base radius $\rho$, and clipping coefficient $\tau$. Then execute: (1) $g\leftarrow\nabla f(x)$; (2) $r\leftarrow\min(\rho,\tau(\|g\|+\epsilon)^\alpha)$; (3) perturb every parameter tensor by $\Delta x=r\,g/(\|g\|+\epsilon)^\alpha$; (4) recompute the minibatch gradient $\tilde g=\nabla f(x+\Delta x)$; (5) restore $x$ and apply the usual SAM/AdamW update using $\tilde g$. In pseudocode: g=grad(loss(x)); norm=sqrt(sum(g_i^2)); r=min(rho,tau*(norm+eps)**alpha); for i: p_i += r*g_i/(norm+eps)**alpha; gt=grad(loss(x_perturbed)); restore(); optimizer.step(gt). The mathematical guarantee used by the implementation is $\|\Delta x\|\le\tau\|g\|$, while the threshold $(\rho/\tau)^{1/\alpha}$ is computed exactly from the rule. $L$ need not be known; optionally estimate it with periodic gradient differences $\hat L=\|g_t-g_{t-1}\|/(\|x_t-x_{t-1}\|+\epsilon)$ only for diagnostics. First test on CIFAR-10 with a small ResNet-18 or ViT-Tiny, comparing SGD, AdamW, fixed-radius SAM, and clipped SAM at matched two-forward-pass FLOPs. Track training loss, validation accuracy, gradient norm, and sharpness proxy. The expected signal is that fixed SAM's gradient norm plateaus near a nonzero floor while clipped SAM continues below it without losing SAM's validation advantage; success is lower final loss or accuracy improvement at equal compute, especially when $\rho$ is large enough to make fixed SAM visibly plateau.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Confirmed ✓
Stage 2 · Practical benchmark result: Inconclusive
Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works
Stage 1 — Mechanism check agent confidence 9/10
Built Vanishing-Perturbation SAM with global-gradient clipping and a deterministic toy verification. The mechanism manifested: observed clipping thresholds were within 5.5% of predictions, clipped displacement had the predicted linear gradient slope, the unclipped slopes matched 1-alpha, and the displacement/error bounds held to numerical precision. In the small classifier, clipped SAM reached 0.985 validation accuracy versus 0.990 for fixed SAM and 0.985 for SGD, so the mechanism was verified but no accuracy win over fixed SAM was observed.
- Agent confidence
- 9/10
- Baseline
- SGD: validation accuracy 0.9850, validation loss 0.0375, final raw gradient norm 0.0273; fixed SAM: validation accuracy 0.9900, validation loss 0.2167, final raw gradient norm 0.0630
- Idea
- Clipped SAM (rho=0.12, tau=0.5, alpha=1): validation accuracy 0.9850, validation loss 0.0365, final raw gradient norm 0.0250
Limitations: The mini-experiment used a tiny synthetic 2D MLP rather than CIFAR-10 or ResNet-18, and did not test AdamW, multiple datasets, larger seeds, wall-clock speed, or sharpness proxies. The toy sweep tested alpha=0.5 and 1.0, while the learned-classifier comparison used alpha=1.0 only.
How to run: python3 experiment.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2608.06692)
No significant difference vs. the tuned baseline (+9.4%, p=0.072, wins 1 / 8 paired seeds).
- Benchmark
- Tabular regression (Friedman)
- Model
- mlp_tiny
- Paired seeds
- 8
- Baseline mean
- 5.4024
- Idea mean
- 5.9104
- Effect (Δ)
- 0.508 (+9.4%; negative = idea better)
- Wins
- 1 / 8 paired seeds
- p-value
- 0.072 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±10.0%
- Mechanism
- Confirmed ✓
- Practical effect
- Inconclusive
- Baseline tuning
- swept over 9 configs
Only the registered tabular optimizer track was tested. Vision, sequence, dynamics, SGD, separately trained fixed-radius SAM, alpha=0.5, wall-clock speed, and sharpness proxies were not tested.
How to run: python3 bench_experiment.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Stage 2 — Benchmark latest Failed ✗
Agent confidence: 9/10
Vanishing-Perturbation SAM was implemented as a local two-forward-pass Adam intervention on the registered tabular Friedman#1 track with the shared mlp_tiny architecture. The trained-model displacement bound was confirmed, but the idea had higher test MSE than tuned Adam: 5.9104 versus 5.4024, paired delta +0.5080, permutation p=0.07195. Therefore there is no benchmark win.
- Baseline
- Adam mlp_tiny, best lr=0.006; mean test MSE 5.402375519275665 over 8 seeds.
- Comparison
- delta_mean=0.5080268383026123, p_value=0.07195, idea_wins=1/8, verdict=no significant win.
- Idea
- Vanishing-Perturbation SAM, lr=0.006, rho=0.05, tau=0.5, alpha=1.0; mean test MSE 5.910402357578278 over 8 seeds.
- Mechanism signature
- Predicted maximum displacement/gradient ratio 0.5; observed trained-model mean ratio 0.005617373155015077; confirmed=true.
Benchmark result
No significant difference vs. the tuned baseline (+9.4%, p=0.072, wins 1 / 8 paired seeds).
- Benchmark
- Tabular regression (Friedman)
- Model
- mlp_tiny
- Paired seeds
- 8
- Baseline mean
- 5.4024
- Idea mean
- 5.9104
- Effect (Δ)
- 0.508 (+9.4%; negative = idea better)
- Wins
- 1 / 8 paired seeds
- p-value
- 0.072 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±10.0%
- Mechanism
- Confirmed ✓
- Practical effect
- Inconclusive
- Baseline tuning
- swept over 9 configs
Only the registered tabular optimizer track was tested. Vision, sequence, dynamics, SGD, separately trained fixed-radius SAM, alpha=0.5, wall-clock speed, and sharpness proxies were not tested.
How to run: python3 bench_experiment.py
Artifacts
- bench_experiment.py 6.5 KB View Raw
- bench_report.json 4.2 KB View Raw
- experiment.py 6.5 KB View Raw
- report.md 1.4 KB View
- report_bench_2026-09-02T230521.md 6.0 KB View
- results.json 2.6 KB View Raw