Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

PennyLane: Automatic differentiation of hybrid quantum-classical computations

PennyLane lets gradients flow through hybrid quantum-classical computations

  • Problem Before PennyLane, no single tool optimized hybrid quantum-classical models across quantum devices and machine learning libraries. Most tools were built for one side or the other.
  • Method PennyLane makes quantum nodes differentiable, so gradients flow through whole hybrid computations. It picks the gradient method the device supports, such as backpropagation or parameter-shift rules.
  • Results The authors report that adjoint differentiation on lightning.qubit cuts time-to-solution compared to other simulators and gradient methods.

Why variational circuits sit outside classical training

Variational circuits are parameter-dependent quantum circuits that a classical computer tunes to optimize an objective. Much of this work is numerical, since the heuristic algorithms are rarely analysed rigorously. Some frameworks were built with variational circuits in mind, but that was not the norm when PennyLane launched in 2018. No tool treated all quantum devices on the same footing while also plugging into machine learning tooling.

So the authors set out to extend libraries such as Autograd, TensorFlow, PyTorch and JAX to handle quantum modules.

Quantum nodes inside a differentiable graph

The core idea is to treat each quantum circuit as a node in a directed acyclic graph, alongside classical numerical nodes. A cost is computed by passing values along this graph, and gradients are accumulated by traversing it with automatic differentiation rules. This means a gradient can reach a variable that sits inside a quantum circuit, which is what gradient descent needs.

Classical nodes can run any numerical computation, as long as it is built from differentiable functions. A quantum node, by contrast, is a function that runs on a device and returns expectation values. That device can be real quantum hardware or a classical simulator.

The circuit inside each quantum node has three stages. It starts from the zero state, applies gates whose parameters come from inputs or trainable variables, and then measures observables. Inputs are encoded as gate parameters that are not trained, while variables are the parameters the optimizer adjusts. Each output is \( f_i(x;\theta)=\langle \hat B_i\rangle=\langle 0|U(x;\theta)^\dagger \hat B_i U(x;\theta)|0\rangle \), the expectation of an observable in the final state.

On hardware, these expectation values are estimated by averaging measurements over R runs of the circuit. Simulators can instead compute the exact value, and this is the default when shots=None. The estimate is unbiased, and its spread depends on the variance of the observable and on the number of shots R.

Picking a gradient method per quantum node

A quantum node's derivative can come from several sources, and PennyLane chooses among them with heuristics. The aim is the most accurate and efficient method that both the circuit and the device support. The first choice is whatever gradient method the device itself provides. If the device computes exact expectations and supports backpropagation, backpropagation comes next.

On hardware, or when shots are used, parameter-shift rules are the next best choice.

Finite differences are the last resort, used when the circuit doesn't allow analytic hardware gradients. The order keeps exact or device-supplied derivatives ahead of approximations. For example, a simulator that supports the adjoint method gets that method first, since device-provided methods come first.

Parameter-shift rules give exact derivatives

For analytic derivatives, PennyLane runs the circuit several times at shifted parameter values and forms a linear combination of the results. This works for single-parameter qubit gates whose Hermitian generator has an equidistant frequency spectrum, which covers the common qubit rotation gates. It also covers continuous-variable circuits built from Gaussian operations.

The rule reads \( \partial_\mu f(\mu)=\sum_{i=1}^{r} c_i\, f(\mu+s_i) \). Here r counts the unique differences in the eigenvalue spectrum of the gate, s_i are the shift values, and c_i are the coefficients. Unlike finite-difference formulas, the shifts are finite, so the result is exact rather than an approximation.

The shifts and coefficients are not fixed, so they can be chosen and then computed as needed. PennyLane picks shifts that are equidistant with respect to the gate's period, which the authors say minimizes variance. The result is still built from measured expectation values, so device noise and statistical error carry through.

Finite differences as the fallback

Numerical methods need only black-box evaluations of the node's output near the current value. The forward method uses \( \partial_\mu f(\mu)\approx \frac{f(\mu+\Delta\mu)-f(\mu)}{\Delta\mu} \). The choice of \( \Delta\mu \) is a trade-off, and it matters more on noisy hardware.

