Classical Shadows: Estimate Many Pauli Observables from Random Shots

Classical Shadows: Estimate Many Pauli Observables from Random Shots

Randomly measure in the X, Y, or Z basis, turn each result into an unbiased snapshot, and reuse the same data to estimate several observables.

A full density matrix is often more information than you need. If the goal is to predict a handful of observables, classical shadows offer a different idea: collect randomized measurement results once, then reuse their classical records to estimate several properties.

One qubit, three possible measurement bases

For each copy of a qubit, choose one Pauli basis uniformly: X, Y, or Z. Measure and record the basis P and the outcome s, where s is +1 or -1. Let |b_P⟩ be the measured eigenstate. The corresponding one-qubit snapshot is

ρ̂ = 3|b_P⟩⟨b_P| - I = (I + 3sP)/2

A single snapshot is random and need not itself be a physical density matrix. The useful guarantee is that its average over random bases and outcomes equals the true state: E[ρ̂] = ρ.

Now consider an observable O = a_X X + a_Y Y + a_Z Z. A shot measured in basis P contributes 3s a_P to its estimate. Averaging these contributions over all shots is unbiased, because each basis is chosen one third of the time. The same records can estimate all three Pauli expectations, not just the one chosen in advance.

Here is a small simulation. It prepares synthetic measurement records for a qubit whose exact Bloch-vector components are known, then estimates those components from random Pauli measurements:

import numpy as np

rng = np.random.default_rng(7)
bloch = np.array([0.3, -0.4, 0.7])  # exact <X>, <Y>, <Z>
shots = 12_000
basis = rng.integers(0, 3, size=shots)  # 0:X, 1:Y, 2:Z
p_plus = (1 + bloch[basis]) / 2
outcome = np.where(rng.random(shots) < p_plus, 1, -1)

estimate = np.array([
    3 * outcome[basis == k].sum() / shots
    for k in range(3)
])
print(np.round(estimate, 3))

With this seed, the estimates are [0.286, -0.405, 0.683], close to the exact [0.3, -0.4, 0.7]. The gap is ordinary finite-shot noise, not a failure of the method.

What the shortcut does and does not buy

For several qubits, random local Pauli measurements produce snapshots built from one-qubit pieces. This lets one dataset serve multiple target observables. It does not make every prediction cheap: the number of shots depends on the observables and the measurement scheme, and some high-weight Pauli terms can be costly. A classical shadow is best thought of as a reusable estimator, not a free reconstruction of every detail of the quantum state.

For the formal protocol and guarantees, see the original classical-shadows paper. For a practical discussion of random Pauli measurements and post-processing, see the Mitiq shadows tutorial.