Skip to content

Best Practices

QESEM optimizes the QPU runtime required to reach the desired precision in unbiased error mitigation.

The following components affect the QPU-time required to run an algorithm:

  1. circuit
  2. observables
  3. precision
  4. QPU fidelities

The QPU-time behaves roughly like

\[ T_{\rm{QPU}} \sim A \frac{e^{C \times IF \times V_{\rm{eff}}}}{\epsilon^2} + B \]
  • \(B\): overhead of gate optimization and error characterization.

  • precision \(\epsilon\): absolute error in expectation value

  • \(IF\times V_{\rm{eff}}\): infidelity-per-gate times effective volume. The effective volume only includes gates within the effective light-cone.

Layers and volume

While Qedma's transpiler is optimized for QESEM runs, circuit compression by the user can lead to significant reduction in QPU time (both in the number of unique layers and the effective volume).

  • The total number of two-qubit-gate layers affect the error mitigation time

  • The # of unique two-qubit-gate layers affect the gate optimization, and error characterization times.

Fractional gates

QESEM uses fractional angle 2-qubits gates. This allows reduction of the quantum volume, e.g. the two are unitarily equivalent

Note

QESEM's transpilation_level=1 transpiles the circuit to include fractional gates when it reduces QPU time.

import qiskit
rzz_circ = qiskit.QuantumCircuit(2)
rzz_circ.cx(0,1)
rzz_circ.rz(0.31, 1)
rzz_circ.cx(0,1)
print(rzz_circ.draw())

rzz_circ_simple = qiskit.QuantumCircuit(2)
rzz_circ_simple.rzz(0.31, 0, 1)
print(rzz_circ_simple.draw())

assert qiskit.quantum_info.Operator(rzz_circ).equiv(rzz_circ_simple)

Observables

Light-cone

The QPU-time grows exponentially with the effective-volume, which acts as an observable's light-cone. One way to reduce the QPU-time is to choose observables composed of Pauli strings with fewer support.

For example, the magnetization \(\sum_{q=0}^4 Z_{q} / 5\) has support of 1. This might affect the choice of observables. For example, it is preferable to use the projector $$ (Z_0 + 1) / 2 $$ to measure an ancilla qubit, instead of a bitstring projector $$ \vert 00000\rangle\langle 00000\vert = \prod_{q=1}^5 \frac{Z_{q}+1}{2}$$ which contains Pauli strings of with several qubits.

Measurement bases

Qedma detects usage of more than a single measurement basis needed for an observable, and transpiles a circuit and observable to a set of circuit and Z-based observable.

For example consider $ X_0X_1X_2+Z_0Z_1Z_2$ with some circuit

observable = qedma_api.Observable(
    {"X0,X1,X2": 1.0, "Z0,Z1,Z2": 1.0}
)

trotter_circ = qiskit.QuantumCircuit(3)
trotter_circ.rx(0.55, range(3))
trotter_circ.rzz(0.31, 0, 1)
trotter_circ.rzz(0.31, 1, 2)
print(trotter_circ.draw())

Qedma's compiler detects the need of more then one measurement basis and compiles the original circuit to several circuits.

For example, the original circuit can measure the \(Z_0Z_1Z_2\) Pauli and the \(X_0X_1X_2\) can be measured on the circuit

variant_circ = qiskit.QuantumCircuit(3)
variant_circ.barrier()
variant_circ.h(range(3))
variant_circ.compose(trotter_circ, front=True, inplace=True)
print(variant_circ.draw())

Qedma's API optimizes the resources allocated to each measurement basis circuit. However, in some cases, algorithm design can bypass the need of several measurement bases.