Before you submit a quantum circuit to a cloud backend, estimate its resource requirements. This practical workflow shows how to count logical qubits, gate operations, circuit depth, two-qubit interactions, measurements, repetitions, memory, and transpilation overhead so you can compare implementations, identify bottlenecks, and plan experiments with clearer assumptions.
Overview
A quantum circuit resource estimate is a planning model, not a guarantee of runtime or result quality. The same algorithm can have very different requirements depending on how data is encoded, which gates are available on the target device, how the circuit is transpiled, and how many samples are needed to make a conclusion.
Start by separating three layers of cost:
- Logical resources: the qubits, operations, depth, and measurements expressed by your algorithm before hardware-specific compilation.
- Compiled resources: the circuit after decomposition, routing, optimization, and mapping to a device's native gate set.
- Experiment resources: repetitions, parameter evaluations, classical memory, queue submissions, and any additional circuits used for calibration or validation.
This distinction prevents a common mistake: treating the gate count in source code as the final cost. A circuit containing a small number of abstract operations may require additional basis-change gates, swaps, or repeated executions after compilation. Conversely, compiler optimization may remove redundant operations.
Resource estimation is especially useful when comparing a direct implementation with an alternative encoding method, evaluating a variational ansatz, or deciding whether a circuit belongs on a simulator or a hardware backend. For background on basis, angle, and amplitude encoding, see Quantum Data Encoding Methods Compared.
How to estimate
1. Define the workload, not just the circuit
Write down the task the circuit must perform and the output you need. A single probability distribution, an expectation value, and an optimization loop have different resource profiles. Record whether the circuit is run once, repeated for many input records, or evaluated at many parameter settings.
2. Count logical qubits
Count the largest number of qubits that must exist simultaneously. Include data qubits, work or ancilla qubits, and any qubits reserved for error-detection or intermediate calculations. Do not count a qubit that is measured and safely reused as an additional simultaneous qubit, but do record the reuse because it can increase depth.
A useful worksheet entry is:
Logical qubits = data qubits + ancillas + temporary qubits alive at the same time
3. Count operations by type
Record one-qubit gates, two-qubit gates, multi-qubit gates, measurements, resets, and barriers or synchronization points where relevant. Two-qubit gates deserve separate attention because connectivity and error behavior often make them more expensive to compile and execute than one-qubit gates.
Count both the total number of operations and the number on the critical path. Total operations indicate overall work; depth indicates how much sequential execution is required.
4. Calculate circuit depth
Circuit depth is the number of sequential layers when operations acting on different qubits can run in parallel. A simple estimate can be made by placing each gate in the earliest layer that does not conflict with an earlier operation on the same qubit.
Track at least two values:
- Unweighted depth: the number of circuit layers.
- Weighted or duration-aware depth: an estimate based on gate durations, measurement time, reset time, and device scheduling.
The unweighted value is portable and easy to compare. The duration-aware value is more useful when estimating wall-clock execution or exposure to noise.
5. Estimate measurements and repetitions
One circuit definition is rarely equivalent to one hardware execution. If you need a sampled distribution or an expectation value, estimate the number of shots per circuit. If an algorithm evaluates several observables, parameter settings, or input cases, multiply the shot count across those executions.
A basic experiment estimate is:
Total shots = circuits per experiment × shots per circuit × input cases × optimization iterations
For an expectation-value workflow, also count the measurement circuits required for the observable terms. Commuting terms may sometimes be grouped, while noncommuting terms generally require separate measurement settings. The final number depends on the grouping strategy and the precision target.
6. Apply a transpilation scenario
Compile the circuit for a representative target backend or gate basis, then inspect the resulting qubit count, gate counts, depth, and layout. If a specific backend is not yet selected, create at least two scenarios: an idealized all-to-all scenario and a constrained-connectivity scenario.
Compare the pre- and post-transpilation circuits rather than relying on a single overhead factor. Decomposition and routing overhead can vary substantially by circuit structure. The Qiskit Transpilation Explained guide provides useful context for this stage.
| Component | Resource to record | Why it matters |
|---|---|---|
| Data encoding | Input qubits, encoding gates, repeated encodings | Encoding can dominate the circuit before the algorithm begins. |
| Oracle or problem operator | One- and two-qubit gates, ancillas, depth | Often determines the main logical workload. |
| Variational layer | Parameters, entangling gates, layer count | Costs multiply across optimization iterations. |
| Measurement | Settings, shots, observables | Controls sampling and execution volume. |
| Compilation | Native gates, swaps, final depth | Reveals hardware-specific overhead. |
| Classical loop | Iterations, parameter evaluations, stored results | Can exceed the cost of one circuit execution. |
Inputs and assumptions
Write assumptions beside every estimate. At minimum, record the SDK and version, target gate basis, coupling-map assumption, optimization setting, number of shots, number of observables, number of input instances, and expected number of algorithm iterations.
Also distinguish algorithmic qubits from hardware qubits. A logical circuit may fit within a selected qubit count, but the physical device may need additional qubits for routing, calibration procedures, or an error-corrected implementation. If fault-tolerant execution is part of the plan, physical-qubit requirements should be treated as a separate estimate that depends on the error-correction design and target logical error rate. See Quantum Error Correction Explained for the conceptual distinction.
For simulators, memory is another constraint. A state-vector simulation generally stores amplitudes for every basis state, so memory grows rapidly with the number of simulated qubits. A shot-based or tensor-network method may have different limits and assumptions. Record the simulator method, precision, and whether noise is included.
Finally, avoid presenting one number as certain. Use a range when compiler settings, connectivity, shot requirements, or optimization iterations are not fixed. For example, report a baseline circuit and a compiled circuit, then identify which assumption causes the largest increase.
Worked examples
Example 1: A compact sampling circuit
Suppose a circuit uses eight data qubits, one temporary ancilla, 40 one-qubit gates, 24 two-qubit gates, and three measurement settings. Assume 2,000 shots per setting and one input instance.
- Logical qubits: 9
- Logical gate count: 64 gates before decomposition
- Two-qubit gate count: 24
- Measurement executions: 3 settings × 2,000 shots = 6,000 shots
This is only the logical estimate. After compilation, the circuit may contain additional gates or a different depth. Run the circuit through the intended transpiler and repeat the count using the compiled representation.
Example 2: A variational circuit
Consider a variational algorithm with six qubits, four layers, two parameterized one-qubit rotations per qubit in each layer, and one entangling operation between neighboring qubits per layer. If the optimizer evaluates 80 parameter sets and each parameter set requires five measurement groups with 1,000 shots each, the experiment estimate is:
80 parameter sets × 5 measurement groups × 1,000 shots = 400,000 shots
The circuit depth and gate count are important, but the repeated classical loop is the larger execution-volume driver in this example. Before running it, test the optimizer and measurement logic on a simulator, then benchmark quality and runtime against a classical baseline. The Quantum Algorithm Benchmarking Template can help organize that comparison.
Reusable resource-estimation worksheet
- Task and output: ____________________
- Data qubits: ______
- Ancillas and temporary qubits: ______
- Maximum simultaneous logical qubits: ______
- One-qubit gates before compilation: ______
- Two-qubit gates before compilation: ______
- Logical depth: ______
- Compiled depth and native gate counts: ______
- Measurement settings: ______
- Shots per setting: ______
- Input cases or parameter evaluations: ______
- Estimated total shots: ______
- Simulator memory or backend constraint: ______
- Largest uncertainty in the estimate: ______
When to recalculate
Recalculate your estimate whenever the target backend, SDK, transpiler settings, native gate set, connectivity model, measurement strategy, or algorithm version changes. A small source-level change can alter routing and depth, so rerun the compiled count after modifying entanglement patterns, adding ancillas, changing the encoding, or increasing the number of variational layers.
Review the worksheet before each hardware submission and after any major platform or compiler update. A practical maintenance cycle is to revisit representative circuits at least every six months, or sooner when your development stack changes. Also update the estimate when measured results show that more shots, repetitions, or optimization iterations are needed than originally planned.
Before submitting a job, use this final checklist:
- Confirm the maximum simultaneous qubit count.
- Transpile for the intended backend or clearly label the estimate as hardware-independent.
- Record total and two-qubit gate counts before and after compilation.
- Separate circuit depth from total gate count.
- Multiply shots by measurement settings, inputs, and algorithm iterations.
- Check simulator memory or backend capacity.
- State every major assumption and identify the largest uncertainty.
This process turns a quantum circuit tutorial or prototype into an implementation plan. It will not predict every execution outcome, but it gives developers a repeatable way to compare circuits, budget experiments, and decide what must be optimized before moving from a simulator to hardware.