AWS Quantum Technologies Blog

Getting the Most from Your Quantum Measurements: Adaptive Shot Allocation on Amazon Braket

With current noisy quantum hardware, every quantum circuit evaluation is precious. Variational quantum algorithms like the Variational Quantum Eigensolver (VQE) require repeated estimation of expectation values of quantum observables—each requiring multiple shots, or measurements of quantum states. On today’s hardware, these shots represent a finite resource that needs to be managed carefully. Efficient shot allocation therefore improves algorithm performance and reduces quantum runtime.

This post explores how shot allocation techniques can reduce errors in quantum expectation value estimation, without increasing the total shot cost. To help users understand and experiment with these advanced strategies, we released an educational implementation of an adaptive shot allocation algorithm in the Amazon Braket Algorithms Library, based on the paper “Adaptive Estimation of Quantum Observables” (Shlosberg et al., 2023).

As a starting point, we published two new interactive notebooks in the Braket Algorithms Library:

  • Intro to Shot Allocation: A hands-on introduction to the shot allocation problem and its impact on expectation value estimation.
  • Adaptive Shot Allocation: A step-by-step walkthrough of the algorithm and how to use it with observables in Braket.

Why shot allocation matters in quantum algorithms

Iterative estimation of expectation values is a common pattern in near-term quantum algorithms. In VQE, for example, the energy of a molecular Hamiltonian is computed as the weighted sum of expectation values of Pauli terms. Each term requires estimation from repeated measurements and with limited quantum runtime available, how we allocate these measurements—or shots—impacts the estimator error.

Comparing naive and optimal allocation

A naive approach assigns the same number of shots to each term. But this ignores key differences in variance and contribution of each term to the result. Terms with larger weights or higher variance contribute more to the overall estimation error and should receive more of the measurement budget.

Tailoring shot allocation to the structure of the observable, achieves lower estimation error for the same total number of shots. In a representative example using a 26-term Hamiltonian of a small molecule, the adaptive allocation strategy reduced the estimation error by approximately 40% compared to the uniform allocation strategy, where each term received the same number of shots.

Figure 1: Overlapped histograms of estimation values for the uniform and adaptive shot allocation on a representative example.

The tradeoff between accuracy and runtime

Shot reallocation techniques—especially adaptive ones—reduce the estimation error without increasing cost in terms of total shot count. However, this improvement comes with an important tradeoff: increased classical runtime.

In contrast to static allocation strategies that submit a single circuit with the full shot budget, adaptive approaches typically submit multiple rounds of circuits, each using only a fraction of the total budget. This iterative behavior enables the algorithm to update its allocation based on intermediate results—but also increases total runtime due to repeated circuit submissions and classical post-processing.

Understanding this tradeoff helps decide when and how to apply adaptive strategies in real-world workflows.

A minimal adaptive algorithm for expectation value estimation

To help researchers and developers understand these advanced techniques, we implemented a simplified version of the adaptive algorithm proposed in Shlosberg et al., 2023. The implementation is available in braket.experimental.algorithms.adaptive_shot_allocation.

This module is part of the braket.experimental namespace and is designed primarily for educational and exploratory purposes. It demonstrates the key principles behind adaptive shot allocation, including:

  • Structuring observables and grouping measurement terms
  • Iterative allocation of shots based on estimated term variance
  • Updating estimates and tracking convergence

Though not optimized for production use, this example is fully functional and serves as a starting point for building more advanced or customized versions. It also provides insight into how iterative allocation strategies are implemented on Braket.

from braket.circuits import Circuit
from braket.devices import LocalSimulator

from braket.experimental.algorithms.adaptive_shot_allocation.\
                        adaptive_allocator import AdaptiveShotAllocator
from braket.experimental.algorithms.adaptive_shot_allocation.\
                        adaptive_allocator_braket_helpers import run_adaptive_allocation


estimator = AdaptiveShotAllocator(['IZ', 'ZI', 'XX'], [1.0, 1.0, 10.0])

expectation_value = estimator.expectation_from_measurements(
                        run_adaptive_allocation(
                                    device = LocalSimulator(), 
                                    circuit = Circuit().h(0).h(1),
                                    estimator = estimator, 
                                    shots_per_round = 100, 
                                    num_rounds = 12
                        )
                    )

Find a comprehensive walkthrough in the adaptive shot allocation notebook, which details how to integrate the algorithm with Braket observables and simulators.

Getting started with the notebooks

To explore these concepts, we created two companion notebooks:

Intro to Shot Allocation

This tutorial walks through:

  • The motivation for shot allocation
  • Examples comparing naive, weighted, and optimal shot allocation
  • Quantitative comparison of estimation errors

Adaptive Shot Allocation

This notebook includes:

  • A realistic example for the usage of the adaptive shot-allocation algorithm
  • Step-by-step guidance for running adaptive estimation with Braket observables and simulators
  • Discussion of the cost-benefit tradeoff: reduced error at the expense of increased runtime

Learn more and start exploring

As quantum algorithms continue to evolve, optimizing classical resources like shot allocation remains a key strategy for getting the most out of quantum hardware today and in the future. Whether you develop VQE workflows, benchmarking allocation strategies, or are exploring quantum measurement theory, this implementation and its accompanying notebooks, available on the Braket Algorithms Library on GitHub, will help you get started.