Also known as automatic differentiation · autodiff · JAX · differentiable programming · backpropagation
Automatic differentiation (AD) computes exact derivatives of a program by applying the chain rule to every
elementary operation it performs. In quantum control, this means the gradient of any figure of merit — a
fidelity plus leakage penalties, a robustness average, a measure of entanglement — can be obtained without deriving
it by hand. Since the late 2010s, AD frameworks built for machine learning (TensorFlow, PyTorch, JAX, Julia’s
Zygote and Enzyme) have become a standard tool for pulse optimization, often on GPUs [1].
The idea
A simulation of controlled dynamics is a long chain of differentiable operations: build the Hamiltonian from the
control parameters, propagate, evaluate the cost. AD differentiates such chains in one of two modes:
Forward mode carries derivatives along with the values. Its cost grows with the number of inputs, so it
suits a few control parameters (GOAT is forward-mode differentiation of the Schrödinger equation).
Reverse mode (back-propagation) records the computation and then sweeps backwards. It gives the gradient of
one scalar output with respect to all inputs at a cost of a small multiple of one evaluation, independent of the
number of parameters.
GRAPE’s backward propagation is exactly reverse-mode differentiation, derived by hand for one specific
cost function. AD generalizes it: change the cost, add constraints or penalties, make the Hamiltonian depend
non-linearly on the controls — and the gradient follows automatically.
What it enabled
Composite cost functions. Fidelity, leakage to non-computational levels, pulse smoothness, power and
occupation of forbidden states can be combined freely and weighted, with GPU acceleration [1].
Open systems at scale. Differentiating through stochastic quantum trajectories instead of the full density
matrix avoids the \(d^2\) growth of Liouville space [2]; see Control of open quantum systems.
Differentiable programming. A neural-network agent that maps the current state to the control can be trained
by differentiating through both the network and the equations of motion. This model-based alternative to
reinforcement learning has been demonstrated for robust state preparation [3]; see
Reinforcement & machine learning for control.
Integrated device workflows. Toolsets combine gradient-based pulse optimization with calibration and model
learning on real hardware [4, 5]; see System identification for control.
Caveats
Memory. Reverse mode stores intermediate results. For long time grids or large systems this can exceed memory;
checkpointing trades extra computation for memory. Semi-automatic differentiation uses the analytic GRAPE-type
gradient for the dynamics and AD only for the final functional. This removes most of the memory and run-time overhead
of full AD while still allowing practically any functional, including non-analytic ones such as the gate concurrence
[6].
Matrix functions. Gradients through matrix exponentials, eigendecompositions and complex arithmetic must be
supported correctly by the framework. Degenerate eigenvalues are a classic source of numerical trouble; see
Numerical propagation & simulation.
Discretize-then-differentiate. AD returns the exact gradient of the discretized simulation. With adaptive ODE
solvers this can differ from the gradient of the continuous problem, and adjoint-ODE methods offer an alternative.
Optimizers. AD supplies gradients; convergence still depends on the optimizer. Quasi-Newton methods suit
smooth deterministic costs (Quasi-Newton & second-order methods); stochastic optimizers such as Adam suit noisy or sampled
costs.
Key papers
Nelson Leung, Mohamed Abdelhafez, Jens Koch and David SchusterSpeedup for quantum optimal control from automatic differentiation based on graphics processing unitsPhys. Rev. A95, 042318 (2017)doi
Brings automatic differentiation and GPUs to quantum optimal control — arbitrary combinations of cost terms without deriving gradients by hand.
Mohamed Abdelhafez, David I. Schuster and Jens KochGradient-based optimal control of open quantum systems using quantum trajectories and automatic differentiationPhys. Rev. A99, 052327 (2019)doi
Automatic differentiation through quantum trajectories, making gradient-based control of open systems scalable.
Frank Schäfer, Michal Kloc, Christoph Bruder and Niels LörchA differentiable programming method for quantum controlMach. Learn.: Sci. Technol.1, 035009 (2020)doi
Differentiable programming for quantum control — a neural-network agent maps the system state to the control and is trained by differentiating through the equations of motion.
Michael H. Goerz, Sebastián C. Carrasco and Vladimir S. MalinovskyQuantum Optimal Control via Semi-Automatic DifferentiationQuantum6, 871 (2022)doi
Semi-automatic differentiation. Analytic gradients for the dynamics, automatic differentiation only for the functional, avoiding the memory and run-time overhead of full AD.
Software
JAX — automatic differentiation and GPU/TPU compilation for Python
dynamiqs — GPU-accelerated, differentiable simulation of quantum systems (JAX)
qutip-qoc (JOPT) — optimization of JAX-defined controls with automatic differentiation
QuantumControl.jl — Julia framework; supports semi-automatic differentiation of arbitrary functionals
References
Nelson Leung, Mohamed Abdelhafez, Jens Koch and David SchusterSpeedup for quantum optimal control from automatic differentiation based on graphics processing unitsPhys. Rev. A95, 042318 (2017)doi
Mohamed Abdelhafez, David I. Schuster and Jens KochGradient-based optimal control of open quantum systems using quantum trajectories and automatic differentiationPhys. Rev. A99, 052327 (2019)doi
Frank Schäfer, Michal Kloc, Christoph Bruder and Niels LörchA differentiable programming method for quantum controlMach. Learn.: Sci. Technol.1, 035009 (2020)doi
Nicolas Wittler, Federico Roy, Kevin Pack, Max Werninghaus, Anurag Saha Roy, et al.Integrated Tool Set for Control, Calibration, and Characterization of Quantum Devices Applied to Superconducting QubitsPhys. Rev. Applied15, 034080 (2021)doi
Harrison Ball, Michael J Biercuk, Andre R R Carvalho, Jiayin Chen, Michael Hush, et al.Software tools for quantum control: improving quantum computer performance through noise and error suppressionQuantum Sci. Technol.6, 044011 (2021)doi
Michael H. Goerz, Sebastián C. Carrasco and Vladimir S. MalinovskyQuantum Optimal Control via Semi-Automatic DifferentiationQuantum6, 871 (2022)doi
Recent papers
13 tracked papers since 2000 are classified
under this topic. See all ·
Feed
Classical simulation supports the development and validation of quantum algorithms through full-state inspection, controlled noise models and backpropagation, albeit for small quantum systems. Existing frameworks offer gate-level execution, differentiable pulse-level dynamics or optimised hardware execution. Just another quantum simulator (JAQSI) combines gate- and pulse-level simulation in one differentiable circuit model built upon JAX. Circuits are represented as pure functions of numerical inputs which support vectorised batches and JIT compilation. Within a single circuit, matrix-defined operations, gates synthesised from Hamiltonian time evolution and noise channels can be composed freely. For a fast simulation, gate and channel fusion reduces passes over the state, while adjoint differentiation computes expectation-value gradients with a constant number of statevectors. At pulse level, JAQSI reduces evolution under single-term Hamiltonians to a scalar pulse-area integral and reuses cached execution plans and compiled solvers. In a benchmark we compare JAQSI with PennyLane, Qiskit, Qibo, Qulacs, QuTiP and dynamiqs. At gate level, we observe performance either on par or an order of magnitude faster across statevector, density, noise and gradient simulation than the compared simulators up to 12 qubits. Beyond 18 qubits, JAQSI is on par with PennyLane Lightning in both statevector and gradient simulation. In the statevector and noisy density-matrix pulse benchmarks, it is at least 5 times faster than the other simulators, even with its closed-form solve disabled. Disabling the latter increases its runtime by at most a factor of 1.5. We provide JAQSI as open-source software on GitHub and PyPI.
We derive and implement a second-order adjoint method to compute exact gradients and Hessians for a prototypical quantum optimal control problem, that of solving for the minimal energy applied electric field that drives a molecule from a given initial state to a desired target state. For small to moderately sized systems, we demonstrate a vectorized GPU implementation of a second-order adjoint method that computes both Hessians and gradients with wall times only marginally more than those required to compute gradients via commonly used first-order adjoint methods. Pairing our second-order adjoint method with a trust region optimizer (a type of Newton method), we show that it outperforms a first-order method, requiring significantly fewer iterations and wall time to find optimal controls for four molecular systems. Our derivation of the second-order adjoint method allows for arbitrary parameterizations of the controls.
One significant advantage of superconducting processors is their extensive design flexibility, which encompasses various types of qubits and interactions. Given the large number of tunable parameters of a processor, the ability to perform gradient optimization would be highly beneficial. Efficient backpropagation for gradient computation requires a tightly integrated software library, for which no open-source implementation is currently available. In this work, we introduce SuperGrad, a simulator that accelerates the design of superconducting quantum processors by incorporating gradient computation capabilities. SuperGrad offers a user-friendly interface for constructing Hamiltonians and computing both static and dynamic properties of composite systems. This differentiable simulation is valuable for a range of applications, including optimal control, design optimization, and experimental data fitting. In this paper, we demonstrate these applications through examples and code snippets.
We develop general purpose algorithms for computing and utilizing both the Dyson series and Magnus expansion, with the goal of facilitating numerical perturbative studies of quantum dynamics. To enable broad applications to models with multiple parameters, we phrase our algorithms in terms of multivariable sensitivity analysis, for either the solution or the time-averaged generator of the evolution over a fixed time-interval. These tools simultaneously compute a collection of terms up to arbitrary order, and are general in the sense that the model can depend on the parameters in an arbitrary time-dependent way. We implement the algorithms in the open source software package \qiskitdynamics{}, utilizing the JAX array library to enable just-in-time compilation, automatic differentiation, and GPU execution of all computations. Using a model of a single transmon, we demonstrate how to use these tools to approximate fidelity in a region of model parameter space, as well as construct perturbative robust control objectives. We also derive and implement Dyson and Magnus-based variations of the recently introduced Dysolve algorithm [Shillito et al., Physical Review Research, 3(3):033266] for simulating linear matrix differential equations. We show how the pre-computation step can be phrased as a multivariable expansion computation problem with fewer terms than in the original method. When simulating a two-transmon entangling gate on a GPU, we find the Dyson and Magnus-based solvers provide a speedup over traditional ODE solvers, ranging from roughly $2\times$ to $4\times$ for a solution and $10\times$ to $60\times$ for a gradient, depending on solution accuracy.
Quantum optimal control problems are typically solved by gradient-based algorithms such as GRAPE, which suffer from exponential growth in storage with increasing number of qubits and linear growth in memory requirements with increasing number of time steps. Employing QOC for discrete lattices reveals that these memory requirements are a barrier for simulating large models or long time spans. We employ a nonstandard differentiable programming approach that significantly reduces the memory requirements at the cost of a reasonable amount of recomputation. The approach exploits invertibility properties of the unitary matrices to reverse the computation during back-propagation. We utilize QOC software written in the differentiable programming framework JAX that implements this approach, and demonstrate its effectiveness for lattice gauge theory.