45 min read

> *"Part II taught you superconducting qubits and called it quantum computing. This chapter is the

Prerequisites

  • 1
  • 2
  • 3
  • 4
  • 5
  • 7
  • 10
  • 11
  • 12
  • 14

Learning Objectives

  • Build and run circuits with Braket's fluent API and local simulators.
  • Explain what changes when the underlying hardware is not superconducting.
  • Quantify the cost of limited connectivity against all-to-all.
  • Identify the native gate set of a device and use verbatim boxes to control it.
  • Compare qubit modalities on the axes that actually differ.
  • Choose a modality for a given circuit shape.

Chapter 17: Amazon Braket

"Part II taught you superconducting qubits and called it quantum computing. This chapter is the correction."

Overview

Everything in Parts I and II ran on superconducting hardware. That was a reasonable choice — it is what you can get access to most easily — but it quietly installed a set of assumptions:

  • Qubits are arranged on a fixed lattice and only neighbours can interact.
  • SWAP networks are a fact of life, and Chapter 10 spent a chapter on their cost.
  • The native two-qubit gate is ECR or CZ.
  • Coherence is measured in hundreds of microseconds.

Every one of those is a property of superconducting circuits, not of quantum computing.

Amazon Braket is the framework that makes this visible, because it is a single API over genuinely different machines: superconducting processors, trapped ions, and neutral atoms. Same Python, different physics.

The headline consequence, measured. Take a "star" GHZ circuit where qubit 0 must entangle with every other qubit, transpile it to the real 127-qubit heavy-hex device from Part II, and count two-qubit gates:

    n   logical 2q   Sherbrooke ECR   depth   overhead
    4            3                3      18      1.00x
    8            7               15      63      2.14x
   12           11               35     136      3.18x

At twelve qubits the superconducting device executes 3.18× the two-qubit gates the algorithm asks for. The excess is entirely SWAPs — moving information to where the connectivity allows it to interact.

On a trapped-ion machine the same circuit costs 1.00×, at every size, by construction. Every ion can interact directly with every other ion. Chapter 10's routing problem does not exist there.

In this chapter, you will learn to:

  • Use Braket's fluent API and local simulators.
  • Quantify connectivity cost and compute the break-even point.
  • Read a device's native gate set and bypass compilation with verbatim boxes.
  • Compare modalities on the axes that genuinely differ.
  • Choose hardware to fit a circuit shape.

Learning Paths

How to read this chapter by track. - 🔰 Beginner — §17.2 and §17.4. The connectivity result is the one to remember. - 🔬 Researcher — §17.4 and §17.6; modality choice can matter more than any software decision. - 🤖 Quantum ML — §17.4, since variational ansätze are often connectivity-hungry. - 🏗️ Quantum Engineer — all of it, especially §17.5 on verbatim boxes. - 🔐 Security — §17.6's comparison table.


17.1 Setup and the Fluent API

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

circuit = Circuit().h(0).cnot(0, 1)
result = LocalSimulator().run(circuit, shots=1000).result()
print(result.measurement_counts)
  T  : │  0  │  1  │
        ┌───┐
  q0 : ─┤ H ├───●───
        └───┘   │
              ┌─┴─┐
  q1 : ───────┤ X ├─
              └───┘

  {'11': 490, '00': 510}

Gate methods return the circuit, so they chain. Circuit().h(0).cnot(0, 1) is idiomatic; the style sits between Qiskit's mutation and Cirq's immutable values.

🗝️ Version Note — credentials, and what runs without them.

LocalSimulator needs no AWS account and runs everything in this chapter's examples. Real devices go through AwsDevice, which requires AWS credentials, a configured region, and charges per task and per shot — unlike IBM's open tier (Chapter 2), Braket hardware is a paid service.

Two local backends:

python LocalSimulator("braket_sv") # state vector (the default) LocalSimulator("braket_dm") # density matrix -- required for noise

Verified with amazon-braket-sdk 1.125.0. Device availability, pricing, and which vendors are on the service all change — check current documentation before planning around a specific machine.

And the Windows papercut from Chapter 14 applies: Braket's circuit diagrams use box-drawing characters, so sys.stdout.reconfigure(encoding="utf-8") before printing one.

Endianness, using Chapter 14's one-gate test:

  X on qubit 0, measure both:  {'10': 100}
  state vector: [0, 0, 1, 0]   nonzero at index 2

Braket is big-endian, agreeing with Cirq. So of the three frameworks tested:

Framework Convention X on qubit 0 lands at
Qiskit little-endian index 1
Cirq big-endian index 2
Braket big-endian index 2

Qiskit is the odd one out, which is worth knowing given how much of this book is written in it.

🔀 In Another Framework — where the hardware model lives in each API.

Braket's design decision is that the device is a string. AwsDevice("arn:aws:braket:::device/…") selects a superconducting chip or an ion trap, and nothing else in your program changes. The other four frameworks in this book put the hardware somewhere else, and where they put it is a statement about what they think you should have to think about.

Qiskit (Chapter 7) puts it in a Target: basis gates, coupling map, per-edge error rates and instruction durations, all hanging off a backend object. It is the richest hardware model of the five, and it is a model of one modality — the Target has a coupling map because superconducting devices have one, and the whole of Chapter 29 is written against that assumption.

Cirq (Chapter 14) puts it in the qubit type. A cirq.LineQubit knows it lies on a line and a cirq.GridQubit knows its coordinates, so a circuit has committed to a geometry before any device is chosen. Chapter 29 §29.2's framework box makes the routing version of this point.

PennyLane (Chapter 16) puts it in a transformqml.transforms.transpile(tape, coupling_map) takes the topology as an argument rather than reading it off a backend, which makes "what would this ansatz cost on different hardware?" a one-line question.

Q# (Chapter 15) does not model it at all. You write against an abstract machine and the resource estimator prices a connectivity assumption rather than a chip. That is the right abstraction for the fault-tolerant regime Chapter 15 targets and the wrong one for choosing a machine this afternoon.

Braket's is the only one of the five where the modality is a runtime value. That is what makes it the right framework for this chapter, and it is also why §17.6 spends its length warning you about it: a decision you can express as a string is a decision you can make without noticing.

17.2 Results Without Measurement

Braket separates result types from shots, and with shots=0 the simulator returns exact quantities:

Circuit().h(0).cnot(0, 1).probability()
Circuit().h(0).cnot(0, 1).state_vector()
Circuit().h(0).cnot(0, 1).expectation(Observable.Z() @ Observable.Z(), target=[0, 1])
Circuit().h(0).cnot(0, 1).amplitude(["00", "11"])
  probability    -> [0.5, 0.0, 0.0, 0.5]
  state_vector   -> [0.7071, 0, 0, 0.7071]
  expectation ZZ -> 0.9999999999999998
  amplitude      -> {'00': 0.7071+0j, '11': 0.7071+0j}

amplitude has no equivalent in the other frameworks' primitives — it returns specific state-vector entries by bitstring, which is convenient for checking a single amplitude without materializing $2^n$ of them.

The result type is attached to the circuit, not chosen at run time. That is a small design difference with a real consequence: a circuit carries what it is for.

17.3 Noise

from braket.circuits import Noise

