Overview
Curated: · Written: · Reviewed:
Hybrid Classical-Quantum Systems & Quantum Machine Learning
In one line
A variational quantum algorithm is a classical optimizer wrapped around a QPU that returns expectation values for one parameter set at a time. Reach for it only when the cost is a low-dimensional expectation the optimizer can afford to estimate, and when a classical baseline with comparable tuning effort has not already matched the target.
Key definitions
- Parameter-shift rule: exact gradient for a gate exp(-i theta P/2) from two shifted circuit evaluations.
- Shot budget: measurements S per circuit; estimate standard error scales as 1/sqrt(S).
- Barren plateau: gradient variance that shrinks exponentially with qubit count for global cost functions.
- Data re-uploading: encoding the same input in several layers so the model can represent higher frequencies.
- Quantum kernel: state overlap |<phi(x_j)|phi(x_i)>|^2, estimated with a compute-uncompute circuit.
- Contribution attribution: ablation against a matched classical baseline on held-out data.
Formulas and complexity
How it works
The classical side holds theta, the update rule, and the stopping test. Each iteration it sends one parameter set, and the QPU prepares the ansatz and returns S-shot estimates of each Pauli term. The cost C(theta) is a weighted sum of those estimates, one circuit per commuting group. Gradients come from shifted evaluations computed classically, so no gradient returns from hardware. Results are keyed by job ID and parameter set, so a late result cannot attach to a newer iterate.
When to use and when not to
| Condition | Quantum stage plausible | Prefer classical |
|---|---|---|
| Data | Quantum data, or a structured problem with a known ansatz | Small classical data where a tuned baseline matches |
| Encoding | Basis or angle encoding, few qubits, O(1) prep depth | Amplitude encoding of dense classical vectors |
| Gradient budget | Small P, large shot budget, parameter-shift affordable | Large P on noisy hardware: use SPSA or COBYLA |
| Latency | Loop tolerates queue waits and drift | Control loops with sub-millisecond deadlines |
| Kernel size | N in the hundreds | N in the tens of thousands (pairs grow quadratically) |
Traps interviewers probe
- Transpiling inside the loop. Transpile the parameterized ansatz once, bind parameters each iteration, and batch the shifted circuits into one job. Per-iteration transpilation and per-circuit submission dominate wall time long before QPU execution does.
- Quoting expressivity as capability. Check gradient variance against qubit count and cost locality before blaming shots. Reachable functions can be untrainable or classically simulable.
- Assuming free amplitude loading. Generic amplitude preparation costs grow exponentially in n without structure or QRAM. State the encoding, its qubit count, and its preparation depth in the answer.
- Trusting a shot-estimated kernel. Symmetrize the matrix, clip negative eigenvalues or add a ridge, and select the regularization inside cross-validation, not against the test split.
- Crediting the quantum stage. Ablate against a random feature map and a tuned RBF kernel on the same preprocessing. Report uncertainty over data splits and seeds, not over shots.
Interview tips
Open with the boundary: "The QPU is a stateless cost evaluator. The classical optimizer owns the parameters, the iterate, and convergence."
Expected follow-ups:
- How do you get a gradient? Parameter-shift on hardware, 2P evaluations per step, batched. Adjoint differentiation only works on statevector simulators.
- Why does the model not train? Check gradient variance versus qubit count, then cost locality, then shot count.
- What does the kernel cost? N(N-1)/2 pairs times shots per pair, with the arithmetic.
- How do you know the quantum part helped? A preregistered ablation against a matched classical baseline, on held-out data, with its cost beside it.
30-second outline:
- Boundary: classical side owns theta and stopping; QPU returns expectations for one parameter set.
- Gradient: parameter-shift, 2P shifted evaluations per step, batched into one job.
- Cost: S shots per evaluation sets the noise floor, and queue latency sets iterations per day.
- Credibility: check gradient variance first, then compare to a tuned classical baseline with equal budget, and report the incremental held-out benefit with intervals over splits.
Feedback on this overview
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.