Part II: Qiskit in Depth
"A compiler is a program that translates a program. Everything interesting about a compiler is what it is allowed to change and what it must preserve."
In Part I you used Qiskit. In Part II you learn it.
The difference is the difference between driving a car and understanding the drivetrain, and in quantum programming that difference is unusually consequential. A classical developer can go a whole career without knowing what their compiler emits. A quantum developer cannot, because the thing your compiler emits is what runs on a device with a finite coherence time, and the gap between your elegant three-gate circuit and the forty-gate thing that actually executes is the entire difference between a result and a smear.
This is the longest part of the book and the one a working quantum engineer returns to most. It covers Qiskit's architecture, the construction of circuits complex enough to be interesting, the transpiler in real depth, simulation and noise modeling, hardware execution, and error mitigation.
Two ideas run through all seven chapters.
The first is that your circuit is not what runs. Chapter 10 makes this concrete: hardware supports a handful of gate types and a specific qubit connectivity graph, and everything you wrote gets rewritten to fit. Learning to read that rewrite — and to influence it — is the single highest- leverage skill in this part.
The second is that noise is a first-class object you can model, measure, and fight. Chapter 11 builds noise models that reproduce a real device on your laptop. Chapter 12 reads the calibration data that describes a specific processor on a specific day. Chapter 13 fights back with mitigation, and is careful to say — repeatedly, because the confusion is endemic — that mitigation is not error correction, which waits for Chapter 25.
What You Will Learn
Chapter 7 — Qiskit Architecture. What "Qiskit" names today, what the circuit model actually is, what Aer does, and the primitives — Sampler and Estimator — that are the modern interface to hardware. The most important framing question in the part: which question are you asking, "what outcomes?" or "what expectation value?"
Chapter 8 — Building Complex Circuits. Parameters and parameter vectors, composition, custom gates, the circuit library, barriers, and classical control. This is where the project's ansatz gets its real shape.
Chapter 9 — Dynamic Circuits. Mid-circuit measurement and classical feedforward: quantum teleportation and superdense coding, implemented. Qubit reuse and repeat-until-success. And an honest accounting of what dynamic circuits cost on today's hardware.
Chapter 10 — Transpilation. Basis gates, coupling maps, routing, layout, the pass manager, and optimization levels 0 through 3. How to read the diff between what you wrote and what runs. How to write your own pass. And the single biggest performance trick in variational programming: transpile once, bind many times.
Chapter 11 — Simulation and Noise Models. The simulator family and each one's limit. Why statevector simulation dies near thirty qubits and stabilizer simulation does not die at all. Matrix product states. Building a noise model from a real backend, and by hand.
Chapter 12 — Running on Real Hardware. Choosing a backend, reading calibration data, submitting jobs, and the decision procedure for the question that defines this part: is this noise or is this a bug?
Chapter 13 — Error Mitigation. Readout mitigation, dynamical decoupling, zero-noise extrapolation, probabilistic error cancellation, and twirling. What each one costs in extra circuit executions, and the cases where mitigation makes things worse.
How This Part Fits
Part II assumes Part I completely. It is the foundation for Parts IV through VII: every algorithm chapter runs on hardware, and every one of them depends on the transpilation, simulation, and mitigation machinery built here.
If you are on the 🔰 Beginner path, Chapters 7, 10, 11, and 12 are the required core; Chapter 9 and Chapter 13 can wait. If you are on the 🏗️ Quantum Engineer path, this part and Part V are your professional center of gravity, and Chapter 10 deserves a second read.
Time Investment
| Chapter | Title | Difficulty | Est. hours |
|---|---|---|---|
| 7 | Qiskit Architecture | Beginner | 5 |
| 8 | Building Complex Circuits | Intermediate | 6 |
| 9 | Dynamic Circuits | Intermediate | 6 |
| 10 | Transpilation | Intermediate | 8 |
| 11 | Simulation and Noise Models | Intermediate | 7 |
| 12 | Running on Real Hardware | Intermediate | 6 |
| 13 | Error Mitigation | Advanced | 7 |
| Part II total | ~45 hours |
The Project in This Part
vqelab grows from a toy into something with an architecture. Chapter 7 puts the Runtime primitives
behind a single backend interface so the rest of the package never cares whether it is running on a
simulator or a QPU. Chapter 8 gives the ansatz a parameter vector and a tunable depth. Chapter 10
adds the transpile-once/bind-many optimization that makes the eventual optimization loop practical
rather than absurd. Chapter 11 adds the noiseless reference energy that every later result is
measured against. Chapter 12 adds the real hardware path. Chapter 13 adds mitigation.
By the end of Part II the project has everything it needs except an optimizer and a molecule.
Turn to Chapter 7.