circuit = Circuit().h(0).cnot(0, 1)
circuit.apply_gate_noise(Noise.Depolarizing(probability=0.05))
LocalSimulator("braket_dm").run(circuit, shots=8192).result()
  depolarizing p=0.00:  error fraction 0.0000
  depolarizing p=0.02:  error fraction 0.0221
  depolarizing p=0.05:  error fraction 0.0638
  depolarizing p=0.10:  error fraction 0.1292

The same channel physics as Chapter 11, in a third framework, with error fractions of the expected magnitude. Noise requires the density-matrix simulator — and Chapter 11 §11.2's cost applies: density matrix is $4^n$, so half the width.

Braket warns if you run a noiseless circuit on braket_dm, which is a thoughtful touch given that Chapter 11 measured the penalty at 9 seconds versus 66 milliseconds at 15 qubits.

Which machine is this noise model of?

apply_gate_noise(Noise.Depolarizing(probability=0.05)) applies the same channel at the same rate to every gate in the circuit. That is the default in every framework this book has used, and given that the chapter is about hardware that differs, it is worth asking which piece of hardware it is a good model of.

It is not a good model of the device from Part II. Chapter 12 measured a 288× spread in two-qubit gate error across a single superconducting chip, twelve qubits with readout error above 10%, and nine dead gate pairs. Chapter 30 §30.3 put a number on what that does to a summary statistic: the same chip's two-qubit error is 0.00750 or 0.07205 — a factor of 9.6 — depending only on whether the dead links are excluded from the mean. A uniform p is an average over a distribution whose spread is larger than itself.

It is a much better model of an ion trap. Every ion of a given species is identical by the laws of physics, so there is no fabrication lottery, no dead pair, and no stuck qubit 84. The uniform-p assumption that is a convenient fiction on superconducting hardware is close to a description on trapped ions.

That inversion is worth stating plainly, because it is not what the ordering of this book suggests. The noise model that is easiest to write is a model of the machines this chapter is about, not of the machine Parts I and II ran on. Chapter 11's sweeps, Chapter 14's, and §17.3's above are all more faithful to a modality none of them was measured against.

The caveat, and it points where to look rather than what to conclude: ion traps have their own non-uniformity, with a different shape. Gate error depends on chain length and on where in the chain a pair sits, because the shared vibrational mode §17.4 is about becomes harder to control as more ions share it. This book has not measured that, so it is a caution and not a result.

📉 Noise Report — a single depolarizing rate hides different things on each modality.

§17.3's sweep is clean. Every row is close to $4p/3$, which is what a depolarizing channel applied to both gates of a Bell circuit should give, so the simulator is behaving. What the simulator cannot tell you is which physical device the number corresponds to, and that differs on three axes:

Spatial variation. On superconducting hardware p is a per-edge quantity spanning 288× (Chapter 12). On ions it is close to one number for the whole machine. The same simulation is a tight model of one and a loose one of the other.

What one gate costs. §17.4's star circuit is 11 two-qubit gates on an ion trap and 35 on heavy-hex, so an identical per-gate p produces $(1-p)^{11}$ against $(1-p)^{35}$. At $p = 0.00750$ that is 0.9205 against 0.7684, an infidelity of 0.0795 against 0.2316 — a 2.91× difference out of a channel that is byte-for-byte the same in both simulations.

What duration costs. Chapter 11 §11.7 established that decoherence scales with duration, and §17.6's table puts ion coherence in seconds against superconducting hundreds of microseconds while ion gates run ~100× slower. A gate-count-proportional depolarizing model — which is exactly what apply_gate_noise is — captures the first two effects and represents the third not at all.

So a uniform depolarizing sweep is a model of gate error and of nothing else. Two of the three axes on which §17.6 compares modalities are invisible to it. Use it to reason about circuits; do not use it to rank machines.

17.4 Connectivity: The Result That Matters

Now the chapter's centerpiece.

The test circuit is a "star" GHZ: qubit 0 entangles with every other qubit directly.

qc = QuantumCircuit(n)
qc.h(0)
for i in range(1, n):
    qc.cx(0, i)          # qubit 0 talks to everyone

This is the worst case for a line and the best case for all-to-all — deliberately, because the point is to measure the gap rather than to be fair.

On a linear coupling map:

    n   logical 2q   line 2q   line depth   all-to-all 2q   ratio
    4            3         6            9               3   2.00x
    6            5        10           20               5   2.00x
    8            7        16           26               7   2.29x
   10            9        24           27               9   2.67x
   12           11        26           43              11   2.36x

On the real device from Part IIFakeSherbrooke, 127 qubits, heavy-hex:

    n   logical 2q   Sherbrooke ECR   depth   overhead
    4            3                3      18      1.00x
    6            5                7      36      1.40x
    8            7               15      63      2.14x
   10            9               27     115      3.00x
   12           11               35     136      3.18x

Three things to read out of that table.

The overhead grows. It is 1.00× at four qubits and 3.18× at twelve — and it is still climbing. This is Chapter 10's routing cost, measured on a circuit shape chosen to stress it.

Depth grows faster than gate count. 136 layers for an algorithm with 11 two-qubit operations. Since Chapter 11 §11.7 established that decoherence scales with duration, depth is the number that hurts.

And heavy-hex beats a line at small $n$ but loses at large $n$ — 3 versus 6 gates at $n=4$, 35 versus 26 at $n=12$. A 2-D lattice has better local connectivity and the same fundamental limitation: a qubit can only reach its neighbours.

The trapped-ion difference

On a trapped-ion machine, the overhead is 1.00× at every size. Not "better routing" — no routing.

The reason is physical. Ions in a linear trap share collective vibrational modes, and the native two-qubit gate — the Mølmer–Sørensen gate — couples any two ions through that shared mode. The mode belongs to the whole chain, so any ion can be entangled with any other directly.

Measured on the MS gate itself:

  MS(phi0=0, phi1=0, theta=pi/2) on |00>  ->  [0.7071, 0, 0, -0.7071i]

One native gate takes $|00\rangle$ to a maximally entangled state. A superconducting device needs H plus ECR plus single-qubit corrections to do the same thing.

📐 Math AsideMS(0, 0, θ) is a rotation about $XX$, and more of it is not more entanglement.

The measured state vector identifies the gate exactly. Braket's two-phase Mølmer–Sørensen gate at $\phi_0 = \phi_1 = 0$ is a rotation generated by $X \otimes X$:

$$\mathrm{MS}(0, 0, \theta) \;=\; \exp\!\left(-\mathrm{i}\,\tfrac{\theta}{2}\, X \otimes X\right) > \;=\; \cos\tfrac{\theta}{2}\, I \;-\; \mathrm{i}\sin\tfrac{\theta}{2}\, X \otimes X$$

so on $|00\rangle$ it produces

$$\mathrm{MS}(0,0,\theta)\,|00\rangle \;=\; \cos\tfrac{\theta}{2}\,|00\rangle > \;-\; \mathrm{i}\sin\tfrac{\theta}{2}\,|11\rangle$$

At $\theta = \pi/2$ that is $(|00\rangle - \mathrm{i}|11\rangle)/\sqrt{2}$ — the $[0.7071, 0, 0, -0.7071\mathrm{i}]$ printed above, with nothing fitted. (Verified against scipy.linalg.expm(-1j*theta/2 * XX) at three angles: exact to $10^{-9}$.)

Now sweep $\theta$. The state never leaves the span of $|00\rangle$ and $|11\rangle$, so its concurrence has a closed form: for $a|00\rangle + d|11\rangle$, $C = 2|ad|$, giving

