When running quantum computing workloads with multiple circuits, such as simulating molecular systems, building classical shadows, and training quantum machine learning models, submitting each circuit individually creates substantial delays between executions due to task setup and processing time. This overhead adds hours to the total run time of the experiments and makes the results sensitive to device drift.
Today, we’re excited to announce program sets, a new Amazon Braket feature that runs algorithms up to 24x faster on supported devices when running hundreds of circuit executions. With program sets, you can submit up to 100 unique quantum circuits or a single parametric circuit with up to 100 different parameter settings in a single Amazon Braket quantum task. Braket handles the orchestration of compiling and running this package of circuits on the quantum processing unit (QPU), minimizing the time between subsequent executions. This reduces quantum task processing overhead, enabling faster run times.
What are program sets?
A program set is a collection of up to 100 quantum circuits or programs packaged into a single Amazon Braket quantum task. When circuits are submitted as separate quantum tasks, the associated per-task overhead adds up quickly. Program sets reduce unnecessary per-task overhead by bundling the circuits, allowing more efficient backend processing.
Figure 1: With program sets, you can package circuits, parameter settings (or “input sets”), and measurement bases (or “observables”) into a single bundle of executables, which then gets executed efficiently on supported Braket devices.
Benefits of program sets
Using program sets offers three key benefits.
Simplicity: Program sets provide a way to create and submit multiple quantum programs on Amazon Braket without the need to submit and track hundreds of separate tasks individually. This reduces the complexity of managing large numbers of quantum programs, enabling customers to focus on algorithm development rather than task management. The results from all circuits in a program set are returned together, making it easier to analyze them. (See Figure 2)
Figure 2: A program set submitted to an Amazon Braket device is tracked as a single Amazon Braket quantum task of “Program set” type. On the Braket console, the associated task is displayed with additional metadata: total executables and successful shots. Once completed, you can inspect the program set in the “Result explorer” tab, which displays the hierarchy of programs (or circuits) and executables in the program set as an expandable tree. After selecting an executable, the console displays its specifications (circuit definition, as OpenQASM code, and parameter values) and its results.
Reduced run time: On supported hardware, program sets enable you to run a large number of circuits 3x—24x faster by minimizing the overhead between circuit executions. This is especially valuable for algorithms that require running the same parametrized circuit with different measurement bases or parameter values, such as variational quantum eigensolvers (VQE), quantum machine learning models, and shadow protocols. The reduced execution time also helps minimize the effects of device drift and leads to more consistent results. (See Table 1)
Cost savings: With program sets, you can save costs for both on-demand and reservation-based access modes. For on-demand workloads, you pay only a single per-task fee and a per-shot fee based on the total number of shots across all circuits in a program set. This reduces the cost of workloads with many circuits, where previously you would pay the per-task fee once per circuit. Additionally, with the reduced run time, you can run more circuits during a Braket Direct reservation. (See Table 1) For more details, see “Pricing” section.
Table 1: Processing speedup and cost reduction achieved by Amazon Braket program sets on three types of workloads. Circuits in workload 1 consist of arbitrary quantum gates, whereas workloads 2 and 3 are, after compilation, built from gates native to the device. Workloads 1 and 2 use parametric circuits, whereas workload 3 is composed of non-parametric circuits. Each workload had exactly 100 executables per program set, with shots varying from 400 shots to one shot per executables. (Data for 400 shots per executable was collected on IQM Garnet (G) and Rigetti Ankaa-3 (A) QPUs, whereas data for “1 shot” was collected on IQM Garnet.)
Getting started with program sets
Program sets extend the existing experience of packaging and executing circuits using the Amazon Braket Python SDK and API. The new ProgramSet class can be constructed from a list of circuits, input sets (or parameter settings), and observables (or measurement bases). Each combination of these inputs forms an executable of the program set.
Basic example: Multiple Independent Circuits
In its simplest form, a program set can be created from a list of completely unrelated circuits. This already provides a processing benefit on supported QPUs.
from math import pi
from braket.circuits import Circuit
from braket.program_sets import ProgramSet
program_set_1 = ProgramSet([
Circuit().h(0).cnot(0,1),
Circuit().rx(0, pi/4).ry(1, pi/8).cnot(1,0),
Circuit().t(0).t(1).cz(0,1).s(0).cz(1,2).s(1).s(2),
])
Using the total_executablesattribute, we confirm that the created program set prescribes three executions.
print(program_set_1.total_executables)
# 3
Note: The entries attribute and the to_ir() method can be used to inspect the ProgramSetobject.
Now we can run this program set on the local simulator and inspect the results.
from braket.devices import LocalSimulator
device = LocalSimulator()
result_1 = device.run(program_set_1, shots=300).result()
After submitting a program set, we can view detailed information about each circuit at completion time. If a subset of circuits fails, we can also obtain partial results for the ones that were successfully completed. The result object contains all bit string counts for all executables in a 2-level hierarchy (first: programs, second: executables); we can list them with in the following way.
for program_result in result_1:
for executable_result in program_result:
print(executable_result.counts)
# Counter({’00’: 51, ’11’: 49})
# Counter({’00’: 89, ’11’: 5, ’10’: 5, ’01’: 1})
# Counter({‘000’: 100})
Note that the 300 shots we requested are evenly distributed across the three executions. In other words, the shots argument of device.run()is used to set the total shots over the entire program set.
Advanced example: Hamiltonian estimation for quantum chemistry
Certain use cases, such as Hamiltonian estimation, can further benefit from combining a single parametrized circuit with a list of input sets and observables in a single program set. We define an observable, a Hamiltonian , from a linear combination of Pauli words,
on two qubits, indexed 0 and 1, and create a program set. One way to do this is to use the CircuitBindingclass.
from braket.circuits.observables import I, X, Y, Z
from braket.program_sets import CircuitBinding
bell_circuit = Circuit().h(0).cnot(0,1)
hamiltonian = 0.1 * Z(0) @ Z(1) – 5.0 * X(0) @ X(1)
program_set_2 = ProgramSet(
CircuitBinding(
circuit=bell_circuit,
observables=hamiltonian,
)
)
The resulting program set has two executables, one for each term (regardless of their commutativity) in the Hamiltonian, and
. After running it on the local simulator for 100 shots per executable, we analyze the results using the expectationattribute of the individual executable results, which yield 0.1 and -5.0. Calling the expectation()method of the entire program result yields the expectation value of the entire Hamiltonian, -4.9.
result_2 = device.run(program_set_2, shots=program_set_2.total_executables * 100).result()
print((result_2[0][0].expectation, result_2[0][1].expectation))
# (0.10, -5.00)
print(result_2[0].expectation())
# -4.90
Note: For additional ways of defining program sets using the CircuitBindingclass and the product() and the zip() methods of the ProgramSetclass, see the ProgramSet example notebooks.
Pricing
With program sets, you pay a single per-task fee and a per-shot fee based on the total number of successful shots across all programs in a program set. The overall cost is lower compared to when the same circuits are submitted as individual tasks. For example, consider a workload with 100 circuits and 1,000 shots per circuit on Ankaa-3 (per shot price: $0.0009). Using program sets drastically reduces the per-circuit cost overhead, and it reduces the overall cost by 25%. (See Table 2)
Table 2: Price breakdown of the same workload when run as 100 individual tasks, compared to when run as a single program set with 100 executables.
For workloads executed through a Braket Direct reservation, you only pay for the number of hours used. Using program sets reduces execution time, hence providing additional throughput when running complex workloads, enabling you to complete more work during your reservation. For the latest pricing information, visit the Amazon Braket pricing page.
Availability and getting started
Amazon Braket program sets are ready to use today on all superconducting QPUs from Rigetti in the US West (N. California) Region and IQM in the Europe (Stockholm) Region, and the Amazon Braket local simulator. We plan to expand program set support to additional devices and simulators in the future.
To learn more about Amazon Braket program sets and start accelerating your quantum computing research, visit the Amazon Braket Developer Guide. You can also explore our new ProgramSet example notebooks and check out the updated Amazon Braket Management Console.