pennylane-maestro

Run your PennyLane code on the Maestro quantum simulator, on your machine or in the Qoro cloud, by changing the device name.

  • Drop-in for default.qubit: the same QNodes, measurements, mid-circuit measurements and broadcasting, with adjoint gradients by default.

  • Beyond statevector: matrix product state (MPS) for hundreds of qubits, with shot sampling, plus stabilizer, tensor network and Pauli propagation.

  • Noise: PennyLane’s noise channels and qp.add_noise models, exact on the density matrix and the MPO as on default.mixed, or sampled shot by shot on the statevector and the MPS for circuits a density matrix cannot hold.

  • Fast: 5–6× faster than lightning.qubit on 20–26-qubit statevector circuits, and 10–18× faster than default.tensor on MPS circuits up to 1,000 qubits (benchmarks).

  • CPU, GPU or cloud: run locally, on your own GPU, or on Qoro’s CPUs and GPUs in the cloud with no hardware of your own.

Install

pip install pennylane-maestro            # local simulation, Python 3.10+
pip install "pennylane-maestro[cloud]"   # adds the Qoro cloud, Python 3.11+

Quick start

import pennylane as qp
from pennylane import numpy as pnp

dev = qp.device("maestro.qubit", wires=2)   # was: qp.device("default.qubit", wires=2)

@qp.qnode(dev)
def circuit(theta):
    qp.RX(theta, wires=0)
    qp.CNOT(wires=[0, 1])
    return qp.expval(qp.Z(1))

theta = pnp.array(0.4, requires_grad=True)
print(circuit(theta), qp.grad(circuit)(theta))   # the gradient uses the adjoint method

Run on the Qoro cloud

  1. Sign up at dash.qoroquantum.net to get an API key. New accounts get 1,000 free tokens, with no credit card.

  2. Install the cloud extra and set your key:

    pip install "pennylane-maestro[cloud]"
    export QORO_API_KEY=...   # or put it in a .env file
    
  3. Add backend="qoro" to the device. Nothing else changes:

    dev = qp.device("maestro.qubit", wires=2, backend="qoro")
    

The quick start above then runs in the cloud, adjoint gradient included. Each optimizer step usually goes as a single job, results come back as they do locally, and options such as simulation_type="MatrixProductState" travel with the job. Add simulator_type="Gpu" to run on Qoro’s GPU cluster. examples/qoro_cloud.py trains a circuit and samples a 50-qubit state in the cloud. A few features, such as qp.state(), run locally only for now: see the guide.

Pick a simulation method

dev = qp.device("maestro.qubit", wires=100,
                simulation_type="MatrixProductState", max_bond_dimension=64)

simulation_type

Use it for

"Statevector" (default)

exact results; memory doubles with each qubit

"MatrixProductState"

many qubits with limited entanglement, including shot sampling

"Stabilizer"

Clifford circuits, any size

"PauliPropagator"

expectation values on many qubits, with Pauli-string truncation

Add simulator_type="Gpu" for your own GPU (get GPU access). The guide lists every method and option.

Next steps

  • Guide: every option, gradients, the GPU and the cloud, and benchmarks, one topic per page.

  • Examples: runnable scripts, from VQE and QAOA to a 100-qubit Ising quench.

  • API reference: the device and its methods.

pennylane-maestro is open source under GPL-3.0, at github.com/QoroQuantum/pennylane-maestro. For Maestro itself, see the Maestro docs.