Source-linked AI summary

Speedup for quantum optimal control from automatic differentiation based on graphics processing units

Nelson Leung, Mohamed Abdelhafez, Jens Koch, David I. Schuster

arXiv:1612.04929v3quant-phcond-mat.mes-hall

TL;DR

Quantum optimal control must accommodate experimental constraints, but adding them can require substantial gradient-implementation effort. This paper combines automatic differentiation with GPU computation to optimize quantum control, reporting order-of-magnitude runtime speedups that are not unusual on standard desktop PCs.

  • Problem

    Adding experimental constraints to quantum optimal control can require analytical gradient derivations and implementation, impeding rapid development of control strategies.

    Source: §I · p. 1
  • Method

    The authors use reverse-mode automatic differentiation to incorporate varied cost functions and GPUs to accelerate quantum optimal-control calculations.

    Source: §I · p. 1, §VI · pp. 9–10
  • Results

    Runtime speedups of an order of magnitude are not unusual on a standard desktop PC when using GPU-based computations.

    Source: §VI · p. 10
  • Takeaways & Limitations

    The approach supports low-overhead exploration of diverse constraints and system parameters, with examples including optimized gates and state transfer.

    Source: §VI · pp. 9–10

    Runtime speedup depends on factors including system type, Hilbert-space size, and the hardware used.

    Source: §VI · p. 10

Abstract

from arXiv · show

We implement a quantum optimal control algorithm based on automatic differentiation and harness the acceleration afforded by graphics processing units (GPUs). Automatic differentiation allows us to specify advanced optimization criteria and incorporate them in the optimization process with ease. We show that the use of GPUs can speed up calculations by more than an order of magnitude. Our strategy facilitates efficient numerical simulations on affordable desktop computers, and exploration of a host of optimization constraints and system parameters relevant to real-life experiments. We demonstrate optimization of quantum evolution based on fine-grained evaluation of performance at each intermediate time step, thus enabling more intricate control on the evolution path, suppression of departures from the truncated model subspace, as well as minimization of the physical time needed to perform high-fidelity state preparation and unitary gates.

I. INTRODUCTION

Quantum optimal control combines gradient-based linear algebra with experimental constraints, but adding constraints can require substantial gradient-implementation work. The paper uses automatic differentiation and GPUs, and formulates control as optimizing discretized fields against a weighted cost function.

I. INTRODUCTION

  • The paper connects quantum optimal control and deep neural networks through their shared reliance on linear algebra and gradient descent.It presents machine-learning hardware and software as resources that can boost quantum-control techniques.Source: §I · p. 1
  • GPUs accelerate matrix multiplication, a central operation in quantum-system simulation and control, and offer a route to faster optimization.The motivation is especially relevant as experimental quantum-computing systems increase in qubit number.Source: §I · p. 1
  • Adding experimental constraints can require new analytical gradient terms and impede rapid development of control strategies.Examples include pulse-amplitude and power limits, time-resolution limits, and minimizing preparation or gate duration.Source: §I · p. 1
  • Automatic differentiation incorporates constraints without hard-coding additional gradient contributions, while GPUs boost computational efficiency.The paper identifies Hilbert spaces larger than about 100 dimensions as the regime where GPU speedup becomes significant for its applications.Source: §I · p. 1

II. THEORY

  • Quantum evolution is discretized into small time steps, with control fields represented by M × N real parameters.The system Hamiltonian combines an intrinsic term with control fields acting through control operators.Source: §II · p. 2
  • Optimization minimizes a weighted sum of cost contributions, whose weights depend on the problem and experimental realization.The cost function is defined over the discretized control fields.Source: §II · p. 2

A. Important types of cost function contributions

Quantum-control cost functions combine target matching with constraints on signals and evolution. The described contributions address gate or state fidelity, realistic pulse shapes, leakage, and evolution time.

