Q//Horizon 2026 entry from team QEUI

Quantum encoding strategies for electrical grid stability classification

Can a quantum model learn to tell a stable power grid from an unstable one, and when is it worth using? We built quantum-kernel and variational classifiers on at most 8 qubits, scored them against classical models on identical rows, and report what held up.

Q//Horizon 2026 is a quantum computing competition at The American University in Cairo with the Afretec Network. QEUI is the Quantum Computing Club at Egypt University of Informatics.

Angle kernel live on 8 qubits

Each wire carries one grid feature as a rotation. Slide the RY gates to move point z away from point x and watch how similar the kernel says they are.

1.000
K(x, z) = ∏ cos²((xᵢ − zᵢ) / 2)
the number on each wire is that wire's factor

0.902Classical RBF SVMTuned on three folds. 91 of 100 holdout rows correct.
0.830Variational classifier, 4 qubits77 trainable parameters. 84 of 100 correct.
0.813Angle-kernel SVM, 8 qubitsExact fidelity kernel. 84 of 100 correct.

Macro-F1 on the same 100 holdout rows, after training on the same 400 rows. The classical model wins. The competition did not ask us to beat it; it asked us to find out where the quantum models work, where they struggle, and why.

Protocol one wire

Same rows, same folds, one look at the holdout.

A comparison is only fair if both sides see the same data in the same way. Every model on this page passed through this one pipeline, and no choice was made by looking at holdout scores.

  1. 10krows

    The dataset

    UCI Electrical Grid Stability: 10,000 simulated operating points of a four-node grid, labelled stable (3,620) or unstable (6,380).

  2. 8features

    Feature budget

    Reaction times τ1–τ4 and price coefficients g1–g4, picked by an ANOVA F-test fitted on training rows only.

  3. 400/ 100

    Matched split

    400 training rows and 100 holdout rows. Classical and quantum models use exactly these rows.

  4. 3folds

    Cross-validation

    Three stratified folds of the 400. Feature selection and scaling are refitted inside each fold.

  5. F1macro

    Selection

    The model, encoding and circuit are chosen by mean validation macro-F1 and nothing else.

  6. 1×measure

    Holdout

    Each selected model is retrained on all 400 rows and scored on the 100 holdout rows once.

Every quantum circuit here uses at most 8 qubits; the competition limit is 10. All quantum results are exact, noiseless statevector simulations, so they describe ideal circuits and not hardware.

Encodings 3 circuits

Three ways to load eight numbers into qubits.

Before a quantum model can classify a row, the row has to become a quantum state. Fewer qubits is not automatically cheaper or better: the encoding that uses the fewest qubits needs the deepest circuit and scores the worst.

Angle

One feature per qubit. Each qubit is rotated by RY(xᵢ).

8qubits
4depth
32gates
0two-qubit gates
0.854validation macro-F1
± 0.037 over 3 folds

Dense-angle

Two features per qubit. RY for the first, then RZ for the second.

4qubits
4depth
16gates
0two-qubit gates
0.825validation macro-F1
± 0.062 over 3 folds

Amplitude

The row, scaled to length 1, becomes the 8 amplitudes of 3 qubits.

3qubits
17depth
23gates
4two-qubit gates
0.571validation macro-F1
± 0.034 over 3 folds

Depth and gate counts are measured after transpiling each 8-feature circuit to the gate set rz, sx, x, cx. Scores are from a fidelity-kernel SVM with C = 1 on the three training folds.

Results 18 models

Every model on one chart.

Six classical families, three quantum kernels and nine variational circuits, all trained on the same 400 rows and folds. Hover or tab through the rows for details.

00.250.50.751

Macro-F1 runs from 0 to 1. A model that always answers "unstable" scores about 0.39 here because the classes are unbalanced.

bar: mean of 3 validation folds, whisker: ± 1 sample SD diamond: macro-F1 on the 100 holdout rows

Quantum models have a diamond only if cross-validation selected them, because the holdout was used once per selected model. All six classical families were tuned and scored on the holdout for transparency.

Findings 5

What we learned.

The scores say who won. These five results say why. Every number in this section comes from the training folds, so the holdout stayed untouched.

|000⟩The core quantum kernels are classical formulas

None of the three encodings applies a gate between two data qubits. Without entanglement, each kernel collapses to a short formula that any laptop evaluates exactly. We checked the formulas against the statevector simulation on 9,600 kernel entries each: they agree to within 2.4e-13.

So the angle-kernel SVM is a valid quantum model and a fair baseline, but its score cannot show a quantum effect. The live circuit at the top of this page is that formula.

Kangle(x, z) = ∏ cos²((xᵢ − zᵢ) / 2)
Kamplitude(x, z) = (x · z)²
Classical RBF SVM0.880
Angle kernel, C = 100.864
Angle kernel, C = 10.854

Validation macro-F1 on the same angle-scaled inputs. Giving the kernel the same C values as the classical SVM narrows the gap to 0.016.