$$C(\theta) \;=\; 2\left|\cos\tfrac{\theta}{2}\,\sin\tfrac{\theta}{2}\right| \;=\; |\sin\theta|$$

text theta state vector concurrence |sin theta| pi/4 [0.9239, 0, 0, -0.3827i] 0.7071 0.7071 pi/2 [0.7071, 0, 0, -0.7071i] 1.0000 1.0000 pi [ 0, 0, 0, -1i] 0.0000 0.0000

At $\theta = \pi$ the MS gate is not entangling at all. It sends $|00\rangle$ to $-\mathrm{i}|11\rangle$ — a product state, a bit flip on both ions with a phase attached. Entanglement peaks at $\pi/2$ and returns to zero at $\pi$, exactly as $|\sin\theta|$ says.

Internalize that before hand-writing a decomposition. "Turn the MS angle up" is not a knob that makes a circuit more entangled; it is a rotation, and rotations come back round. The single native gate that reaches a maximally entangled state is a specific gate, not a family — which is what makes the one-gate claim above a real claim rather than a convenient framing.

🐛 Debug This — the check that could not tell a Bell state from a product state.

This chapter's own code/example-03-native-gates.py builds a Bell state from the trapped-ion native set and verifies it against H + CNOT:

python native = (Circuit().gpi2(0, np.pi / 2) .ms(0, 1, 0, 0, np.pi / 2) .gpi2(0, -np.pi / 2) .gpi2(1, -np.pi / 2)) ... np.allclose(np.sort(p_logical), np.sort(p_native), atol=1e-6) # prints True

It prints True. The circuit is wrong.

text circuit populations concurrence H + CNOT [0.5, 0.0, 0.0, 0.5] 1.0000 the "native equivalent" [0.5, 0.5, 0.0, 0.0] 0.0000 MS(0, 0, pi/2) alone [0.5, 0.0, 0.0, 0.5] 1.0000

The GPi2 wrappers destroyed the entanglement the MS gate had just created. What comes out is qubit 0 in superposition and qubit 1 in $|0\rangle$ — separable, concurrence exactly zero.

The reason the check passed is np.sort. Sorting a population vector keeps how much weight there is and discards which outcomes carry it, and $[0.5, 0, 0, 0.5]$ and $[0.5, 0.5, 0, 0]$ sort to the same list. The comparison was invariant under precisely the difference it was written to detect. Remove the sort and it fails on the first run.

The file's comment then attributes the mismatch to "a global/relative phase convention," which is the second half of the bug: a plausible explanation arrived before the check was audited, and it stopped the search. Phases were not the problem. The entanglement was gone.

Two fixes, both verified on LocalSimulator:

python Circuit().ms(0, 1, 0, 0, np.pi / 2) # already Bell-equivalent Circuit().ms(0, 1, 0, 0, np.pi / 2).gpi2(0, 0).gpi2(1, np.pi / 2) # exact, native set only

Both give $[0.7071, 0, 0, -0.7071\mathrm{i}]$ with concurrence 1.0000. The wrappers were never needed for the state — that is this section's whole point, that one native gate gets you there — and adding them without a test that could fail is how the point got lost.

The general rule, and this book keeps rediscovering it: an equivalence check that is invariant under the property you care about is not a check. It is another instance of the recurring failure Part V catalogues — a measurement that cannot detect the thing being asked about — and it landed in this chapter's own source, which is where these usually turn up.

⚛️ The Physics Underneath — why connectivity is a physical property, not an engineering choice.

Superconducting qubits are fixed circuits on a chip, coupled by fabricated resonators. Two qubits interact if and only if someone etched a coupler between them, and you cannot etch a coupler between all pairs — the wiring does not fit, and unwanted couplings cause crosstalk. The lattice is a manufacturing constraint.

Trapped ions are individual atoms held in an electromagnetic trap, addressed by lasers. They interact through their shared motion in the trap, which is a global degree of freedom. The connectivity graph is complete because the coupling bus is shared by construction.

The trade is speed. Superconducting gates run in tens to hundreds of nanoseconds; trapped-ion gates take microseconds — roughly a hundred times slower. Ion coherence times are correspondingly longer, so the number of gates you can run before decoherence is comparable, but wall-clock time per circuit is very different.

Neither is better. They fail differently, and §17.6 lays out on which axes.

When does all-to-all actually win?

The overhead only matters if it costs more error than it saves. Taking FakeSherbrooke's median ECR error over the working links — 0.00750, excluding Chapter 12's dead pairs — survival probability goes roughly as $(1-\varepsilon)^{N}$, so the two architectures break even when

$$(1 - \varepsilon_{\text{sc}})^{r\,m} = (1 - \varepsilon_{\text{ion}})^{m} \quad\Longrightarrow\quad \varepsilon_{\text{ion}} = 1 - (1 - \varepsilon_{\text{sc}})^{r}$$

for overhead $r$:

    n   overhead r   break-even error for an all-to-all device
    4        1.00x                                     0.0075
    8        2.14x                                     0.0160
   12        3.18x                                     0.0237

At twelve qubits, trapped ions win this circuit if their two-qubit gate error is below about 2.4% — a threshold current trapped-ion hardware clears comfortably. And the break-even loosens as $n$ grows, because the overhead grows.

The control case settles it. The same measurement on a nearest-neighbour GHZ chain:

    n = 4, 6, 8, 10, 12   ->   overhead 1.00x at every size

A chain maps onto a lattice for free, the overhead vanishes, and the calculation reverses entirely: the faster superconducting gates win.

So the question is never "which hardware is better." It is "what shape is my circuit."

The depth overhead is three times the gate overhead

The tables above report Sherbrooke's depth — 18, 36, 63, 115, 136 — and never divide it by anything. The overhead column is a gate ratio. Transpiling the same circuits against an all-to-all coupling map supplies the missing denominator, using the same settings and the same seed as code/example-02-connectivity-cost.py (the ECR and depth columns below reproduce §17.4's table exactly, which is what makes the new columns trustworthy):

    n   all-to-all 2q   a2a depth   Sherbrooke ECR   depth   gate ovh   depth ovh
    4               3           6                3      18      1.00x       3.00x
    6               5           8                7      36      1.40x       4.50x
    8               7          10               15      63      2.14x       6.30x
   10               9          12               27     115      3.00x       9.58x
   12              11          14               35     136      3.18x       9.71x

At twelve qubits the gate overhead is 3.18× and the depth overhead is 9.71× — three times larger, on the axis Chapter 11 §11.7 established as the one that couples to decoherence.

Read the top row before concluding that all of that is routing. At $n = 4$ the gate overhead is exactly 1.00× and the depth overhead is already 3.00×. Three logical two-qubit gates, three hardware two-qubit gates, and three times the depth. Nothing was routed, so the depth came from somewhere else.

The chain control identifies where:

    chain GHZ            n = 4    6      8     10     12
    gate overhead        1.00x  1.00x  1.00x  1.00x  1.00x
    depth overhead       2.50x  2.88x  2.80x  3.25x  2.93x

A circuit with zero routing pays a depth overhead of about 2.9× at every size. That is basis translation, not connectivity: a CX written in the rz/sx/x/cx basis arrives on the device as an ECR wrapped in single-qubit rotations, and the wrappers occupy layers. Chapter 10 §10.3's native-gate cost shows up here as a depth multiplier that is roughly constant and roughly three.

So the star circuit's 9.71× factorizes into two independent mechanisms:

