Sparse Perturbations for Improved Convergence in Stochastic Zeroth-Order Optimization

Mayumi Ohta, Nathaniel Berger, Artem Sokolov, Stefan Riezler

Abstract

Stochastic zeroth-order (SZO) optimization is essential for black-box optimization where gradients are unavailable. However, its convergence rate typically scales with the total number of parameters $n$, leading to a "curse of dimensionality" in deep learning. We present a sparse perturbation method that reduces this dependency to the number of perturbed parameters $\bar{n}$. By employing masking strategies—specifically "freezing" unperturbed weights rather than pruning them—we demonstrate significantly improved convergence and gradient approximation accuracy on high-dimensional benchmarks like MNIST and CIFAR-10.

Introduction

In many real-world applications, such as black-box adversarial attacks, reinforcement learning, and hyperparameter tuning, the explicit gradient of an objective function is inaccessible. Stochastic zeroth-order (SZO) optimization addresses this by estimating gradients through random perturbations of model parameters. Despite its utility, standard SZO suffers from poor scalability: its convergence rate is hindered by a factor of $\sqrt{n}$, where $n$ is the total parameter count. For modern neural networks with millions of parameters, this often leads to slow convergence or complete divergence.

This work introduces Sparse SZO, a technique that applies perturbations to only a sparse subset of parameters. By reducing the effective dimensionality of the search space, we theoretically and empirically mitigate the curse of dimensionality, enabling efficient gradient-free training for large-scale models.

Methodology

Standard SZO estimates gradients by applying a random Gaussian perturbation to all parameters simultaneously. In contrast, Sparse SZO utilizes a binary mask to restrict perturbations to a subset of $\bar{n}$ parameters ($\bar{n} \ll n$).

Masking Strategies

The authors evaluate two primary strategies for selecting which parameters to perturb:

  1. Magnitude Masking: Parameters are sorted by their $L_1$-norm, and those with the smallest weights are masked (similar to weight pruning).
  2. Random Masking: Multiple random mask patterns are sampled, and the one yielding the highest validation accuracy is selected.

Handling Unperturbed Parameters

A critical distinction is made in how the masked parameters are treated:

  • Pruning: Masked weights are set to zero.
  • Freezing: Masked weights retain their current values, and only the unmasked weights are updated.

Theoretical and Empirical Insights

The core theoretical contribution is a proof showing that for non-convex, Lipschitz-smooth functions, the SZO convergence bound depends on the expected dimensionality of the random perturbation $\hat{n}$ rather than the total dimensionality $n$.

Empirically, the success of Sparse SZO is linked to the natural sparsity of gradients in deep networks. Throughout the training process, most gradient coordinates remain near zero. Furthermore, the "freezing" approach proves superior to "pruning." While pruning is common in first-order optimization (e.g., the Lottery Ticket Hypothesis), in the zeroth-order regime, it can push the optimizer into less smooth regions of the loss landscape. Freezing maintains a smoother search path, facilitating better generalization.

Experimental Results

The proposed methods were evaluated on MNIST (3-layer MLP, ~266k parameters) and CIFAR-10 (CNN, ~4.3M parameters). Although SZO is intended for black-box tasks, these white-box benchmarks allow for direct comparison between SZO estimates and ground-truth gradients calculated via backpropagation.

Gradient Approximation Accuracy

Sparse SZO, particularly the freezing variant, provides a much tighter approximation of the true gradient than dense SZO. As shown in Figure 1, on the high-dimensional CIFAR-10 model, dense SZO fails to approximate the gradient effectively, whereas sparse methods converge toward the true gradient.

Gradient approximation error across training for MNIST and CIFAR-10.

Convergence and Accuracy

The freezing variant of Sparse SZO consistently achieved the fastest reduction in cross-entropy loss. In contrast, pruning variants often exhibited performance degradation or overfitting in later stages of training.

Cross-entropy loss vs. number of examples for MNIST and CIFAR-10.

On CIFAR-10, the active parameter space was reduced from 4.3 million to approximately 62,000 (a 98.5% reduction) while maintaining superior performance over dense baselines.

Conclusion

Sparse SZO offers a robust solution to the dimensionality challenges of zeroth-order optimization. By focusing perturbations on a subset of parameters and "freezing" the remainder, we achieve faster convergence and more accurate gradient estimates. While the method introduces new hyperparameters related to masking schedules, it provides a theoretically grounded framework for scaling black-box optimization to high-dimensional neural networks.

Summary updated

BibTeX
@inproceedings{ohta2020sparse,
  author = {Mayumi Ohta and Nathaniel Berger and Artem Sokolov and Stefan Riezler},
  title = {{Sparse Perturbations for Improved Convergence in Stochastic Zeroth-Order Optimization}},
  booktitle = {LOD},
  year = {2020},
  url = {https://openreview.net/forum?id=F4MQznjJ0qz},
}
Figure