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.

Operator backpropagation (OBP)

Operator backpropagation (OBP) is a technique to reduce circuit depth by trimming operations from its end at the cost of more operator measurements. There are a number of ways in which operator backpropagation can be performed, and this package uses a method based on Clifford perturbation theory.

As one propagates an operator further through a circuit, the size of the observable to measure grows exponentially. This results in both a classical and quantum resource overhead. However, for some circuits, the resulting distribution of additional Pauli observables is more concentrated than the worst-case exponential scaling. This implies that some terms in an observable with small coefficients can be truncated to reduce the quantum overhead. The error incurred by doing so can be controlled to find a suitable tradeoff between precision and efficiency.


Installation

You can install the OBP package in one of two ways: via PyPI or building from source. Consider installing these packages in a virtual environment to ensure separation between package dependencies.

Install from PyPI

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

pip install qiskit-addon-obp

Build from source

Users who wish to contribute to this package or who want to install it manually may do so by first cloning the repository:

git clone git@github.com:Qiskit/qiskit-addon-obp.git
```_
 
and install the package via `pip`. The repository also contains example notebooks. If you plan on developing in the repository, install the `dev` dependencies.
 
Adjust the options to suit your needs:
 
```bash
pip install tox notebook -e '.[notebook-dependencies, dev]'

Theoretical background

When using the Estimator primitive, the output of a quantum workload is the estimation of one or more expectation values O\langle O \rangle with respect to some state prepared using a QPU. This section summarizes the procedure.

First, start by writing the expectation value measurement of an observable OO in terms of some initial state ψ|\psi\rangle and a quantum circuit UQU_Q:

OUψ=ψUOUψ.\langle O \rangle_{U|\psi\rangle} = \langle\psi | U^\dagger O U |\psi \rangle.

To distribute this problem across both classical and quantum resources, split the circuit UU into two subcircuits, UCU_C and UQU_Q, classically simulate the circuit UCU_C, then execute the circuit UQU_Q on quantum hardware and use the results of the classical simulation to reconstruct the measurement of the observable OO.

OBP diagram depicting splitting a circuit into two subcircuits, classically computing one of the subcircuits, then measuring the other circuit using quantum hardware

The subcircuit UCU_C should be selected to be classically simulable and will compute the expectation value

OUCOUC,\langle O' \rangle \equiv U_C^\dagger O U_C,

which is the version of the initial operator OO evolved through the circuit UCU_C. Once OO' has been determined, the quantum workload is prepared wherein the state ψ|\psi\rangle is initiated, has the circuit UQU_Q applied to it, and then measures the expectation value OO'. You can show that this is equivalent to measuring O\langle O \rangle by writing:

ψUQOUQψ=ψUQUCOUCUQψ=ψUOUψ=OUψ \langle \psi | U_Q^\dagger O' U_Q \psi \rangle = \langle \psi | U_Q^\dagger U_C^\dagger O U_CU_Q \psi \rangle = \langle\psi | U^\dagger O U |\psi \rangle = \langle O \rangle_{U|\psi\rangle}

Lastly, in order to measure the expectation value O\langle O' \rangle, we must require it to be decomposable into a sum of Pauli strings

O=PcPP,O' = \sum_P c_P P,

where cPc_P are real coefficients of the decomposition and PP is some Pauli string composed of II, XX, YY, and ZZ operators. This ensures that you can reconstruct the expectation value of OO by

ψUQOψ=PcPψUQPUQψ.\langle \psi | U_Q^\dagger O' |\psi \rangle = \sum_P c_P \langle \psi | U_Q^\dagger P U_Q | \psi \rangle.

Truncating terms

This scheme offers a tradeoff between the required circuit depth of UQU_Q, the number of circuit executions on quantum hardware, and the amount of classical computing resources needed to compute OO'. In general, as you choose to backpropagate further through a circuit, the number of Pauli strings to measure as well as the error-mitigation overhead both grow exponentially (alongside the classical resources needed to simulate UCU_C).

Fortunately, the decomposition of OO' can often contain coefficients that are quite small and can be truncated from the final measurements used to reconstruct OO without incurring much error. The qiskit-addon-obp package possesses functionality to specify an error budget, which can automatically search for terms that can be truncated, to within some error tolerance.

Clifford perturbation theory

Lastly, the qiskit-addon-obp package approaches operator backpropagation based on Clifford perturbation theory. This method has the benefit that the overhead incurred by backpropagating various gates scales with the non-Cliffordness of UCU_C (i.e. how much of U C is comprised of non-Clifford instructions).

This approach to OBP begins by splitting the simulated circuit, UCU_C, into slices:

UC=s=1SUs=US...U2U1,U_C = \prod_{s=1}^S \mathcal{U}_s = \mathcal{U}_S...\mathcal{U}_2\mathcal{U}_1,

where SS represents the total number of slices and Us\mathcal{U}_s denotes a single slice of the circuit UCU_C. Each of these slices are then analytically applied in sequence to measure the back propagated operator OO' and may or may not contribute to the overall size of the sum, depending on if the slice is a Clifford vs non-Clifford operation. If an error budget is allocated, truncation will then occur between the application of each slice.


Next steps

Recommendations