$$9.71 \;\approx\; \underbrace{2.93}_{\text{basis translation}} \times \underbrace{3.31}_{\text{routing}}$$

and the routing factor, 3.31, sits within 5% of the 3.18× measured on gate count. The two effects are separable and they multiply. All-to-all connectivity removes the second one and leaves the first, because an ion trap has a native gate set too and CNOT is not in it either.

📊 What the Numbers Say — 3.18× is a gate ratio. It is not a fidelity ratio, a depth ratio, or a price.

The number this chapter is built on gets quoted as though it were one cost multiplier. It is not. Convert it and it lands somewhere different every time:

text quantity star GHZ, n = 12 factor two-qubit gates 11 -> 35 3.18x depth 14 -> 136 9.71x infidelity at eps = 0.00750 0.0795 -> 0.2316 2.91x dollars, Braket's per-shot rate card 1.00x

The fidelity conversion under-reads it. Survival goes as $(1-\varepsilon)^{N}$, which is concave in $N$, so tripling the gate count does not triple the infidelity: $(1-0.0075)^{11} = 0.9205$ against $(1-0.0075)^{35} = 0.7684$, an infidelity ratio of 2.91× for a gate ratio of 3.18×. The compression gets worse as circuits grow, which is Chapter 29 §29.3's warning that a bounded score stops resolving once a distribution has decohered most of the way to uniform.

The depth conversion over-reads it, at 9.71×, for the reason just measured: about 2.9 of that factor is basis translation and would survive a move to all-to-all hardware unchanged.

And the dollar conversion is exactly 1.00×. Chapter 39 §39.4 established that a per-shot price does not depend on gate count at all, and Braket charges per task and per shot. So the 3.18× overhead that is this chapter's headline result costs precisely zero dollars on Braket's own superconducting rate card. It is paid in fidelity and in wall clock; the invoice never mentions it.

That last row is the one to carry out of the section. The architecture's headline cost is invisible to the pricing model of the platform that hosts both architectures — so the framework that makes the modality choice easiest to express is also the one whose bill contains the least evidence about whether you expressed it correctly.

What the 28× per-shot premium buys, quantitatively

The break-even above is an error-rate threshold: how good an all-to-all device's gates must be to beat heavy-hex on fidelity. It says nothing about what the device costs. Braket is a commercial service, and Chapter 39 §39.4 recorded the two rate cards it prices this chapter's two modalities on:

   AWS Braket (superconducting)    per-task + per-shot    ~$0.30 + $0.00035/shot
   AWS Braket (trapped ion)        per-task + per-shot    ~$0.30 + $0.01/shot

These are published list prices, dated, and they move — Chapter 39 §39.4's as_of discipline applies, and the structure is what survives. The structure is one division:

$$\frac{0.01}{0.00035} = 28.57$$

All-to-all connectivity costs 28.57× per shot. Chapter 39 quotes it as 28× and calls it "not a markup for nothing," which is right — it buys connectivity, coherence, and uniformity together. This section asks how much of it connectivity alone can pay back, because connectivity is the part §17.4 has measured.

Set up the exchange rate. Shot noise falls as $1/\sqrt{N}$ — Chapter 27 measured it on GHZ(3), where 1,000 shots gave a mean TVD of 0.01313 against the $1/\sqrt{N} = 0.03162$ scale. If noise attenuates the quantity you are estimating by a factor $F$, recovering the unattenuated value divides both the estimate and its standard error by $F$, so reaching a fixed precision costs

$$N \;\propto\; \frac{1}{F^{2}}$$

shots. A modality with better fidelity therefore needs fewer of them, and the question is whether it needs 28.57× fewer.

It only has to be better by 5.35×, because the shot count carries a square:

$$\frac{N_{\text{sc}}}{N_{\text{ion}}} = \left(\frac{F_{\text{ion}}}{F_{\text{sc}}}\right)^{2} > 28.57 \quad\Longleftrightarrow\quad \frac{F_{\text{ion}}}{F_{\text{sc}}} > \sqrt{28.57} = 5.35$$

Now evaluate that on this chapter's own circuit. At $n = 12$ the superconducting device runs 35 two-qubit gates at $\varepsilon_{\text{sc}} = 0.00750$:

$$F_{\text{sc}} = (1 - 0.0075)^{35} = 0.7684$$

An ion machine runs 11, and even a perfect one — $\varepsilon_{\text{ion}} = 0$, so $F = 1$ — is $1/0.7684 = 1.30\times$ better.

1.30 against a required 5.35. The premium is not close to being recovered, and no improvement in ion gate quality can close the gap, because 1.30 already assumes error-free gates.

How large would the circuit have to be?

That is a solvable question and the answer is a gate count. Hold the ion machine perfect. The superconducting fidelity has to fall to $1/\sqrt{28.57} = 0.187$, which at $\varepsilon_{\text{sc}} = 0.00750$ takes

$$N_{2q} \;=\; \frac{\ln\!\big(1/\sqrt{28.57}\,\big)}{\ln(1 - 0.0075)} \;=\; 223 \text{ two-qubit gates}$$

   estimator model      required F_sc    superconducting 2q gates
   variance-limited            0.1871                         223
   post-selected               0.0350                         446

(The second row covers workloads that keep only the runs that succeed, where $N \propto 1/F$ rather than $1/F^{2}$ — amplitude-amplification problems, or anything with a verification step.)

A superconducting circuit must run 223 two-qubit gates before an ideal ion machine's fidelity advantage covers the 28.57× per-shot premium, and 446 if the workload post-selects. For scale, put four of this book's circuits beside it:

   circuit                                              superconducting 2q gates
   Ch.17 star GHZ, n = 12                                                     35
   Ch.39 EfficientSU2(14, reps=2) circular, worst seed                       112
   Ch.29 EfficientSU2(6, reps=3) full entanglement, L1                       147
   Ch.28 Grover-like circuit                                                 257

Only Chapter 28's circuit clears the first bar, and none clears the second. That circuit retained 12.9% of the noiseless answer, against $(1-0.0075)^{257} = 0.145$ from the same survival model — close enough to be reassuring and not close enough to be a validation.

This is not an argument that trapped ions are overpriced. It is the observation that the circuit for which all-to-all connectivity is worth paying 28.57× is substantially larger than any circuit this book runs — and that the calculation is four lines of arithmetic available before a single shot is submitted.

💰 Cost and Queue — the task fee makes the premium look smaller than it is.

The 28.57× is a ratio of per-shot rates. It is not the ratio that appears on an invoice, because Braket charges $0.30 per task on both modalities and a fixed fee is a larger fraction of the cheaper bill.

text shots tasks superconducting trapped ion observed fee as % of ratio the sc bill 1,000 1 $0.65 $10.30 15.85x 46.15% 10,000 1 $3.80 $100.30 26.39x 7.89% 100,000 1 $35.30 $1,000.30 28.34x 0.85% 18,456,984 3,240 $7,431.94 $185,541.84 24.97x 13.08%

At a thousand shots the observed premium is 15.85×, not 28.57×. The rate-card ratio is only approached when shots per task are large, and it recedes again when they are not: the bottom row is Chapter 39 §39.5's LiH VQE — 18,456,984 shots over 3,240 tasks — whose observed ratio is 24.97×, because a variational workload is task-heavy by construction.

