Skip to main contentIBM Quantum Documentation Preview
This is a preview build of IBM Quantum™ documentation. Refer to docs.quantum.ibm.com for the official documentation.

Circuit cutting

Circuit cutting is a technique to increase the size of circuits we can run on quantum hardware at the cost of an additional sampling overhead This package implements this technique; where a handful of gates and/or wires are cut, resulting in smaller circuits that are better suited for execution on hardware. These smaller circuits are then executed and the results of the original circuit are reconstructed through using classical post-processing. However, the trade-off is that the overall number of shots must increase by a factor exponential in the number of cuts made. Circuit cutting can also be used to engineer gates between distant qubits which would otherwise require a large swap overhead.

Key terms

  • subcircuits: The set of circuits resulting from cutting gates in a QuantumCircuit and then separating the disconnected qubit subsets into smaller circuits. These circuits contain SingleQubitQPDGates and are used to instantiate each subexperiment.

  • subexperiment: A term used to describe the unique circuit samples associated with a subcircuit which are sent to a QPU for execution.


Install the circuit cutting package

There are three ways to install the circuit cutting package: PyPI, building from source, and running within a containerized environment. It is recommended to install these packages in a virtual environment to ensure separation between package dependencies.

Install from PyPI

The most straightforward way to install the qiskit-addon-cutting package is via PyPI

pip install qiskit-addon-cutting

Install from source

Click here to read how to install this package manually.

If you wish to contribute to this package or want to install it manually, first clone the repository:

git clone git@github.com:Qiskit/qiskit-addon-cutting.git

and install the package via pip. If you plan on running the tutorials found in the package repository, install the notebook dependencies as well. If you plan on developing in the repository, you may also want to install the dev dependencies.

pip install tox notebook -e '.[notebook-dependencies,dev]'

Use within Docker

A dockerfile is included in the addon repository which can be used to build a docker image. There is also a compose.yaml file which allows you to use the Docker image with the following commands

Click here to read how to use this package within Docker

git clone git@github.com:Qiskit/qiskit-addon-cutting.git
cd qiskit-addon-cutting
docker compose build
docker compose up
Note

If you are using podman and podman-compose instead of docker, the commands are:

podman machine start
podman-compose --podman-pull-args short-name-mode="permissive" build
podman-compose up

Once the container is running, you should see a message similar to:

notebook_1  |     To access the server, open this file in a browser:
notebook_1  |         file:///home/$USERNAME/.local/share/jupyter/runtime/jpserver-7-open.html
notebook_1  |     Or copy and paste one of these URLs:
notebook_1  |         http://e4a04564eb39:8888/lab?token=00ed70b5342f79f0a970ee9821c271eeffaf760a7dcd36ec
notebook_1  |      or http://127.0.0.1:8888/lab?token=00ed70b5342f79f0a970ee9821c271eeffaf760a7dcd36ec

The last URL in this message will give you access to the Jupyter notebook interface.

Additionally, the home directory includes a subdirectory named persistent-volume. All work you would like to save should be placed in this directory, as it is the only one that will be saved across different container runs.


Theoretical Background

In the process of circuit cutting, there are two types of cuts: a gate or "space-like" cut where a cut goes through a gate operating on two (or more) qubits, and a wire or "time-like" cut which cut directly through a qubit wire (essentially a single-qubit identity gate that has been cut into two pieces).

There are also three scenarios to consider when preparing a circuit cutting workflow; which center around the availability of classical communication between the circuit executions. The first is where only local operations (LO) are available while the other two introduce classical communication between executions known as local operations and classical communication (LOCC). The LOCC scenarios are then grouped into either near-time, one-directional communication between circuit executions or real-time, bi-directional communication (which you might see in a multi-QPU environment).

While circuit cutting can be used to execute quantum circuits larger than what is possible on currently available hardware, it does come at a cost. Because the technique can be framed as a quasiprobability decomposition (QPD) problem, there is an exponential sampling overhead required in order to reconstruct the results. This overhead is the factor by which the overall number of shots must increase in order for the quasiprobability decomposition to result in the same amount of error, ϵ\epsilon, as you would get by executing the original circuit. Each cut gate contributes to this overhead and the amount of overhead added is dependent on the type of gate that was cut (more details on the overhead sampling can be found in final appendix of [1]).

For example, a single cut CNOT gate incurs a sampling overhead of 9 [2,6] and a circuit with nn wire cuts incurs a sampling overhead of O(16n)\mathcal{O}(16^n) when classical communication is not available (the LO scenario). This is reduced to O(4n)\mathcal{O}(4^n) when classical communication becomes available (LOCC scenario) [4]. However, wire cutting with classical communication (LOCC) is not yet supported by this package.

Formally, the QPD problem of circuit cutting can be expressed as follows:

U=iaiFi, \mathcal{U} = \sum_i a_i \mathcal{F}_i,

where U\mathcal{U} is the quantum channel implementing the desired operation, and each aia_i is a real coefficient corresponding to a channel, Fi\mathcal{F}_i, that is executable on hardware.