A. Important types of cost function contributions

  • The total cost is a weighted combination of contributions, with weights selected empirically for the specific problem and experimental realization.The table identifies relevant cost-function contributions by the quantity each is intended to minimize.Source: Table I · p. 2
  • C1 penalizes final-time unitary infidelity, while C2 measures final-time state infidelity and can be extended to a selected subspace.For a complete basis, the composite state-transfer cost is equivalent to gate fidelity and can require less memory because it stores the current state rather than the full unitary.Source: A. Important types of cost function… · p. 2
  • C3 penalizes large control amplitudes, while C4 penalizes rapid changes between successive control samples.C3 is a soft amplitude penalty; a trigonometric mapping can instead enforce a fixed maximum, and C4 smooths signals to account for instruments' finite impulse response.Source: A. Important types of cost function… · p. 3
  • C5 penalizes occupation of selected states during evolution, limiting leakage and reducing the risk that Hilbert-space truncation misguides optimization.The strategy is reported to work well for harmonic oscillators or transmon qubits, but may be less effective for fluxonium circuits.Source: A. Important types of cost function… · p. 3
  • C6 and C7 penalize deviations from a target unitary or state at intermediate time steps, guiding evolution toward the target in less time.These contributions are designed to make gate or state-preparation duration part of the optimization rather than requiring repeated runs at different durations.Source: A. Important types of cost function… · pp. 3–4

B. Gradient evaluation

The paper evaluates gradients with reverse-mode automatic differentiation over a computational graph of cost-function operations. This supports gradient-based optimization, including cost terms accumulated throughout the evolution rather than only at the final time.

B. Gradient evaluation

  • The implementation supports both L-BFGS-B second-order methods and ADAM or gradient-descent methods for choosing control updates.The step size affects convergence and may be selected adaptively.Source: B. Gradient evaluation · p. 4
  • The computational graph decomposes the cost into elementary operations with known derivatives, then recursively evaluates partial derivatives from the cost toward the control variables.The implementation expresses cost functions using linear-algebra operations, including matrix summation and multiplication.Source: B. Gradient evaluation · p. 4
  • Reverse-mode automatic differentiation computes the full gradient with one backward sweep after one forward sweep through the computational graph.Each derivative is evaluated once, and the approach is related to the GRAPE algorithm.Source: B. Gradient evaluation · p. 4
  • Intermediate-time costs such as C5 through C7 require summing contributions across the evolution, extending beyond GRAPE's final-time fidelity objective.The paper states that these costs can be included in the general backward-propagation scheme.Source: B. Gradient evaluation · p. 5

III. IMPLEMENTATION

The implementation uses TensorFlow and custom matrix-operation routines to support GPU-based quantum optimal control. Its matrix-exponential strategy uses a global expansion and scaling choice, while complex-valued operators are mapped to real matrices because TensorFlow has limited complex-matrix support.

TensorFlow implementation

  • TensorFlow provides GPU and parallel computation, while custom matrix-exponential and gradient routines support efficient quantum-control operations.The implementation includes an efficient kernel for approximate matrix-exponential and gradient evaluation.Source: §III · p. 5

Matrix exponentiation

  • A global expansion order and scaling level avoid per-time-step spectral-radius estimation, speeding matrix exponentiation for applications with bounded control fields.A few series terms suffice when the spectral radius of Hjδt is below 1; larger eigenvalues call for scaling and squaring.Source: §III · p. 5

Gradient evaluation

  • For small spectral radius, the custom gradient routine reuses the matrix exponential, improving speed and memory performance.The approximation neglects higher-order corrections associated with noncommuting M′(x) and M(x).Source: §III · p. 5

Complex-valued representation

  • TensorFlow’s limited support for complex matrices is addressed by mapping complex operators and states to real-valued representations, doubling Hamiltonian-matrix memory cost.The authors note that improved future complex-number support could remove the need for this mapping.Source: §III · pp. 5–6

IV. PERFORMANCE BENCHMARKING

GPU speedups depend on Hilbert-space size and the operation being optimized: they appear at smaller sizes for unitary gates than for state transfer. The reported large-system benchmarks show substantial gains, with the exact performance dependent on hardware and the dense-matrix setting.

