Pauli correlation encoding to reduce max-cut requirements
Usage estimate: 35 minutes on an Eagle r3 processor (NOTE: This is an estimate only. Your runtime might vary.)
Learning outcomes
After going through this tutorial, users should expect the following outcomes:
- Understand the theoretical principles behind Pauli Correlation Encoding (PCE), including how multi‑body Pauli strings enable polynomial compression of classical optimization problems.
- Implement PCE in practice to encode and solve large‑scale optimization tasks on near‑term quantum hardware.
Prerequisites
We recommend familiarity with the following topics before going through this tutorial:
Background
This tutorial presents Pauli Correlation Encoding (PCE) [1], an approach designed to encode optimization problems into qubits with greater efficiency for quantum computation. PCE maps classical variables in optimization problems to multi-body Pauli-matrix correlations, resulting in a polynomial compression of the problem's space requirements. By employing PCE, the number of qubits needed for encoding is reduced, making it particularly advantageous for near-term quantum devices with limited qubit resources. Furthermore, it is analytically demonstrated that PCE inherently mitigates barren plateaus, offering super-polynomial resilience against this phenomenon. This built-in feature enables unprecedented performance in quantum optimization solvers.
Overview
The PCE approach consists of three main steps, as illustrated in Figure 1 from [1] in below:
- Encoding the optimization problem into a Pauli correlation space.
- Solving the problem using a quantum-classical optimization solver.
- Decoding the solution back to the original optimization space.
The PCE approach is adaptable to any quantum optimization solver capable of processing Pauli correlation matrices.
In Figure 1 from [1], the max-cut problem is used as an example to illustrate the PCE approach. The max-cut problem with nodes is encoded into a Pauli correlation space, representing the optimization problem as a correlation matrix — specifically, two-body Pauli-matrix correlations across qubits . Node colors indicate the Pauli string used for each encoded node.
For example, node 1, which corresponds to binary variable , is encoded by the expectation value of , while is encoded by .
This corresponds to compressing the problem's variables into qubits. More broadly, -body correlations enable polynomial compressions of order , with . The chosen Pauli set comprises three subsets of mutually-commuting Pauli strings, allowing all correlations to be experimentally estimated with only three measurement settings.
A loss function of Pauli expectation values that imitates the original max-cut objective function is constructed. The loss function is then optimized using a quantum-classical optimization solver, such as the Variational Quantum Eigensolver (VQE).
Once the optimization is complete, the solution is decoded back to the original optimization space, yielding the optimal max-cut solution.
Requirements
Before starting this tutorial, be sure you have the following installed:
- Qiskit SDK v1.0 or later, with visualization support
- Qiskit Runtime v0.22 or later (
pip install qiskit-ibm-runtime)
Setup
# Added by doQumentation — required packages for this notebook
!pip install -q networkx numpy qiskit qiskit-aer qiskit-ibm-runtime rustworkx scipy
from itertools import combinations
import numpy as np
import rustworkx as rx
import networkx as nx
from scipy.optimize import minimize, OptimizeResult
from qiskit.circuit.library import efficient_su2
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
from qiskit.quantum_info import SparsePauliOp
from qiskit_ibm_runtime import EstimatorV2 as Estimator
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_ibm_runtime import Session
from rustworkx.visualization import mpl_draw
from qiskit_aer import AerSimulator
def calc_cut_size(graph, partition0, partition1):
"""Calculate the cut size of the given partitions of the graph."""
cut_size = 0
for edge0, edge1 in graph.edge_list():
if edge0 in partition0 and edge1 in partition1:
cut_size += 1
elif edge0 in partition1 and edge1 in partition0:
cut_size += 1
return cut_size
Small-scale simulator example
service = QiskitRuntimeService()
real_backend = service.least_busy(
operational=True, simulator=False, min_num_qubits=156
)
backend = AerSimulator.from_backend(real_backend)
print(f"We are using the {backend.name}")
We are using the aer_simulator_from(ibm_pittsburgh)
Step 1: Map classical inputs to a quantum problem
The max-cut problem
The max-cut problem is a combinatorial optimization problem that is defined on a graph , where is the set of vertices and is the set of edges. The goal is to partition the vertices into two sets, and