Gradient Testing and Estimation by Comparisons

Xiwen Tao, Chenyi Zhang, Helin Wang, Yexin Zhang, Tongyang Li

Introduction

In the realm of optimization, gradients are the ultimate guide, dictating the direction to move to minimize a loss function. However, in many real-world applications—such as black-box adversarial attacks on neural networks or reinforcement learning with human feedback—direct access to gradients is impossible. Often, we lack even reliable function values, relying instead on comparisons.

Consider human-in-the-loop systems or A/B testing: it is significantly easier for a user to indicate that "Option A is better than Option B" than to assign a precise numerical score to both. This paper investigates a fundamental question: How much information about a gradient can we extract using only these binary comparisons?

The Core Tasks

The authors formalize this problem using a comparison oracle, which simply returns a binary indicator ($\pm 1$) of which of two points yields a higher function value. Using this oracle, they tackle two primary objectives:

  1. Gradient Testing: Determining whether the gradient direction roughly aligns with a specific target vector $v$.
  2. Gradient Estimation: Finding the unit vector that points in the exact direction of the true gradient.

Methodology: Classical and Quantum Approaches

Classical Algorithms

The foundation of the classical approach is the Directional Preference (DP) primitive. By comparing $f(x)$ with $f(x + \delta v)$, the algorithm ascertains whether the gradient has a positive or negative projection along a vector $v$.

  • Gradient Testing in $O(1)$ Queries: To test if a gradient aligns with a target vector, the authors employ random projections. Remarkably, by checking a constant number of random directions, the algorithm can distinguish between a gradient that is "close" to the target and one that is "far" with high probability. This process is entirely independent of the dimensionality $n$.
  • Gradient Estimation in $O(n \log 1/\epsilon)$ Queries: To estimate the full gradient, the authors utilize a coordinate-wise binary search. While a naive implementation would require $O(n \log n/\epsilon)$ queries, they optimize this by exploiting the geometric constraint that the sum of squared coordinate ratios is bounded. This clever amortization across dimensions yields an optimal query complexity.

Quantum Algorithm

Taking the problem into the quantum realm, the authors adapt Jordan’s gradient algorithm to achieve Quantum Gradient Estimation in $O(\log n/\epsilon)$ queries. By leveraging quantum superposition, they encode directional derivatives into the phases of a quantum state using comparisons. Applying the Inverse Quantum Fourier Transform (IQFT) extracts the gradient direction, offering a massive, exponential speedup for high-dimensional optimization problems.

Key Insights and Empirical Results

The theoretical contributions of this paper are backed by rigorous proofs and empirical validation on synthetic benchmarks, including General Strongly-Convex Quadratics, Sparse Quadratics, and the notoriously difficult Extended Rosenbrock function.

Major Takeaways: * Testing is Dimension-Independent: The most striking finding is that verifying a guessed gradient direction requires only $O(1)$ queries, regardless of how many dimensions the problem has. * Comparisons are Sufficient: Knowing how much better one point is than another is unnecessary for finding the steepest ascent direction. The binary "sign" of the difference provides almost all the information needed for normalized gradient descent. * Mathematically Optimal Bounds: The classical estimation bound of $\Theta(n \log 1/\epsilon)$ is proven to be mathematically optimal; no classical algorithm can perform better. * Strong Empirical Performance: When integrated into a Normalized Gradient Descent (NGD) optimizer, the comparison-based estimator performed nearly as well as using the exact gradient, significantly outperforming existing zeroth-order baselines like ZO-SGD or SCOBO.

Task Classical Complexity Quantum Complexity
Gradient Testing $\Theta(1)$ $O(1)$ (via classical)
Gradient Estimation $\Theta(n \log 1/\epsilon)$ $O(\log n/\epsilon)$

Limitations and Future Directions

While the paper establishes robust theoretical foundations, several avenues remain open for future exploration:

  • Closing the Quantum Gap: Although the quantum algorithm is exceptionally fast, a small gap exists between the upper bound ($O(\log n/\epsilon)$) and the proven lower bound ($\Omega(\log 1/\epsilon)$). A tighter quantum algorithm may still be discovered.
  • Stochastic Oracles: The current framework assumes a deterministic, "clean" comparison oracle. In practice (especially with human feedback), oracles are often noisy or probabilistic. Extending these optimal bounds to stochastic settings is a critical next step.
  • Non-Smooth Functions: The mathematical guarantees rely on the assumption of $L$-smoothness. Investigating how these comparison techniques handle non-smooth or highly irregular functions would broaden their applicability in complex machine learning environments.

Summary updated

BibTeX
@inproceedings{tao2026gradient,
  author = {Xiwen Tao and Chenyi Zhang and Helin Wang and Yexin Zhang and Tongyang Li},
  title = {{Gradient Testing and Estimation by Comparisons}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=1JG0y5cOmK},
}
Figure