TL;DR
ZO-SAM is a new optimization framework that brings the generalization benefits of Sharpness-Aware Minimization (SAM) to sparse neural network training without the usual 100% computational overhead. By replacing the first of SAM's two backpropagation steps with a "zero-order" gradient estimation (using only forward passes), ZO-SAM cuts the extra training cost in half while significantly improving the accuracy and robustness of sparse models.
What Problem Does This Paper Address?
Sparse neural networks—where a large majority of weights are set to zero—are essential for deploying AI on edge devices with limited memory and power. However, training these models is notoriously difficult. As sparsity increases, the "loss landscape" becomes jagged and steep, leading to chaotic, noisy gradient signals that hinder convergence and hurt the model's ability to generalize to new data.
Sharpness-Aware Minimization (SAM) is a popular technique designed to find "flat minima" (broad valleys in the loss landscape), which typically leads to better generalization. The catch? SAM requires two backpropagation passes per update, effectively doubling the training time. In resource-constrained sparse training scenarios, this "SAM tax" is often too expensive to pay.
Methods
The authors introduce ZO-SAM (Zero-Order Sharpness-Aware Minimization). To understand how it works, we have to look at the two steps of standard SAM:
- Perturbation Step: Calculate a gradient to find the "worst-case" nearby direction to perturb the weights.
- Update Step: Calculate the gradient at that perturbed location to perform the actual weight update.
ZO-SAM’s "aha!" moment is realizing that the first step doesn't need perfect precision. Instead of a full backpropagation pass, ZO-SAM uses Random Gradient Estimation (RGE)—a zero-order method. RGE estimates the gradient by slightly tweaking the weights in a few random directions and measuring the change in loss using only forward passes.
By using zero-order estimation for the perturbation and reserving the precise first-order backpropagation for the final update, ZO-SAM achieves the "flatness" benefits of SAM with only a single backpropagation pass per iteration.
Datasets
The researchers evaluated ZO-SAM across a wide range of benchmarks:
- Image Classification: CIFAR-10, CIFAR-100, and the large-scale ImageNet-1K.
- Robustness: CIFAR-10-C (a version of CIFAR-10 with 19 different types of corruptions like blur and noise).
- Architectures: ResNet-32, ResNet-50, WideResNet-28-10, and Vision Transformers (DeiT-Tiny and DeiT-Small).
Key Insights and Ideas
- Precision Trade-off: The paper demonstrates that "minor inaccuracies" in the perturbation direction are tolerable. This allows for the use of cheaper zero-order estimates in the first step without sacrificing the final model quality.
- Stabilizing Sparse Training: Sparse training often suffers from "turbulent" gradients. ZO-SAM acts as a stabilizer, smoothing out the optimization trajectory.
- Efficiency is King: In sparse training, the goal is efficiency. ZO-SAM achieves ~76% of the throughput of standard SGD, whereas traditional SAM drops to ~47%.
- Visual Proof: The authors provide loss surface visualizations showing that ZO-SAM successfully transforms steep, narrow "pits" into wide, stable "basins," even at 95% sparsity.
Key Results
- Accuracy Gains: ZO-SAM consistently outperformed standard sparse training methods (like RigL, SNIP, and MEST). On ResNet-32 (CIFAR-100), it improved accuracy by up to 2.54%.
- Faster Convergence: Models trained with ZO-SAM reached 90% accuracy significantly faster than those trained with SGD. For example, at 90% sparsity, ZO-SAM reached the target in 70 epochs, compared to 104 for SGD.
- Superior Robustness: On the corrupted CIFAR-10-C dataset, ZO-SAM improved accuracy by 3.10% over the baseline, proving that "flat minima" really do help models handle real-world noise better.
- Transformer Success: The method isn't just for CNNs; it improved DeiT-Small performance on ImageNet-1K by 1.17% at 70% sparsity.
Limitations and Future Work
While ZO-SAM is highly effective, the authors note a few areas for further exploration:
- Hyperparameter Tuning: Like standard SAM, ZO-SAM introduces a perturbation radius ($\rho$) that may require tuning for different tasks.
- Scaling to LLMs: While the paper mentions Large Language Models (LLMs) in the context of zero-order optimization, the experiments in this paper focus on computer vision. Testing ZO-SAM on massive generative models remains a promising future direction.
- Optimal 'm': The number of random directions ($m$) used for the zero-order estimate affects the trade-off between speed and accuracy; finding an automated way to set this could further optimize the process.
Summary updated