QUICK-PDE by ColibriTD
See the API reference
IBM Quantum® Functions are a beta feature available only to IBM Quantum Premium Plan, Flex Plan, and On-Prem (through the IBM Quantum Platform API) Plan users. Beta features are subject to change.
Overview
The Partial Differential Equation (PDE) solver presented here is part of our Quantum Innovative Computing Kit (QUICK) platform (QUICK-PDE), and is packaged as a quantum function. With the QUICK-PDE function, you can solve domain-specific partial differential equations on IBM Quantum QPUs. This function is based on the algorithm described in ColibriTD's H-DES description paper. This algorithm can solve complex multi-physics problems, starting with Computational Fluid Dynamics (CFD) and Materials Deformation (MD), and now including quantitative finance with the Black-Scholes equation for options on one to three assets. Other use cases are coming soon.
To tackle the differential equations, the trial solutions are encoded as linear combinations of orthogonal functions (typically Chebyshev polynomials, and more specifically up to of them where is the number of qubits encoding your function), parametrized by the angles of a Variable Quantum Circuit (VQC). The ansatz generates a state encoding the function, which is evaluated by observables whose combinations allow for evaluating the function at all points. You can then evaluate the loss function in which the differential equations are encoded, and fine-tune the angles in a hybrid loop, as shown in the following. The trial solutions get gradually closer to the actual solutions until you reach a satisfactory result.
In addition to this hybrid loop, you can also chain together different optimizers. This is useful when you want a global optimizer to find a good set of angles, and then a more fine-tuned optimizer to follow a gradient to the best set of neighboring angles. In the case of computational fluid dynamics (CFD), the default optimization sequence produces the best results - but in the case of material deformation (MD), while the default provides good results, you can configure it further for problem-specific benefits.
Note that for each variable of the function, you specify the number of qubits (which you can experiment with). By stacking 10 identical circuits and evaluating the 10 identical observables on different qubits throughout one big circuit, you can noise-mitigate within the CMA optimization process or parallelize the PSR computations, relying on the noise learner method, and significantly reducing the number of shots needed.
Computational fluid dynamics
The inviscid Burgers' equation models flowing non-viscous fluids as follows:
,
represents the fluid speed field. This use-case has a temporal boundary condition: you can select the initial condition and then allow the system to relax. Currently, the only accepted initial conditions are linear functions: . The analytical solution is:
.
The pressureless Euler equations model compressible inviscid fluid flow with damping as follows:
,
,
represents the density field, the velocity field and a damping coefficient. In our formulation, we pose , so it will not be used as a parameter in the following. This use-case has temporal boundary conditions: and . The analytical solution is:
,
.
The arguments for CFD's differential equations are on a fixed grid, as follows:
- is between 0 and 0.95 with 41 sample points. is between 0 and 0.95 with 41 sample points.
Material deformation
This use case focuses on hypoelastic deformation with the one-dimensional tensile test, in which a bar fixed in space is pulled at its other extremity. We describe the problem as follows:
,
,
represents the bulk modulus of the material being stretched, the exponent of a power law, the force per unit mass, the proportional stress limit, the proportional strain limit, the stress function, and the strain function. The analytical solution is:
,
,
where is the boundary condition on the strain at .
The considered bar is of unitary length. This use-case has a boundary condition for surface stress , or the amount of work needed to stretch the bar.
The arguments for MD's differential equations are on a fixed grid, as follows:
- is between 0 and 1 with 30 sample points.
Quantitative finance
The Black-Scholes equation gives the price of a European call option as a function of the time and of the price of the underlying asset or assets. We pose a zero interest rate, no dividends and a maturity . This use case is available for one, two and three assets.
For a single asset, the equation reads:
,
where is the volatility of the asset and its price. The boundary conditions are given by the analytical solution. It fixes the price at the final time (a residual maturity of 0.1) and at the edges and of the price domain, and the solver recovers the price at the earlier times. The analytical solution is:
,
where is the strike of the option and is the cumulative distribution function of the standard normal distribution.
For baskets of two and three assets, the option is written on the geometric average of the asset prices, where the weights are strictly positive and sum to 1:
,
where is the volatility of asset and the correlation between assets and . The boundary conditions are given by the analytical solution on the final time and on the edges of the price domain. With , the analytical solution is:
,
,
and the one-asset solution is recovered for and .
The physical parameters of the use case are the following:
Parameter | Description | Range | Business range |
|---|---|---|---|
sigma, sigma1, sigma2, sigma3 | Volatility of each asset | 0.05 to 1 | 0.10 to 0.40 |
K | Strike of the option | 1 to 2 | 1.2 to 1.8 (80% to 120% of a spot price at the center of the domain, ) |
w1 (basket of 2 assets) | Weight of the first asset. The weight of the second asset is deduced: | Each weight is strictly positive (so ) | Each weight from 0.2 to 0.8 |
w1, w2 (basket of 3 assets) | Weights of the first and of the second asset. The weight of the third asset is deduced: | Each weight is strictly positive (so ) | Each of the three weights from 0.2 to 0.8 |
rho, rho12, rho13, rho23 | Correlation between two assets | 0 to 1 (the correlation matrix must be positive semi-definite) | 0.1 to 0.8 |
The range column gives the values accepted by the use case. The business range gives the values commonly met in practice: volatilities of equity indices, large capitalizations and currencies, strikes close to the spot price, moderate to high correlations between assets, and a residual maturity between 0.3 and 1 year.
The arguments for the Black-Scholes differential equations are on a fixed domain, as follows:
- is between 0 and 0.9. The variable of each asset is between 0 and 1, and the price of the asset is , so between 1 and 2.
Ansatz
The variable quantum circuit that encodes each function is selected with the ansatz argument:
HEAis a hardware-efficient ansatz measured with a global observable. It is the most general choice.BPM-LE(Barren Plateau Mitigation, Low Expressivity) is an ansatz designed to avoid barren plateaus, measured with local observables. It has few parameters and shallow circuits, which keeps the cost of the optimization low, including the cost of parameter-shift gradients.BPM-HE(Barren Plateau Mitigation, High Expressivity) follows the same construction with more parameters per circuit, for functions that the low-expressivity version cannot represent accurately enough.
The number of qubits per variable and the depth of the circuit remain controlled by the nb_qubits and depth arguments.
Optimizer chain and error metric
The optimizers are chained as a list of stages with the optimizers argument. Each stage defines its own method, its maximum number of iterations and its own number of shots, so that cheap and noisy evaluations explore the landscape first, and the number of shots increases as the optimization converges. A typical chain is made of the following pieces:
- One or more
CMAESstages (global and gradient-free), which identify the right region of the space of solutions. Each stage has its ownshots,sigma0, andpopsize(population size, that is the number of candidates evaluated at each generation). Thesigma0argument is the initial standard deviation of the search distribution of CMA-ES, that is, its initial step size: a large value widely explores the space of the circuit parameters, while a small value searches locally around the best candidate found so far. Decreasingsigma0from one stage to the next therefore moves from exploration to refinement. - A
LS-TRFstage (Least Squares - Trust Region Reflective), which explores this region to refine the final angles. Withoutpsr,LS-TRFestimates the Jacobian of the cost function with finite differences. Withpsr=True, the Jacobian is computed on the QPU exactly, with the parameter-shift rule (PSR). The PSR increases the computation time since it requires additional circuits, but it allows a better precision than the finite differences.
The error metric used on this page is the Root Mean Square Error (RMSE) between the solution and the reference solution, over the sampled points. The function also reports the mean squared error (MSE) and the maximum absolute deviation, which are the d2 and d1 metrics of Section 2.6 of the H-DES paper.
Benchmarks
The following tables present statistics on various runs of the function. The first table gives the results of the current version of the function. The second table, at the end of this section, only keeps the results of the previous version for reference.
Current version
Example | Total number of qubits | Ansatz | RMSE | Classical compute time (min) | QPU time (min) |
|---|---|---|---|---|---|
| Inviscid Burgers' equation | 4 | BPM-LE | 0.0147 | ~1 | 11 |
| Pressureless Euler's equations | 8 | HEA | 0.0193 | ~1.5 | 10 |
| Hypoelastic 1D tensile test | 6 | HEA | 0.0296 | ~1 | 10 |
| Black-Scholes equation, 1 asset | 6 | BPM-LE | 0.0084 | ~0.3 | 5.0 |
| Black-Scholes equation, basket of 2 assets | 7 | BPM-HE | 0.0085 | ~4 | 12.0 |
| Black-Scholes equation, basket of 3 assets | 9 | BPM-HE | 0.0104 | ~67 | 20.7 |
The RMSE is the Root Mean Square Error between the solution and the reference solution (aggregated over the two functions for the Euler, and tensile test cases). For the Burgers, Euler, and tensile test cases, it is measured on the QPU over the sampled points. For the Black-Scholes cases, it is computed inside the domain, excluding the final time and the edges where the solution is imposed, on a fine grid (600 points per axis for 1 asset, 80 for 2 assets, 16 for 3 assets), by noiseless simulation at the parameters retained on the QPU. The classical compute time is the time spent by the optimizers on the classical side of the hybrid loop. It is mostly due to the evaluation of the points on the grid, which is easily parallelizable. The QPU time is the quantum processing time billed for the optimization jobs.
The number of qubits is lower than in the previous version. The circuit binding feature reduces the QPU time of the runs, not the number of qubits. It remains possible to increase the number of qubits by executing several circuits in parallel, which reduces the QPU time needed even further, and the new version of the function leaves room to scale to larger numbers of qubits and larger problems.
The optimization steps of these runs are described as follows:
- The
popsizeargument is the number of candidates evaluated at each generation ofCMAES. - The
CMAESstages can stop early when the cost stagnates. - A cost evaluation is the computation of the cost function for one set of circuit parameters, measured on the QPU with the number of shots of the stage.
- A
CMAESgeneration is made ofpopsizeevaluations, so the iterations ofCMAESare counted in generations. - An
LS-TRFiteration computes the Jacobian of the cost function at the current point, with the parameter-shift rule (PSR) here, and evaluates the cost function at one or several trial points. - The Jacobian requires its own circuits (the parameter-shifted circuits), which are not counted as evaluations. The number of Jacobians is therefore the number of
LS-TRFiterations, and the number of evaluations is higher than the number of iterations because some trial points are rejected.
Example | Stage | Method | Shots | sigma0 | popsize | Iterations |
|---|---|---|---|---|---|---|
| Inviscid Burgers' equation | 1 | CMAES | 3,000 | 0.4 | 12 | 40 generations |
| 2 | CMAES | 15,000 | 0.1 | 12 | 15 generations | |
| 3 | CMAES | 50,000 | 0.04 | 12 | 6 generations | |
| Pressureless Euler's equations | 1 | CMAES | 2,500 | 0.5 | 12 | 12 generations |
| 2 | CMAES | 4,000 | 0.15 | 12 | 18 generations | |
| 3 | LS-TRF with psr=True | 10,000 | n/a | n/a | 30 evaluations, 7 iterations (7 Jacobians) | |
| Hypoelastic 1D tensile test | 1 | CMAES | 2,500 | 0.5 | 12 | 12 generations |
| 2 | CMAES | 4,000 | 0.15 | 12 | 18 generations | |
| 3 | CMAES | 6,000 | 0.07 | 12 | 12 generations | |
| 4 | LS-TRF with psr=True | 10,000 | n/a | n/a | 31 evaluations, 3 iterations (3 Jacobians) |
Previous version
The values in the following table were obtained with the previous version of the function and its previous parameters. They are kept for reference only and are not the current results.
Example (previous version) | Total number of qubits | Error (RMSE, order of magnitude) | Classical time (min) | QPU time (min) |
|---|---|---|---|---|
| Inviscid Burgers' equation (previous version) | 50 | ~41 | ~25 | |
| Pressureless Euler's equations (previous version) | 70 | ~14 | ~34 | |
| Hypoelastic 1D tensile test (previous version) | 18 | ~23 | ~100 |
The classical time is the part of the duration of the runs that is not spent on the QPU, which includes the calls to the API. The QPU time is the quantum processing time billed for the optimization jobs.
Get support
For support, contact qiskit-function-support@colibritd.com.
Next steps
- Fill out the form to request access to the QUICK-PDE function.
- Run your first workload with the get started guide.
- Review the functions overview, includes available functions and cost per execution.
- Understand resource units (RUs).
- Review the IBM Quantum Platform plans.
© IBM Corp., 2017-2026