Numerical derivatives approximate the true derivative even when the node returns exact expectations. They are used only when the circuit doesn't permit analytic hardware gradients.

Backpropagation and device-provided derivatives

A simulator written with TensorFlow, PyTorch or JAX can use their backpropagation to compute derivatives. The intermediate values needed for the derivative are stored during the forward circuit evaluation and then reused. This may save time compared with the analytic method on simulators, since it adds only constant overhead.

A device with its own custom gradient formula can expose that formula directly, and PennyLane can use it. Higher-order derivatives come from applying the chain and product rules repeatedly to the gradient transforms. Repeated terms are merged using the gate periods, which avoids redundant device evaluations.

Optimizing a single qubit rotation

The task rotates one qubit with RX and then RY so that it moves from |0> toward |1>. After the rotations the state is \( |\psi\rangle = R_y(\varphi_2)R_x(\varphi_1)|0\rangle \), and the measured output is \( f(\varphi_1,\varphi_2)=\cos(\varphi_1)\cos(\varphi_2) \).

The code declares a one-wire default.qubit device and a quantum node that applies RX and RY to that wire. The node returns the expectation value of PauliZ on that wire, and the optimizer uses a step size of 0.25. A loop calls step_and_cost for 30 iterations and prints the cost at each step. The excerpt does not report the values that this loop prints.

A quantum function must apply operations and return measurement statistics, and several observables are returned together as a tuple. The decorator can take an interface keyword, so the QNode can accept, for example, Torch or TensorFlow tensors. Creating the QNode by calling qml.QNode directly, without the decorator, is an alternative.

Built-in simulators and when adjoint differentiation helps

PennyLane ships five simulator devices, which differ mainly in backend and in the circuit size they suit. default.qubit is a statevector simulator with NumPy, TensorFlow, PyTorch and JAX backends that supports end-to-end backpropagation. Because backpropagation carries memory overhead, default.qubit works best for 0-20 qubits.

lightning.qubit is a C++ statevector simulator that supports adjoint differentiation. It is aimed at quantum nodes with 20 or more qubits. Its adjoint implementation runs in parallel over the requested observables, which matters when a workload evaluates many observables.

lightning.gpu offloads gate calls to NVIDIA's cuQuantum SDK and is presented as an extension of lightning.qubit. The authors report that adjoint differentiation on lightning.qubit cuts time-to-solution compared to other simulators and gradient methods. The excerpt gives no timing numbers or benchmark circuits for this comparison.

A device integration test checks that a device applies and measures operations correctly. Gradient formulas don't need separate device testing, because PennyLane defines and tests them. The example run is pl-device-test against default.qubit with 10000 shots, skipping unsupported operations.

Limitations

Analytic derivatives are limited by device noise and by the statistical imprecision of averaging measurements. This limits accuracy only, since analytic derivatives avoid numerical issues. Finite differences differ here, because they approximate the derivative even when expectations are exact.

Further derivative extensions, such as stochastic parameter-shift rules and a Hadamard test-based approach, are described. They are not currently implemented in PennyLane. The speed claim for lightning.qubit has no timing numbers in the excerpt.

Paper info