The results equivalent to the desired channel U\mathcal{U} are obtained by first generating the coefficients, aia_i, then executing subexperiments to obtain the outcomes of the different channels Fi\mathcal{F}_i in order to reconstruct the expectation values corresponding to U\mathcal{U}.

A short example: cutting a RZZGate

As a basic explicit example, let's consider the decomposition of a cut RZZGate (all the details can be found in [2]). A quantum circuit which contains an RZZGate can be simulated by performing six subexperiments where the RZZGate has been replaced with only single-qubit operations (these are the Fi\mathcal{F}_i's from the equation above). The results of this circuit are reconstructed by combining the results of each subexperiment alongside a set of coefficients (the aia_i's from the equation above) which can be either positive or negative.

For some chosen θ\theta parameter for the RZZGate, the six subexperiments are as follows:

  1. With coefficient a1=cos2(θ/2)a_1 = \cos^2(\theta/2), do nothing (III\otimes I)
  2. With coefficient a2=sin2(θ/2)a_2 = \sin^2(\theta/2), perform a ZGate on each qubit (ZZZ\otimes Z)
  3. With coefficient a3=sin(θ)/2a_3 = -\sin(\theta)/2, perform a projective measurement in the ZZ basis on the first qubit and an SS on the second (MzSM_z\otimes S^\dagger). If the result of the measurement is 11, flip the sign of that outcome's contribution during reconstruction.
  4. With coefficient a4=sin(θ)/2a_4 = \sin(\theta)/2, perform a projective measurement in the ZZ basis on the first qubit and an SS^\dagger on the second (MzSM_z\otimes S^\dagger). If the result of the measurement is 1, flip the sign of that outcome's contribution during reconstruction.
  5. Same as 3. (a5=a3a_5=a_3), but swap the qubits (perform SMzS\otimes M_z instead).
  6. Same as 4. (a6=a4a_6=a_4), but swap the qubits (perform SMzS^\dagger\otimes M_z instead).

Sampling overhead reference table

The below table provides the sampling overhead factor for a variety of two-qubit instructions, provided that only a single instruction is cut.

InstructionsKAK decomposition anglesSampling overhead factor
CSGate, CSdgGate, CSXGate(π/8,0,0)\left(\pi/8, 0, 0\right)3+2(2)2.8283+2\sqrt(2) \approx 2.828
CXGate, CYGate, CZGate, GHGate, ECRGate(π/4,0,0)\left(\pi/4, 0, 0\right)32=93^2=9
iSwapGate, DCXGate(π/4,π/4,0)\left(\pi/4, \pi/4, 0\right)72=497^2 = 49
SwapGate(π/4,π/4,π/4)\left(\pi/4, \pi/4, \pi/4\right)72=497^2 = 49
RXXGate, RYYGate, RZZGate, RZXGate(θ/2,0,0,)\left(\lvert\theta/2\rvert, 0, 0, \right)(1+2sin(θ))2\left(1 + 2\lvert\sin(\theta)\rvert\right)^2
CRXGate, CRYGate, CRZGate, CPhaseGate(θ/4,0,0)\left(\lvert\theta/4\rvert, 0, 0\right)(1+2sin(θ/2))2\left(1 + 2\lvert\sin(\theta/2)\rvert\right)^2
XXPlusYYGate, XXMinusYYGate(θ/4,θ/4,0)\left(\vert\theta/4\rvert, \lvert\theta/4\rvert, 0\right)(1+4sin(θ/2)+2sin2(θ/2))2\left(1 + 4\lvert\sin(\theta/2)\rvert + 2\sin^2(\theta/2)\right)^2 (independent of β\beta)
Move (cut wire in the LO scenario)N/A42=164^2 = 16

Next steps

Recommendations

References

[1] Christophe Piveteau, David Sutter, Circuit knitting with classical communication, https://arxiv.org/abs/2205.00016

[2] Kosuke Mitarai, Keisuke Fujii, Constructing a virtual two-qubit gate by sampling single-qubit operations, https://arxiv.org/abs/1909.07534

[3] Kosuke Mitarai, Keisuke Fujii, Overhead for simulating a non-local channel with local channels by quasiprobability sampling, https://arxiv.org/abs/2006.11174

[4] Lukas Brenner, Christophe Piveteau, David Sutter, Optimal wire cutting with classical communication, https://arxiv.org/abs/2302.03366

[5] K. Temme, S. Bravyi, and J. M. Gambetta, Error mitigation for short-depth quantum circuits, https://arxiv.org/abs/1612.02058

[6] Lukas Schmitt, Christophe Piveteau, David Sutter, Cutting circuits with multiple two-qubit unitaries, https://arxiv.org/abs/2312.11638

[7] Jun Zhang, Jiri Vala, K. Birgitta Whaley, Shankar Sastry, A geometric theory of non-local two-qubit operations, https://arxiv.org/abs/quant-ph/0209120