Menu
Amazon Braket: Get started with quantum computing

Amazon Braket: Get started with quantum computing

Amazon’s quantum computing service is currently good for learning about quantum computing and developing NISQ-regime quantum algorithms, but stay tuned

Credit: Dreamstime

While IBM, Microsoft, and Google have made major commitments and investments in quantum computing, Amazon has, until recently, been fairly quiet about the field. That changed with the introduction of Amazon Braket.

Amazon still isn’t trying to build its own quantum computers, but with Braket it is making other companies’ quantum computers available to cloud users via Amazon Web Services (AWS). Braket currently supports three quantum computing services, from D-Wave, IonQ, and Rigetti.

D-Wave makes superconducting quantum annealers, which are usually programmed using D-Wave Ocean software, although there is also an annealing module in the Braket SDK. IonQ makes trapped ion quantum processors, and Rigetti makes superconducting quantum processors.

In Braket, you can program both IonQ and Rigetti processors using the Braket Python SDK circuits module. The same code also runs on local and hosted quantum simulators.

The name Braket is kind of an in-joke for physicists. Bra-ket notation is the Dirac formulation of quantum mechanics, which is an easier way of expressing Schrödinger’s equation than partial differential equations. In Dirac notation, a bra <f| is a row vector, and a ket |f> is a column vector. Writing a bra next to a ket implies matrix multiplication.

Amazon Braket and the Braket Python SDK compete with IBM Q and Qiskit, Azure Quantum and Microsoft Q#, and Google Cirq. IBM already has its own quantum computers and simulators available to the public online.

Microsoft’s simulator is generally available, but its quantum offerings are currently in limited preview for early adopters, including access to quantum computers from Honeywell, IonQ, and Quantum Circuits, and optimisation solutions from 1QBit.

Microsoft hasn’t announced when its own topological superconducting quantum computers will become available, nor has Google announced when it will make its quantum computers or Sycamore chips available to the public.

Amazon Braket overview

Amazon Braket is a fully managed service that helps you get started with quantum computing. It has three modules, Build, Test, and Run. The Build module centres around managed Jupyter notebooks pre-configured with sample algorithms, resources, and developer tools, including the Amazon Braket SDK.

The Test module provides access to managed, high-performance, quantum circuit simulators. The Run module provides secure, on-demand access to different types of quantum computers (QPUs): gate-based quantum computers from IonQ and Rigetti, and a quantum annealer from D-Wave.

Tasks may not run immediately on the QPU. The QPUs only execute tasks during execution windows.

Amazon Braket SDK API

The Braket Python SDK defines all of the operations you need to build, test, and run quantum circuits and annealers. It is organised into five packages: braket.annealing, braket.aws, braket.circuits, braket.devices, and braket.tasks.

The braket.annealing package allows you to define two kinds of binary quadratic models (BQMs): Ising (a mathematical model of ferromagnetism in statistical mechanics, using magnetic dipole moments of atomic “spins”) and QUBO (Quadratic Unconstrained Binary Optimisation) problems, to solve on a quantum annealer, such as a D-Wave unit.

The braket.circuits package lets you define quantum circuits based on a set of gates, to solve on gate-based quantum computers, such as ones from IonQ and Rigetti.

The other three packages control the running of your problem. The braket.aws package allows you to select quantum devices, load problems into tasks, and connect tasks to AWS sessions. The braket.devices package lets you run tasks on quantum devices and simulators. The braket.tasks package lets you manage, track, cancel, and get results from quantum tasks.

Amazon Braket circuits and gates

Circuits in a quantum computer such as the ones from IonQ or Rigetti (or IBM or Honeywell, for that matter) are built from a standard set of gates (see figure below), although not every QPU may have an implementation of every kind of gate. In the Braket SDK you define a circuit using the Circuit() method from the braket.circuits package, qualified by the gates in the circuit and their parameters.

For example, this Braket code (from Amazon’s Deep_dive_into_the_anatomy_of_quantum_circuits example) defines a circuit that initialises four qubits to a Hadamard (equal probability of 1 and 0) state, then entangles qubit 2 with qubit 0 and qubit 3 with qubit 1 using Controlled Not operations.

The Braket SDK seems to have a nearly full set of quantum logic gates. I don’t see a Deutsch gate listed, but as far as I know it hasn’t yet been implemented on a real QPU.

D-Wave Ocean

Ocean is the native Python-based software stack for D-Wave quantum annealers. For use via Braket, you can combine the Ocean software with the Amazon Braket Ocean plug-in, which translates between Ocean and Braket formats.

Quantum annealers function quite differently than gate-based QPUs. Essentially, you formulate your problem as a binary quadratic model (BQM) that has a global minimum at the solution you want to find. Then you use the annealer to sample the function many times (since the annealer isn’t perfect) to find the minimum.

You can create the BQM for a given problem mathematically or generate the BQM using Ocean software. The code that follows, from Amazon’s D-Wave_Anatomy example, uses the Braket Ocean plug-in to solve a BQM on a D-Wave device.

Enabling Amazon Braket and using notebooks

Before you can use Braket, you need to enable it in your AWS account. Then you need to create a notebook instance. Notebooks use Amazon SageMaker (read my review).

When you open a notebook, you can enter new code or use one of Amazon’s examples. You need to check the status of the QPU devices, as they aren’t always available. While you can run them yourself, the Braket example notebooks have been saved with results from a previous run.

Learn today, useful tomorrow

Amazon Braket is a reasonable way to get your feet wet with quantum computers and simulators. Since we’re still in the NISQ (Noisy Intermediate Scale Quantum) phase of quantum computing, you can’t really expect useful results from Braket. We’ll need more qubits, less noise, and longer coherence times, all of which are being actively researched.

Braket’s current QPU offerings are modest. The 2048-qubit D-Wave annealer is mostly useful for optimisation problems; it’s about half the size of D-Wave’s latest-generation annealer.

The 11-qubit IonQ QPU, which has relatively long coherence times, is way too small to implement the algorithms for quantum computers that should exhibit useful quantum supremacy, such as Grover’s algorithm for finding the inverse of a function and Shor’s algorithm for finding the prime factors of an integer. The 30-qubit Rigetti Aspen-8 is also too small.

Braket is not free, although it is relatively cheap to use. By comparison, IBM Q is completely free, although the publicly available IBM QPUs are very small: they range from a 1 qubit QPU in Armonk to a 15-qubit QPU in Melbourne. IBM also offers a paid premium QPU service.

IBM also rates its QPUs by their quantum volume (QV), a measure that combines the number of qubits with their error rate and coherence time. There are five-qubit IBM QPUs ranging from QV8 to QV32: higher is better. IBM has announced achieving QV64 internally, but hasn’t made such a QPU available to the public. Honeywell has also announced achieving QV64.

What Braket is currently good for is learning about quantum computing and developing NISQ-regime quantum algorithms. Stay tuned, though. As QPUs improve and are plugged into AWS, Braket will become more and more useful.

Cost: Managed notebooks: US$0.04 to $34.27 per instance-hour; quantum simulator: $4.50 per hour; quantum computers: $0.30 per task plus $0.00019 to $0.01 per shot (repetition of a circuit). 

Platform: AWS; installing the Braket SDK locally requires Python 3.7.2 or greater, and Git.


Tags Amazon Web ServicesAWSCloud

Show Comments