smartyfy.mrindigi.com

Quantum Computing Master Course — 195. End to End Resource Accounting

Lesson 195: End to End Resource Accounting

Smartyfy Quantum Computing Master Course

Objectives and prerequisites

Build a resource ledger that includes preparation, compilation, repetitions, failure handling, correction and readout. Prerequisites are query complexity, circuit decomposition, expectation estimation and fault-tolerance concepts. Resource numbers here are explicit teaching scenarios, not specifications of a current processor or predictions of commercial performance.

Start with an output contract

A resource estimate is meaningful only for a stated result: a sample, an expectation with a specified error, a prepared quantum state, or a complete classical vector. These outputs can have radically different costs even when they use the same central algorithm. Fix the success probability and error metric before counting operations.

Separate input construction from repeated use. A data structure or block encoding may be expensive to build but reusable. An application with thousands of queries can amortize that cost; a one-off task cannot. State what data change between runs and whether rebuilding is required.

Compilation includes basis translation, routing, optimization and parameter binding. Some parts can be reused across repeated circuits, while others depend on each instance. Reporting only the shortest logical diagram omits work needed to produce an executable circuit under actual connectivity and native gates.

End-to-end resource ledger
Stage Useful quantities Typical hidden work
Input and preparation Data size, state-preparation cost Loading, normalization and access construction
Compilation and execution Gate count, depth, qubits, latency Routing and precision synthesis
Repetitions and success Shots, settings, acceptance rate Discarded trials and restarts
Output and protection Readout accuracy, logical failure budget Measurement, correction and classical processing

Worked capstone factor counts

The final project splits the logical Hamiltonian into A = −ΔZL and B = JXL. A first-order r-step product has 2r generator exponentials. A symmetric second-order product has 3r factors before merging and 2r + 1 after adjacent half-A factors are combined.

At r = 16, these counts are 32 for first order and 33 for merged second order. They are logical model-factor counts, not yet physical two-qubit gate counts. The near-equality makes this particular two-term comparison useful, but other formulas and hardware decompositions can have different constants.

In the original two-qubit representation, one A exponential contains two commuting single-qubit Z rotations. One B exponential can be split exactly into commuting XX and YY Pauli exponentials. Under that specified decomposition, the first-order product uses 4r Pauli exponentials, and merged second order uses 4r + 2. Further native-gate synthesis and cancellation still need separate analysis.

Counting both decompositions exposes what is assumed. A processor with a native exchange interaction might realize the B block differently. A simulator multiplying a two-by-two matrix does not establish any of these hardware operation times.

Shots multiply execution cost

For an independent Bernoulli probability estimate, worst-case standard error is 1/(2√N). Requiring it to be at most 0.005 needs N ≥ 10,000 samples. For a ±1 Pauli expectation with the same standard-error target, the worst-case requirement is N ≥ 40,000. The output convention changes the sampling cost.

If an experiment estimates ten independent settings with 10,000 shots each, it uses 100,000 state preparations. If a variational optimizer repeats that collection at one hundred parameter points, the total is ten million preparations before calibration and independent final validation.

Suppose a hypothetical shot takes 10 microseconds for preparation, 20 microseconds for the scheduled coherent circuit, and 5 microseconds for measurement and reset. The per-shot total is 35 microseconds. One million shots require 35 seconds of this idealized serial execution time, before queueing, communication, control overhead and classical processing.

Parallel execution can change wall time but uses additional simultaneous resources. Gate count, depth, throughput and latency are distinct metrics. Report which bottleneck the estimate assumes rather than multiplying a gate duration by every gate when many gates can run concurrently.

Success processing and error correction

If each independent attempt succeeds with probability p and consumes its resources regardless of outcome, obtaining N accepted outputs takes N/p attempts on average. At p = 0.2, ten thousand accepted outputs require fifty thousand attempts on average. A fixed guaranteed deadline needs a tail bound, not just the mean.

Postselection does not make failed work disappear. Coherent amplification can improve some success overheads under additional access assumptions, but its reflections, inverse circuits and error sensitivity must be counted. Do not mix a postselected output fidelity with the resource cost of only the successful branch.

