# feedback-grape: A JAX-based Python Package for GPU-Accelerated GRAPE with Feedback

Quantum.world

> feedback-grape packages GPU-accelerated GRAPE with measurement feedback in JAX and a QuTiP-like interface, giving control engineers a usable open tool for closed-loop pulse design.

**arXiv**: 2611.20222 · Preprint · not peer-reviewed

**Published**: 2026-11-15

**Authors**: Yousef Elbrolosy, Adrian Bories, Florian Marquardt, Pavlo Bilous

## In plain words

Standard GRAPE optimizes control fields by gradient ascent on a fidelity-based quality measure, but it breaks down once a feedback loop is introduced, because measurement outcomes are inherently non-differentiable. Recent work resolved this by parametrizing and optimizing measurements alongside control fields and applying machine-learning techniques to propagate gradients through stochastic measurement records.

## AI summary

## Overview

**Research area:** Quantum control — specifically software infrastructure for gradient-based optimal control of quantum systems with measurement feedback (feedback-GRAPE), built on JAX for GPU acceleration.

**Technical level:** Intermediate. The authors explicitly assume familiarity with general scientific programming in Python using NumPy and explain third-party library functionality as it appears in the examples; the paper is a hands-on tutorial rather than a theoretical treatment.

**Scope (one sentence):** This paper is a tutorial-and-software description of `feedback-grape`, a JAX-based, GPU-accelerated Python package with a QuTiP-inspired interface that implements the feedback-GRAPE algorithm for optimizing control and measurement parameters in quantum feedback loops.

## What This Paper Is About

Standard GRAPE optimizes control fields by gradient ascent on a fidelity-based quality measure, but it breaks down once a feedback loop is introduced, because measurement outcomes are inherently non-differentiable. Recent work resolved this by parametrizing and optimizing measurements alongside control fields and applying machine-learning techniques to propagate gradients through stochastic measurement records.

The goal of this paper is to provide a general, efficient, community-usable implementation of that method, packaged for GPU execution via JAX, with a simple interface for encoding Hamiltonians, dissipation channels, parametrized control and measurement gates, and a reward function.

## Key Contributions

1. **A general-purpose feedback-GRAPE package.** The authors present `feedback-grape`, described as a general implementation applicable to a wide range of feedback-control tasks, in contrast to the two existing online implementations (the code accompanying the original feedback-GRAPE paper and the code used for Gottesman-Kitaev-Preskill (GKP) quantum error correction), which they state were written for the specific problems studied in those works.
2. **GPU acceleration through JAX.** The package uses JAX as its computational backbone, combining physics modeling with machine-learning techniques in vectorized, GPU-accelerated functions; Optax is used for optimization and Flax for defining neural networks, while the Lindblad master equation is solved with the differentiable JAX-based Dynamiqs library.
3. **A QuTiP-inspired user interface with multi-component system support.** The package follows and extends the patterns of the widely used QuTiP library and includes a simplified treatment of multi-component systems, lowering the barrier for users already familiar with QuTiP.
4. **A hands-on tutorial with worked examples.** The article walks through encoding basic quantum-mechanical objects (states, operators) in the `feedback_grape.utils` subpackage, how gate parametrizations become quantum-mechanical operators, and two application examples of feedback GRAPE, alongside a description of further useful package features.

## Main Findings

- **Feedback can be optimized jointly with control:** Measurement gates are parametrized and optimized in feedback GRAPE, serving a two-fold role — as non-unitary elements that remove entropy and purify the state, and as sources of information that condition the parameters of subsequent gates.
- **Binary POVMs are the supported measurement model:** The package as described treats generalized binary measurements with outcomes ±1, represented by operator pairs satisfying the POVM completeness condition, with outcome probabilities and post-measurement states given by the standard generalized-measurement formulas (Eq. 1).
- **Gradients are computed with a two-term estimator:** Training collects statistics over multiple trajectories and evaluates average reward gradients over trainable parameters using an expression (Eq. 2) consisting of the mean direct gradient term plus a term involving the reward weighted by the gradient of the log trajectory probability — the score-function-type term that handles the non-differentiable measurement record.
- **Feedback policies are memory-bearing:** The feedback policy is either a lookup table (LUT) holding optimized parameters directly or a recurrent neural network (RNN); both maintain memory of past measurement outcomes within the current trajectory, making the feedback non-Markovian.
- **Exploration is not a design choice:** The authors note that the approach closely follows reinforcement learning, but that exploration here is forced by the stochasticity of the measurements rather than chosen by the designer.
- **Installation and dependencies are specified:** Minimum versions listed are Python ≥3.11, NumPy ≥2.2.4, SciPy ≥1.15.2, JAX ≥0.5.2, Optax ≥0.2.4, FLAX ≥0.10.6, and Dynamiqs ≥0.3.2, with `orbax-checkpoint<=0.11.32` and `chex>=0.1.89` pinned in `requirements.txt` for compatibility. GPU installation via `pip install feedback-grape[cuda12]` assumes compatibility with CUDA 12.
- **Benchmark numbers are not reported:** The provided content does not report quantitative performance results, speed-up factors, fidelities, or comparisons against other implementations.

