Skip to main content

pennylane-zksf

CI PyPI Python PennyLane License: MIT DOI

A PennyLane device for the ZKSF quantum simulation service.

Run PennyLane circuits past the ~30-qubit statevector wall, and get an accuracy statement with every approximate result rather than a bare number.

pip install pennylane-zksf
import pennylane as qml

dev = qml.device("zksf.simulator", wires=3, shots=1024, token=YOUR_TOKEN)

@qml.qnode(dev)
def ghz():
    qml.Hadamard(0)
    qml.CNOT([0, 1])
    qml.CNOT([1, 2])
    return qml.counts()

ghz()              # {'000': 512, '111': 512}
dev.error_info()   # how far that result can be from the truth

Your token is on the dashboard at app.zksf.org. It can also come from the ZKSF_TOKEN environment variable.

Why run here

default.qubit is faster for small circuits and costs nothing, so use it. This device is for the two things it cannot do:

  • Reach. Stabilizer circuits at thousands of qubits, tensor networks past 100, Pauli propagation for expectation values at ~200. An exact statevector stops around 30 because the memory doubles per qubit.
  • Evidence. Every approximate run reports a measured error bound under the open ZCC-v0.1 protocol, and any finished job can be exported as a certificate that anyone can check with zcc-verify without an account and without calling this service.

Engines

Leave engine unset and a rule-based router picks the cheapest one that fits. Name it to pin the choice:

engine qubits returns
exact.cpu 30 counts, exact
exact.gpu 32 counts, exact
clifford 5000 counts, exact (Clifford gates only)
mps.quimb.cpu 128 counts, with a certified error bound
mps.aer.cpu 128 counts, with a certified error bound
pauli.cpu 200 expectation values only
noisy.cpu 20 counts, with device-noise modelling

An oversized circuit is refused before it is submitted, not after it is billed.

Real quantum hardware

Name a processor the same way. These run on the machine rather than a model of it, and are billed at the provider's list price:

engine qubits processor
qpu.rigetti 108 Rigetti Cepheus-1-108Q, superconducting
qpu.iqm.emerald 54 IQM Emerald, superconducting
qpu.ionq 36 IonQ Forte Enterprise 1, trapped ion
qpu.iqm.garnet 20 IQM Garnet, superconducting
qpu.aqt.ibex 12 AQT IBEX Q1, trapped ion
dev = qml.device("zksf.simulator", wires=2, shots=1000,
                 engine="qpu.iqm.garnet", token=TOKEN)

Hardware results carry a ZHF-v0.1 fidelity rather than a simulation error bound, readable through dev.error_info() like any other run. The service also offers neutral-atom and photonic processors, which take pulse sequences and linear optics rather than gate circuits, so they are reachable from qsim-sdk and not from a PennyLane device.

Batching

PennyLane hands execute a sequence of tapes whenever it broadcasts or differentiates. Those go to the service as one request, not one per tape:

from pennylane.tape import QuantumScript

tapes = [QuantumScript(ops(v), [qml.counts()], shots=1024) for v in values]
dev.execute(tapes)      # one round trip

This matters more than it looks. A round trip to the service is on the order of a second, so a sweep issued one point at a time spends most of its wall clock waiting rather than simulating.

Measurements

qml.counts, qml.sample, qml.probs and qml.expval of a Pauli observable. One measurement per circuit.

qml.expval needs an engine that computes expectation values, so an unpinned device routes those runs to pauli.cpu. Pinning a counts-only engine and asking for an expectation raises rather than returning a plausible-looking zero.

No gradients

supports_derivatives() returns False, deliberately. Each execution is a billed cloud job, so differentiating through it would issue shifted tapes and spend money without the cost being visible. PennyLane falls back to its own gradient handling. Compute gradients on a local device and use this one for the runs that need the reach or the bound.

Links

Licence

MIT

Metadata

Release files for pennylane-zksf 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pennylane-zksf 0.2.0
File Size Uploaded
pennylane_zksf-0.2.0.tar.gz 15.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pennylane-zksf 0.2.0
File Interpreter ABI Platform
pennylane_zksf-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 27.1 kB

Release files / pennylane_zksf-0.2.0.tar.gz

Download URL pennylane_zksf-0.2.0.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
00b22e33f08920d897d8f7ed91feb080109deb491b5f37114402d4e418d4929c
BLAKE2b-256 checksum
How to use checksums
d64181a1e355dae3f15c9debbc13cb6b5e96f3e1cf78a247e9634d9d5403828b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

Release files / pennylane_zksf-0.2.0-py3-none-any.whl

Download URL pennylane_zksf-0.2.0-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb9c4022dc927b189213705996b6ea63c3822bc505817328034b33a1bab418db
BLAKE2b-256 checksum
How to use checksums
097febf643f56105238f026ae632d8df7a6fff6302c8375fa532324bb2a66e11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page