Optimization on black-box function by parameter-shift rule

Vu Tuan Hai · 2025

Read Optimization on black-box function by parameter-shift rule by Vu Tuan Hai (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2503-13545.txt.

Introduction

Vu Tuan Hai borrows a trick from quantum computing to train hard machine learning models, in a 2025 paper. Many training tasks are black-box problems: the link between settings and results is tangled or unknown, and each test run is costly. Standard methods often need many queries and many parameters to search well. The parameter-shift rule comes from quantum circuits, where it gives exact gradients from a few shifted runs.

Hai adapts that rule into a zeroth-order method for black-box optimization, one that never needs the inner formula of the model. The method works with fewer parameters than earlier approaches. If it scales, it could ease training for models whose internals are hidden, proprietary, or too complex to differentiate directly.

Catalog record

CREATORVu Tuan Hai
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE17 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2503-13545

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

Optimization on black-box function by parameter-shift rule Vu Tuan Hai Abstract Machine learning has been widely applied in many aspects, but training a machine learning model is increasingly difficult. There are more optimization problems named “black-box” where the relationship between model parameters and outcomes is uncertain or complex to trace. Currently, optimizing black-box models that need a large number of query observations and parameters becomes difficult. To overcome the drawbacks of the existing algorithms, in this study, we propose a zeroth-order method that originally came from quantum computing called the parameter-shift rule, which has used a lesser number of parameters than previous methods. 1 Introduction In general, black-box models can be understood in terms of inputs and outputs; their internal workings are completely hidden. Such as selecting the optimal position for tsunami-detecting buoys or minimizing structure damage during an earthquake [ 1 ] . These optimization processes are done manually by experts based on a series of experiments. As a result, creating effective and efficient black-box model optimization (BBO) methods has become a critical challenge [ 2 , 3 ] . However, this procedure necessitates a large number of experiments, which may be both costly and time-consuming. Automated optimization methods with varied computing complexity and scalability have been developed to decrease human effort and resources. Automated BBO algorithms have been studied for a long time. It includes grid search and random search [ 4 ] . The idea behind the grid search method is to define a k -dimensional grid space of f(p) where each grid dimension corresponds to a parameter p_{i} , and each grid point \{p_{i_{j}}\} corresponds to a parameter combination. We then evaluate the function on \prod_{i=1}^{k}n_{p_{i}} parameter combinations and choose the grid point that returns the best performance. On the other hand, a random search randomly generates parameter combinations in the parameter space and stops depending on some conditions like time-consuming. However, both of these methods are blind, and the number of grid points grows exponentially as the number and value range of the parameters increase. Recently, more advanced automated optimization algorithms have been introduced, including radial basis function [ 5 ] , Bayesian optimization [ 6 , 7 ] , Gaussian process [ 8 ] , and evolutionary optimization [ 9 ] . These algorithms explore the relationship between parameter combinations and the performance of black-box models and give recommendations for the next parameter combination to be evaluated, making those approaches more effective in their search for the global optimal parameter combination. However, the above algorithms have exponential complexity with regard to the size of the problem. In this paper, we focus on the parameter-shift rule (PSR) which has been first introduced in [ 10 ] and extended in [ 11 ] , this method can calculate the gradient of the parameterized quantum circuit (PQC) while treating it as a black-box function and its complexity is only linear with the size of the circuit. So, the main idea is to apply it in some other BBO cases and review its applicability. The rest of the paper includes four sections. The related works part introduces the zeroth-order method and the original PSR. The PRS, when applied in different contexts, is introduced in detail in Section. 3 . We test the proposed method in Section. 4 . Finally, the paper discusses some future steps. 2 Related works 2.1 Numerical differentiation A zeroth-order method approach is to use finite-difference, for example, the central difference method. Consider the differentiable function f with the variable x , f^{{}^{\prime}}(x) denotes the derivative of f(x) . If the Taylor series apply on f(x+\epsilon) and f(x-\epsilon) with \epsilon\in\mathbb{R} , then: \displaystyle f(x+\epsilon)\approx f(x)+f^{{}^{\prime}}(x)\epsilon+... (1) \displaystyle f(x-\epsilon)\approx f(x)-f^{{}^{\prime}}(x)\epsilon+... (2) Take (( 1 ) - ( 2 ))/2: \displaystyle\frac{f(x+\epsilon)-f(x-\epsilon)}{2\epsilon}\approx f^{{}^{\prime}}(x)+\mathcal{O}(\epsilon^{2}) (3) By using ( 3 ), f^{{}^{\prime}}(x) is approximated through two function calls with \mathcal{O}(\epsilon^{2}) error if \epsilon\approx 0 . This method is called the zeroth-order method because it does not need to go through the higher-order derivative. Temporarily ignoring the error, ( 3 ) can be rewritten as: \displaystyle\hat{f}^{\prime}(x)=r[f(x+\epsilon)-f(x-\epsilon)],(r,\epsilon\in\mathbb{R}) (4) In case f is a multivariable function that has M variables, calculating the gradient by ( 4 ) will involve 2M evaluations of the function, each evaluation varies the input by \epsilon in some direction, thereby it gives us an estimate of the gradient of the function with a precision O(\epsilon^{2}) . In general, we can use lower-order methods, which have fewer queries but higher errors, such as forward difference with O(\epsilon) error from M+1 objective queries. Or higher-order methods which have less error but a higher number of queries, such as a five-point stencil method with O(\epsilon^{4}) error from 4M queries. 2.2 Parameter-shift rule The PSR has been applied in quantum machine learning to optimize the parameters on phase gates in the quantum circuit. For the sake of simplicity, assuming a simple circuit consisting of a parameter subset \mu\in\theta and a single gate \mathcal{G} depends on \mu , the partial derivative of \mu is denoted by \partial_{\mu}f(\mu) . Here we use f instead of f(\mu) and \mathcal{G} instead of \mathcal{G}(\mu) because both quantities depend on \mu . Note that in the case of a more complex circuit, we can use the multiplication rule in the derivative to calculate each derivative and then combine them to get the final result. Thus, the entire circuit is U(\theta)=V\mathcal{G}(\mu)W with \mathcal{G}(\mu) as the only parameter gate, and V,W are the remaining non-parametric gate sets. In this context, our objective function is the expectation value of the measurement \hat{B} , which maps the gate parameters to an expectation: \displaystyle f(\mu)= \displaystyle\langle\hat{B}\rangle=\langle 0|U^{\dagger}\hat{B}U|0\rangle (5) \displaystyle= \displaystyle\langle 0|(V\mathcal{G}(\mu)W)^{\dagger}\hat{B}(V\mathcal{G}(\mu)W)|0\rangle (6) \displaystyle= \displaystyle\langle 0|W^{\dagger}\mathcal{G}^{\dagger}(\mu)(V^{\dagger}\hat{B}V)\mathcal{G}(\mu)W|0\rangle (7) Absorb V into the observable \hat{B} and W into the state |0\rangle , we substitute V^{\dagger}\hat{B}V=\hat{Q} , W|0\rangle=|\psi\rangle and \langle 0|W=\langle\psi| into ( 7 ) so f=\langle\psi|\mathcal{G}^{\dagger}\hat{Q}\mathcal{G}|\psi\rangle . When taking the partial derivative of f with respect to \mu : \displaystyle\partial_{\mu}f= \displaystyle\partial_{\mu}\langle\psi|\mathcal{G}^{\dagger}\hat{Q}\mathcal{G}|\psi\rangle (8) \displaystyle= \displaystyle\langle\psi|\mathcal{G}^{\dagger}\hat{Q}(\partial_{\mu}\mathcal{G})|\psi\rangle+\langle\psi|(\partial_{\mu}\mathcal{G})^{\dagger}\hat{Q}\mathcal{G}|\psi\rangle (9) If G is a Hermitian operator with two unique eigenvalues \pm r , then \mathcal{G}(\mu)=e^{-i\mu G} . From the results of [ 11 ] : \displaystyle\partial_{\mu}f=\frac{\Omega}{2\sin(\Omega\epsilon)}\Big[f(\mu+\epsilon)-f(\mu-\epsilon)\Big] (10) where \Omega is associated with the eigenvalues of G and \epsilon\in[0,2\pi] is a free shift value. In case G is in \frac{1}{2}\sigma with \sigma=\{\sigma_{X},\sigma_{Y},\sigma_{Z}\} are the Pauli matrices, r=\frac{1}{2} and \epsilon=\frac{\pi}{4r}=\frac{\pi}{2} . In the other hand, if G=r\vec{n}\sigma is the linear combination of Pauli matrices with n=[n_{X}\;n_{Y}\;n_{Z}]^{\intercal} is a three-dimensional vector, r=\sqrt{n_{X}^{2}+n_{Y}^{2}+n_{Z}^{2}} . Some special gates like ExpW(\mu,\delta)=e^{-i\mu(\sigma_{X}\cos{\delta}+\sigma_{Y}\sin{\delta})} , ExpZ(\mu)=e^{-i\mu\sigma_{Z}} which all have generator G with eigenvalues \pm 1 [ 12 ] . In case G has more than two distinct eigenvalues, such as control rotation gates CR_{i} where i=\{X,Y,Z\} has three eigenvalues include: \{-1,0,1\} . The original PSR is developed to four-term PSR: \displaystyle\begin{aligned} \partial_{\mu}f=\;&d_{1}\left[f\left(\mu+\epsilon_{1}\right)-f\left(\mu-\epsilon_{1}\right)\right]\\ +&d_{2}\left[f\left(\mu+\epsilon_{2}\right)-f\left(\mu-\epsilon_{2}\right)\right]\end{aligned} (11) 3 Methodology Having inspiration from the PSR in quantum machine learning, we realized that this method can apply in a universal context, linear and non-linear functions. Any without some special conditions about the eigenvalues. Below is the analysis of the perceptron [ 13 ] . 3.1 The perceptron We consider applying PSR on the simplest perceptron without an activation function, it only has an input layer with n nodes and an output layer with one node.

Read the complete text