Skip to content
CLIOSearchCtrl K
Download

A hybrid quantum classifier

This example is a real recorded session with the IBM Quantum plugin. Asked a plain question, the agent built a small hybrid quantum-classical classifier and a classical baseline, trained both, ran the hybrid on an exact simulator and on a simulated noisy IBM device, and compared the two image by image. Everything ran locally: no IBM account or key was used. You can open the whole session below.

The session started from this request, with no tools or steps named:

Build a hybrid quantum-classical classifier for MNIST 0 vs 1, compare it with a
classical baseline, and show me how hardware noise changes it
  1. The agent loaded the plugin’s hybrid quantum machine learning skill and built a Python environment for PyTorch and Qiskit in the workspace with CLIO’s own uv.
  2. Both models share a small classical front end that reduces each 28×28 image to two numbers. The hybrid feeds them to a two-qubit circuit (a ZZ feature map and one layer of trainable rotations) and reads ⟨ZZ⟩; the baseline uses a linear layer instead. Same data, epochs, optimizer and loss.
  3. It published a live dashboard before training started, and the training script streamed each epoch’s loss and accuracy to it.
  4. After a first run, it checked the exact simulator’s values against PyTorch, found that the quantum layer had been trained with an unintended 1/64 shot noise, and retrained with exact values.
  5. It evaluated the trained hybrid on 100 test images as one batched estimator job on the exact simulator and one on fake_fez, a noisy simulation that uses the calibration data of IBM’s Fez device.
The training dashboard, filled live as each epoch finished. The classical baseline (pink) learns the task in one epoch; the hybrid (blue) levels off.
Model Run on Test accuracy
Classical baseline PyTorch 100%
Hybrid Exact simulator 73%
Hybrid fake_fez noisy simulator 73%

Noise pulled the hybrid’s outputs toward zero, by about 12% (a fitted slope of 0.88), with a mean shift of 0.052. No image changed class. Five images sit within 0.05 of the decision threshold, so they are the ones a stronger noise level could flip.

The agent stated the limits itself: the two-qubit head underfits, the noisy run used one seed and one calibration snapshot, and the result is not evidence of a quantum advantage.

Asked to show how the noisy results compare with the exact ones for each test image, the agent opened the plugin’s results view: one point per image, exact and noisy side by side, the shape marking the true class and a dashed line the class threshold.

The results view. Each image appears twice, exact and noisy; the noisy point sits a little closer to the threshold.

Clicking a point selects that image, and the agent sees the selection. Here image 6 was selected, the image nearest the threshold, and the question was simply: “Why does this image sit so close to the boundary, and could noise flip it?”

The selection reaches the agent as the image, both values and its true class.
The answer works from the selected values, the trained weights and the noisy run, and says what it has not shown.

The page is an interactive archive of the actual session. Opening it does not run the agent or contact any service. The plugin’s interactive views run only in a live session, so the results view appears above as captures rather than in the archive.

A real-hardware run of the same evaluation needs an IBM Quantum account; see IBM Quantum for how CLIO asks for the key and checks the time left before it submits.