That is the same mechanism Chapter 39 §39.5 documented from the other side, where 129× became 149× once $972 of task fees were added. A per-task fee flatters whichever modality is expensive per shot, so a team benchmarking with a small pilot run will systematically under-estimate what the ion machine costs at scale — the pilot is the shape that hides it.

The rule: quote the premium at your actual shots-per-task, not off the rate card. One task at 5,760 shots shows 25.00×; one task at 40,500 shots shows 28.00×. The number is a function of your workload's shape and it is printed nowhere.

17.5 Native Gates and Verbatim Boxes

Braket exposes 41 gates, including several that only exist because specific hardware implements them:

Gate Hardware Note
MS, GPi, GPi2 trapped ion (IonQ) Mølmer–Sørensen plus single-qubit phase gates
XY, CPhaseShift superconducting (Rigetti) parameterized two-qubit interactions
ECR superconducting (IBM) the gate from Part II
PulseGate pulse-level control

The native set determines the cost, exactly as Chapter 10 §10.3 established. A CNOT is one logical instruction and compiles into a device-specific sequence — on trapped ions, an MS wrapped in GPi2 rotations.

Verbatim boxes turn the compiler off:

circuit = Circuit().add_verbatim_box(Circuit().rz(0, 0.1).rz(1, 0.2))

Everything inside runs exactly as written, with no transpilation, no optimization, and no rewriting. You must use native gates and respect the device's connectivity yourself.

This is the escape hatch Part II lacked. Chapter 10 documented the transpiler making choices you did not ask for; Chapter 13's Case Study 2 documented a pass silently doing nothing. A verbatim box is how you say run precisely this — essential for benchmarking (Chapter 30), for error-correction circuits whose structure must not be "optimized," and for any experiment where the compiler's helpfulness is the thing you are trying to eliminate.

Why you would ever turn the compiler off

"Run precisely this" sounds like a niche request. It is the default request in five situations, and four of them are chapters of this book.

Benchmarking (Chapter 30). Randomized benchmarking composes $m$ random Clifford gates and appends the single Clifford that inverts them, so the ideal circuit is the identity and the measured survival probability decays with $m$. The whole sequence multiplies to identity, which is exactly the pattern a peephole optimizer exists to notice. A compiler that simplifies it hands the device an empty circuit, the survival probability comes back 1.0 at every sequence length, and you report a perfect machine. The experiment requires that the gates you wrote are the gates that ran.

Error correction (Chapter 25). A code circuit is deliberately redundant — redundancy is what a code is. An optimizer sees redundancy and removes it, and removing it removes the protection. Syndrome extraction must execute as specified or it extracts nothing.

Dynamical decoupling (Chapter 31). A DD sequence is a train of pulses that multiplies to identity by construction. Chapter 31 measured an XX sequence making things significantly worse — $-0.0053 \pm 0.0012$, 4.4 standard errors — which is a real, reproducible negative result, and it is only measurable because the pulses reached the device. A compiler that applies $X \cdot X = I$ deletes the experiment and the finding with it.

Reproducing someone else's result. Chapter 39 §39.8 lists the metadata a hardware result needs to be verifiable, and transpiler version, optimization level and seed are three of its fields. A verbatim box removes all three from the list: there is no transpilation to version, to configure, or to seed.

And characterizing the compiler itself. You cannot measure what a transpiler is worth without a baseline it did not produce. Chapter 29 §29.4's hand-picked layout lost to the transpiler by $-0.0157$, and the only reason that is a measurement rather than an anecdote is that both circuits ran as written.

The common thread is worth naming, because it also tells you when not to reach for one. Every one of these is an experiment whose subject is the execution, not the answer. When you want the answer, let the compiler help — Chapter 10's measurements are unambiguous that it usually does. When the execution is the result, the compiler is a confound.

⚙️ Under the Transpiler — what happens to your circuit before it reaches the ions.

A circuit submitted to Braket is compiled on its way to the hardware, and the vendor's own compiler is part of that path. add_verbatim_box exists to switch that stage off, which tells you the stage is there and that you otherwise cannot see it.

The most visible thing it does is basis translation, and a CNOT on a trapped-ion device is not a CNOT. It becomes an MS with GPi2 rotations around it — code/example-03-native-gates.py writes one out at four instructions against the logical circuit's two:

text logical Bell circuit H, CNOT 2 instructions MS-based equivalent GPi2, MS, GPi2, GPi2 4 instructions

The two-qubit count does not change and the single-qubit count does — the same trade §17.4's depth measurement found on the superconducting side, where a chain GHZ has gate overhead 1.00× and depth overhead ~2.9× entirely from translation. All-to-all connectivity removes routing overhead. It does not remove translation overhead, because an ion trap has a native gate set too.

There is a second reason to care, and it is about counting. connectivity_overhead() counts ("ecr", "cz", "cx") on a backend and ("cx",) against the all-to-all reference, because the two transpilations land in different bases. Count the wrong gate name and the overhead comes back 0.00× — a zero rather than an exception, which is the failure mode that survives review. Any cross-architecture gate comparison has to name the gate set on both sides of the division.

And a version note that runs opposite to the rest of this book: qiskit.pulse was removed in Qiskit 2.0, taking add_calibration, .calibrations, backend.defaults and instruction_schedule_map with it — Chapter 31 is the chapter about what that cost. Braket kept both escape hatches, PulseGate and add_verbatim_box. The framework with the thinner gate-level tooling has the stronger gate-level control, which is not the trade anyone expects and is worth knowing when you need one.

⚠️ Common Pitfall — a verbatim box means you are now the compiler.

Inside the box you get no gate translation, no routing, and no error if your circuit is merely inefficient. You will get an error if you use a non-native gate or an unavailable qubit pair — which is the good case. The bad case is a circuit that runs and is slower or noisier than what the compiler would have produced, because you hand-wrote a decomposition that the transpiler knows how to do better.

Use verbatim boxes when you need control, not when you want performance. Chapter 10's measurements are the reason: the transpiler beat hand-written layouts in most of them.

17.6 Comparing Modalities

The axes that actually differ, and which chapter established each:

Superconducting Trapped ion Neutral atom
Connectivity fixed lattice (+SWAPs) all-to-all reconfigurable
Gate speed ns — fast μs — ~100× slower μs
Coherence ~100s of μs (Ch. 12) seconds ~seconds
Qubit count today ~100–1000+ ~30–50 100s–1000s
Qubit uniformity poor (288× spread, Ch. 12) excellent — atoms are identical excellent
Native 2q gate ECR / CZ MS Rydberg blockade
Best for deep, local circuits connectivity-hungry circuits large-scale, analog

Two rows deserve emphasis.

Qubit uniformity. Chapter 12 measured a 288× spread in two-qubit gate error across one superconducting chip, twelve unusable qubits, and one stuck at a constant output. That entire chapter — the device-health query, layout scoring, the preflight check — is a response to fabrication variability. Trapped ions do not have this problem, because every ion of a given species is identical by the laws of physics. There is no "dead qubit 84" on an ion trap.

Speed. Trapped-ion gates are roughly a hundred times slower. For a variational algorithm running thousands of circuits (Chapter 16 §16.4: $2n+1$ executions per gradient, every iteration), that is the dominant practical constraint regardless of how good the connectivity is.

Neutral atoms add a genuinely different mode: analog Hamiltonian simulation. Rather than applying discrete gates, you arrange atoms in space and let them evolve under a Hamiltonian you have engineered. It is not universal gate-model computing, and for the specific problems it fits — Ising models, certain optimization problems — it reaches sizes the gate model cannot.

