Superfermion
High-performance quantum computing with a Python API and Rust simulation core.
pip install superfermionSuperfermion is a high-performance quantum computing framework. A fluent Python API for everything you write, a Rust simulation core for everything the computer runs. 3–5x faster than Qiskit Aer, 23–33x for MPS, and 1.9–43x on adjoint gradients against PennyLane's qml.grad (20 down to 4 qubits).
Choose your path
I'm new here
Install, run a Bell state, understand the basics in 5 minutes.
I want to build circuits
Circuit construction, parameterized gates, gate library reference.
I want to run simulations
sf.run(), sf.simulate(), 4 simulation methods, noise models.
I want to compile for hardware
Gate optimization, SABRE routing, basis translation, noise suppression.
I want to do ML / VQE
Adjoint gradients, VQE, QAOA, 5 gradient methods, ML layers.
I want to run on real QPUs
IBM Quantum, IonQ, AWS Braket, OpenQuantum. Protocol-based, no registries.
I want the API reference
Every class, method, and parameter. Cross-referenced from source.
I want to see benchmarks
MPS 23–33x vs Qiskit Aer, a statevector crossover vs Qulacs, and adjoint gradients checked three ways.
I want to know why it's fast
The instruction plan, the math of each rewrite, the Rust kernels, and the memory budget.
What's inside
| Capability | What you get |
|---|---|
| Simulation | Statevector (CPU/GPU), MPS (200+ qubits), Stabilizer (1000+), Density Matrix |
| Gradients | Adjoint (O(1)), Parameter-shift, SPSA, QNG, Riemannian — 5 methods |
| Chemistry | Jordan-Wigner, Bravyi-Kitaev, UCCSD, PySCF bridge, molecular library |
| Compilation | Gate cancellation, rotation merge, SABRE routing, Pauli twirling, DD |
| QEC | 10 codes + 4 decoders: Surface, Color, Toric, MWPM, Union-Find, BP+OSD |
| ML | Quantum layers for PyTorch, Flax/JAX, TensorFlow |
| Providers | IBM Quantum, IonQ, AWS Braket, OpenQuantum |
| Interop | Qiskit, Cirq, PennyLane, OpenQASM 2/3 import/export |
import superfermion as sf
# Bell state — 3 lines
qc = sf.Circuit(2).h(0).cx(0, 1)
result = sf.run(qc, shots=1024)
print(result.counts) # {'00': ~512, '11': ~512}
# Gradient — exact, O(1) scaling
ansatz = sf.Circuit(2).ry(sf.param("t"), 0).cnot(0, 1).ry(sf.param("p"), 1)
state = sf.simulate(ansatz, params={"t": 0.5, "p": 1.2})
obs = [([3, 3], 1.0, 0.0)] # Pauli ZZ (Rust format: 0=I 1=X 2=Y 3=Z)
grads = state.grad(obs, ansatz.to_ir(), {"t": 0.5, "p": 1.2})
print(grads) # {'t': ~0.0, 'p': -0.932...}