I am conducting research in continuous-variable (CV) quantum machine learning (ML) and have identified some strong limitations in PennyLane’s Gaussian backend that hinder its use in this area of research. I would like to discuss contributing to PennyLane with my solution!
Currently the default.gaussian backend has the following limitations:
- Redundant circuit evaluation: Implementing a heterodyne measurement requires building the same circuit 5 times (for means (x,p), variances (x,p), and an angled quadrature for covariance). Part of this issue is that PennyLane doesn’t allow expval() and var() of the same operator in a single circuit, despite the fact that there is no fundamental limitation for this.
- Non-differentiable statevector: The full Gaussian statevector (mu, cov) cannot be returned differentiably; only specific measurement results can be extracted. This prevents us from accessing the full information carried by the statevector, which is used in internal calculations!
- No backpropagation support: Unlike default.qubit, the Gaussian backend is limited to parameter-shift differentiation (O~2N), which becomes prohibitively slow for large circuits. This is due to how default.gaussian still relies on NumPy/SciPy operations, which cannot be automatically differentiated, as opposed to qml.math, or in my example, PyTorch tensor operations.
To combat these, I have rewritten the PennyLane Gaussian operations in PyTorch, making them fully differentiable under Autograd. This enables:
- Backpropagation (O~1) instead of parameter-shift (O~2N)
- Differentiable statevector return: A single circuit pass can return the full statevector (mu, cov), from which all measurement results can be derived analytically.
The speedup is substantial and makes the Gaussian backend far more suitable for ML research. The PyTorch operations could also straightforwardly be extended to qml.math, for framework-agnostic support, such as with default.qubit.
How can I best contribute this work to help improve PennyLane?
Many thanks! ![]()