Status: not actively maintained. Left up as a reference.
Gradient-based pulse optimization (GRAPE) for noise-robust single-qubit gates on transmons, with a Lindblad open-system simulator and an error-budget comparison of GRAPE against DRAG.
"When does numerical pulse optimization actually help? Error budgets, robustness tradeoffs, and calibration guidance for transmon single-qubit gates" Rylan Malarchick | 2024–2025 arXiv:2511.12799
A pipeline from Lindblad-master-equation simulation to infrastructure for hardware validation on IQM processors (parameters representative of the 20-qubit IQM Garnet). Everything reported here is simulation; no circuits were run on physical hardware.
- GRAPE Optimization: Gradient Ascent Pulse Engineering algorithm for discovering optimal control pulses
- High-Fidelity Simulation: Full Lindblad master equation solver with T₁ (relaxation) and T₂ (dephasing) decoherence
- Hardware Integration: API connectivity confirmed with IQM Garnet quantum processor (20-qubit system)
- Sim-to-Real Calibration: Hardware-in-the-loop workflow with real-time parameter extraction
- Verification & validation: 857 unit/integration tests, 74% code coverage; NASA JPL Power-of-10–informed coding practices
Simulation results: On a three-level transmon model with IQM-Garnet-representative parameters (T₁ = 37 µs, T₂ = 9.6 µs, α/2π = −200 MHz), GRAPE eliminates all coherent X-gate error to machine precision (1 − F < 10⁻¹⁵) at 20 ns — but properly calibrated DRAG already operates within 1.2× of the decoherence floor (1 − F = 8.4×10⁻⁴ vs. GRAPE's 7.2×10⁻⁴ under full decoherence). DRAG is also more robust to qubit-frequency detuning than GRAPE (minimum fidelity 0.990 vs. 0.931 over ±5 MHz), while GRAPE retains the best amplitude robustness (0.994 vs. 0.990). The practical conclusion: numerical optimization earns its added complexity mainly at short gate times (≲ 15 ns) or when targeting error rates below the decoherence floor. The full error budget and methodology are in the paper (paper/quantum/).
# Clone repository
git clone https://github.com/rylanmalarchick/QubitPulseOpt.git
cd QubitPulseOpt
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install the package with dev (and optional RL) extras
pip install -e ".[dev]" # add ,rl for the reinforcement-learning subsystem: ".[dev,rl]"
# Run test suite (verify installation)
pytest tests/ -vimport qutip as qt
from src.optimization import GRAPEOptimizer
# Single-qubit system: zero drift, X and Y control channels
H_drift = qt.qzero(2)
H_controls = [qt.sigmax(), qt.sigmay()]
# Initialize the GRAPE optimizer
optimizer = GRAPEOptimizer(
H_drift=H_drift,
H_controls=H_controls,
n_timeslices=50,
total_time=20.0, # gate duration (ns)
max_iterations=200,
verbose=False,
)
# Optimize the pulse to implement an X gate
result = optimizer.optimize_unitary(qt.sigmax())
print(f"Final fidelity: {result.final_fidelity * 100:.2f}%")
print(f"Optimized pulses shape: {result.optimized_pulses.shape}") # (n_controls, n_timeslices)# Phase 1: Hamiltonian simulation and Bloch dynamics
python examples/phase1_demo.py
# Phase 2: GRAPE pulse optimization
python examples/phase2_demo.py
# Phase 3: DRAG pulse implementation
python examples/phase3_demo.py
# Phase 4: Benchmarking and fidelity analysis
python examples/phase4_demo.py┌─────────────────────┐ ┌──────────────────────┐ ┌─────────────────┐
│ IQM Quantum │ (1) │ QubitPulseOpt │ (2) │ QPU Execution │
│ Processor │─────▶│ GRAPE + Lindblad │─────▶│ Real Hardware │
│ (20-qubit Garnet) │ │ Noise Simulator │ │ Validation │
└─────────────────────┘ └──────────────────────┘ └─────────────────┘
│ │
└──────────────────────────────────────────────────────────────┘
(3) Measure fidelity
Analyze sim-to-real gap
- Calibration: Query real-time hardware parameters (ω, T₁, T₂) from IQM QPU
- Optimization: Generate hardware-specific optimal pulse using GRAPE
- Validation: Execute on quantum processor and measure fidelity
QubitPulseOpt/
├── src/
│ ├── hamiltonian/ # Drift & control Hamiltonians, time evolution
│ ├── optimization/ # GRAPE algorithm, cost functions
│ ├── pulses/ # Pulse generators (DRAG, Gaussian, custom)
│ ├── hardware/ # IQM hardware integration & async job management
│ └── visualization/ # Bloch sphere, fidelity plots
├── tests/ # Unit/integration tests
├── scripts/ # Experiment and figure generation scripts
├── docs/ # Documentation
└── examples/ # Tutorial notebooks
These are the four figures from the paper (paper/quantum/); all numbers are reproducible with the experiment scripts in scripts/.
Figure 1: Control waveforms for the X gate (T = 20 ns, α/2π = −200 MHz). (a) Gaussian: I-channel only. (b) DRAG: Gaussian on I, derivative correction on Q with β = 0.398. (c) GRAPE: both channels piecewise-constant over 50 time slices, showing the richer spectral content discovered by numerical optimization.
Figure 2: X-gate infidelity (a) and leakage P₂ (b) vs. gate time. GRAPE reaches machine-precision fidelity at all gate times; DRAG's perturbative correction begins to fail below ≈ 15 ns. DRAG's leakage suppression improves exponentially with gate time.
Figure 3: Fidelity under (a) qubit-frequency detuning (±5 MHz) and (b) amplitude error (±5%). DRAG keeps the highest minimum fidelity under detuning (0.990 vs. GRAPE's 0.931) because GRAPE's richer spectrum couples more strongly to off-resonant transitions; GRAPE wins on amplitude robustness (0.994).
Figure 4: Error budget with IQM-Garnet-representative parameters. The uncorrected Gaussian is coherent-error-limited (≈ 39× the decoherence floor); DRAG and GRAPE are both decoherence-limited, with DRAG only 1.2× above GRAPE. Dephasing (T₂) dominates the floor, making T₂ the highest-leverage hardware upgrade.
QubitPulseOpt demonstrates API connectivity with IQM's Garnet quantum processor (20-qubit system):
from scripts.query_iqm_calibration import query_iqm_system
# Query IQM Garnet system information
system_info = query_iqm_system()
print(f"Connected to: {system_info['name']}")
print(f"Qubits: {system_info['qubits']}")
# Output: IQM Garnet, qubits QB1-QB20Verified Capabilities:
- API connectivity to IQM Garnet confirmed (20-qubit system)
- System topology retrieved (qubits QB1-QB20)
- Hardware-representative parameters for simulation (T₁=37µs, T₂=9.6µs, α/2π=−200MHz; see HARDWARE_REFERENCE.md)
- Hardware execution infrastructure implemented but not yet validated with physical QPU runs
Note: All results in this work are from simulation using hardware-representative parameters. No quantum circuits were executed on physical hardware. The framework provides the infrastructure for hardware-in-the-loop optimization pending access to quantum execution credits.
Gradient Ascent Pulse Engineering treats pulse amplitude at each time step as an independent parameter, enabling discovery of complex control sequences:
- Objective: Maximize gate fidelity F = |⟨ψ_target|U(T)|ψ_initial⟩|²
- Optimization: Gradient ascent with analytic derivatives via adjoint method
- Constraints: Amplitude bounds, smoothness regularization
- Convergence: Typically 100-200 iterations to >99.9% fidelity
Full open quantum system simulation including decoherence:
dρ/dt = -i[H(t), ρ] + L₁[ρ] + L₂[ρ]
where:
L₁[ρ] = (1/T₁)(σ₋ρσ₊ - ½{σ₊σ₋, ρ}) # Relaxation
L₂[ρ] = (1/T₂)(σ_z ρσ_z - ρ) # Dephasing
Implemented using QuTiP's mesolve with adaptive time-stepping for numerical stability.
Derivative Removal by Adiabatic Gate (DRAG) technique for suppressing leakage to non-computational states:
Ω_DRAG(t) = Ω(t) + i·β·(dΩ/dt)/Δ
where β is the DRAG coefficient and Δ is the anharmonicity.
- 857 tests, 74% code coverage
- Unit tests for all core algorithms (optimization, pulses, Hamiltonians, I/O)
- Numerical stability and regression tests
- IQM hardware-integration modules covered at the unit level (REST/translation); no live-QPU tests
- NASA JPL Power-of-10–informed: bounded loops, assertions, short functions (partial; see
scripts/compliance/) - Automated linting (flake8, black)
- Type hints throughout
- Comprehensive docstrings (Google style)
- Pre-commit hooks for quality assurance
# Run full test suite with coverage
pytest tests/ --cov=src --cov-report=html
# Code quality checks
flake8 src/
black src/ --check
mypy src/| Operation | Time | Fidelity | Notes |
|---|---|---|---|
| Lindblad Evolution (100 steps) | 0.8s | N/A | QuTiP adaptive solver |
| GRAPE Optimization (200 iter) | ~45s | →1.000 | X gate, 3-level, closed system |
| Hardware Job Submission | 2s | N/A | REST API v1 |
| Full Phase 1-4 Validation | 90s | Various | Simulation-based |
Benchmarked on: Intel i7-9700K, 32GB RAM, Ubuntu 22.04
- Hardware Reference: Complete guide for IQM integration
- API Documentation: Full module and class documentation
- Examples: Jupyter notebooks with tutorials
- Contributing Guide: Development guidelines
Several items originally planned as future work for QubitPulseOpt have been implemented in QubitOS, the open-source quantum control kernel that builds on this project's methodology:
Hardware Validation→ QubitOS provides IQM, IBM Quantum, and AWS Braket backend infrastructure with randomized benchmarking (v0.1.0+)Open-System GRAPE→ QubitOS v0.5.0 implements a Rust-native Lindblad master equation solver with decoherence-aware GRAPE optimization- DRAG Comparison: Completed in paper — DRAG with correct β achieves 99.95% fidelity; GRAPE advantage is 1.2x at 20ns
Adaptive Calibration→ QubitOS v0.4.0 implementsActiveCalibrationLoopwith drift detection, automatic recalibration triggers, and provenance tracking
If you use QubitPulseOpt in your research, please cite:
@article{malarchick2025qubitpulseopt,
author = {Malarchick, Rylan},
title = {When does numerical pulse optimization actually help? {E}rror budgets, robustness tradeoffs, and calibration guidance for transmon single-qubit gates},
year = {2025},
eprint = {2511.12799},
archivePrefix = {arXiv},
primaryClass = {quant-ph},
url = {https://arxiv.org/abs/2511.12799}
}-
GRAPE Algorithm: Khaneja et al., "Optimal control of coupled spin dynamics: design of NMR pulse sequences by gradient ascent algorithms," J. Magn. Reson. 172, 296-305 (2005)
-
Lindblad Master Equation: Lindblad, "On the generators of quantum dynamical semigroups," Commun. Math. Phys. 48, 119-130 (1976)
-
DRAG Technique: Motzoi et al., "Simple Pulses for Elimination of Leakage in Weakly Nonlinear Qubits," Phys. Rev. Lett. 103, 110501 (2009)
-
IQM Quantum Computers: IQM Resonance Documentation
-
IQM Garnet Benchmarks: Algaba et al., "Technology and Performance Benchmarks of IQM's 20-Qubit Quantum Computer," arXiv:2408.12433 (2024)
MIT License - See LICENSE file for details
Rylan Malarchick
Email: [rylan1012@gmail.com]
GitHub: @rylanmalarchick
Project: QubitPulseOpt
- IQM Quantum Computers for providing access to quantum hardware
- QuTiP Development Team for the quantum toolbox in Python
- Qiskit Community for quantum circuit framework



