Skip to main content

pennylane-zksf

CI PyPI Python 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.

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pennylane_zksf-0.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pennylane_zksf-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file pennylane_zksf-0.1.0.tar.gz.

File metadata

  • Download URL: pennylane_zksf-0.1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pennylane_zksf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8c7077e93efe7bd68f58cbf27e5926433537f90af008017fc4715187ce5b6b17
MD5 37b36d833e260bacbb84abbcdf54b5dc
BLAKE2b-256 debed2fb6c2a128e575a5a1964e4d5e6a3648b8d42cfe95a86024798eee33712

See more details on using hashes here.

Provenance

The following attestation bundles were made for pennylane_zksf-0.1.0.tar.gz:

Publisher: publish.yml on official-dvl/pennylane-zksf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pennylane_zksf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pennylane_zksf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pennylane_zksf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e2af6d079e546b90991b79d17b6133e7a70010579ac6debf422f638138c8ecb2
MD5 1d9f0f6beb0bb97d29a165fe3365e8d3
BLAKE2b-256 296de8dca05f774369de3c05d65680f1cd8b5a4295364a60f1b9f41ecd73f2d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pennylane_zksf-0.1.0-py3-none-any.whl:

Publisher: publish.yml on official-dvl/pennylane-zksf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page