Skip to main content

Superfermion

Superfermion

A high-performance quantum computing framework with a Python API and a Rust simulation core. Statevector, MPS, stabilizer, and density matrix simulation methods with native adjoint differentiation, quantum error correction, and multi-framework interop.

Python 3.10+ Rust 1.85+ License: Apache 2.0


What is Superfermion?

Superfermion is a quantum computing framework that combines a Python-native API with a Rust acceleration core (Rayon multithreading + in-place statevector).

  • 4 simulation methods — statevector (CPU/GPU), MPS tensor network, stabilizer (Aaronson-Gottesman tableau), density matrix (Kraus channels)
  • Adjoint differentiation — 1 forward + 1 backward pass regardless of parameter count (44–198x faster than parameter-shift on deep circuits)
  • MPS tensor networks — Rust MPS with faer-based QR decomposition and lazy SWAP routing; scales to 200+ qubits for low-entanglement circuits
  • Stabilizer simulator — word-packed tableau; Clifford circuits at poly-time to ~1000 qubits
  • Quantum Error Correction — stabilizer code constructions (Repetition, Shor, Steane, Surface) + decoders (BP+OSD, greedy matching, Union-Find, Neural); additional codes in progress
  • Multi-framework ML — QuantumLayer (Flax), TorchQuantumLayer (PyTorch), TFQuantumLayer (TensorFlow)
  • 5 gradient methods — adjoint, parameter-shift, SPSA, QNG, Riemannian
  • Quantum algorithms — VQE, QAOA, Grover, QPE, HHL, Amplitude Estimation
  • Chemistry module — Jordan-Wigner + Bravyi-Kitaev transformations, UCCSD ansatz, PySCF bridge, molecular Hamiltonian library
  • Hardware compilation — gate decomposition, rotation merging, SABRE qubit routing, Pauli twirling; targets IBM, Rigetti, IonQ, IQM
  • QPU providers — IBM Quantum, IonQ, AWS Braket, OpenQuantum
  • Cross-framework bridges — Qiskit, Cirq, PennyLane, OpenQASM 2/3

Installation

pip install superfermion

Already installed? pip will not move an existing environment on its own, so upgrade in place:

pip install -U superfermion

From 0.1.20 the package also prints a one-line notice to stderr when a newer release is on PyPI. It checks at most once a day, in a background thread, and is silent when offline, in CI, or under pytest; disable it with SF_NO_UPDATE_CHECK=1.

Wheels are built once against the CPython stable ABI and tagged cp310-abi3, so a single binary per platform installs on CPython 3.10 and every later release, including versions published after the wheel was built:

Platform Architectures Wheel
Linux (glibc 2.28+) x86_64, aarch64 manylinux_2_28
Linux (musl / Alpine) x86_64, aarch64 musllinux_1_2
macOS universal2 (Intel + Apple Silicon) macosx
Windows amd64, arm64 win_amd64, win_arm64

Anything not covered by a wheel — PyPy, 32-bit targets, other architectures, and free-threaded builds (3.14t, 3.15t) — is built from the source distribution by pip, which needs Rust 1.85+ and ~3 GB of free disk. Free-threaded interpreters get a version-specific extension instead of a limited-API one; prebuilt free-threaded wheels are not published yet.

From source (development)

git clone https://github.com/Catstate101/superfermion.git
cd superfermion
pip install maturin
maturin develop --release        # builds crates/sf-bindings into the source tree
pip install -e ".[dev]"

Requirements: Python 3.10+, Rust 1.85+, ~3 GB free disk for the Rust build.

Optional dependency groups:

pip install -e ".[dev]"        # pytest, ruff, mypy, black
pip install -e ".[gpu]"        # JAX with CUDA 12
pip install -e ".[qpu]"        # IBM + AWS Braket SDKs
pip install -e ".[benchmarks]" # PennyLane, Qiskit Aer, pandas, matplotlib
pip install -e ".[chemistry]"  # PySCF, SciPy
pip install -e ".[viz]"        # matplotlib
pip install -e ".[all]"        # everything

Quick Start

import superfermion as sf