Analog Hamiltonian simulation is not a gate model

Calling that "another modality" undersells how different it is. On a neutral-atom device running in analog mode there are no gates at all.

The program is a geometry and a schedule. You place atoms at coordinates in a plane with optical tweezers, then drive them with a global laser field whose amplitude $\Omega(t)$, phase $\phi(t)$ and detuning $\Delta(t)$ you specify as functions of time. The atoms evolve under

$$H(t) = \sum_{j} \frac{\Omega(t)}{2}\Big(e^{i\phi(t)}\,|g\rangle\langle r|_{j} + \mathrm{h.c.}\Big) \;-\; \Delta(t)\sum_{j} n_{j} \;+\; \sum_{j

where $|g\rangle$ and $|r\rangle$ are the ground and Rydberg states, $n_j = |r\rangle\langle r|_j$ counts excitations, and $V_{jk} = C_6 / |\mathbf{r}_j - \mathbf{r}_k|^{6}$ is the van der Waals interaction between two excited atoms.

The interaction term is where the geometry becomes the program. $V_{jk}$ falls off as the sixth power of distance, so two atoms closer than the blockade radius — the separation at which $V_{jk}$ overwhelms the drive,

$$R_b = \left(\frac{C_6}{\Omega}\right)^{1/6}$$

— cannot both be excited. That constraint, no two nearby atoms in $|r\rangle$ simultaneously, is exactly the independent-set condition on the graph you drew when you positioned the atoms. You do not compile the problem into a circuit. You lay it out as a lattice.

Four things this costs, and each of them is a chapter of this book becoming inapplicable:

There is no instruction set, so Chapter 10 has nothing to transpile. Routing, basis translation, optimization levels, and §17.5's verbatim boxes are all operations on a list of gates. There is no list of gates.

There is no per-gate error rate, so Chapter 12's device-health apparatus has no unit. The error budget is state preparation, atom loss, laser phase noise, and readout fidelity — none of which decomposes into "the error of gate $g$ on pair $(a, b)$," which is the shape every tool in Part II assumes.

Chapter 30's randomized benchmarking cannot run. RB measures the average error of a gate group by composing random Cliffords and inverting them. With no gates there is no group, no inverse, and no sequence length to sweep — so the standard way this book characterizes hardware is simply unavailable.

And Chapter 25's error correction has nothing to protect. A code protects logical qubits against errors on physical qubits, defined relative to a gate set that implements syndrome extraction. Analog evolution is not fault-tolerant and is not attempting to be.

What you get in exchange is size. Every gate-model result in this book is capped where two-qubit gate count times error rate caps it, and §17.4's arithmetic is that story told on connectivity. An analog device is not paying a per-gate error, so its ceiling is set by coherence and by how closely the Hamiltonian you engineered matches the one you wanted. For the problems that fit — Ising models, maximum independent set, quantum-magnetism dynamics — that reaches hundreds of atoms, which is the "100s–1000s" cell in the table above.

Analog Hamiltonian simulation is not a faster quantum computer. It is a different machine that answers a narrower question, and the narrowness is why it scales.

Braket exposes it through AnalogHamiltonianSimulation, a program type entirely separate from Circuit. That is the one place the uniform API stops pretending. The abstraction that hides the superconducting-versus-trapped-ion decision behind a device string does not try to hide this one, because there is no shared vocabulary left to hide it in — and it is worth noticing that the decision the API does hide is the one you are more likely to get wrong, precisely because it looks like a device string.

Where trapped ions win, and where they lose

The table lists axes. This is the decision on each of them, with the measurement that settles it.

They win on circuit shape. §17.4's whole subject. A circuit whose interaction graph has high maximum degree — a hub, a ring, a complete graph — pays 3.18× on heavy-hex and 1.00× on ions. Chapter 29 §29.2 measured the same effect on a different circuit family and got 3.27× for full entanglement on six qubits (147 hardware gates for 45 logical), close enough to be a second data point rather than a coincidence.

They win on reproducibility. Chapter 29 §29.5 measured that a circuit with routing overhead 1.0 compiles to one distinct layout across 24 seeds, identical gate count and identical depth every time, while a circuit that does not embed produced 16 layouts and gate counts from 135 to 165. Chapter 39 §39.6's layout roulette — fidelity 0.5755 to 0.7911 from nothing but the seed — is a routing phenomenon, and Chapter 39 §39.1 states the consequence directly: on an all-to-all device that spread cannot occur, because there is no routing to vary. No routing, no roulette.

They win on uniformity. Chapter 12's 288× error spread, its twelve high-readout qubits, its nine dead pairs and its stuck qubit 84 are fabrication artefacts. The whole of Chapter 29 §29.4 — a hand-picked chain scoring 0.6790 because two of its five edges were dead — is a failure mode that requires a chip.

They lose on speed, and the loss is workload-shaped. Ion gates run in microseconds against superconducting nanoseconds, roughly 100×. But that is a gate figure, and Chapter 39 §39.2 measured that a shallow circuit is mostly readout: a Bell circuit is 1.69 µs of which 1,560 ns is the measurement, leaving 130 ns of gates. Scale only the gate portion by 100× and hold everything else at the superconducting device's values:

   circuit             sc duration   gate portion   gates x100   circuit slowdown
   Bell                    1.69 us         130 ns     14.56 us              8.62x
   GHZ-10                  2.49 us         930 ns     94.56 us             37.98x
   EfficientSU2-12         3.22 us       1,660 ns    167.56 us             52.04x
   QFT-8                  10.55 us       8,990 ns    900.56 us             85.36x

A 100× gate slowdown becomes an 8.6× circuit slowdown on a Bell state and an 85× slowdown on QFT-8. The penalty you actually pay is a function of how gate-dominated your circuit is — and the shallow circuits people benchmark with are exactly the ones that hide it.

(That column is a scaling argument, not a measurement of an ion trap. It holds readout, reset and classical overhead fixed at superconducting values, and ion readout is its own physics that this book has not measured. Read it as the part of the slowdown attributable to gates, which is the part the ~100× figure is about.)

They lose on price, by 28.57× per shot, which §17.4 worked through: a superconducting circuit would need 223 two-qubit gates before an ideal ion machine's fidelity advantage repaid the premium, and §17.4's largest measured circuit runs 35.

They lose on qubit count — ~30–50 against ~100–1000+ — which is a harder constraint than any of the above, because it is not a trade at all.

And they lose hardest on variational workloads, where three of the losses compound. Chapter 16 §16.4 established $2n+1$ circuit executions per gradient per iteration; Chapter 39 §39.7 decomposed a 120-iteration VQE into 3,240 tasks and 18,456,984 shots. Price that shot count on the ion rate card and it is Chapter 39 §39.5's $185,542 — the largest number in this book — for thirty-one seconds of device time.

The summary is a shape, not a ranking. Ions win when the circuit is wide in interaction degree and run few times. Superconducting wins when the circuit is local and run many times. Nothing on the Braket device list tells you which of those you have. One transpilation does.

🔬 Honest Assessment — what a multi-vendor API does and does not give you.

The pitch is portability: write once, run on any hardware. It is partly true.

What genuinely transfers: circuit construction, the result types, simulators, and the overall workflow. A Bell state is a Bell state.

What does not: the performance of your circuit, which depends entirely on the modality. A connectivity-hungry circuit that is excellent on trapped ions is 3.18× more expensive on superconducting hardware — and nothing in the portable API tells you that. Portability of code is not portability of results.

This is Chapter 12's lesson at the architecture level. There, choosing the right qubits on one device mattered 100× more than choosing the device. Here, choosing the right modality for your circuit shape can matter more than any amount of software optimization — and it is a decision the abstraction actively hides from you.

Use the common API for development. Make the modality decision explicitly, with a measurement.

A modality-selection procedure

"Make the decision explicitly" needs edges or nobody does it. Here are six steps, all of which run locally, none of which needs an AWS account, and all of which use numbers available before you submit anything.

Step 1 — extract the interaction graph. interaction_graph(circuit) returns the qubit pairs that must interact; interaction_degree(circuit) returns how many distinct partners each qubit needs. The maximum degree is the whole diagnosis. Degree 2 is a chain and embeds in anything; degree $n-1$ is a hub and embeds in nothing of bounded degree. You can read it off the source without transpiling.

Step 2 — measure the overhead. One transpilation against the target and one against CouplingMap.from_full(n), then divide. connectivity_overhead() does both and returns the gate ratio and the depth ratio, which §17.4 measured differing by a factor of three.

   r < 1.2       routing is essentially free -- stop here.
                 Superconducting, for the ~100x faster gates.
   1.2 < r < 2   marginal. Steps 3-5 decide it.
   r > 2         connectivity is a first-order cost. Continue.

Step 3 — convert the overhead into an error threshold. $\varepsilon_{\text{ion}} = 1 - (1 - \varepsilon_{\text{sc}})^{r}$, which §17.4 evaluated at 2.4% for $r = 3.18$. If the all-to-all device's published two-qubit error is below that, all-to-all wins on fidelity. This is the step most people stop at, and it is not the step that decides the invoice.

Step 4 — convert the overhead into a shot count. Compute $F_{\text{sc}} = (1 - \varepsilon_{\text{sc}})^{r m}$ for your circuit's $m$ logical two-qubit gates, and ask whether $F_{\text{ion}} / F_{\text{sc}}$ can exceed $\sqrt{P_{\text{ion}} / P_{\text{sc}}}$. On Braket's rate cards that is $\sqrt{28.57} = 5.35$, and §17.4 showed it takes 223 superconducting two-qubit gates to reach even against a perfect ion machine.

Step 5 — check the workload shape, not just the circuit. How many times does this circuit run? A single execution is a fidelity problem. A variational loop is a wall-clock and dollars problem, and both the ~100× gate slowdown and the 28.57× price multiply by the iteration count while the fidelity advantage does not. This is the step that reverses the answer most often.

Step 6 — write down the reason. recommend_modality() returns a recommendation whose reason is required to cite a number, and one of its tests enforces that. A recommendation without a measurement behind it is exactly what §17.6 is warning about, and the discipline is cheaper to build into the tool than to maintain in yourself.

Run it on the two circuits this chapter has been using all along:

   circuit            max degree   gate ovh   depth ovh   break-even   verdict
   chain GHZ (12)              2      1.00x       2.93x       0.0075   superconducting
   star  GHZ (12)             11      3.18x       9.71x       0.0237   all-to-all

Same final state, same qubit count, opposite recommendations. That is the chapter, in a table.

📐 Math Aside — the break-even is just $r\,\varepsilon_{\text{sc}}$, and knowing that is worth more than the formula.

$\varepsilon_{\text{ion}} = 1 - (1 - \varepsilon_{\text{sc}})^{r}$ looks like something you need a calculator for. Expand it for small $\varepsilon$:

$$1 - (1-\varepsilon)^{r} \;=\; r\varepsilon \;-\; \binom{r}{2}\varepsilon^{2} \;+\; O(\varepsilon^{3})$$

and at these error rates the first term carries almost all of it:

text r exact r x eps ratio two terms 1.00 0.007500 0.007500 1.0000 0.007500 2.14 0.015981 0.016050 1.0043 0.015981 3.18 0.023656 0.023850 1.0082 0.023655 5.00 0.036942 0.037500 1.0151 0.036937 10.00 0.072519 0.075000 1.0342 0.072469

The linear approximation is high by 0.8% at $r = 3.18$ and by 3.4% even at $r = 10$, and two terms reproduce the exact value to five decimal places throughout.

So the whole break-even calculation is a multiplication you can do in your head: an overhead of $r$ needs an all-to-all device roughly $r$ times better on two-qubit error. At $r = 3.18$ and $\varepsilon_{\text{sc}} = 0.0075$ that is about 2.4%, which is the number §17.4 measured.

Two consequences follow from the linearity, and they point in opposite directions. The threshold loosens proportionally with the overhead, so the connectivity argument gets stronger without limit as circuits widen. And the threshold is proportional to $\varepsilon_{\text{sc}}$, so it tightens proportionally as superconducting hardware improves: halve $\varepsilon_{\text{sc}}$ and the ion machine's target halves too. The case for all-to-all connectivity is a case about circuit width, not about the current state of superconducting fidelity — which is why it is the more durable half of the argument. (Compare Chapter 39 §39.4's version of this move: the pricing conclusion is dated because rate cards move, while the method is not.)