For a fault-tolerant computation with G = 10^8 logical locations and total logical failure target at most 0.01, a simple union-bound allocation is a per-location failure bound of at most 10^(−10). This sufficient accounting step does not determine a code distance by itself. The code, decoder, physical noise and layout determine how much hardware is needed to achieve the bound.

Logical gate synthesis, non-Clifford resource preparation, syndrome extraction, routing and classical decoding can contribute major overheads. A count of logical qubits without the error-correction architecture is not a complete physical-qubit estimate. Conversely, a worst-case overhead model should not be presented as a measured implementation.

Amortization and matched comparisons

Suppose preprocessing costs one million abstract operations and each subsequent query costs one thousand. Over one thousand reusable queries, average cost per query is 1,000,000/1000 + 1000 = 2000 operations. For a single query it is 1,001,000. The reuse assumption changes the conclusion substantially.

Apply the same accounting boundaries to classical competitors. Include their preprocessing and exploit their reuse and structure fairly. A comparison that charges input construction only to one side, or gives one side exact expectations while charging the other for samples, does not solve the same resource problem.

Finally distinguish estimates, executed local timings and actual device measurements. Local Python timing mainly reflects that implementation and machine; it is not a direct prediction of quantum runtime. Report a range or unresolved component when evidence is missing rather than assigning a fabricated number.

Four worked exercises

  1. Count merged second-order logical factors and specified Pauli exponentials for r = 8.

    Solution. Logical factors are 2r + 1 = 17. Under the stated two-qubit decomposition, Pauli exponentials are 4r + 2 = 34. Neither number is automatically a native-gate count.

  2. How many attempts are expected for 500 accepted outputs at success probability 0.1?

    Solution. The expected total is 500/0.1 = 5000 attempts, assuming independent stable success and restart behavior.

  3. At 35 microseconds per serial shot, how long do 200,000 shots take before other overhead?

    Solution. They take 200,000 × 35 × 10^(−6) = 7 seconds. Queueing and classical processing were explicitly excluded.

  4. What per-location failure allocation suffices for G = 10^6 and total failure at most 0.001 by a union bound?

    Solution. Use at most 0.001/10^6 = 10^(−9) per location. This is a target for the protection design, not a derived physical error rate or code distance.

Five explained multiple-choice questions

  1. What is required before comparing total resources? A. Only equal qubit counts. B. Only equal algorithm names. C. A matched output, accuracy and success contract. D. Only a central subroutine’s query count.

    Answer: C. Different outputs or tolerances can dominate the cost and change the problem.

  2. How many worst-case samples give Bernoulli standard error at most 0.005? A. One hundred. B. Ten thousand. C. One thousand. D. Forty thousand is the minimum under this Bernoulli bound.

    Answer: B. The requirement 1/(2√N) ≤ 0.005 gives N ≥ 10000.

  3. Why can postselection hide resource cost? A. Rejected attempts require no preparation. B. Acceptance probability must always be one. C. Postselection removes all physical noise. D. Failed attempts may consume full execution resources without contributing accepted outputs.

    Answer: D. The cost ledger includes attempts, not just retained results.

  4. What does the union-bound allocation determine directly? A. A unique surface-code distance. B. The number of physical qubits for every architecture. C. The exact decoder runtime. D. A sufficient target for per-location failure probability.

    Answer: D. Translating that target into hardware requires a separate code and noise model.

  5. When is preprocessing amortization justified? A. Whenever preprocessing is inconvenient to report. B. Only for quantum algorithms and never classical ones. C. When repeated runs rebuild the data structure from scratch each time. D. When the data structure is genuinely reused under a stated workload.

    Answer: D. Reuse must be real and counted consistently for all compared methods.

Pitfalls and summary

Count the complete path from input to usable output. Separate abstract factors, native gates, wall time, repetitions and protected resources. Amortization and success processing are legitimate only when their assumptions remain visible in a matched comparison.

Primary sources and further study

These sources support the definitions and context. The numerical examples, exercises, and explanations here were prepared for this lesson. Research papers are optional advanced reading.