Crossover with system size

  • GPU computation begins to outperform CPU computation at about 100 basis states for unitary-gate optimization and about 300 for state-transfer optimization.The benchmark measures average runtime for a single iteration across spin-chain sizes.Source: §IV · p. 6

Why crossover sizes differ

  • The different crossover sizes reflect the workloads: gate optimization propagates a matrix, whereas state transfer propagates a vector.The former uses matrix-matrix multiplication; the latter uses matrix-vector multiplication.Source: §IV · p. 6

Speedup at larger system sizes

  • 19-fold GPU speedup for a 10-qubit Hadamard transform and 6-fold GPU speedup for an 11-qubit GHZ state preparation.These correspond to Hilbert space dimensions of 1,024 and 2,048, respectively.Source: §IV · p. 6

Benchmark scope

  • The benchmarks use dense matrices, and the reported performance trends may vary with system architecture.The authors note that incorporating sparse matrices could further improve computation speed for both CPU and GPU.Source: §IV · p. 6

V. SHOWCASE APPLICATIONS

The showcase applications cover pulse shaping and suppression of higher-state occupation, reduced-time state transfer, Schrödinger-cat preparation, and GHZ-state and Hadamard-gate optimization. The reported examples achieve a minimum fidelity of 99.9%.

Application overview

  • Across the showcase applications, the authors achieve a minimum fidelity of 99.9%.The examples include realistic pulse shaping and higher-state suppression, reduced-time state transfer, Schrödinger-cat preparation, and GHZ-state and Hadamard-gate optimization.Source: §V · p. 6

A. CNOT gate for two transmon qubits

The CNOT optimization reaches 99.9% fidelity while added costs suppress forbidden-level occupation and smooth control pulses. A time penalty also shortens state-transfer duration, and GPU benchmarking identifies system sizes where GPU execution outperforms CPU execution.

A. CNOT gate for two transmon qubits

  • GPU execution outperforms CPU execution above Hilbert-space dimensions of ~100 for unitary gates and ~300 for state transfer.Runtime per iteration scales linearly with the number of time steps.Source: Figure 3 · p. 7
  • 99.9% CNOT fidelity is retained as added costs reduce maximum forbidden-state occupation from ~20% to ~3% and smooth the control signals.All three illustrated gates use a 10 ns duration; the more constrained cases may require longer gates in practice.Source: Figure 4 · p. 7, A. CNOT gate for two transmon qubits · p. 7
  • C5 suppresses higher-level occupation, while C3 and C4 reduce excess control amplitudes and derivatives without reducing target-gate fidelity.The added terms also lessen high-frequency control noise and help improve convergence.Source: A. CNOT gate for two transmon qubits · p. 7

B. Reducing duration of |0⟩to |1⟩state transfer

C. Generating photonic Schr¨odinger cat states

The paper tests its control algorithm on photonic cat-state preparation and increasing-size spin-chain tasks. The cat state reaches 99.9% fidelity in 40 ns, while 10-qubit Hadamard and 11-qubit GHZ tasks take about a day to reach their 99.9% fidelity thresholds on a modest desktop PC.

C. Generating photonic Schr¨odinger cat states

  • The cat-state transfer uses a 154-dimensional transmon–resonator model and controls the transmon rather than the cavity directly.The simulation omits the rotating-wave approximation.Source: C. Generating photonic Schr¨odinger… · p. 8
  • The photonic cat state reaches 99.9% fidelity after 40 ns, with enlarged-Hilbert-space simulation confirming the same fidelity.The task uses 8,000 time steps and penalizes truncation-level occupation and control variations; maximum truncation-level populations are ~6×10^-6 for the transmon and ~7×10^-10 for the cavity.Source: C. Generating photonic Schr¨odinger… · p. 8, Figure 6 · p. 9

