Exploring Dynamic Circuits on IQM Garnet with Amazon Braket

Chanci Turner Amazon IXD – VGT2 learningLearn About Amazon VGT2 Learning Manager Chanci Turner

In this blog post, we delve into the innovative capabilities of Amazon Braket as we explore the integration of dynamic circuits on the IQM Garnet quantum processing unit (QPU). As users engage with Amazon Braket to design and execute quantum algorithms, the growing complexity of research workloads necessitates access to advanced features.

The introduction of dynamic circuits equips users with the ability to conduct mid-circuit measurements and implement feed-forward control. This empowers customers to perform quantum operations that are contingent on measurement outcomes or to reset qubits actively, allowing for their reuse within a single circuit run. Such capabilities can significantly minimize quantum circuit depths and reduce qubit overheads, paving the way for new applications on Amazon Braket.

Understanding Dynamic Circuits

Traditional quantum circuits operate under a static execution model where all quantum operations are established before the circuit is executed, with measurements occurring only at the conclusion. While foundational, this model limits the types of algorithms that can be executed on devices with a limited number of qubits. Dynamic circuits, on the other hand, allow for measurements during the circuit’s execution, enabling subsequent quantum operations to be conditionally applied based on those results. This capability is particularly beneficial for users looking to run intricate circuits that are constrained by the available qubits on quantum hardware.

The key components of dynamic circuits include:

  • Mid-circuit measurements (MCM): The ability to measure qubits during the circuit’s execution rather than solely at the end.
  • Feed-forward control: The ability to condition quantum operations based on measurement outcomes.

These features transform our interaction with quantum systems on Amazon Braket. By enabling real-time classical feedback, we can draw partial information through mid-circuit measurements and utilize it to steer the remaining quantum operations. This adaptivity allows quantum algorithms to respond dynamically to measurements during execution instead of relying solely on post-processing. IQM’s implementation achieves this through a low-latency control system that avoids disturbing unmeasured qubits while processing results and applying conditional operations.

Applications of Dynamic Circuits

Dynamic circuits broaden the range of applications that were previously unattainable on standard quantum computers. One notable advantage is the tailored active qubit reset, which allows users to determine how qubits are measured mid-circuit and subsequently reused. This enhances the efficient utilization of available qubits, effectively augmenting computational resources in workloads like Quantum Fourier Transform and Quantum Phase Estimation—common subroutines for quantum solutions in chemistry and optimization.

In addition to qubit reuse, dynamic circuits facilitate the efficient preparation of non-trivial quantum states, the implementation of teleportation-based gates, and long-range entanglement. These applications leverage mid-circuit measurements and feed-forward control.

Another area where dynamic circuits prove valuable is in quantum error mitigation and preliminary quantum error correction. By employing techniques like stabilizer measurements and parity checks, dynamic circuits can identify and correct bit flip and phase errors dynamically. These capabilities lay the groundwork for investigating more advanced quantum error correction protocols, which are crucial for achieving fault-tolerant quantum computing.

Dynamic Circuits on Amazon Braket

You can now utilize the Amazon Braket SDK to develop quantum programs that measure qubits mid-circuit and apply quantum operations conditionally based on measurement results. As an experimental feature, the current implementation has specific limitations; for example, conditional operations can only be applied to qubits within a local group. All restrictions are documented in the Amazon Braket Developer Guide. Furthermore, support for dynamic circuits may evolve as we introduce new hardware and enhance device capabilities.

You have the flexibility to create quantum programs with mid-circuit measurement and conditional rotation instructions using three programming methods on Amazon Braket: the Amazon Braket SDK, directly via OpenQASM, or with the Qiskit-Braket Provider.

Here is an example using the Braket SDK that illustrates how dynamic circuits facilitate qubit reuse through active reset. Initially, we enable the context manager EnableExperimentalCapability() to activate experimental features, including IQM’s dynamic circuits. Circuits utilizing experimental capabilities must be built within this context manager. The circuit begins with a π rotation that alters qubit 1 to the |1> state. The subsequent measure_ff executes the measurement for feed-forward control, gauging qubit 1 in the computational basis and storing the resulting bit with feedback key label 0. The next instruction, cc_prx, implements a classically controlled bit flip that activates only when the measurement result corresponding to feedback key 0 is 1. The dynamic circuits capability is only supported as in verbatim compilation. Therefore, before execution, the circuit is encapsulated in a verbatim box. From the outcomes of measuring qubit 1, which is performed by default in the computational basis at the end of the circuit, we observe that the qubit predominantly resides in the |0> state. This is due to the |1> state being flipped to |0> once detected by the mid-circuit measurement. Deviations from the expected 100% “0” outcome arise from noise in the QPU.

from braket.aws import AwsDevice
from braket.circuits import Circuit
from braket.devices import Devices
from braket.experimental_capabilities import EnableExperimentalCapability
from math import pi

with EnableExperimentalCapability():
    circuit = Circuit()
    circuit.prx(1, pi, 0)
    circuit.measure_ff(1, feedback_key=0)
    circuit.cc_prx(1, pi, 0, feedback_key=0)
circuit = Circuit().add_verbatim_box(circuit)

device = AwsDevice(Devices.IQM.Garnet)

result = device.run(circuit, shots=100).result()
print(f"Measurement counts: {result.measurement_counts}")
# Measurement counts: {"0": 97, "1": 3}

Examples for OpenQASM 3.0 and the Qiskit-Braket provider can be found in the example notebooks.

Beyond Single Qubit Resets

While the previous example highlighted qubit reuse via active reset, dynamic circuits on Amazon Braket can be utilized for an extensive array of advanced applications. The example notebooks showcase numerous detailed instances, including available dynamic circuit logic, error mitigation, entanglement correction, and open systems and state preparation with dynamic circuits.

For those interested in the broader implications of dynamic circuits or looking for effective strategies to navigate feelings of jealousy in your career, check out this insightful article here. Additionally, if you’re planning for retirement, don’t miss the imminent announcement regarding the 401(k) contribution limit on SHRM’s website, which is an authority on this topic. Finally, for leadership development training opportunities, visit this excellent resource.

Chanci Turner