🧪 Run It — thirty lines that decide a hardware question.

All of this runs on LocalSimulator and Qiskit's fake backends. No AWS account, no charges.

1. Confirm the MS gate is an $XX$ rotation. Sweep $\theta$ and check the concurrence against the closed form:

```python from braket.circuits import Circuit from braket.devices import LocalSimulator import numpy as np

sv = lambda c: LocalSimulator().run(c.state_vector(), shots=0).result().values[0] for theta in (np.pi / 4, np.pi / 2, np.pi): s = sv(Circuit().ms(0, 1, 0, 0, theta)) print(theta, np.round(s, 4), 2 * abs(s[0] * s[3] - s[1] * s[2])) ```

You should get $|\sin\theta|$: 0.7071, 1.0000, 0.0000. The last one is the point — a $\pi$ rotation is not an entangling gate.

2. Reproduce the bug. Run the four-instruction native circuit from code/example-03-native-gates.py through the same concurrence check. It returns 0.0000. Then look at what np.sort is doing in that file's verification and satisfy yourself that it cannot see the difference. That is the more valuable half of the exercise.

3. Measure your own overhead, on a circuit you actually run:

python from vqelab.topology import interaction_degree, connectivity_overhead print(max(interaction_degree(qc).values())) # the diagnosis print(connectivity_overhead(qc, backend=backend).summary())

If the first number is 2 or 3, stop — your circuit embeds, this chapter's headline does not apply to you, and Chapter 29 is the one you want.

4. Price the decision. Take your circuit's logical two-qubit count $m$ and its overhead $r$, and evaluate $(1 - 0.0075)^{r m}$. Invert it. If the answer is below 5.35, no achievable ion fidelity repays Braket's 28.57× per-shot premium on your circuit — which is not an argument against using ions, it is an argument against using that argument for using them.

5. Break a verbatim box on purpose. Put a cnot inside one and record the error. Then put a native gate on a qubit pair the device does not couple, and record that error too. Both failures are the good case. §17.5's warning is about the silent third case, where it simply runs.

🧱 Project Checkpointvqelab/topology.py: what does connectivity cost me?

Chapter 12 scored layouts on one device. This asks the prior question: is this circuit shape suited to this architecture at all?