# Bell state
qc = sf.Circuit(2).h(0).cx(0, 1)
result = sf.run(qc, device="cpu", shots=1024)
print(result.counts)  # {'00': ~512, '11': ~512}

# Exact simulation with sf.simulate()
state = sf.simulate(qc, device="cpu")
print(state.numpy())       # [0.707+0j, 0, 0, 0.707+0j]
print(state.entropy())     # 0.0 (pure state)
print(state.purity())      # 1.0

# Expectation value (Rust-native)
zz_obs = [([3, 3], 1.0, 0.0)]  # ZZ observable
print(state.expectation(zz_obs))  # 1.0

# Parameterized circuit with gradient
qc = sf.Circuit(1).ry(sf.param("theta"), 0)
bound = qc.bind({"theta": 0.5})
state = sf.simulate(bound, device="cpu")
grads = state.grad([([3], 1.0, 0.0)], qc.to_ir(), {"theta": 0.5})
print(grads)  # {"theta": -0.479...}

Architecture

Python is the API, Rust Does the Work. All performance-critical computation runs in Rust. Python provides the fluent API surface. JAX is used only in nn/quantum_layer.py for the Flax custom_vjp bridge.

Python API (superfermion/)
    |-- Circuit, run(), simulate(), State, MethodError, RunResult
    |-- devices/      RustDevice (CPU/GPU), IBM, IonQ, Braket providers
    |-- observables/   PauliString, SparsePauliOp, Hamiltonian, expval
    |-- qml/          gradients (adjoint, param-shift, SPSA, QNG, Riemannian, SR)
    |-- nn/           Thin ML bridges: Flax/PyTorch/TF → sf.State.grad()
    |-- algorithms/   VQE, QAOA, QSVM, QBM, QRL + Grover, QPE, HHL
    |-- chemistry/    JW/BK transforms, UCCSD ansatz, PySCF bridge
    |-- qec/          codes + 4 decoders
    |-- compiler/     gate decomposition, rotation merge, SABRE routing
    |-- bridge/       Qiskit, Cirq, PennyLane, QASM interop
    |-- noise/        NoiseModel (Kraus channels for density matrix)
    |
    +-- _sf_core  (Rust PyO3 extension: State, QuantumDAG, ...)

Rust workspace (crates/)
    |-- sf-ir/        QuantumStateImpl trait, DAG, statevector, MPS,
    |                 stabilizer, density matrix simulation engines
    |-- sf-compiler/  Pass manager, gate cancellation, rotation merge
    |-- sf-router/    SABRE routing, hardware topology
    |-- sf-qec/       Stabilizer codes, MWPM/UnionFind decoders
    |-- sf-gpu/       CUDA statevector simulation (cudarc, sm_75+)
    |-- sf-bindings/  PyO3 FFI — State, QuantumDAG, compile

Execution flow

sf.run(circuit, device="cpu", method="statevector", shots=N)
    │
    ▼
runner.py — resolve device, bind params, optional compile
    │
    ▼
RustDevice.execute(dag, method, shots)
    │
    ├── statevector    → dag.simulate()             [Rust, Rayon]
    ├── mps            → dag.simulate_mps()         [Rust, faer]
    ├── stabilizer     → dag.simulate_stabilizer()  [Rust, tableau]
    ├── density_matrix → dag.simulate_dm_noisy()    [Rust, Kraus]
    └── gpu            → dag.simulate_gpu()         [CUDA]
    │
    ▼
sf.State (Rust-native) → RunResult(counts, state, metadata)

Simulation Methods

Method Max Qubits Best For
statevector (default) ~25 CPU, ~30 GPU Exact simulation, gradient computation
mps 200+ Low-entanglement circuits (QAOA, VQE, GHZ)
stabilizer ~1000 Clifford-only circuits (QEC, randomized benchmarking)
density_matrix ~12 Noisy simulation with Kraus channels
# MPS simulation
result = sf.run(circuit, device="cpu", method="mps", shots=10000, bond_dim=64)

# Stabilizer simulation
result = sf.run(clifford_circuit, device="cpu", method="stabilizer", shots=10000)

