Quantum Software Landscape
The stack is five layers deep, and most problems blamed on an algorithm are actually layer mix-ups. Code written against the circuit layer gets recompiled silently at the compiler layer, then executed on a backend whose native gate set never matched the assumptions in the paper you copied.
| Layer | What it owns | Typical tools |
|---|---|---|
| Application | Drivers, workflows, chemistry and optimization glue | Qiskit Nature, OpenFermion, PennyLane Chemicals |
| Circuit SDK | Gates, registers, parameters, measurement | Qiskit, Cirq, Q#, Strawberry Fields |
| Compiler | Routing, cancellation, basis translation, layout | `t |
| Runtime | Shot budgets, queueing, job splitting, result decoding | IBM Runtime, Amazon Braket, Azure Quantum |
| Backends | Statevector simulators, shot simulators, physical devices | Aer, Cirq simulators, ion traps, GPUs |
A practical rule follows from the table: pick the runtime before the SDK. Qiskit is the natural choice if the destination is IBM hardware, Cirq if it is Google or IonQ through Braket, and PennyLane if the quantum circuit is a layer inside a larger classical training loop. Two SDKs in one repository is a maintenance cost that almost never pays for itself.
Qiskit
Qiskit (IBM) is the most widely used quantum SDK, split across four packages that beginners routinely confuse: qiskit for circuits and transpilation, qiskit-aer for simulation, qiskit-ibm-runtime for jobs on hardware, and domain packages for chemistry and optimization.
from qiskit import QuantumCircuit, Aer, execute
qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cx(0, 1)
qc.measure([0, 1], [0, 1])
simulator = Aer.get_backend('qasm_simulator')
result = execute(qc, simulator, shots=1000).result()
print(result.get_counts())
Running that prints {'00': 512, '11': 488} within sampling error of the ideal 50/50 split. The interesting part is what happens before execution: transpile(qc, backend) rewrites the circuit for the device, inserting SWAP gates for connectivity and decomposing the CNOT into the native cross-resonance gate. A two-qubit Bell circuit stays at two gates; a 20-qubit all-to-all algorithm on a heavy-hex layout can triple in gate count purely from routing.
Two details catch people out. First, execute is legacy API â current code calls backend.run(transpiled, shots=1000) or submits through the Runtime primitives Sampler and Estimator. Second, shot counts are a budget, not a formality: 1000 shots resolve a probability to about 0.03, so any expectation value you compare against theory needs enough shots to push that noise floor below the signal.
Cirq
Cirq (Google) assumes from day one that you are targeting a device with a fixed connectivity graph, so qubits are explicit objects rather than an anonymous register.
import cirq
q0, q1 = cirq.LineQubit.range(2)
circuit = cirq.Circuit([
cirq.H(q0),
cirq.CNOT(q0, q1),
cirq.measure(q0, q1)
])
simulator = cirq.Simulator()
result = simulator.run(circuit, repetitions=1000)
print(result.histogram(key='q(0),q(1)'))
The line qubits above are a placeholder for real hardware grids: cirq.GridQubit(3, 4) pins a qubit to a physical coordinate, and cirq.google.CouplingMap refuses to schedule a two-qubit gate between positions that are not adjacent. That constraint is visible in the API instead of hidden in a compiler pass, which is the design difference most often cited when teams choose Cirq for device-level work. Cirq also exposes moment-by-moment scheduling through cirq.InsertStrategy, letting you control exactly which gates share a time slice â useful when idle qubits must be decoupled between layers.
PennyLane
PennyLane (Xanadu) treats a quantum circuit as a differentiable node in a classical computation graph, which changes what the SDK is for.
import pennylane as qml
import numpy as np
dev = qml.device('default.qubit', wires=2)
@qml.qnode(dev)
def circuit(params):
qml.RY(params[0], wires=0)
qml.CNOT(wires=[0, 1])
return qml.expval(qml.PauliZ(0))
params = np.array([0.5], requires_grad=True)
print(circuit(params))
The output is an expectation value, not a bitstring, and params carries requires_grad=True so the same function works under Autograd, JAX, PyTorch or TensorFlow differentiation. Two gradient methods matter in practice. diff_method="backprop" back-propagates through the simulator and is exact but memory-hungry; diff_method="parameter-shift" evaluates the circuit at and costs two executions per parameter. On hardware only the parameter-shift rule exists, so a model trained with backprop must be re-validated with parameter-shift before any claim about trainability holds.
Q# (Microsoft)
Q# is a domain-specific language with classical control flow baked in, running on the .NET runtime and interoperating with Python through qsharp.
operation BellState() : (Result, Result) {
use q = Qubit[2];
H(q[0]);
CNOT(q[0], q[1]);
let r0 = M(q[0]);
let r1 = M(q[1]);
ResetAll(q);
return (r0, r1);
}
Allocation and release are scoped: qubits leaving the use block must be returned to , and the compiler enforces this, which removes an entire class of bugs that Python SDKs only catch at runtime. Q# also carries resource estimation tooling â you can ask how many T gates a factoring instance needs before any hardware exists â which is why it shows up in fault-tolerance roadmaps rather than NISQ experiments.
Comparison
| Feature | Qiskit | Cirq | PennyLane | Q# |
|---|---|---|---|---|
| Primary use | General QC | NISQ hardware | QML / variational | Fault-tolerant |
| Hardware focus | IBM | Google, IonQ | Any via plugins | Microsoft |
| Language | Python | Python | Python | Q# |
| Differentiation | Manual | Manual | Automatic | Manual |
| Connectivity handling | Transpiler pass | Explicit in API | Device dependent | Compiler |
| Community | Largest | Growing | ML-focused | Enterprise |
Version churn and long-lived code
The table above is stable, the APIs underneath it are not. execute() was deprecated in favour of Runtime primitives, Aer moved to its own package, and Cirq's device modules were reorganised around the Qtip devices interface. Scripts pinned to a tutorial from two or three years ago fail at import rather than at run time, which makes a pinned requirements.txt and a small smoke test that builds and transpiles one circuit part of the deliverable rather than optional hygiene. Recording the transpiled circuit alongside the source is the cheapest insurance: the qpy serialisation format round-trips it, and it preserves the exact gate sequence a result came from even after the SDK that produced it has moved on.
Choosing an SDK
Three questions settle the decision faster than benchmark tables.
- Where does it run? If the target is a specific QPU, the vendor SDK's native toolchain gives the shortest path from circuit to calibrated pulse. Cross-platform abstraction costs fidelity at the edges.
- Is quantum inside a training loop? If gradients must flow through the circuit, PennyLane's differentiation support removes boilerplate that would otherwise be hand-written in Qiskit or Cirq.
- Do you need classical control in the program? Mid-circuit measurement, feed-forward and repeat-until-success loops read naturally in Q# and in Qiskit's newer control-flow constructs, and awkwardly in scripts built around static circuit objects.
Budget also matters. A team shipping one experiment per quarter will do better with the largest community and the most Stack Overflow answers; a team building a variational optimizer will do better with the framework whose gradient machinery matches their model.
Python: Framework Comparison
The three Python SDKs side by side, each producing the same Bell state so the API differences are the only variable:
# Qiskit style: build, transpile, run
def qiskit_bell():
from qiskit import QuantumCircuit, transpile, Aer
qc = QuantumCircuit(2, 2)
qc.h(0); qc.cx(0, 1); qc.measure([0, 1], [0, 1])
job = Aer.get_backend('qasm_simulator').run(
transpile(qc, Aer.get_backend('qasm_simulator')), shots=1000)
return job.result().get_counts()
# Cirq style: qubits are objects, topology is explicit
def cirq_bell():
import cirq
q0, q1 = cirq.LineQubit.range(2)
circuit = cirq.Circuit([cirq.H(q0), cirq.CNOT(q0, q1),
cirq.measure(q0, q1)])
return cirq.Simulator().run(circuit, repetitions=1000).histogram(
key='q(0),q(1)')
# PennyLane style: expectation values, differentiable
def pennylane_bell():
import pennylane as qml
dev = qml.device('default.qubit', wires=2, shots=1000)
@qml.qnode(dev)
def circuit():
qml.Hadamard(wires=0)
qml.CNOT(wires=[0, 1])
return qml.probs(wires=[0, 1])
return circuit()
print("Qiskit counts:", qiskit_bell())
print("Cirq histogram:", cirq_bell())
print("PennyLane probs:", pennylane_bell())
The three functions agree to within shot noise on the underlying distribution â roughly [0.5, 0.0, 0.0, 0.5] â but return different shapes: a counts dictionary keyed by bitstring, a histogram keyed by integer basis state, and a probability vector in qubit order. Bit ordering is the classic integration bug here: Qiskit writes bitstrings with qubit 0 on the right, Cirq and NumPy index qubit 0 on the left. Translating results between tools without reversing the order silently doubles the error in any downstream classifier.
Common Mistakes
Assuming a circuit written for a simulator will run unchanged on hardware
Fix: Call transpile with the real backend first and inspect the gate counts â routing on heavy-hex layouts routinely doubles or triples two-qubit depth
Comparing a Qiskit counts dictionary with a NumPy probability vector without normalising or reversing qubit order
Fix: Convert both to a fixed qubit-order convention and divide counts by shots before any comparison; qubit 0 sits on the right in Qiskit bitstrings
Picking an SDK before picking a backend, then rewriting when the device changes
Fix: Decide the execution target first â IBM routes through Qiskit, Google and IonQ through Cirq or Braket, variational workloads through PennyLane
Training with exact backpropagation gradients and assuming they transfer to real hardware
Fix: Re-validate with the parameter-shift rule, which is the only gradient method a physical device supports, before reporting trainability results
Key Takeaways
- The stack has five layers â application, circuit SDK, compiler, runtime, backend â and choosing the runtime first usually settles the SDK choice
- Qiskit hides connectivity handling in a transpiler pass while Cirq exposes it as explicit GridQubit coordinates, which is the main practical difference between them
- PennyLane returns expectation values with automatic differentiation: backprop is exact but simulator-only, parameter-shift costs two circuit runs per parameter and works on hardware
- Bit ordering differs between tools â Qiskit prints qubit 0 on the right, Cirq and NumPy put it on the left â so cross-SDK result comparison needs an explicit convention