NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

On the Optimal Construction of Unbiased Gradient Estimators for Zeroth-Order Optimization

Shaocong Ma, Heng Huang

Abstract

Zeroth-order optimization (ZOO) is a critical tool for optimizing functions where gradient information is unavailable, such as in black-box adversarial attacks and memory-efficient fine-tuning of large language models (LLMs). However, traditional ZOO methods rely on finite-difference approximations that introduce inherent bias, often hindering convergence. This paper introduces a novel family of unbiased gradient estimators derived from a randomized telescoping series reformulation of directional derivatives. By optimizing the sampling distributions and perturbation stepsizes, the authors develop estimators that achieve optimal convergence rates for non-convex problems and demonstrate superior performance in high-dimensional tasks.

Introduction

Zeroth-order optimization (ZOO) serves as the primary strategy when an objective function $f(x)$ can be evaluated but its gradient $\nabla f(x)$ is inaccessible. This scenario is increasingly common in modern machine learning, particularly in reinforcement learning, black-box optimization, and the fine-tuning of massive language models where backpropagation is computationally prohibitive.

The fundamental challenge in ZOO is the reliance on finite-difference methods. Standard one-point or two-point estimators approximate the gradient using a perturbation stepsize $\mu$. While accuracy improves as $\mu$ approaches zero, practical constraints—such as numerical instability and fixed stepsizes—introduce a persistent bias. This bias acts as a "tax" on optimization, often preventing the algorithm from reaching the true global minimum. This research challenges the long-held assumption that bias is an unavoidable consequence of zeroth-order access.

Methodology: The Randomized Telescoping Estimator

The authors propose a mathematical framework to construct truly unbiased ZOO gradient estimators using only function evaluations. The core innovation lies in the "Telescoping Trick."

The Telescoping Trick and Randomized Sampling

The directional derivative, which defines the gradient, is typically viewed as a limit. The authors reformulate this limit as an infinite telescoping series of function differences. To make this computationally tractable, they treat the series as an expectation. By sampling an index $n$ from a carefully selected probability distribution $p_n$, they create a randomized estimator that is unbiased by design.

The $P_k$-Estimator Family

The paper derives a family of estimators, denoted as $P_k$, based on the number of function evaluations ($k$) required per iteration:

  • $P_1$ Estimator: Uses a single evaluation. While theoretically unbiased, the authors prove it suffers from infinite variance, rendering it impractical for real-world optimization.
  • $P_2, P_3, P_4$ Estimators: These use additional evaluations to stabilize variance. The $P_3$ and $P_4$ variants are particularly significant because they are "parameter-agnostic," meaning they achieve optimal variance without requiring exhaustive tuning of the sampling distribution.

Optimal Scaling and Distributions

To identify the most efficient estimators, the authors solved a non-convex functional optimization problem to determine the ideal perturbation stepsizes ($\mu_n$) and sampling distributions ($p_n$). Their analysis identifies Zipf and Geometric distributions as the optimal candidates for balancing the trade-off between evaluation cost and variance reduction.

Experimental Validation

The proposed estimators were evaluated against standard biased ZOO methods across synthetic and real-world benchmarks.

Synthetic Benchmarks

Testing on quadratic loss (linear regression) and logistic loss (binary classification) across dimensions up to $d=4096$ revealed that the Zipf-based $P_3$-estimator consistently achieved lower Mean-Square Error (MSE) in gradient estimation. Notably, the performance gap between the unbiased approach and standard Gaussian or Uniform two-point estimators widened as the dimensionality of the problem increased.

LLM Fine-tuning

To test real-world applicability, the authors fine-tuned the OPT-1.3B language model on the SST-2 (Stanford Sentiment Treebank) dataset. Under a fixed budget of function evaluations, the unbiased estimators converged faster and achieved lower training loss than traditional biased baselines. This suggests that unbiasedness is particularly beneficial in the high-dimensional parameter spaces characteristic of modern transformer architectures.

Key Insights and Complexity

  1. Unbiasedness is Attainable: By randomizing the resolution of finite differences, it is possible to recover the true gradient in expectation without direct gradient access.
  2. Optimal Complexity: The authors prove that Stochastic Gradient Descent (SGD) utilizing these estimators reaches the theoretical lower bound for complexity in smooth non-convex optimization, specifically $O(d/\epsilon^4)$.
  3. Robustness: The unbiased approach is less sensitive to hyperparameter selection, addressing a major pain point in the deployment of zeroth-order methods.

Limitations and Future Work

While the theoretical framework is robust, practical implementation involves truncating the infinite series. Although the authors note this truncation bias is negligible compared to standard finite-difference bias, it remains a factor. Additionally, the current study assumes a "noiseless oracle" (exact function evaluations). Future research is required to determine how these estimators behave in noisy environments, such as certain reinforcement learning tasks, and how they might be adapted for non-smooth objective functions where Lipschitz continuity of the gradient does not hold.

Summary updated

BibTeX
@inproceedings{ma2025optimal,
  author = {Shaocong Ma and Heng Huang},
  title = {{On the Optimal Construction of Unbiased Gradient Estimators for Zeroth-Order Optimization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=rVT1GK60Nt},
}
Figure