A reliable quantum machine learning experiment starts before the circuit is written. This workflow helps you define the task, prepare data, choose an encoding and model, compare against classical baselines, validate results, and report resources clearly enough for someone else to reproduce the work.
Overview
Quantum machine learning (QML) combines a classical data pipeline with a quantum circuit, usually in a hybrid loop. A classical optimizer proposes parameters, a quantum processor or simulator evaluates the circuit, and the resulting measurements are used to update the model. The quantum component may be a feature map, a variational classifier, a kernel, or part of a larger optimization routine.
The central evaluation question is not simply whether a circuit produces a high score. It is whether the complete workflow adds useful value compared with a reasonable classical approach under comparable conditions. That requires controlling the dataset, preprocessing steps, train-test split, parameter budget, execution method, and evaluation metrics.
For background on qubits and circuits, see this quantum computing learning path for beginners. If your project is still at the use-case stage, the classical-versus-quantum feasibility checklist can help determine whether a QML experiment is a sensible next step.
A repeatable QML workflow
- Define the prediction or optimization problem.
- Establish a classical baseline.
- Prepare and split the data without leakage.
- Reduce and encode features deliberately.
- Select a circuit architecture and training objective.
- Train with controlled settings and repeated runs.
- Evaluate on held-out data and inspect uncertainty.
- Report circuit and execution resources alongside performance.
Checklist by scenario
Scenario 1: You are starting with a supervised classification problem
- Define the target: Record the label meaning, number of classes, class balance, and the cost of false positives versus false negatives.
- Choose an appropriate metric: Accuracy may be inadequate for imbalanced data. Consider precision, recall, F1 score, balanced accuracy, area under a suitable curve, or a task-specific cost.
- Build a classical baseline: Use a simple reference model and, where practical, a stronger classical model. Keep preprocessing and data splits consistent so the comparison is meaningful.
- Set a feature budget: Do not assume that every original feature must be mapped to a qubit. Remove irrelevant variables, test dimensionality reduction, or select a small feature subset with a documented rule.
- Choose the QML model: A variational classifier may use a feature-encoding circuit followed by trainable layers. Record the number of qubits, layers, gates, trainable parameters, and measurement outputs.
- Use a controlled split: Create training, validation, and test partitions before fitting transformations that learn from the data. Fit scaling, imputation, and dimensionality-reduction steps on the training set only.
The related guide on variational classifiers and QML evaluation provides a useful companion when implementing this scenario.
Scenario 2: Your data has more features than available qubits
- Decide whether to select features, compress them, or use a sequential or grouped encoding.
- Fit any compression method only on training data, then apply the learned transformation to validation and test data.
- Measure whether compression changes the classical baseline before adding the quantum circuit.
- Compare at least two encoding choices when the experiment is exploratory, such as angle-based encoding and a compact amplitude-style representation where appropriate.
- Record encoding depth and repeated data-uploading steps, because a representation that fits the feature count may still create an impractical circuit.
Encoding is part of the model, not a neutral formatting step. Different encodings change circuit depth, parameter count, measurement behavior, and the way information reaches the trainable layers.
Scenario 3: You are testing a variational quantum neural network
- Start with a small circuit and a fixed initialization strategy.
- Specify the ansatz pattern, entangling gates, repetition count, and observable or measurement rule.
- Run multiple seeds or initial parameter settings so one favorable optimization path is not mistaken for a general result.
- Track training and validation loss separately. A decreasing training loss with stagnant validation performance may indicate overfitting.
- Compare optimizers and learning rates only through a defined experiment plan, rather than selecting the best result after many unrecorded trials.
- Check whether gradients, objective values, or measurement noise make optimization unstable.
Scenario 4: You are evaluating a quantum kernel or hybrid feature map
- Define exactly how the kernel matrix is estimated and whether it is computed by a simulator or hardware.
- Use the same train-test protocol as the classical kernel comparison.
- Check matrix properties and numerical stability before fitting the downstream classical model.
- Separate the cost of constructing the kernel from the cost of training and prediction.
- Test whether the quantum feature map changes performance enough to justify its circuit and sampling requirements.
What to double-check
Data integrity and leakage
Inspect every transformation between raw data and circuit input. Leakage can occur when normalization, feature selection, imputation, augmentation, or dimensionality reduction uses information from the validation or test set. Duplicated records across partitions can also produce an inflated score. For time-dependent or grouped data, use a split that respects chronology or group boundaries rather than a random split by default.
Baseline fairness
A quantum model should be compared with baselines that receive the same useful information and follow the same split rules. Record the classical model type, preprocessing, hyperparameter-selection process, and evaluation metric. A weak baseline does not establish that the quantum method is useful; it only establishes that the quantum method beat that particular reference.
Uncertainty and repeated runs
One run is often insufficient for a trainable model. Store results for different random seeds, report the spread of scores, and distinguish variation from optimization, finite measurement shots, and hardware noise. The guide to measurement and shot allocation can help when sampling uncertainty affects comparisons.
Resource reporting
Performance should be accompanied by the resources needed to obtain it. Record qubit count, circuit depth, two-qubit gate count, total gate count, trainable parameter count, shots per circuit, number of circuit evaluations, simulator or hardware mode, and transpilation settings where relevant. Use the circuit resource estimation guide and transpilation checklist as practical references.
Experiment results template
Keep a compact record for every run:
- Task and dataset: objective, sample count, feature count, label definition, and split method.
- Preprocessing: scaling, selection, compression, and the data partition used to fit each transformation.
- Encoding: encoding type, qubit count, repetitions, and encoding depth.
- Model: ansatz, trainable parameters, observable, optimizer, initialization, and stopping rule.
- Execution: simulator or hardware, shots, transpilation details, noise settings, and circuit evaluations.
- Results: training, validation, and test metrics; seed-level variation; runtime or execution cost where available.
- Interpretation: baseline comparison, limitations, and the next experiment.
Common mistakes
- Starting with a large circuit: More layers and qubits increase the number of factors that can obscure why a result changed. Begin with the smallest circuit that tests the hypothesis.
- Treating encoding as an afterthought: An encoding can dominate depth and measurement cost. Test it as an explicit design choice.
- Reporting only the best seed: Selective reporting hides optimization variability. Preserve all planned runs and summarize the distribution.
- Using the test set for tuning: Once test performance guides model selection, it is no longer an unbiased final estimate. Keep a final holdout when the project allows it.
- Comparing incomparable budgets: A QML model with extensive tuning should not be compared with an untuned classical baseline. Define a fair tuning and resource protocol.
- Ignoring the classical pipeline: The quantum circuit is only one part of the system. Preprocessing, data transfer, compilation, sampling, and postprocessing may affect practical value.
- Confusing a simulator result with hardware readiness: A noiseless simulation can test algorithmic behavior, but it does not by itself establish performance under hardware constraints.
For optimization-focused experiments, such as QAOA, the same discipline applies: define the objective, compare with a classical method, track circuit resources, and evaluate solution quality rather than only optimizer loss. The QAOA Max-Cut tutorial offers a concrete example of that pattern.
When to revisit
Revisit this workflow before each new dataset, model family, or execution environment. A change in feature count may require a new encoding; a change from simulation to hardware may require shallower circuits, revised shot budgets, or a different noise analysis. A new library version can also change APIs, transpilation behavior, default optimizers, or supported backends, so rerun a small validation experiment before comparing new results with old ones.
Use a short review before seasonal planning cycles or major project milestones:
- Restate the use case and success metric.
- Recheck the data split and leakage controls.
- Rebuild or verify the classical baseline.
- Review qubit, depth, gate, shot, and evaluation budgets.
- Repeat the smallest representative experiment with fixed seeds.
- Decide whether the next step is better data, a different encoding, a simpler circuit, improved validation, or no quantum model.
Keep experiment logs under version control and link each result to the code, dataset version, configuration, and execution environment. Developers building these skills can use the quantum developer roadmap to turn individual QML experiments into a reproducible portfolio. The goal is not to add a quantum circuit to every machine learning problem. It is to test a clearly defined hypothesis with enough discipline to determine whether the quantum component contributes useful, repeatable value.