Clemson's ZO-SAM Trains 90% Sparse Neural Nets 60% Faster Without Losing Accuracy
A new optimizer cuts Sharpness-Aware Minimization's cost in half by replacing one backprop with random probes, unlocking flat minima for highly sparse networks.
ProTakeaways
- ZO-SAM replaces SAM's first backprop with a zero-order random gradient estimate, halving compute overhead.
- Uses Random Gradient Estimation with
mforward-only probes, keeping precise first-order gradients for the weight update. - Improves accuracy over SGD baselines by up to 2.54 points at 90-98% sparsity across ResNet and DeiT models.
- Runs at 76.67% of SGD throughput versus 47.67% for standard SAM on ResNet-32.
- Boosts CIFAR-10-C robustness by 3.10 points, outperforming ESAM, LookSAM, and GSAM under corruption.
- Full paper on arXiv; drop-in wrapper compatible with LTH, SNIP, RigL, MEST, and SViTE.
Training neural networks at extreme sparsity, where 90% or more of the weights are zeroed out, is a bumpy ride. The few remaining parameters have to shoulder all the work, and the gradients that guide them tend to jitter wildly from step to step. A new paper from researchers at Clemson University and the University of Arizona proposes ZO-SAM, an optimizer that borrows a trick from black-box optimization to stabilize sparse training without doubling the compute bill.
Why sparse training gets shaky
Sparse neural networks apply a binary mask to the weights so that only a small fraction remain active. That saves memory and FLOPs, but it changes the shape of the loss landscape. Introducing or increasing sparsity transforms the loss surface from a smooth, wide basin into a steeper, narrower landscape, and standard SGD exhibits highly erratic gradient fluctuations during sparse training, with increased sparsity further amplifying gradient variance.
The natural fix is Sharpness-Aware Minimization (SAM), which pushes optimization toward flat minima where small weight perturbations barely change the loss. Flat regions mean smaller gradient variance and better generalization. The catch: each SAM optimization step requires two full backpropagations, effectively doubling the computational cost compared to standard SGD. That overhead defeats the entire point of going sparse in the first place.
Half the backprops, same flat minima
ZO-SAM's core idea is surgical. SAM has two stages per step: first it computes a small adversarial perturbation of the weights, then it takes a real gradient step at that perturbed point. The authors argue the first stage doesn't actually need a precise gradient, it just needs a reasonable direction. So they replace it with a zero-order estimate.

Zero-order optimization estimates gradients using only forward passes, no backprop required. ZO-SAM uses Random Gradient Estimation (RGE): sample a handful of random direction vectors, evaluate the loss at tiny positive and negative steps along each, and average the finite differences. In pseudocode:
for i in range(m):
u = torch.randn_like(theta)
loss_plus = loss_fn((theta + delta*u) * mask)
loss_minus = loss_fn((theta - delta*u) * mask)
g_hat += ((loss_plus - loss_minus) / (2*delta)) * u
g_hat /= m
epsilon = rho * g_hat / g_hat.norm()
# Now do ONE real backprop at (theta + epsilon)
g = torch.autograd.grad(loss_fn((theta+epsilon)*mask), theta)
The perturbation step becomes backprop-free, while the actual weight update still uses a precise first-order gradient. The authors picked RGE over coordinate-wise estimation because CGE requires d evaluations where d is the dimensionality, leading to extreme expensive computational cost for deep learning models with millions of parameters. With RGE, you pick m based on your compute budget.
What the numbers show
The experiments span ResNet-32, ResNet-50, WideResNet-28-10, and DeiT-Tiny/Small, tested against static pruning methods (LTH, SNIP, GraSP) and dynamic ones (SET, DSR, RigL, MEST). ZO-SAM is a drop-in wrapper, so every baseline gets a paired "+ZO-SAM" version. The accuracy bumps are consistent:
- On CIFAR-10 with ResNet-32 at 98% sparsity, MEST gains 2.31 points (89.22% to 91.53%).
- On CIFAR-100 at 90% sparsity, RigL gains 2.54 points (70.34% to 72.88%).
- On ImageNet-1K, DeiT-Small at 70% sparsity trained with RigL improves by 1.17 points to 79.16%.
The efficiency comparison against the SAM family is where the design pays off. Measuring throughput on ResNet-32 at 90% sparsity, SAM ran at 2704.84 images per second (47.67%) of the SGD baseline, while ZO-SAM ran at 4349.53 (76.67%). Accuracy stayed within a fraction of a point of full SAM.

Convergence also improves. While SGD typically requires more than 130 epochs to approach its final accuracy, ZO-SAM reaches comparable performance within only about 120 epochs. At 95% sparsity, ZO-SAM hits 90% accuracy in 88 epochs versus 131 for SGD and 113 for GSAM.
Robustness under distribution shift
Because flat minima tend to generalize, the authors ran the trained sparse models against CIFAR-10-C, which applies 19 common corruptions at 5 severity levels. Training ResNet-32 with SNIP at 90% sparsity, adding ZO-SAM improved corrupted-set accuracy by 3.10 points, a larger robustness gain than any other SAM variant tested, including ESAM, LookSAM, and GSAM.
Caveats and when to reach for it
ZO-SAM is designed for the sparse-training regime specifically, where you're already trying to squeeze compute. It's not a free win on dense models where standard SAM's overhead is more tolerable. Full SAM still edges it out in raw accuracy in some settings, so if you have budget for two backprops, the original wins narrowly. The method also introduces two extra hyperparameters (the finite-difference step delta and the number of random directions m), and the zero-order estimate does inject some approximation noise, which is why the authors kept the precise gradient for the update step.
The paper doesn't include a public code release link, but the algorithm fits in about ten lines on top of any existing SAM implementation, so reproducing it should be straightforward for anyone already running dynamic sparse training frameworks like RigL or MEST.