Module 6: Simulating Quantum Circuits with Tensor Networks
Goal
After this module you can write a quantum circuit as a tensor network, simulate it with the MPS machinery of Module 3 while keeping track of the fidelity you lose at every gate, and predict when exact contraction along a contraction tree is cheaper than both.
So far every tensor network in this course came from a Hamiltonian. In Module 3 we split into two-site gates, applied them to an MPS one bond at a time, and truncated the bond with an SVD. In Module 5 we made the same tensors block-sparse. Now we drop the Hamiltonian. A quantum computer applies a list of one- and two-qubit unitaries chosen by the programmer, and the question is whether a classical computer can reproduce what comes out.
The direct answer is the state-vector simulator. Store all amplitudes and multiply each gate in. This is exact, the cost per gate is , and the memory wall sits around qubits on the largest machines. Tensor networks give two different ways around the wall. We will spend most of the module on them.
Compress the state. Keep as an MPS with bond dimension and apply gates with the TEBD step. The memory is , but every truncation costs a little fidelity. We will learn to count that loss exactly.
Do not store the state at all. Draw the whole circuit as one closed network and contract it in a clever order. Here the cost is set by the shape of the network (its treewidth), not by the number of qubits .
Which way wins depends on the question you ask: a full state, one amplitude, or one expectation value. It also depends on how much entanglement the circuit builds. We number qubits in prose; the Python code counts from .
A circuit is a tensor network
A one-qubit gate is a unitary : one input leg and one output leg . A two-qubit gate is a unitary, which we reshape into a four-leg tensor with outputs first, the same convention as the MPO in Module 4. The input state is a product of one-leg tensors. Wiring outputs to inputs in the order the gates are applied gives a network.
Definition 6.1 (Circuit tensor network).
Let a circuit apply gates to . Its tensor network has one tensor per gate and one tensor per input qubit. Every wire segment between two consecutive gates on the same qubit is a contracted index of dimension 2. The last segment of each wire is an open index . Contracting all internal indices gives the amplitudes of .
Our running example is the random brickwork circuit of Figure 6.1. Each layer applies a random one-qubit gate to every qubit and then a CZ gate to every second neighbouring pair, alternating between even and odd bonds. The one-qubit gate is the general rotation
and CZ flips the sign of . We draw time running downward: the input kets sit on top and the gates hang below them. This is the picture of Module 3, where the MPS sat on top and the gate was attached to its physical legs from below.
Figure 6.1. Three layers of a brickwork circuit on four qubits, read as a tensor network. Time runs downward. Every box is a tensor, every vertical wire segment is an index of dimension 2, and the four legs left open at the bottom carry the output state.
The network of Definition 6.1 answers different questions depending on what we attach to its open legs (Figure 6.2).
Amplitude. Cap every output leg with a bra . The network is closed and contracts to one complex number .
State. Leave the legs open. The result has entries, or far fewer if we keep it compressed as an MPS.
Expectation value. Glue the network to its own mirror image through an observable . This is again a closed network, now for . Any gate outside the backward light cone of meets its own inverse and cancels, , so for a local in a shallow circuit only a small part of the network survives.
Figure 6.2. One circuit, three contractions. Left: closing the output legs with a bit string gives an amplitude. Middle: leaving them open gives the state. Right: sandwiching an observable between the circuit and its adjoint gives an expectation value.
Schrödinger simulation with an MPS
The Schrödinger strategy keeps the state and pushes it through the circuit gate by gate. With an MPS this is exactly the TEBD loop of Module 3, now with gates picked by the programmer rather than by a Trotter formula (1,2).
One-qubit gate on qubit . Contract into the physical leg of . The bond dimensions do not change and nothing is lost.
Two-qubit gate on neighbours . Move the orthogonality centre to the pair. Merge into the two-site tensor , apply , and split with an SVD, . Keep the largest singular values (Figure 6.3).
The SVD of the matrix costs , and so does the QR that moves the centre. Applying the gate itself costs . The memory is complex numbers. Nothing here depends on .
Figure 6.3. One two-qubit gate on an MPS. Blue tensors are left-orthogonal, green ones right-orthogonal, gold marks the orthogonality centre. The gate is absorbed into the two-site tensor, which is split by an SVD whose singular values are cut to the largest D.
Because the rest of the chain is in canonical form, the singular values are the Schmidt coefficients of the whole state across the bond . That is what makes the loss of one gate easy to measure.
Proposition 6.1 (Per-gate fidelity).
Let be the normalized MPS right after a two-qubit gate, before truncation, with Schmidt coefficients across the gate’s bond (). Let be the normalized state after keeping the largest. Then
In mixed canonical form with orthonormal and orthonormal . Truncation keeps the first terms, so the unnormalized result is , where is the orthogonal projector onto . Its squared norm is . With ,
The canonical form matters. Without it the SVD of does not see the true Schmidt values, the cut is not optimal, and is not the loss.
So every truncating gate comes with a number that we get for free from the SVD we already computed. The Julia and Python notebooks return it from apply_gate2! / apply_gate2 (Hands-on 6.2).
Gates on distant qubits. A gate on with does not fit the two-site step. The standard fix is SWAP routing. Apply SWAP gates on , , …, , which carries the state of qubit to position . Then apply the gate on and swap back in reverse order. That is extra two-qubit steps, each with its own truncation and its own . quimb’s CircuitMPS does this by default (gate_contract="swap+split"), and Hands-on 6.3 (apply_gate_long!) builds it by hand. Hardware with a 2D layout therefore costs an MPS many swaps per layer. That is one reason 2D circuits are hard for a chain.
Reading out samples. A device returns bit strings, not amplitudes. An MPS in right-canonical form can be sampled exactly, one qubit at a time. With the row vector for the bits drawn so far, the conditional probability of the next bit is , because the right-orthogonal tensors to the right contract to the identity. Each sample costs and the samples are independent (Hands-on 6.4, sample_mps).
Fidelity across many gates
One gate loses . What does a circuit of gates lose? Let be the exact state after gates and the normalized MPS. The quantity we want is the circuit fidelity.
Proposition 6.2 (Multiplicative fidelity).
Under the random-sign assumption stated in the derivation below,
The product runs over truncating gates only; for the others .
Derivation (random-sign heuristic)
Apply gate to and split the result into a part along the exact state and a part orthogonal to it,
with , because is unitary and . Truncation is the projector of Proposition 6.1, with , and . Then
Now the assumption. In a scrambling circuit the kept subspace has nothing special to do with or . We assume (i) keeps the same fraction of the exact state as of the whole vector, , and (ii) the cross term is a sum of many terms with random signs, so it is negligible (of order for typical states). Both are exact at the first truncation, where . With them,
and iterating from gives . This is the argument of Zhou, Stoudenmire and Waintal (2).
Intuition
Think of as weight that has leaked out of the exact state. Each truncation throws away a fraction of whatever is there. If it throws away good and bad weight in the same proportion, the good part shrinks by the factor every time, like compound interest. The assumption can fail in either direction. If a truncation happens to remove part of the error made by an earlier one, the true is larger than the product. If it preferentially cuts weight from the exact state, is smaller. The heuristic carries no safety margin. In the worked example below the product is slightly low (pessimistic), but a run of the same recipe with another random seed (, , ) gave against a true , slightly high. The worked example tests the heuristic at fidelities down to .
The heuristic is what everyone uses in practice. It is also nice to have a statement with no assumption in it.
Theorem 6.1 (Exact fidelity bound).
For any circuit simulated with truncations of discarded weight in canonical form, let . If ,
The last form is the one quoted in (2); it is already negative, hence vacuous, once .
Proof
Work with distances instead of overlaps. Let , with . By the triangle inequality and unitarity of ,
Expand the last norm using :
since on . Hence . For unit vectors , so if ,
Finally for , which gives the last inequality in .
The bound adds up square roots of errors, the product multiplies errors. For a circuit of gates of equal error the product gives , while the bound only promises . The bound is a safety net; the product is the forecast.
Warning
After truncation the MPS has norm . If the code does not renormalize (quimb’s CircuitMPS does not), the final MPS has , which is exactly what circ.fidelity_estimate() returns. The true fidelity is then . Forgetting the denominator gives roughly instead of .
Feynman paths as a baseline. There is an even cheaper simulator. Write CZ 𝟙. Inserting this split at all CZ gates turns the circuit into a sum of terms. In each term every gate acts on one qubit, so each term (“path”) is a product state that costs memory. Summing all paths is exact, at time . Keeping one path per gate keeps a product state. For random one-qubit gates the two terms of each CZ carry equal weight on average, so the kept weight is per gate and . To hold a fixed per-gate fidelity with paths you need about of them, exponentially many. The MPS holds a fixed at a fixed cost per gate (2).
Saturation. For deep random circuits on a chain, stops changing after a while and settles at a plateau . Zhou, Stoudenmire and Waintal estimate the floor from a random-tensor model as for CZ/CNOT and for iSWAP-type gates, which have four nonzero operator Schmidt values instead of two (2). Raising pushes towards 1, but only slowly. In our circuit run to 48 layers, the mean over the last 60 CZ gates is , and for , , (printed by figures/src/make-06-fidelity.py). The next section explains why.
The entanglement barrier
Why must grow at all? Write a two-qubit gate in its operator Schmidt decomposition, the SVD of regrouped as (qubit 1 in and out) (qubit 2 in and out). CZ has (the split above). A generic two-qubit unitary, and also SWAP, has .
Proposition 6.3 (Schmidt rank grows at most by R per gate).
Let have Schmidt rank across a cut. A gate that does not cross the cut leaves the rank unchanged. A two-qubit gate with operator Schmidt rank that crosses the cut produces a state of rank at most . Consequently, after a brickwork circuit of depth , the exact bond dimension across the middle cut satisfies
Proof
A gate on one side of the cut acts as 𝟙 or 𝟙 and maps the Schmidt vectors on that side to another orthonormal set, so the rank is unchanged. For a crossing gate, is a sum of product vectors across the cut, so its rank is at most . In a brickwork circuit each bond is crossed by a gate in every second layer, which gives at most crossing gates. The second bound is the dimension of the smaller half.
For CZ circuits this says , and for generic gates up to rounding. In words: the bond dimension needed for an exact MPS grows exponentially with depth until it hits the maximum . Since , the entanglement entropy can grow at most linearly in depth.
For random circuits the bound is not reached, but the growth is still linear (3), with a smaller slope. Figure 6.4 shows the centre-bond entropy of our brickwork circuit. The exact curve climbs in steps, once every second layer (the middle bond meets a CZ only in every other layer), at about per crossing CZ on average instead of the maximum . It then approaches the Page value, the average entropy across a 6|6 cut of a random state of 12 qubits (4): at , and the Python notebook, which runs on to 96 layers, finds a plateau at . A fixed- MPS follows the exact curve until approaches , then it saturates below it. From that layer on, every crossing gate truncates, sits on its plateau, and decays exponentially in the number of gates.
Figure 6.4. Entanglement entropy (natural log) across the middle bond of the random U3 + CZ brickwork circuit with n = 12, continued to 48 layers with the same random recipe (the shaded part is the 12-layer worked example). Black: exact state vector. Coloured: MPS with D = 4, 16, 32; dotted lines mark ln D. Read off the linear growth, the saturation of the exact curve near the Page value, and how each MPS flattens out just below its own ln D.
Intuition
An MPS stores a state as a chain of “pipes” of width between neighbouring qubits. Each two-qubit gate pushes up to more entanglement through the pipe it crosses. Random gates fill every pipe at a steady rate until it is full. Once a pipe is full, the extra entanglement has nowhere to go and is cut off, and the cut-off part is exactly the discarded weight . This is the entanglement barrier: for chaotic circuits, an MPS with fidelity close to one needs exponential in . Shallow circuits, or circuits with a lot of structure (Clifford pieces, a QFT, a short-range Hamiltonian), stay below it, which is why MPS simulators are useful far beyond random circuits.
Exact contraction: treewidth and contraction trees
Now take the second road. To get one amplitude we do not need the state at all. We need to contract the closed network of Figure 6.2 (left). Module 1 showed that the contraction order can change the cost by orders of magnitude. For circuits with hundreds of tensors this effect becomes the whole story.
Definition 6.2 (Contraction tree, cost and width).
A contraction tree for a network is a binary tree whose leaves are the tensors. Each internal node contracts its two children and into one tensor. Write for the set of open indices of the tensor at node and for the dimension of index . For a network where every index joins two tensors, (symmetric difference: shared indices are summed away). The width and the cost of the tree are (5)
The largest intermediate tensor has entries, so measures memory. counts scalar multiplications (each node loops once over every index that either child carries). For qubit wires and is simply the largest number of open legs.
ABCDabcdall bonds of size wABCDroot: { }, cost w2AB: {b,d}CD: {b,d}C = 2 w3 + w2, W = 2 log2 wFigure 6.5. A closed ring of four tensors, every bond of dimension w, and one contraction tree for it. Contracting A with B costs w³ (the loop runs over a, b, d) and leaves a tensor with legs b and d; the same holds for C with D; the root costs w². Pairing A with C first would instead form an outer product with four legs, so W = 4 log₂ w (see the homework).
Two natural orders for a circuit are worth naming, and the notebooks compute and of Definition 6.2 for both (Hands-on 6.5).
Time order absorbs the gates one by one into the input. The intermediate is the state vector, so , the Schrödinger simulator.
Qubit order absorbs whole wires one by one. The intermediate keeps the legs of every gate that crosses the current cut between wires. A four-leg CZ tensor leaves two of them (its input and output on the far wire), so with about crossing gates . The notebooks use these four-leg tensors and print at and at for : the qubit order wins for shallow circuits and loses once approaches .
Split gates first. Write each CZ as two three-leg tensors joined by a bond of dimension (its operator Schmidt decomposition). Now each crossing gate leaves a single leg, the qubit order has , and it is the exact-contraction twin of Proposition 6.3. cotengra does this kind of split automatically (see below).
The best order cuts the network along its “thinnest” direction, which is what treewidth measures.
Theorem 6.2 (Markov and Shi).
Let a circuit have gates and let be its underlying graph (vertices are gates, inputs and outputs, edges are wires). If has treewidth , then any amplitude or output probability can be computed deterministically in time (6).
Proof sketch
Orders are eliminations. Contracting a network edge by edge is the same as eliminating vertices of its line graph, whose vertices are the wires of , two of them adjacent when they meet at a gate. At each step the intermediate tensor carries the indices that are neighbours of the eliminated set.
Best elimination = treewidth. Over all elimination orders, the smallest possible value of the largest neighbourhood met at an elimination step equals . This is a standard fact about tree decompositions: a tree decomposition of width gives an elimination order in which every eliminated vertex has at most neighbours, and conversely.
Count. With , eliminating one index merges the tensors that carry it into a tensor with at most indices, and the loop runs over at most indices, so it costs . There are indices to eliminate, which gives .
Back to . For graphs of maximum degree , . Two-qubit gates have degree at most 4, so . A tree decomposition of width can itself be found in time polynomial in times , which fits the bound.
Intuition
Imagine sweeping a curtain through the network. Behind the curtain everything is contracted; the curtain itself is the set of open legs of the big intermediate tensor. Treewidth is the width of the thinnest curtain that can sweep the whole network, allowing it to bend and branch. For an brickwork, the curtain can run along time (width ) or along the qubits (width about ), so . Shallow circuits are easy at any ; deep circuits on few qubits are easy at any ; deep and wide is hard.
Theorem 6.2 says what is possible; it does not say how to find a good tree, and finding the optimal one is itself NP-hard. Practical path finders are heuristics.
Greedy. Repeatedly contract the pair whose result is smallest relative to its inputs. Fast, often good, sometimes very bad.
Hyper-optimized. Gray and Kourtis sample many trees from randomized greedy and recursive graph-partitioning builders (KaHyPar hypergraph bisection), tune their hyperparameters with Bayesian optimization, and keep the best (5). This is cotengra. Before searching, it also simplifies the network exactly: diagonal gates such as CZ become hyperedges, rank-1 and rank-2 tensors are absorbed, and gates are split by an exact SVD.
Figure 6.6 shows both on our brickwork circuit, for one amplitude . Up to both find trees with (the qubit-order curtain), and their costs agree. Beyond that greedy keeps following the same plan and climbs to 17 at . The hyper-optimizer switches to a curtain of width about , so its width levels off at 13 to 14 and its cost at , a factor of about 24 below greedy at . The point at (, ) is not a free lunch: at that depth the exact simplification alone contracts the whole network to a single tensor, and counts only the work left for the tree after simplification.
Figure 6.6. Exact contraction of one amplitude of the n = 12 U3 + CZ brickwork circuit, as a function of depth. Left: base-10 logarithm of the cost C. Right: the width W of the contraction tree. Orange: greedy; blue: cotengra's hyper-optimizer with 8 trials. Read off that W grows like L/2 while depth is the thin direction, and that a good path finder caps it near n = 12 (dotted) once the qubit direction is thinner.
Proposition 6.4 (Slicing trades memory for time).
Fix the values of a set of indices with . The network splits into independent networks, one per assignment, whose results add up to the original. Contracting each slice with the same tree, the sliced width and the total cost satisfy
Memory drops by at most , and the total work never decreases.
Proof
Sums commute, so : summing the indices of last gives the same number. Fixing deletes those legs, at most of them from any intermediate, so no intermediate shrinks by more than a factor ; that is . At node a slice loops over , so its cost there is at least of the unsliced cost, with equality only when that node carries every sliced index. Summing over nodes and multiplying by the slices gives . Nodes that carry no sliced index simply repeat the same work in every slice.
Slicing (Proposition 6.4) is how large contractions are spread over many processors, each holding one slice (7). Slice every index and you are back at the Feynman path sum: memory , time exponential in the number of gates. Slicing interpolates between the two.
Random circuit sampling, and where the line is
Google’s 2019 Sycamore experiment (8) ran random circuits on 53 qubits with 20 cycles and estimated a total fidelity of about , measured with the linear cross-entropy benchmark (XEB)
which is 0 for uniform noise and about 1 for a perfect device running a fully scrambled circuit, whose ideal probabilities follow the Porter-Thomas (exponential) distribution. For a circuit that is not yet scrambled the ideal value can be larger: the Python notebook prints for our 12-layer example. The classical answers came from exactly the tools of this section.
Pan, Chen and Zhang contracted a sliced network only once and generated uncorrelated samples from an approximate state of fidelity , in 15 hours on 512 GPUs (9). It built on their big-batch method for many correlated amplitudes at once (10).
The key trick uses the low target. Cutting edges of the network lowers the fidelity to about , but lowers the contraction cost by much more than . A classical simulator only has to match the device’s , not reach .
Two cautions belong to this story. First, XEB is a proxy for , and it can disagree with it. In the noisy-gate simulations of Zhou, Stoudenmire and Waintal, XEB overestimated the true fidelity by about a factor of 10 at per-gate fidelity (2). Second, the line moves. Google’s 2024 experiment (67 qubits, 32 cycles, ) argues that at weak enough noise the circuit keeps global correlations that both MPS truncation and edge-cutting destroy (11). Treat that as the current frontier, not as a settled verdict.
Beyond the chain: loopy networks, BP and the Heisenberg picture
Real devices are not chains. IBM’s 127-qubit Eagle processor has a heavy-hex layout, and in 2023 IBM used it to run a kicked Ising circuit,
reporting expectation values beyond exact simulation (12). Classical simulations followed within weeks. Two lines of attack are worth knowing: tensor network states on the device graph, and the Heisenberg picture.
Tensor network states on the device graph. Put one tensor per qubit and a diagonal matrix on every edge of the heavy-hex graph, the same form as the Vidal gauge of Module 2. A two-qubit gate is applied by the “simple update”: absorb the s around the edge, apply the gate, SVD, truncate, put the new singular values on the edge. On a chain this is TEBD in the Vidal form. On a graph with loops there is no canonical form, and the question is how to choose the gauge. Tindall and Fishman showed that belief propagation (BP) does it (13). Each edge carries two messages , matrices that approximate the environment of seen through that edge; they are iterated to a fixed point, and the square roots of the messages define the gauge transformation (Figure 6.7).
mmcircles: Gammav, one per qubitdiamonds: Lambdae on each edgearrows: BP messages mv to won a tree: BP gauge = canonical formwith loops: an approximation thatignores correlations around the loopFigure 6.7. A loop of six qubit tensors in the Gamma-Lambda form. Belief propagation passes messages along the edges until they stop changing; on a loop-free graph the result is the exact canonical form, on a graph with loops it is the best rank-one guess for each environment. Heavy-hex loops have 12 sites.
On a tree, BP converges to the exact environments and the BP gauge equals the canonical form. On a loopy graph it neglects correlations that travel around loops, and the error shrinks as loops get longer. Heavy-hex loops have 12 qubits. Tindall, Fishman, Stoudenmire and Sels used this to reproduce the IBM data more accurately than the device (14). The average magnetization at 5 steps came out in under 10 seconds on a laptop, to about , because the light cone has not yet wrapped around any loop, so BP is exact there. Weight-10 and weight-17 observables took a few minutes and 0.3 GB.
The Heisenberg picture. To compute we can also evolve the observable backwards, , and only evaluate it on at the end. For Pauli rotations there is a closed rule.
Proposition 6.5 (Pauli rotation rule).
Let and be Pauli strings and . Then
and is again a Hermitian Pauli string.
Proof
If and commute, commutes with and . If they anticommute, , so for any power series , and . Then
using 𝟙. Finally , and a product of two Pauli strings is a Pauli string up to a phase.
Each non-commuting rotation turns one Pauli string into two. At Clifford angles, , one of the two coefficients vanishes, so Clifford gates never branch. In the kicked Ising circuit the part is Clifford and only the kicks branch. Sparse Pauli dynamics keeps a dictionary of Pauli strings and coefficients, applies gate by gate, and drops strings with tiny coefficients. Begušić, Gray and Chan showed that this, and a mixed scheme that evolves the state forward with a BP-gauged PEPS and the operator backward with a PEPO and meets in the middle, converges the IBM observables to an error below 0.01 at 20 steps, at an effective bond dimension above (15). The lesson repeats: the cost is set by the question (one local observable), not by .
Remark 6.1 (Noise as an MPO).
A noisy circuit acts on density matrices. Vectorize into an MPS with local dimension 4 (an MPO), and each noise channel becomes a local operator. For noisy 1D random circuits at a fixed gate error rate, the operator entanglement of peaks at an intermediate depth, and its maximum is bounded by a constant that depends on the error rate but not on the number of qubits. Above a characteristic system size, adding qubits therefore no longer makes the MPO simulation exponentially more expensive. The cost still grows exponentially as the error rate goes down (16).
Remark 6.2 (Clifford-augmented MPS).
Write , where is a Clifford circuit kept symbolically as a stabilizer frame and is an MPS. Clifford gates only update ; a non-Clifford gate is conjugated through into a Pauli rotation and applied to the MPS. Entanglement then grows only at non-Clifford gates (17). A related construction expands the MPS in a stabilizer basis instead (18).
Remark 6.3 (Approximate contraction).
Between exact contraction and an MPS lies approximate contraction: follow a contraction tree but compress each large intermediate to bond dimension , choosing the tree to keep the compressions cheap and accurate. This works for networks of arbitrary geometry (19). A related idea applies a whole layer of gates and then recompresses variationally, with DMRG-like sweeps from Module 4(20).
Software landscape
You will rarely write a production circuit simulator yourself. The table lists open tools and the job each one is good at (21,22).
Package (language)
What it does
Use it for
quimb CircuitMPS, Circuit + cotengra (Python)
MPS with max_bond, cutoff and a fidelity estimate; exact contraction with hyper-optimized trees and slicing
both roads in one library; this course’s quimb notebook
ITensorMPS.jl apply (Julia)
gate lists applied to an MPS with maxdim, cutoff
circuits next to ITensor DMRG code
TensorNetworkQuantumSimulator.jl (Julia)
tensor network states on any graph; BP or boundary-MPS expectation values
heavy-hex and 2D devices
Yao.jl + YaoToEinsum, OMEinsum.jl (Julia)
circuit to einsum network; TreeSA, greedy, KaHyPar orders
exact amplitudes of a Yao circuit
PastaQ.jl (Julia)
MPS and MPO circuits with noise, on ITensors
noisy circuits; plain circuits now go to ITensorMPS
Qiskit Aer (C++, Python)
matrix_product_state method on CPU, tensor_network method on GPU
differentiable simulation on JAX, TensorFlow, PyTorch; cotengra paths
variational circuits that need gradients
QTensor (Python)
bucket elimination with line-graph orders, GPU
QAOA energies on many qubits
Worked example: a random brickwork circuit
We now put numbers on the first road. The circuit is the one of Figure 6.1 with qubits and depth . Layer applies to every qubit, with angles uniform in from numpy.random.default_rng(2026) drawn layer by layer, qubit by qubit, in the order . It then applies CZ to the pairs for in the 0-based code numbering. That makes 66 CZ gates, 6 of which cross the middle bond. We run quimb’s CircuitMPS with max_bond and cutoff=1e-12, and compare with the exact state from CircuitDense. The quimb notebook prints the columns; figures/src/make-06-fidelity.py prints every column below.
gates cut
true
unnormalized
bound
2
45
2.55
0.066017
0.066252
0.004374
none
4
28
0.524
0.584765
0.588641
0.344217
none
8
15
0.0510
0.949994
0.950642
0.903104
0.478
16
6
7.2e-5
0.999928
0.999928
0.999856
0.99953
32
3
4.8e-8
1.000000
1.000000
1.000000
1.000000
64
3
2.0e-12
1.000000
1.000000
1.000000
1.000000
“Gates cut” counts the CZ gates whose truncation discarded weight above , “unnormalized” is without dividing by the norm, and “bound” is from (none when ).
Figure 6.8. Fidelity of the n = 12, L = 12 brickwork MPS simulation against bond dimension D. Blue: true fidelity of the normalized MPS with the exact state. Orange: quimb's fidelity estimate, the product of the per-gate fidelities. Grey: the overlap of the unnormalized MPS, which is roughly the square of F. Read off how closely the product tracks the truth, and the jump from F = 0.95 to F = 1 between D = 8 and D = 16.
The product works. agrees with the true to within at , where 28 truncations brought down to , and to within at (, 45 truncations). The heuristic of Proposition 6.2 is in good shape.
The unnormalized overlap is the square. At , : the unnormalized overlap is exactly (true ) (squared norm), and the squared norm is the estimate. This is the pitfall in the warning box, in numbers.
The bound is a safety net. At , and guarantees (the weaker form gives ), while the truth is . At , and the bound says nothing.
Exact at . By Proposition 6.3 with and 6 crossing CZs, the middle bond never needs more than . At only of weight is lost. The cutoff trims the largest bond actually used at to 51.
Entanglement. The exact middle-bond entropy after 12 layers is , far from the Page value 3.66. Continuing the same recipe to 48 layers (Figure 6.4) gives at and at . At the estimated fidelities are , and for , , : once reaches , decays exponentially.
Exact contraction of one amplitude (Figure 6.6). At both path finders give and , tiny. At greedy needs , ; the hyper-optimizer needs , . For this small the full state vector () is never far away, so the comparison is about orders and constants. At the same gap decides between feasible and infeasible.
Warning
Deep, chaotic, wide circuits. Once the entanglement entropy reaches , each crossing gate loses a roughly fixed , and decays exponentially in the number of gates. Doubling only buys a constant number of extra layers.
2D connectivity on a chain. SWAP routing multiplies the number of truncating gates. Use fat MPS sites, a 2D TNS, or exact contraction instead.
Structure the method ignores. Plain MPS truncation pays for Clifford entanglement it could have tracked for free (Remark 6.2), treats a noisy device as if it were pure (Remark 6.1), and exact contraction gives up entirely where approximate contraction still works (Remark 6.3).
A wrong fidelity. Forgetting to normalize the truncated MPS gives roughly ; using the bound instead of the product gives a uselessly pessimistic number; reporting XEB as if it were can be off by a large factor.
Default path finders in scripts. cotengra’s default hyper-optimizer starts a process pool, which breaks unless the script body sits under if __name__ == "__main__":. Passing parallel=False is not enough on its own, because some trials call the random-greedy presets, which start their own pool. Pass an explicit optimizer, keep the __main__ guard, and re-register those presets as serial (the Python and quimb notebooks show how).
Why it matters
Every claim of quantum advantage is a claim about classical simulation, and the tools that test those claims are the ones in this course: the TEBD step and the discarded weight, canonical forms and their BP generalisation, and contraction order. The useful habit is to ask first which question the experiment answers (a state, samples, an amplitude, a local expectation value), and then pick the representation whose cost driver (entanglement, treewidth, operator spread) is small for that question.
Further reading
Vidal, the original argument that slightly entangled quantum computations are efficiently simulable with gate-by-gate SVDs (1).
Zhou, Stoudenmire and Waintal, MPS simulation at finite fidelity, the product rule, the bound and the saturation plateau (2); the DMRG-style variant (20).
Markov and Shi, treewidth and exact contraction (6); Gray and Kourtis, hyper-optimized contraction trees and cotengra (5); slicing (7).
Random circuit sampling, classical side (9) and the 2024 experiment (11).
The IBM utility experiment (12) and two answers to it: BP-gauged tensor networks (13,14) and Heisenberg-picture methods (15).
Vidal G. Efficient classical simulation of slightly entangled quantum computations. Physical Review Letters. 2003;91(14):147902.
2.
Zhou Y, Stoudenmire EM, Waintal X. What Limits the Simulation of Quantum Computers? Physical Review X. 2020;10:041038.
3.
Nahum A, Ruhman J, Vijay S, Haah J. Quantum entanglement growth under random unitary dynamics. Physical Review X. 2017;7(3):031016.
4.
Page DN. Average entropy of a subsystem. Physical Review Letters. 1993;71(9):1291–4.
5.
Gray J, Kourtis S. Hyper-optimized tensor network contraction. Quantum. 2021;5:410.
6.
Markov IL, Shi Y. Simulating Quantum Computation by Contracting Tensor Networks. SIAM Journal on Computing. 2008;38(3):963–81.
7.
Huang C, Zhang F, Newman M, Ni X, Ding D, others. Efficient parallelization of tensor network contraction for simulating quantum computation. Nature Computational Science. 2021;1:578–87.
8.
Arute F, Arya K, Babbush R, others. Quantum supremacy using a programmable superconducting processor. Nature. 2019;574(7779):505–10.
9.
Pan F, Chen K, Zhang P. Solving the Sampling Problem of the Sycamore Quantum Circuits. Physical Review Letters. 2022;129:090502.
10.
Pan F, Zhang P. Simulation of Quantum Circuits Using the Big-Batch Tensor Network Method. Physical Review Letters. 2022;128(3):030501.
11.
Morvan A, others. Phase transitions in random circuit sampling. Nature. 2024;634:328–33.
12.
Kim Y, Eddins A, Anand S, Wei KX, van den Berg E, Rosenblatt S, et al. Evidence for the utility of quantum computing before fault tolerance. Nature. 2023;618:500–5.
13.
Tindall J, Fishman M. Gauging tensor networks with belief propagation. SciPost Physics. 2023;15:222.
14.
Tindall J, Fishman M, Stoudenmire EM, Sels D. Efficient Tensor Network Simulation of IBM’s Eagle Kicked Ising Experiment. PRX Quantum. 2024;5:010308.
15.
Begušić T, Gray J, Chan GK-L. Fast and converged classical simulations of evidence for the utility of quantum computing before fault tolerance. Science Advances. 2024;10(3):eadk4321.
16.
Noh K, Jiang L, Fefferman B. Efficient classical simulation of noisy random quantum circuits in one dimension. Quantum. 2020;4:318.
17.
Liu Z, Clark BK. Classical simulability of Clifford+T circuits with Clifford-augmented matrix product states. Physical Review Research. 2026;8:023116.
18.
Masot-Llima S, Garcia-Saez A. Stabilizer Tensor Networks: Universal Quantum Simulator on a Basis of Stabilizer States. Physical Review Letters. 2024;133(23):230601.
19.
Gray J, Chan GK-L. Hyperoptimized Approximate Contraction of Tensor Networks with Arbitrary Geometry. Physical Review X. 2024;14:011009.
20.
Ayral T, Louvet T, Zhou Y, Lambert C, Stoudenmire EM, Waintal X. Density-Matrix Renormalization Group Algorithm for Simulating Quantum Circuits with a Finite Fidelity. PRX Quantum. 2023;4:020304.
21.
Gray J. quimb: a python package for quantum information and many-body calculations. Journal of Open Source Software. 2018;3(29):819.
22.
Fishman M, White SR, Stoudenmire EM. The ITensor Software Library for Tensor Network Calculations. SciPost Physics Codebases. 2022;4.