Authors
Bergholm, Ville, Izaac, Josh, Schuld, Maria, Gogolin, Christian, Ahmed, Shahnawaz, Ajith, Vishnu, Alam, M. Sohaib, Alonso-Linaje, Guillermo, AkashNarayanan, B., Asadi, Ali, Arrazola, Juan Miguel, Azad, Utkarsh, Banning, Sam, Blank, Carsten, Bromley, Thomas R, Cordier, Benjamin A., Ceroni, Jack, Delgado, Alain, Di Matteo, Olivia, Dusko, Amintor, Garg, Tanya, Guala, Diego, Hayes, Anthony, Hill, Ryan, Ijaz, Aroosa, Isacsson, Theodor, Ittah, David, Jahangiri, Soran, Jain, Prateek, Jiang, Edward, Khandelwal, Ankit, Kottmann, Korbinian, Lang, Robert A., Lee, Christina, Loke, Thomas, Lowe, Angus, McKiernan, Keri, Meyer, Johannes Jakob, Montañez-Barrera, J. A., Moyard, Romain, Niu, Zeyue, O'Riordan, Lee James, Oud, Steven, Panigrahi, Ashish, Park, Chae-Yeun, Polatajko, Daniel, Quesada, Nicolás, Roberts, Chase, Sá, Nahum, Schoch, Isidor, Shi, Borun, Shu, Shuli, Sim, Sukin, Singh, Arshpreet, Strandberg, Ingrid, Soni, Jay, Száva, Antal, Thabet, Slimane, Vargas-Hernández, Rodrigo A., Vincent, Trevor, Vitucci, Nicola, Weber, Maurice, Wierichs, David, Wiersema, Roeland, Willmann, Moritz, Wong, Vincent, Zhang, Shaoming, Killoran, Nathan
Venue
arXiv · Preprint
First published
2018-11-12
Added
2026-11-12
Updated
2022-7-29
Version
v4
arXiv
1811.04968
Category
quant-ph · cs.ET · cs.LG · physics.comp-ph
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Bergholm, Ville, Izaac, Josh, Schuld, Maria, Gogolin, Christian, Ahmed, Shahnawaz, Ajith, Vishnu, Alam, M. Sohaib, Alonso-Linaje, Guillermo, AkashNarayanan, B., Asadi, Ali, Arrazola, Juan Miguel, Azad, Utkarsh, Banning, Sam, Blank, Carsten, Bromley, Thomas R, Cordier, Benjamin A., Ceroni, Jack, Delgado, Alain, Di Matteo, Olivia, Dusko, Amintor et al. (2018). PennyLane: Automatic differentiation of hybrid quantum-classical computations. arXiv:1811.04968v4. https://arxiv.org/abs/1811.04968v4

BibTeX
@misc{ville2018pennylane,
  title = {{PennyLane: Automatic differentiation of hybrid quantum-classical computations}},
  author = {Bergholm, Ville and Izaac, Josh and Schuld, Maria and Gogolin, Christian and Ahmed, Shahnawaz and Ajith, Vishnu and Alam, M. Sohaib and Alonso-Linaje, Guillermo and AkashNarayanan, B. and Asadi, Ali and Arrazola, Juan Miguel and Azad, Utkarsh and Banning, Sam and Blank, Carsten and Bromley, Thomas R and Cordier, Benjamin A. and Ceroni, Jack and Delgado, Alain and Di Matteo, Olivia and Dusko, Amintor and Garg, Tanya and Guala, Diego and Hayes, Anthony and Hill, Ryan and Ijaz, Aroosa and Isacsson, Theodor and Ittah, David and Jahangiri, Soran and Jain, Prateek and Jiang, Edward and Khandelwal, Ankit and Kottmann, Korbinian and Lang, Robert A. and Lee, Christina and Loke, Thomas and Lowe, Angus and McKiernan, Keri and Meyer, Johannes Jakob and Montañez-Barrera, J. A. and Moyard, Romain and Niu, Zeyue and O'Riordan, Lee James and Oud, Steven and Panigrahi, Ashish and Park, Chae-Yeun and Polatajko, Daniel and Quesada, Nicolás and Roberts, Chase and Sá, Nahum and Schoch, Isidor and Shi, Borun and Shu, Shuli and Sim, Sukin and Singh, Arshpreet and Strandberg, Ingrid and Soni, Jay and Száva, Antal and Thabet, Slimane and Vargas-Hernández, Rodrigo A. and Vincent, Trevor and Vitucci, Nicola and Weber, Maurice and Wierichs, David and Wiersema, Roeland and Willmann, Moritz and Wong, Vincent and Zhang, Shaoming and Killoran, Nathan},
  year = {2018},
  eprint = {1811.04968},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1811.04968v4}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up