# GPU simulation (requires CUDA)
result = sf.run(circuit, device="gpu", shots=0)

Benchmarks

Performance measured against Qiskit Aer 0.17 and PennyLane Lightning 0.45 on CPU (details in notebooks/). Speedups are regime-dependent; the caveats below are part of the claim.

Workload SF vs Competitor Speedup
Statevector (n=10–18) vs Qiskit Aer statevector up to ~5x (Aer faster at n≥20)
Stabilizer (n=10–500, 10k shots) vs Qiskit Aer stabilizer 3–7x
MPS GHZ (n=10–100, 10k shots) vs Qiskit Aer MPS 23–33x (GHZ is the best case for MPS)
Adjoint gradient (n=4–16, depth=1) vs PennyLane qml.grad 1.5–800x (PennyLane faster at n≥18)
Adjoint vs param-shift (n=10, depth 1–8) SF internal 44–198x (grows with depth)
Shot sampling (n=10–22, 100k shots) vs Qiskit Aer 1.4–11.7x (Aer wins at 1k–10k shots, n≥20)

Key Modules

Gradients

Method File Description
Adjoint qml/gradient/adjoint.py 1 forward + 1 backward pass; fastest for most QML
Parameter-shift qml/gradient/parameter_shift.py 2 forward passes per param; analytic
Finite difference qml/gradient/parameter_shift.py Centered difference fallback
SPSA qml/gradient/spsa.py Stochastic approximation; noisy-hardware friendly
Quantum Natural qml/gradient/qng.py Fubini-Study metric; faster convergence

Machine Learning Layers

from superfermion.nn.quantum_layer import QuantumLayer     # Flax (JAX)
from superfermion.nn.torch_layer import TorchQuantumLayer  # PyTorch
from superfermion.nn.tf_layer import TFQuantumLayer        # TensorFlow

Quantum Error Correction

from superfermion.qec import SurfaceCode2D, MWPMDecoder, QECManager

code = SurfaceCode2D(distance=3)
circuit = code.build()

Cross-Framework Bridge

from superfermion.bridge import from_qiskit, to_qiskit, from_pennylane, to_cirq

sf_circuit = from_qiskit(qiskit_circuit)
qiskit_circuit = to_qiskit(sf_circuit)

Documentation

Full documentation is available at superfermion.com (or superfermion-docs.pages.dev).

Document Content
docs/usage_guide.md Canonical API reference with runnable examples
docs/architecture.md Hexagonal architecture, module map, execution flow
CONTRIBUTING.md Contribution guide
CHANGELOG.md Release history

Citing

@misc{superfermion-2026,
  title  = {SuperFermion: a high-performance quantum-circuit simulator
            with native adjoint differentiation},
  author = {SuperFermion Team},
  year   = {2026},
  url    = {https://github.com/Catstate101/superfermion}
}

License

Apache License 2.0.

Metadata

Release files for superfermion 0.1.24

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

Source distribution (sdist)

Source distribution for superfermion 0.1.24
File Size Uploaded Provenance Actions
superfermion-0.1.24.tar.gz 657.3 kB With provenance Details for superfermion-0.1.24.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for superfermion 0.1.24
File Actions
superfermion-0.1.24-cp310-abi3-win_arm64.whl CPython 3.10 abi3 Windows ARM64 Details for superfermion-0.1.24-cp310-abi3-win_arm64.whl
superfermion-0.1.24-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for superfermion-0.1.24-cp310-abi3-win_amd64.whl
superfermion-0.1.24-cp310-abi3-musllinux_1_2_x86_64.whl CPython 3.10 abi3 Linux musl 1.2+ x86-64 Details for superfermion-0.1.24-cp310-abi3-musllinux_1_2_x86_64.whl
superfermion-0.1.24-cp310-abi3-musllinux_1_2_aarch64.whl CPython 3.10 abi3 Linux musl 1.2+ ARM64 Details for superfermion-0.1.24-cp310-abi3-musllinux_1_2_aarch64.whl
superfermion-0.1.24-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for superfermion-0.1.24-cp310-abi3-manylinux_2_28_x86_64.whl
superfermion-0.1.24-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for superfermion-0.1.24-cp310-abi3-manylinux_2_28_aarch64.whl
superfermion-0.1.24-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64, macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64) Details for superfermion-0.1.24-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Total release size: 18.0 MB