D. Hadamard transform and GHZ state preparation

  • The Hadamard and GHZ tasks use identical allowed durations and time-step counts for a given spin-chain size.The chain has nearest-neighbor coupling, and the gate and state-preparation tasks target 99.9% fidelity.Source: D. Hadamard transform and GHZ state… · p. 9
  • About 1 day is required on a modest desktop PC for a 10-qubit Hadamard gate or 11-qubit GHZ preparation to reach 99.9% fidelity.The authors note that optimizer, hyperparameter, or initial-control choices could significantly reduce wall-clock time.Source: D. Hadamard transform and GHZ state… · p. 9

VI. CONCLUSION

The conclusion presents automatic differentiation and GPU computation as complementary tools for efficient quantum-control optimization. The method simplifies adding experimental cost functions, while GPU runs can provide order-of-magnitude speedups on desktop computers.

VI. CONCLUSION

  • Automatic differentiation removes the need for analytical gradient derivations when adding cost functions, easing the inclusion of diverse optimization constraints.The paper illustrates cost functions relevant to superconducting circuits and circuit QED.Source: §VI · pp. 9–10
  • For Hadamard gates and GHZ state preparation, total time and iteration count grow rapidly as qubit number increases.The caption attributes the challenge to more control parameters and greater target-state complexity in larger systems.Source: Figure 7 · p. 10
  • The approach is illustrated with optimized unitary gates and state transfer, and the authors state that it is not limited to these examples.The conclusion frames these examples as instances within a larger class of quantum systems where optimal control is instrumental.Source: §VI · p. 10
  • Order-of-magnitude runtime speedups are not unusual on a standard desktop PC, though the gain depends on system type, Hilbert-space size, and hardware.The implementation uses TensorFlow and supports high-performance distributed computing for larger optimizations.Source: §VI · p. 10
  • The authors identify sparse-matrix implementations and adaptive-step-size and Runge-Kutta time evolution as future work.Source: §VI · p. 10

Appendix A: Analytical gradients and algorithms

Appendix A presents analytical gradient derivations as illustrations, while the implementation evaluates gradients autonomously with automatic differentiation. Its derivations use matrix calculus and the chain rule to connect real-valued controls to a real cost through a complex matrix.

Appendix A: Analytical gradients and algorithms

  • The analytical derivations are illustrative; automatic differentiation computes the gradients without requiring those derivations or hard-coded gradients.Source: Appendix A · p. 10
  • The appendix uses Einstein summation and the Jacobian, or numerator-layout, convention for matrix derivatives.Source: Appendix A · p. 10
  • The chain rule gives gradients for a real cost c of a complex matrix M that depends on real-valued control parameters u.The control index can encode both the control-field label and discretized-time index.Source: Appendix A · p. 11

1. Gradient for C1: target-gate infidelity

The appendix derives gradients for target-gate and target-state infidelity costs. It also describes memory-saving backward-propagation alternatives that trade additional computation for lower storage requirements.

1. Gradient for C1: target-gate infidelity

  • Automatic reverse-mode differentiation stores the intermediate propagators {Kj} from every time step in memory during forward evolution, yielding memory demand O(ℓ2 × N).A backward-propagation alternative regenerates each short-time propagator locally, uses roughly twice the computation time and O(ℓ2) memory independent of N, and is not implemented in this code.Source: §1 · p. 11

2. Gradient for C2: target-state infidelity

  • For target-state infidelity C2, the method optimizes a few initial states rather than the complete basis when preparing a state or specifying a unitary only in a subspace.Stored intermediate states require O(ℓ × N) memory; backward propagation can reduce this to O(ℓ), independent of the time-step count.Source: §2 · p. 11

3. Gradient for C5: occupation of forbidden state

The C5 cost penalizes occupation of a forbidden state throughout the evolution, so its gradient includes contributions from intermediate time steps. Although its expression appears to involve a double sum, simplification yields linear-time computation.

3. Gradient for C5: occupation of forbidden state

  • C5 penalizes forbidden-state occupation at every intermediate time step, unlike gate and state infidelity costs evaluated only at the final time.Source: §3 · p. 12
  • The C5 gradient can be computed in O(N) time after simplification, despite the double sum initially appearing to require O(N^2).Source: §3 · p. 12
Loading 1612.04929v3…