Scan your whole stack
From OX Research Newsroom
Are you using superfermion?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.1.31
superfermion was last scanned on 23 Nov 2026 at version 0.1.31. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.1.31 LATEST | 23 Nov 2026 | No rules fired |
| 0.1.30 | 14 Nov 2026 | No rules fired |
| 0.1.29 | 11 Nov 2026 | No rules fired |
| 0.1.28 | 8 Nov 2026 | Not shown |
| 0.1.27 | 7 Nov 2026 | Not shown |
Findings for v0.1.31. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.1.31; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
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.
Superfermion is a quantum computing framework that combines a Python-native API with a Rust acceleration core (Rayon multithreading + in-place statevector).
QuantumLayer (Flax), TorchQuantumLayer
(PyTorch), TFQuantumLayer (TensorFlow)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, and the CI lane that
exercises 3.14t is advisory (continue-on-error: true), so a free-threaded
install is best-effort rather than gated.
Three things are structurally absent from every published artifact. The first two fail loudly instead of silently degrading.
CUDA. The GPU backend is a Rust feature (gpu, off by default in
crates/sf-bindings), not a Python extra, so no published wheel carries it.
sf.run(..., device="gpu") on a PyPI install raises immediately:
RuntimeError: GPU not available. Diagnostic: GPU feature not compiled
To get it, rebuild the extension yourself —
maturin develop --release --features gpu — which needs the CUDA 12 toolkit and
a matching driver. The [gpu] pip extra is a different thing: it installs JAX
with CUDA for the QML layers and adds no CUDA simulator.
crates.io. The eight crates (sf-ir, sf-cat, sf-qec, sf-pulse,
sf-router, sf-compiler, sf-gpu, sf-bindings) are workspace members, not
published packages: cargo add sf-ir resolves nothing, and no release job
publishes them. The Rust API reaches users only as the _sf_core extension
module inside the Python wheel.
x86_64 CPUs older than 2008. Every x86_64 wheel is compiled with
-C target-cpu=x86-64-v2 (.cargo/config.toml), so the binary assumes SSE4.2,
POPCNT and CMPXCHG16B are present — the level Intel reached with Nehalem (2008)
and AMD with Bulldozer (2011); earlier parts, including AMD's K10, do not have
it. A machine below that level cannot run the wheel, and there is no fallback
build: the flag is what lets LLVM vectorise the statevector kernel. Three
qualifications, all read from the config: aarch64 wheels are unaffected; the
x86_64-unknown-linux-musl target is not listed, so the Alpine wheel keeps
the generic x86-64 baseline; and the windows-gnu entry only affects local
builds, since shipped Windows wheels use msvc.
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
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...}
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-cat/ Compile-once, multi-mode execution core
| (statevector / density matrix / adjoint / stabilizer / Clifford)
|-- 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-pulse/ Pulse-level control — waveforms, schedules, calibration
|-- sf-bindings/ PyO3 FFI — State, QuantumDAG, compile
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)
| 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)
sf.cat()sf.run() rebuilds the DAG on every call. sf.cat() lowers the circuit into a
reusable handle once — topological order, constant gate matrices and fusion
metadata are cached — and then re-executes it with new parameter values:
theta = sf.param("theta")
circuit = sf.Circuit(2).ry(theta, 0).cx(0, 1)
rho = sf.cat(circuit, mode="density_matrix").simulate({"theta": 0.5})
mode |
Call | Returns |
|---|---|---|
statevector (default) |
simulate(values) |
state vector |
density_matrix |
simulate(values) |
rho; the only lane that accepts a Reset after use or an unread mid-circuit readout |
adjoint |
run_gradient(pauli, values) |
gradient of one Pauli string; RY/RZ parameters and CNOT only |
stabilizer, clifford |
sample(shots, seed=None) |
counts with little-endian keys; the same seed reproduces, different seeds are decorrelated |
Three details that bite:
rho cannot stand for a mixture over measurement branches, so
sample() on a density_matrix handle raises ValueError. Execute it and
read probabilities() from the returned state instead.State.numpy() flattens a rho row-major; read it back with
reshape(2**n, 2**n) in C order. An F-order reshape silently returns rho.T,
which is identical for real states and wrong for complex ones.run_gradient, State.expectation) are indexed from the left:
"ZI" is Z on qubit 0. Count keys are indexed the other way — leftmost
character is the highest qubit.Checked against Qiskit 2.1.2 on a 4-qubit circuit, by
tests/unit/test_cat_vs_qiskit.py:
statevector amplitudes agree to 1.1e-16, the density matrix to 0.0, adjoint
gradients to 1.9e-11 against a central finite difference, and Clifford sampling
sits 0.0041 total variation from the exact distribution at 20k shots (Qiskit
Aer: 0.0058 at the same shot count).
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) |
| 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 |
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
from superfermion.qec import SurfaceCode2D, MWPMDecoder, QECManager
code = SurfaceCode2D(distance=3)
circuit = code.build()
from superfermion.bridge import from_qiskit, to_qiskit, from_pennylane, to_cirq
sf_circuit = from_qiskit(qiskit_circuit)
qiskit_circuit = to_qiskit(sf_circuit)
Full documentation is available at superfermion.com (or superfermion-docs.pages.dev).
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.