Release files / superfermion-0.1.24.tar.gz

Download URL superfermion-0.1.24.tar.gz
Size 657.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8ac059529d4480eb15d881eb10c47d77509bb4e7d48eaf5b57282e998be3da88
BLAKE2b-256 checksum
How to use checksums
0a5234269c22eb9a557db17090f9ccd8b7c3ba4cacc54a285f593d1f41ff7c46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / superfermion-0.1.24-cp310-abi3-win_arm64.whl

Download URL superfermion-0.1.24-cp310-abi3-win_arm64.whl
Size 1.9 MB
Tags CPython 3.10 Windows ARM64 abi3
SHA-256 checksum
How to use checksums
f1fecc817d8368d5caa0acbb2d815341ec43e3492075b9ec9a2d1018d35d6377
BLAKE2b-256 checksum
How to use checksums
dce2b88514eba0fe020bbf4ab0c50823d4b5585f1c0507dac988408aef34e1b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / superfermion-0.1.24-cp310-abi3-win_amd64.whl

Download URL superfermion-0.1.24-cp310-abi3-win_amd64.whl
Size 2.2 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
707d06929f720777e3cefe23d1a24f3001c223e00b6aefd862de3a6e03c719e7
BLAKE2b-256 checksum
How to use checksums
5c545ab7efdb912707e0f5c272791effda6f719bcee67b4320734266e0948919
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / superfermion-0.1.24-cp310-abi3-musllinux_1_2_x86_64.whl

Download URL superfermion-0.1.24-cp310-abi3-musllinux_1_2_x86_64.whl
Size 2.5 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
3ee922519d5c07ea33fb08cb3dbd3329908f4faf3a8504f0f4919484c0728c33
BLAKE2b-256 checksum
How to use checksums
82756ebae50c9d431ab05bbb4f51cfa402cafb7b52e09cf02d83a721d7be5a5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / superfermion-0.1.24-cp310-abi3-musllinux_1_2_aarch64.whl

Download URL superfermion-0.1.24-cp310-abi3-musllinux_1_2_aarch64.whl
Size 2.3 MB
Tags CPython 3.10 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
dcfd2e553f27f7ac68f7d1b49a4a98abd4dee1c30fe29d9e9d3763cebc45352a
BLAKE2b-256 checksum
How to use checksums
96c0e86e741123fda5239ff40381e5ee1ada7d88ddf71bb4efed0a0b4b493185
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / superfermion-0.1.24-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL superfermion-0.1.24-cp310-abi3-manylinux_2_28_x86_64.whl
Size 2.4 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
edefb4235c166f883e378cf83ccba5156a0b648913db634adaa5bae5e8d51da5
BLAKE2b-256 checksum
How to use checksums
c60718cd4350f8ada2dbc316dd28929b4525b9e334fb9b3fe0c9d76bc6f2a902
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / superfermion-0.1.24-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL superfermion-0.1.24-cp310-abi3-manylinux_2_28_aarch64.whl
Size 2.2 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
01a0fb238c74b8795074c58675ef514bd067d6930aecfbc56367a9dc568710df
BLAKE2b-256 checksum
How to use checksums
2385182f288fdfff6fc70837323f4971355d8c7e8a0464beade46a6fc4782118
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Release files / superfermion-0.1.24-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Download URL superfermion-0.1.24-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
Size 3.9 MB
Tags CPython 3.10 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d9f9112c4601dec9571a1e2f793f0daecabf239c6053da688eeceedc6dd48b55
BLAKE2b-256 checksum
How to use checksums
7d70d918e5488cd98a636a85aff74812d6e10707ec2610c873ccd7dca3ffd580
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 1, 2026.

Transparency log

Security for superfermion 0.1.24

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.

Full provenance

All 8 files in this release have been uploaded with provenance metadata.

Select from 8 files

Attestation for superfermion-0.1.24.tar.gz

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 Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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