## Methodology in Plain English

The authors take a method previously published in the literature and turn it into reusable software. The user describes the physical problem in code: the system's Hamiltonian, any dissipation channels, a repeating sequence of "timesteps" each containing a unitary control gate and a measurement gate, and a reward that scores how well a task went.

Because measurement outcomes are random and cannot be differentiated in the usual way, the package simulates many trajectories in parallel — each trajectory is one particular random sequence of measurement outcomes. For every trajectory it computes the reward and, crucially, the probability of that outcome sequence. The gradient of the average reward is then split into two parts: one part that differentiates the physics directly, and a second part that uses the reward weighted by how sensitive the log-probability of the outcome sequence is to the parameters. This second term is what lets the optimizer improve the measurement settings and the feedback policy despite the randomness.

The feedback decision — which parameters to use at the next timestep based on the outcomes seen so far — comes either from a lookup table of optimized numbers or from a small recurrent neural network. Training means repeatedly simulating batches of trajectories and taking gradient-ascent steps on all trainable parameters.

## Why This Matters

**Impact on research:** The package turns a research method into general infrastructure. Because it is built on JAX, it inherits automatic differentiation, vectorization, and GPU execution, which matter when the cost is dominated by averaging over many stochastic trajectories. Because the interface follows QuTiP conventions, existing QuTiP users can adopt it without learning a new modeling idiom. The paper places strong emphasis on generality: prior implementations were tied to the specific problems of their papers, whereas this one is intended for a wide range of feedback-control tasks. The source is openly available on GitHub under the MIT license and contributions are invited.

**Real-world applications (as discussed or implied in the paper):**

- State preparation with feedback, as demonstrated in prior feedback-GRAPE work.
- State purification and state stabilization, with extension to quantum error correction.
- Gottesman-Kitaev-Preskill (GKP) quantum error correction, the setting of one of the two prior implementations.
- NMR spectroscopy and related settings, the original application context of GRAPE.

**Industry relevance:** Quantum computing and quantum error correction, quantum sensing and metrology, and any hardware platform where measurement-based feedback is part of the control stack. GPU acceleration and a user-friendly interface matter for groups that want to run feedback-optimization studies without reimplementing the algorithm.

## Future Directions

- **Extending beyond binary measurements:** The content states that the present incarnation of the package considers generalized binary measurements with outcomes ±1, leaving non-binary or more general POVMs as an open extension.
- **Benchmarking against the prior implementations:** Comparing the general package with the two existing problem-specific implementations would clarify where the general design gains or costs performance; such comparisons are not reported in the provided content.
- **Broader task coverage via the reward interface:** Since the reward defines the task, applying the package to further control scenarios beyond the two worked examples is a natural next step; the additional scenarios are not detailed in the truncated content.
- **Community-driven development:** The authors invite contributions on the public repository, and the paper was submitted to SciPost Physics Codebases, which suggests a continuing software-maintenance trajectory rather than a fixed release endpoint.

## Target Audience

Quantum-control researchers and graduate students who already know some quantum mechanics and Python/NumPy and want to add measurement feedback to their optimal-control workflows; groups working on quantum error correction, state preparation, and stabilization who need a differentiable, GPU-accelerated simulator-plus-optimizer; and QuTiP users looking for a familiar interface to gradient-based feedback optimization. Readers seeking detailed derivations of the underlying algorithm should consult the cited original feedback-GRAPE paper, since this article is positioned as a tutorial on the package rather than a theoretical treatment.

## Authors’ abstract

Modern quantum technology applications require accurate control of quantum systems, including a feedback loop in the control process. While open-loop control can be performed using well established gradient methods like GRadient Ascent Pulse Engineering (GRAPE), it was until recently unclear how to combine these with feedback from measurements, which are inherently non-differentiable. Recent work has successfully demonstrated how feedback can be incorporated into GRAPE using…

[The full abstract on arXiv](https://arxiv.org/abs/2611.20222)

[Read the original paper](https://arxiv.org/abs/2611.20222)

## Related papers

- [TCBP-JOBS: GPU-Accelerated Quantum Error Correction Decoding and Noise Learning with Near-Optimal Accuracy](https://quantum.world/paper/tcbp-jobs-gpu-accelerated-quantum-error-correction-decoding-and-noise-2611.21321) 2026-11-16 · quant-ph · Key terms of the title in common
- [A GPU-Accelerated and Geometry-Aware Quantum-Classical Framework for Optimized PES Scans with CUDA-Q](https://quantum.world/paper/a-gpu-accelerated-and-geometry-aware-quantum-classical-framework-for-2611.01389) 2026-11-01 · quant-ph · Key terms of the title in common
- [PADO-Pauli: A GPU-Accelerated Implementation of Pauli Propagation](https://quantum.world/paper/pado-pauli-a-gpu-accelerated-implementation-of-pauli-propagation-2610.17755) 2026-10-13 · quant-ph · Key terms of the title in common

---

Canonical: https://quantum.world/paper/feedback-grape-a-jax-based-python-package-for-gpu-accelerated-grape-2611.20222
