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 containSingleQubitQPDGate
s 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.
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
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
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, , 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 wire cuts incurs a sampling overhead of when classical communication is not available (the LO scenario). This is reduced to 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:
where is the quantum channel implementing the desired operation, and each is a real coefficient corresponding to a channel, , that is executable on hardware.
The results equivalent to the desired channel are obtained by first generating the coefficients, , then executing subexperiments to obtain the outcomes of the different channels in order to reconstruct the expectation values corresponding to .
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 '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 's from the equation above) which can be either positive or negative.
For some chosen parameter for the RZZGate, the six subexperiments are as follows:
- With coefficient , do nothing ()
- With coefficient , perform a ZGate on each qubit ()
- With coefficient , perform a projective measurement in the basis on the first qubit and an on the second (). If the result of the measurement is , flip the sign of that outcome's contribution during reconstruction.
- With coefficient , perform a projective measurement in the basis on the first qubit and an on the second (). If the result of the measurement is 1, flip the sign of that outcome's contribution during reconstruction.
- Same as 3. (), but swap the qubits (perform instead).
- Same as 4. (), but swap the qubits (perform 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.
Instructions | KAK decomposition angles | Sampling overhead factor |
---|---|---|
CSGate, CSdgGate, CSXGate | ||
CXGate, CYGate, CZGate, GHGate, ECRGate | ||
iSwapGate, DCXGate | ||
SwapGate | ||
RXXGate, RYYGate, RZZGate, RZXGate | ||
CRXGate, CRYGate, CRZGate, CPhaseGate | ||
XXPlusYYGate, XXMinusYYGate | (independent of ) | |
Move (cut wire in the LO scenario) | N/A |
Next steps
- Read through the page on getting started with circuit cutting using wire cuts
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