A quantum circuit simulator is classical software that reproduces the behavior of a quantum circuit by computing how its gates transform the state of the qubits and what results measurements would return. In quantum software, simulators are the everyday test bench for quantum programs: developers in Quantum computing write a circuit in an SDK, run it on a simulator to check correctness, and only then spend scarce time on real quantum hardware.
Simulators matter because they offer what hardware cannot: noise-free reference results, full access to the internal state, and deterministic debugging. Their fundamental limit is exponential cost, because the classical memory needed to describe a general quantum state doubles with every added qubit.
How a quantum circuit simulator computes results
A simulator takes a circuit, usually expressed in a format such as OpenQASM or an SDK object, and applies each gate as a linear algebra operation on a classical data structure that represents the quantum state. A single-qubit gate is a 2×2 unitary matrix, and a two-qubit gate is a 4×4 matrix, applied to the relevant amplitudes.
After the gates, the simulator handles measurement. It either returns exact probabilities for every outcome or samples a chosen number of shots, which mimics the statistical output of real hardware. Many simulators also add noise models that insert errors such as depolarization, amplitude damping or readout errors, so that results resemble a specific device.
The core engine choice determines what the simulator can handle. The following table lists the main simulation methods and the circuits for which each one works best.
| Method | What it stores | Best suited for |
|---|---|---|
| Statevector | All 2^n complex amplitudes | General circuits up to about 30-45 qubits |
| Density matrix | A 2^n x 2^n matrix | Exact noisy simulation of small circuits |
| Stabilizer (Clifford) | A tableau of Pauli operators | Clifford circuits with thousands of qubits |
| Tensor network | A network of small tensors | Shallow or weakly entangled circuits |
| Matrix product state | A chain of tensors with bond dimension | One-dimensional, low-entanglement circuits |
Why memory grows exponentially with qubit count
A general state of n qubits needs 2^n complex amplitudes. In double precision each amplitude takes 16 bytes, so memory grows from kilobytes to petabytes over a narrow range of qubit counts. This scaling is the reason simulators cannot replace quantum computers for large, highly entangled problems.
The table below shows the memory needed for a full statevector at double precision. Single precision halves each figure, and distributed simulators split the vector across many nodes, but the doubling per qubit remains.
| Qubits | Amplitudes | Approximate memory |
|---|---|---|
| 20 | About 1 million | 16 MB |
| 30 | About 1 billion | 16 GB |
| 40 | About 1.1 trillion | 16 TB |
| 50 | About 1.1 quadrillion | 16 PB |
Density-matrix simulation is far more demanding, because it stores 4^n entries, so exact noisy simulation of more than roughly 15 qubits is already difficult on a workstation. Methods that exploit structure, such as stabilizer or tensor network simulation, avoid this wall only for circuits with limited entanglement or restricted gate sets.
Common simulators and their place in quantum software
Most quantum SDKs ship with built-in simulators, and specialized engines exist for particular workloads. Qiskit Aer offers statevector, density-matrix, stabilizer and matrix product state methods with noise models derived from IBM devices. Cirq includes its own simulators and integrates with qsim for faster statevector runs, while Stim targets large stabilizer circuits used in error correction research.
GPU acceleration has become important for larger workloads. Libraries such as NVIDIA cuQuantum, used by CUDA-Q and other frameworks, run statevector and tensor network kernels on graphics processors and can be substantially faster than CPU code for circuits above roughly 25 qubits. Cloud services such as Amazon Braket and Azure Quantum also expose managed simulators next to hardware backends.
The following comparison shows how a simulator differs from real quantum hardware in the properties that matter during development.
| Property | Simulator | Quantum hardware |
|---|---|---|
| Noise | None, or a configurable model | Real, drifting device noise |
| State access | Full amplitudes available | Only measurement outcomes |
| Scale limit | Classical memory and time | Qubit count and coherence |
| Repeatability | Deterministic with a fixed seed | Statistical variation between runs |
| Cost model | Compute time on classical machines | Queue time and per-shot fees |
Choosing a simulation approach
The right simulator depends on circuit size, gate set and the question asked. A developer verifying an algorithm needs exact amplitudes, while a researcher estimating logical error rates needs millions of fast stabilizer samples. The decision table below summarizes typical choices.
| Situation | Recommended approach | Reason |
|---|---|---|
| Debugging a 10-qubit algorithm | Statevector with exact probabilities | Full state inspection is cheap |
| Predicting results on a noisy device | Density matrix or noisy trajectories | Captures decoherence and readout errors |
| Benchmarking surface code decoders | Stabilizer simulator such as Stim | Clifford circuits scale to many qubits |
| Shallow circuit with 100 qubits | Tensor network or MPS method | Low entanglement keeps tensors small |
| Variational algorithm training | GPU statevector with gradients | Many repeated evaluations need speed |
Noisy trajectory simulation is a useful middle path. Instead of storing a density matrix, it runs many statevector simulations in which errors are inserted at random, then averages the outcomes. This keeps memory at the statevector level at the price of more repeated runs.
Limitations and common mistakes
The most frequent mistake is trusting ideal simulation results as a forecast of hardware performance. A circuit that produces the correct answer with 99 percent probability on a noise-free simulator may give near-random output on a device once gate errors and decoherence accumulate over hundreds of two-qubit gates.
- Noise models are approximations: calibrated device models miss crosstalk, drift and non-Markovian effects.
- Transpilation is often skipped: simulating the logical circuit ignores the extra SWAP gates added by qubit routing on real hardware.
- Shot count matters: estimating a probability of 1 percent to useful precision needs thousands of shots, even on a simulator.
- Classical simulability is not proof of quantum advantage: if a circuit simulates easily, it probably offers no speedup.
Simulators also play a scientific role in claims of quantum advantage. When a hardware experiment claims to outperform classical computers, improved simulation algorithms are the tool used to test or challenge that claim, and several published advantage claims have later been narrowed by better classical methods.
A non-technical view
A quantum circuit simulator is a program on an ordinary computer. It pretends to be a quantum computer. It follows each step of a quantum program and works out the result with ordinary arithmetic.
This is useful because real quantum computers are rare, noisy and expensive to use. The simulator lets people test their ideas first, a bit like a flight simulator for pilots. The catch is size. Every extra qubit doubles the work for the simulator, so it can only imitate fairly small quantum computers.
A concrete example
A university materials lab plans to compute the lowest energy level of lithium hydride using a variational quantum eigensolver. The circuit uses 12 qubits and about 200 parameterized gates. Before booking time on a cloud quantum computer, the team runs the optimization loop on a GPU statevector simulator, where each evaluation takes milliseconds and the exact energy can be compared with a classical reference calculation.
Once the algorithm converges in ideal simulation, the team adds a noise model calibrated to the target device and transpiles the circuit to its native gates and connectivity. The noisy simulation shows that the energy error grows from almost zero to several percent, so the researchers add error mitigation and shorten the circuit. Only then do they submit the final runs to hardware, which saves queue time and budget and gives them a clear baseline for judging the hardware results.