A framework for efficiently estimating Pauli string observables with bounded-depth measurements
This project implements methods from:
Katherine Van Kirk, Christian Kokail, Jonathan Kunjummen, Hong-Ye Hu, Yanting Teng, Madelyn Cain, Jacob Taylor, Susanne F. Yelin, Hannes Pichler, and Mikhail Lukin. Derandomized shallow shadows: Efficient Pauli learning with bounded-depth circuits.
arXiv:2412.18973
It provides tools to run the derandomized shallow shadows (DSS) algorithm, which optimizes shallow measurement circuits for learning a given set of Pauli strings. The algorithm specifies some set of measurement circuits, which rotate into the desired measurement bases. Crucially, these measurement circuits each contain at most depth
- 🧮 Homemade, special-purpose tensor network contraction functions
- 📉 Compute cost functions based on probability of learning a set of Pauli strings
- 🎯 Optimize short-depth measurement circuits using derandomization
- 🧰 Configure derandomization procedure via a central
DSSConfig - 💻 Command-line and Python API interfaces
- 🧩 Only dependency is Numpy
Clone and install from GitHub:
git clone https://github.com/katherinevankirk/dss.git
cd dss
pip install -e .DSS can be run via the command line or directly as a Python library. We include two example Pauli string files for demonstration:
- 📄
pauli_strings_30.txt: a realistic workload of 30 unique 8-qubit Pauli strings. - 📄
pauli_strings_bell.txt: a minimal test case of 3 commuting Pauli strings, diagonal in the Bell basis.
The DSS algorithm will terminate when either:
- The total number of measurements is reached, or
- Each Pauli observable is measured
measurements_per_observabletimes.
python run_dss.py \
--N 8 \
--depth 3 \
--eta 0.9 \
--max_num_measurements 100 \
--pauli_file pauli_strings_30.txtfrom dss.config import build_config_from_file
from dss.derandomization import full_derandomization
config = build_config_from_file(
pauli_filepath="pauli_strings_bell.txt", # all Pauli strings should be stored in a .txt file with one string per line, each of length N
weights_filepath=args."weights.txt", # (optional) create a file with one float per line, corresponding to relative importance of each Pauli string
N=8, # the length of the Pauli strings (i.e., number of qubits)
depth=3, # the maximum allowed depth of the measurement circuit
eta=0.9, # a noise-tolerance hyperparameter (often set as ε²)
max_num_measurements=300, # the maxium number of measurements you could make
measurements_per_observable=100 # the cap for how often each observable is measured
)
results = full_derandomization(config)dss/
├── config.py # DSSConfig, file loading
├── gates.py # Quantum gate definitions
├── circuit.py # Dressing, single/two-qubit gate processing
├── tensor_constractions.py # State prep, twirling, contractions
├── cost.py # Cost and weight functions
├── derandomization.py # Optimization logic
run_dss.py # Command-line entry point
The Derandomized Shallow Shadows (DSS) algorithm provides an efficient strategy for learning Pauli observables using bounded-depth quantum circuits. In many quantum applications (e.g. chemistry, simulation, phase recognition), we must estimate expectation values of many Pauli strings. However, directly estimating each Pauli string is inefficient, grouping strategies require large circuit depth, and while shallow shadow schemes are low depth, they are not tailored to the specific Pauli learning problem. Indeed usually we know ahead of time what Paulis we want to estimate in our experiment. DSS avoids randomization by systematically selecting measurement circuits that maximize Pauli learnability under depth constraints.
At a high level, the algorithm derandomizes each measurement with the following steps:
- Fixes a shallow ansatz a depth-
dquantum circuit with N qubits - Chooses 2-qubit gates from a discrete set (e.g., CNOT, SWAP)
- Chooses 1-qubit gates from a discrete set (e.g., H, S)
- Returns the final measurement circuit
This mimics a greedy walk through the configuration space, favoring setups that are globally effective. DSS efficiently evaluates each candidate circuit using tensor network methods that computes the expected information gain from that layout. In other words, the DSS algorithm scores circuits based on the probability of learning all Pauli strings, and it always selects the configuration that minimizes this expected cost. The tensor network methods make the algorithm scalable, even for many strings and large qubit counts. See our preprint arXiv:2412.18973 for theoretical details, performance guarantees, and benchmarks against previous bounded-depth learning strategies. The Pauli string estimates are guaranteed to be at least as good as if one used
The output of the DSS algorithm is a set of depth-d measurement circuits. These measurement circuits are the measurements that one should then make on the quantum computer to efficiently learn the given set of Pauli strings. The circuits are specified by specifying the 1- and 2-qubit gates. Choices of eta, max_num_measurements, measurements_per_observable, and (optionally) weights will affect how many and which measurement circuits are chosen. Specifying weights for each desired Pauli string lets you prioritize learning some Paulis over others. And broadly speaking, a smaller eta corresponds to the algorithm prioritizing learning all given Paulis as many times as possible, and a larger eta leads the algorithm to want to learn all given Paulis at least once.
If you use DSS in your research, please cite:
@article{vankirk2024derandomized,
title={Derandomized shallow shadows: Efficient Pauli learning with bounded-depth circuits},
author={Van Kirk, Katherine and Kokail, Christian and Kunjummen, Jonathan and Hu, Hong-Ye and Teng, Yanting and Cain, Madelyn and Taylor, Jacob and Yelin, Susanne F and Pichler, Hannes and Lukin, Mikhail},
journal={arXiv preprint arXiv:2412.18973},
year={2024}
}
MIT License.