Quantum circuit resource estimation turns an abstract algorithm into an executable plan. This guide shows how to estimate qubit count, circuit width and depth, two-qubit gates, simulator memory, runtime, and measurement shots before you commit to a simulator or cloud backend. Use the worksheet-style process for Qiskit, Cirq, PennyLane, or another quantum SDK, then recalculate after compilation and hardware selection.
Overview
A quantum experiment has several different resource requirements, and no single number describes its size. A circuit may use few qubits but require many repeated measurements. Another may fit comfortably on a simulator in its logical form but become deeper after transpilation for a particular device. Treat resource estimation as a planning loop rather than a one-time calculation.
The most useful distinction is between logical resources and hardware resources. Logical resources describe the circuit you write: the number of algorithmic qubits, operations, layers, parameters, and requested shots. Hardware resources describe what the selected backend must execute after compilation: mapped physical qubits, native gates, routing operations, scheduled duration, calibration constraints, and queue or execution overhead.
| Resource | What to record | Why it matters |
|---|---|---|
| Width | Logical and mapped physical qubits | Determines register size, device compatibility, and simulator state size |
| Depth | Logical and transpiled layer count | Indicates exposure to noise and execution time |
| Gate count | Total gates, especially two-qubit gates | Helps estimate compilation overhead and error accumulation |
| Shots | Measurements per circuit configuration | Controls statistical precision and total workload |
| Memory | Statevector, tensor, or sampling requirements | Determines whether local simulation is practical |
For variational algorithms, include the number of circuit evaluations, not just the size of one circuit. An optimizer may evaluate many parameter settings, and a hybrid quantum-AI workflow may repeat the circuit across training batches, epochs, observables, or gradient calculations. The total workload is usually more important than one circuit diagram.
How to estimate
1. Define the experiment boundary
Write down exactly what counts as one experiment. For example, one experiment might mean “evaluate one parameterized circuit for one data sample and one observable.” A different project may define an experiment as a full optimizer run. Without this boundary, shot and runtime estimates are easy to undercount.
Record the SDK, backend or simulator, circuit family, number of parameter settings, observables, data samples, and repetitions. Keep these values in a configuration file or experiment manifest so that the estimate can be regenerated.
2. Estimate logical width
Start with the largest simultaneous quantum register. Count data-encoding qubits, ansatz qubits, work qubits, ancillas, and any qubits reserved for readout or error-management procedures. Do not count classical bits as qubits, but record them separately if your application stores many measurement results.
For a circuit that processes multiple inputs sequentially, use the width of one input circuit. For inputs processed in parallel, multiply only if the implementation actually creates separate quantum registers in the same job.
3. Estimate logical depth and gates
Depth is the number of sequential layers, where gates acting on independent qubits may occupy the same layer. Record total gate count and break it into one-qubit gates, two-qubit gates, measurements, resets, and barriers or control operations where relevant.
Two-qubit gates deserve a separate line item. Connectivity constraints can require additional swaps or equivalent routing operations, and these can increase both depth and total gate count. A short logical circuit is therefore not necessarily a short hardware circuit.
4. Model transpilation or compilation
Compile a representative circuit for the intended backend using the project’s actual SDK settings. Save the compiled circuit and compare its width, depth, and gate counts with the logical version. If the final backend is not known, compile against several representative connectivity and native-gate configurations and report a range rather than a false precise value.
Keep the compilation configuration with the estimate: SDK version, optimization level, layout strategy, routing method, basis or native gates, and backend target. Changes to these inputs can change the result, so this information is part of the measurement.
5. Estimate shots and total circuit evaluations
Let S be shots per circuit execution. A basic workload estimate is:
total shots = shots per execution × circuit configurations × data cases × repetitions
For a variational algorithm, “circuit configurations” may include optimizer steps, parameter-shift evaluations, observables, and ansatz variants. For a classifier, include the number of samples and any validation or test passes. If you are estimating an expectation value, use a pilot run to assess the observed variance before choosing a final shot budget. See how to interpret shots, uncertainty, and statistical validation for the measurement side of this decision.
6. Estimate simulator memory and runtime
For a full statevector simulation of n qubits, the state contains 2^n complex amplitudes. A rough memory estimate is:
memory ≈ 2^n × bytes per complex amplitude × overhead factor
The overhead factor accounts for temporary arrays, framework objects, gradients, batching, and operating-system or runtime needs. It should be treated as a planning margin, not a universal constant. Statevector simulation becomes impractical when memory, not gate count, is the limiting resource. Tensor-network, stabilizer, matrix-product-state, or shot-based methods may have different scaling and limitations, so record the simulator method rather than applying a statevector formula to every workload.
Runtime is best estimated empirically. Run a small representative circuit, measure compilation and execution separately, and scale the result by the number of circuit evaluations. Include warm-up time, data transfer, job submission, queueing, batching, and result retrieval when planning a cloud workflow. For cloud cost and execution planning, compare this estimate with the budgeting considerations in the practical guide to quantum computing cloud costs.
Inputs and assumptions
Use the following worksheet for each experiment:
| Input | Your value | Notes |
|---|---|---|
| Logical qubits | Include data, ansatz, work, and ancilla qubits | |
| Logical depth | Measure sequential layers | |
| Logical two-qubit gates | Separate from one-qubit gates | |
| Target backend or simulator | Record method and version | |
| Transpiled physical qubits | Measure after compilation | |
| Transpiled depth and gates | Record routing additions | |
| Shots per execution | Set from precision requirements or pilot data | |
| Circuit configurations | Parameters, observables, gradients, and variants | |
| Data cases | Training, validation, test, or optimization instances | |
| Repeated runs | Include seeds, replicates, and error mitigation passes | |
| Memory margin | Reserve capacity for framework overhead |
State your assumptions beside every estimate. “One circuit” can mean one parameterized template or one fully bound circuit. “Depth” can mean SDK-reported depth before compilation or backend depth after routing. “Runtime” can exclude or include queue time. These definitions should be explicit in experiment tracking.
For hybrid quantum-AI projects, also record batch size, number of epochs, gradient method, number of observables, and whether circuits are executed independently or batched. A useful quantum machine learning workflow should compare quantum resource estimates with a classical baseline, because a larger quantum workload may affect the overall application even when the circuit itself is small. The hybrid quantum machine learning pipeline guide provides a broader framework for that comparison.
Worked examples
Example 1: A small parameterized classifier
Assume a classifier uses 6 logical qubits, 12 logical layers, and 18 two-qubit gates. A local simulator is used for 4,000 samples, with 256 shots per sample. Suppose the model requires one circuit evaluation for each sample and two repeated runs for reproducibility.
The estimated shot workload is:
256 shots × 4,000 samples × 2 runs = 2,048,000 shots
This number does not say how long the job will take. Measure a representative compiled circuit, then multiply its observed execution time by 8,000 circuit evaluations. If training also evaluates gradients, add those gradient circuits explicitly rather than assuming they are free.
Example 2: QAOA or VQE planning
Assume a variational experiment has 10 logical qubits, an ansatz depth of 8, 30 two-qubit gates, 5 measured observables, and 100 optimizer steps. If each observable is evaluated independently with 512 shots, a simple estimate is:
512 × 5 × 100 = 256,000 shots
If the gradient method adds four circuit evaluations per optimizer step, the estimate changes to:
512 × 5 × 100 × 4 = 1,024,000 shots
This is why resource estimates should be tied to the algorithm’s evaluation schedule. For implementation patterns across common SDKs, see the VQE and QAOA workflow guide.
Example 3: Simulator memory check
For a statevector simulation, a 20-qubit circuit requires 2^20 complex amplitudes before temporary working memory is considered. A 24-qubit circuit requires four times as many amplitudes as a 22-qubit circuit, because each additional qubit doubles the state size. Use the actual numeric representation, simulator implementation, batch settings, and a safety margin to convert this into a machine-memory requirement. If the estimate is close to available memory, benchmark a smaller representative circuit and consider a different simulation method.
When to recalculate
Recalculate the estimate whenever a planning input changes, especially in these situations:
- After SDK upgrades: transpiler defaults, gate decompositions, measurement handling, or reporting fields may change. Record the version and review migration notes using a process such as the quantum SDK upgrade guide.
- After changing the backend: connectivity, native gates, queue behavior, execution limits, and supported features can alter hardware resources.
- After changing the optimizer or gradient method: the number of circuit evaluations may increase substantially.
- After changing data or batch size: total shots and classical orchestration work scale with the number of cases.
- After transpilation: replace logical width, depth, and gate counts with measured compiled values for the final plan.
- After a pilot run: update shot budgets from observed variance, runtime, failure rates, and result stability.
- When pricing or service terms change: refresh cloud execution and simulator cost assumptions before approving a run.
Before execution, save a resource-estimation record containing the circuit identifier, source commit, SDK version, compilation settings, backend, simulator method, qubit counts, depth, gate breakdown, shot formula, and measured benchmark. After execution, compare predicted and observed values. The difference is useful engineering data: it can reveal hidden gradient evaluations, routing overhead, batching effects, or queue time.
Use this process as a repeatable gate in your development workflow: estimate the logical circuit, compile a representative instance, measure the hardware or simulator form, calculate total evaluations and shots, run a small pilot, and then approve the full experiment. Revisit the worksheet whenever the circuit, SDK, backend, workload, or pricing assumptions change.