interaction_graph(circuit) extracts which qubit pairs actually need to interact, which is the property that decides everything below.

connectivity_overhead(circuit, coupling_map) transpiles against a given topology and against all-to-all, returning the two-qubit gate ratio and the depth ratio — §17.4's table, for your circuit.

breakeven_error_rate(overhead, error_rate) computes the $1-(1-\varepsilon)^{r}$ threshold from §17.4, answering "how good would an all-to-all device have to be to beat this one for my circuit?"

recommend_modality(circuit) combines them into a recommendation with its reasoning attached — and it is required to say why, because a recommendation without a measurement behind it is the thing §17.6 warns about.

Its tests assert two structural facts: a nearest-neighbour circuit has overhead 1.0 on a line, and a star circuit's overhead grows with qubit count.

17.7 Summary

Braket is one API over genuinely different physics. LocalSimulator needs no AWS account; AwsDevice needs credentials and charges per task and per shot — unlike IBM's open tier. Two local backends: braket_sv (state vector) and braket_dm (density matrix, required for noise).

The fluent API chainsCircuit().h(0).cnot(0, 1) — and result types attach to the circuit (probability, state_vector, expectation, amplitude), returning exact values at shots=0. amplitude has no equivalent elsewhere: specific state-vector entries by bitstring.

Braket is big-endian, agreeing with Cirq. Qiskit is the odd one out — 1 of the 3 frameworks tested.

★★ Connectivity is an architectural property with a measured price. A star-GHZ circuit on the real heavy-hex device from Part II:

    n = 4   ->  1.00x overhead,  depth  18
    n = 8   ->  2.14x overhead,  depth  63
    n = 12  ->  3.18x overhead,  depth 136

The overhead grows with size and is still climbing at twelve qubits, and depth grows faster than gate count — which is what matters, since decoherence scales with duration.

On trapped ions the overhead is 1.00× at every size. Not better routing — no routing. Ions share collective vibrational modes, so the Mølmer–Sørensen gate couples any two ions directly; measured, MS(0, 0, π/2) takes $|00\rangle$ to a maximally entangled state in one native gate.

The break-even is computable. With $\varepsilon_{\text{sc}} = 0.00750$ (median over working links) and 3.18× overhead, trapped ions win this circuit if their two-qubit error is below $1 - (0.9925)^{3.18} = \mathbf{2.4\%}$ — a threshold current ion hardware clears. The threshold loosens as $n$ grows.

And it is nearly linear. $1 - (1-\varepsilon)^{r} = r\varepsilon - \binom{r}{2}\varepsilon^{2} + \cdots$, and the first term is high by only 0.8% at $r = 3.18$ and 3.4% at $r = 10$. An overhead of $r$ needs an all-to-all device roughly $r$ times better on two-qubit error — head arithmetic. The threshold is proportional to $\varepsilon_{\text{sc}}$, so it tightens as superconducting hardware improves; the durable half of the connectivity argument is about circuit width, not about today's fidelities.

★ The depth overhead is three times the gate overhead, and it splits into two independent factors:

    n = 12 star GHZ   gate overhead 3.18x   depth overhead 9.71x
    n = 12 chain GHZ  gate overhead 1.00x   depth overhead 2.93x

The chain routes nothing and still pays 2.93× in depth — that is basis translation, a CX arriving as an ECR with single-qubit wrappers. So $9.71 \approx 2.93 \times 3.31$, and the routing factor 3.31 is within 5% of the 3.18× on gate count. All-to-all connectivity removes the second factor and leaves the first, because an ion trap has a native gate set too.

★★ And the 3.18× costs zero dollars. Chapter 39 §39.4 established that a per-shot price does not depend on gate count, and Braket charges per task and per shot. This chapter's headline result is invisible to the rate card of the platform that hosts both architectures. What the rate card does charge is $0.01 versus $0.00035 per shot — 28.57× for all-to-all connectivity — and that premium is recoverable only through fidelity. Since precision scales as $1/\sqrt{N}$, the ion machine has to be $\sqrt{28.57} = \mathbf{5.35\times}$ better, and at $n=12$ even a perfect ion machine is $1/(0.9925)^{35} = 1.30\times$ better. A superconducting circuit needs 223 two-qubit gates before the premium pays, and 446 if the workload post-selects. §17.4's largest measured circuit runs 35; Chapter 28's Grover-like circuit, at 257, is the only one in this book that clears the first bar.

And the observed premium is not the rate-card premium. The $0.30 per-task fee is 46% of a 1,000-shot superconducting bill and 2.9% of the ion one, so the ratio you actually see is 15.85× at 1,000 shots, 28.34× at 100,000, and 24.97× on Chapter 39 §39.5's 3,240-task VQE. Quote the premium at your shots-per-task, not off the rate card.

And the control settles it: a nearest-neighbour GHZ chain has overhead 1.00× at every size, where the calculation reverses and the faster superconducting gates win. The question is never "which hardware is better" but "what shape is my circuit."

The trade is speed: ion gates are ~100× slower than superconducting ones, which dominates for variational workloads running thousands of circuits.

But a 100× gate slowdown is not a 100× circuit slowdown. Chapter 39 §39.2 measured a Bell circuit at 1.69 µs of which 1,560 ns is readout, leaving 130 ns of gates. Scaling only the gate portion: 8.62× on Bell, 37.98× on GHZ-10, 85.36× on QFT-8. The penalty tracks how gate-dominated the circuit is, and shallow benchmark circuits are exactly the ones that hide it. (A scaling argument from measured superconducting durations, not a measurement of an ion trap — ion readout is its own physics and this book has not measured it.)

MS(0, 0, θ) is $\exp(-\mathrm{i}\tfrac{\theta}{2} X\otimes X)$, verified against expm at three angles. Its concurrence is $|\sin\theta|$: 0.7071 at $\pi/4$, 1.0000 at $\pi/2$, and 0.0000 at $\pi$ — a $\pi$ rotation sends $|00\rangle$ to $-\mathrm{i}|11\rangle$, a product state. More MS is not more entanglement.

Neutral atoms in analog mode are a different machine, not a different vendor. The program is a geometry plus a pulse schedule; the Rydberg blockade radius $R_b = (C_6/\Omega)^{1/6}$ turns the lattice you laid out into the constraint you are solving. There is no instruction set, so Chapter 10 has nothing to transpile; no per-gate error, so Chapter 12's device health has no unit; no gate group, so Chapter 30's randomized benchmarking cannot run; and no syndrome extraction, so Chapter 25 has nothing to protect. Braket exposes it as AnalogHamiltonianSimulation, a separate program type — the one place the uniform API stops pretending.

Trapped ions have no fabrication variability. Chapter 12's 288× error spread, twelve dead qubits, and stuck qubit 84 are all consequences of manufacturing; every ion of a species is identical by physics. That chapter's entire device-health apparatus is unnecessary on an ion trap.

Verbatim boxes turn the compiler off — run exactly these native gates, no translation, no routing, no optimization. Essential for benchmarking and error correction; and inside one, you are the compiler, with no protection against writing something worse than the transpiler would have.

Portability of code is not portability of results. The common API transfers circuit construction and workflow; it does not transfer performance, and it actively hides the modality decision — which can matter more than any software optimization.


Next: Chapter 18 — the synthesis. Five frameworks, one comparison, and the practical questions Part III has been accumulating: which to choose, how to move a circuit between them without the endianness bug, and what genuinely transfers when you switch.