Skip to content
Quantum ComputingAN INTERACTIVE OPEN TEXTBOOK
charithj.com.au

Classical shadows

Reuse a record of random measurements to estimate many selected properties of a quantum state.

Undergraduate18 min lessonDr. Charith Jayasekara↓ Chapter PDF
By the end, you’ll be able to
  • Construct a single-qubit classical snapshot.
  • Estimate observables from recorded settings and outcomes.
  • Explain the roles of precision, confidence and measurement choice.

Before you begin: Pauli measurements, expectation values, density matrices and sampling uncertainty.

A quantum device repeatedly prepares the same state. We may want several properties: a spin expectation, correlations between qubits, or terms in a Hamiltonian. Reconstructing every density-matrix entry can be much more work than the task requires. Classical shadows use random measurement choices and classical post-processing to estimate selected properties from one reusable dataset.

The word “shadow” describes a classical record supporting predictions. The record contains measurement settings and outcomes. Fresh preparations are still required for new measurements; the procedure does not preserve an extra physical copy of the unknown state.

We will study the local Pauli version. On each qubit, choose X, Y or Z independently and uniformly, then measure in that basis. Store both the chosen basis and the resulting bit. Use eigenvalue s=+1s=+1 for bit 0 and s=−1s=-1 for bit 1.

If the selected basis is P∈{X,Y,Z}P\in\{X,Y,Z\} and the measured eigenvalue is ss, form the estimator

ρ^=I+3sP2.\hat\rho=\frac{I+3sP}{2}.

It need not be a physical density matrix. For example, a Z measurement with outcome zero gives ρ^=diag⁡(2,−1)\hat\rho=\operatorname{diag}(2,-1). Negative eigenvalues are allowed in this intermediate statistical estimator. Averaging over random settings and outcomes gives

E[ρ^]=ρ.\mathbb E[\hat\rho]=\rho.

To estimate ⟨Z⟩\langle Z\rangle, take Tr⁡(Zρ^)\operatorname{Tr}(Z\hat\rho). This equals 3s3s if the selected basis was Z, and zero if it was X or Y. The factor three compensates for using the matching basis only one third of the time.

Checkpoint. Does a snapshot value of 3 mean the physical spin exceeded its allowed range? No. Individual estimators can lie outside the observable’s physical range; their mean estimates the expectation value.

Suppose the device prepares ∣0⟩|0\rangle. A possible record is:

ShotBasisOutcome bitZ estimatorX estimator
1X003
2X10-3
3Y000
4Y100
5Z030
6Z030

The means are ⟨Z⟩^=1\widehat{\langle Z\rangle}=1 and ⟨X⟩^=0\widehat{\langle X\rangle}=0, matching the ideal values for this illustrative record. Y outcomes contribute to the Y estimate in the same way. Six shots are enough to demonstrate the arithmetic; reliable precision needs a substantially larger dataset and uncertainty estimates.

For one qubit, the mean Z estimator has second moment 3 under uniform basis selection. Since its mean is ⟨Z⟩\langle Z\rangle, its variance is 3−⟨Z⟩23-\langle Z\rangle^2. For ∣0⟩|0\rangle, this is 2, giving standard error 2/N\sqrt{2/N} for NN independent snapshots. Directly measuring Z every time is more efficient when Z is the only target. Shadows become attractive when a shared record supports many targets.

For multiple qubits, tensor together the single-qubit estimators. To estimate a weight-kk Pauli string, use the score 3k3^k times the product of measured signs if every nonidentity factor’s basis matches; otherwise use zero. For Z1Z2Z_1Z_2, a matching ZZ shot contributes 9s1s29s_1s_2. Such matches occur with probability 1/91/9 under uniform independent choices.

This gives an important cost trade-off. For MM weight-at-most-kk Pauli observables, suitable aggregation can achieve additive error ϵ\epsilon and failure probability δ\delta using a sample scale

N=O ⁣(3kϵ2log⁡Mδ).N=O\!\left(\frac{3^k}{\epsilon^2}\log\frac{M}{\delta}\right).

The favourable logarithmic dependence on the number of targets comes with dependence on locality, precision and confidence. It should not be read as efficient prediction of every possible global property. Other shadow ensembles have other guarantees.

Classical shadows: save the basis as well as the outcomeThree measurement circuits for the same prepared state: Z measurement directly; X measurement uses H; Y measurement uses S dagger followed by H. A six-shot original record shows single-shot Z scores zero, zero, zero, zero, three, three, with mean one. Classical shadows: save the basis as well as the outcome Z basis ρ X basis ρ H Y basis ρ S† H Select X, Y or Z uniformly for each fresh preparation. Stored shot = (basis, outcome). Z score = 3s in Z; zero in X or Y. 0 1.5 3 X0 X1 Y0 Y1 Z0 Z0 Z estimate = (0 + 0 + 0 + 0 + 3 + 3)/6 = 1
Actual X, Y and Z measurement circuits, followed by the six-shot example's Z estimator values.

To measure Z, measure directly. To measure X, apply HH first. To measure Y, apply S†S^\dagger and then HH. All three finish with the device’s Z measurement. A classical random selector chooses the basis for each shot, independently on each qubit. The example plot shows the six individual Z estimator scores; their average is the final estimate.

Generate fresh records for ∣0⟩|0\rangle, ∣+⟩|+\rangle and (∣0⟩+i∣1⟩)/2(|0\rangle+i|1\rangle)/\sqrt2. Choose target observables after collecting the record. Keep the dataset fixed while changing the target; this demonstrates reuse. Repeat the whole collection with a new random seed to see sampling variation. Add a known readout error and distinguish its bias from finite-shot fluctuations.

  1. A Z-basis shot returns bit 1. What is its Z score?

  2. An XY shot is used to estimate ZZ. What is its score?

  3. Why save the settings as well as the bits?

Worked answers
  1. −3-3.

  2. zero; the required bases did not both match.

  3. a bit’s interpretation depends on the measured basis.

PAUSE & THINK

What is the reusable object?

Choose your answer

Classical shadows trade full reconstruction for targeted prediction. Their value is clearest when many accessible observables share one carefully recorded experiment.

Huang, Kueng and Preskill, original classical-shadows paper and local-Pauli analysis. The six-shot table, single-qubit variance calculation, activities and figure above are original teaching examples.

ONE IDEA FURTHER

Ready for the next step?

Your progress stays in this browser.

View progress & resume a chapter →