|001⟩Amplitude encoding cannot tell x from −x

The amplitude kernel is the squared overlap (x · z)². Squaring throws away the sign, so a row and its mirror image look identical. Our features are standardized around zero, which means half of the geometry folds onto the other half.

The evidence: on the very same unit-length inputs, a plain linear kernel x · z scores 0.783 and the quantum amplitude kernel scores 0.584. Normalization costs a little; the squaring costs about 0.2.

x z
x · z
x · (−z)
(x · z)²
(x · (−z))²
Classical RBF0.814
Linear x · z0.783
Amplitude (x · z)²0.584

Validation macro-F1, each at its better C, all on the amplitude-normalized inputs. The dashed vector −z always gets the same kernel value as z.

|010⟩Adding entangling gates did not help

If product states give classical kernels, the natural next step is entanglement. The repository implements three feature maps with RZZ gates and data re-uploading, including one wired like the grid itself, pairing each node's reaction time with its own price coefficient.

On the training folds all three scored below the unentangled angle encoding, and that holds even with the bandwidth α tuned over the grid the encoding's designer recommended (0.1, 0.25, 0.5, 1.0). Tuning helps: the grid-coupled map rises from 0.783 at α = 0.5 to 0.839 at α = 0.1, the custom map peaks at 0.793 and the ultra-dense map at 0.668. Plain angle encoding scores 0.864, and 0.871 at half scale.

The entangled maps improve as α shrinks, which is also as their entangling term fades. This is an exploratory cross-validation result on one dataset, not a verdict on entanglement in general.

Angle, no entanglement0.864
Grid-coupled, α = 0.10.839
Custom, α = 0.10.793
Ultra-dense, α = 0.250.668

Validation macro-F1, mean of three folds, each entangled map at its best bandwidth α and better C (1 or 10). At the default α = 0.5 they score 0.783, 0.732 and 0.629.

|011⟩In the variational circuit, learned input scaling mattered most

Our variational classifier uses 4 qubits, one per grid node, and re-uploads each node's two features in every layer. We changed one design decision at a time across nine variants trained with the same optimizer, folds and restarts.

Letting the circuit learn a scale and shift for each input lifted validation macro-F1 from 0.560 to 0.836 on the same circuit (variant B to variant C). The original fixed-encoding design, variant A, scored 0.650. No other single change came close: flipping the CNOT direction, widening the readout, adding depth or switching to a chain each moved the score by far less, or made it worse. The selected variant, at 0.852, is within fold-to-fold noise of variant C. A standard 8-qubit EfficientSU2 circuit trained the same way stayed near 0.559, so the gain comes from the encoding, not the optimizer.

Validation macro-F1, mean of three folds. The highlighted row was selected and scored on the holdout.

|100⟩The rotation scale is the knob that matters

One quantity explains more of our scores than any circuit choice: how far each feature rotates its qubit. The team's first kernel used a Z feature map, a Hadamard followed by a phase of 2x. That is the same separable kernel as angle encoding, rotated twice as far, and the factor of two alone takes validation macro-F1 from 0.864 to 0.698.

The variational circuit ran into the same quantity. Making the input scale trainable is what lifted it from 0.560 to 0.836. Before asking what a circuit entangles, ask how far it rotates.

Ks(x, z) = ∏ cos²(s (xᵢ − zᵢ) / 2)
s = 0.250.831
s = 0.50.871
s = 1, angle encoding0.864
s = 1.50.795
s = 2, Z feature map0.698

Validation macro-F1 of the same product kernel at five rotation scales s, better of C = 1 and C = 10, mean of three folds.

Certainty 100 rows

How sure are we?

All three final models answered the same 100 holdout rows, so we can compare them row by row. Each dot is one row. Only the rows where exactly one model is right carry evidence about which model is better.

  • 100 holdout rowsA few rows move a score by points. The 95% interval for the classical model's accuracy runs from 84% to 95%.
  • Noiseless simulationNo shot noise and no hardware errors. Real devices would do worse, most of all on the deep amplitude circuit.
  • One simulated datasetA four-node grid model with one random split. These results say nothing yet about real grids or other data.
  • No quantum advantageWe did not find one and do not claim one. The classical RBF SVM is the best model we trained.

One more look at the holdout happened before the encoding comparison: an earlier kernel with a Z feature map was scored on it once (macro-F1 0.644, accuracy 0.71) and then replaced. It chose no model reported here.

Team 4 qubits

Four people, one circuit.

Team QEUI, from the Quantum Computing Club at Egypt University of Informatics.

q0 |data⟩
ZA

Ziad Ahmed

Data engineering and classical baselines.

q1 |encode⟩
SH

Seif Haytham

Quantum encodings and circuit resources.

q2 |model⟩
AH

AbdUlRahman Hany

Quantum kernels and variational classifier.

q3 |report⟩
AG

Abdelrahman Gabr

Research, integration, analysis, report and presentation.