DESUHE / sg-grand-challenge
PublicHow does QAOA depth affect portfolio-solution quality and quantum-hardware resource requirements as the portfolio problem becomes larger?The experiments show that increasing QAOA depth increases circuit depth and gate count, but does not necessarily produce a better measured solution on current noisy quantum hardware — unless the per-layer angles are tuned for that depth, which the first round of experiments did not do. That gap, why it matters, and the fix we identified for it are documented in Sections 6 and 7.
| Approach | Return Input | Optimisation |
|---|---|---|
| Classical | Historical mean return μ | Classical optimisation |
| Quantum | Historical mean return μ | QUBO → Ising → QAOA |
| Classical + AI | AI-predicted return μ' | Classical optimisation |
| Quantum + AI | AI-predicted return μ' | QUBO → Ising → QAOA |
x ∈ {0,1}ᴺ:
C(x) = Σᵢ (μᵢ − λΣᵢᵢ − cw·costᵢ − P(1−2K)) xᵢ
+ Σᵢ<ⱼ (−2λΣᵢⱼ − 2P) xᵢxⱼ
− PK²
μ is the (historical or AI-predicted) expected return vector, Σ is
the return covariance matrix, cost is the per-asset transaction-cost
vector, λ is the risk-aversion weight, cw is the cost weight, and P is
a penalty coefficient that softly enforces the budget constraint Σᵢ xᵢ = K
(the −P(1−2K)xᵢ, −2Pxᵢxⱼ and −PK² terms together penalise any
bitstring that holds more or fewer than K assets).
All four approaches share this exact formula, verified byte-identical
across the classical and quantum code files — only the return input (μ vs.
the AI-predicted μ') and the solver (classical search vs. QAOA) differ
between them.
zᵢ ∈ {−1,+1} via xᵢ = (1 − zᵢ)/2, giving an equivalent Ising Hamiltonian
H(z) = offset + Σᵢ hᵢzᵢ + Σᵢ<ⱼ Jᵢⱼzᵢzⱼ. This mapping was checked against
brute-force enumeration across 300 random problem instances before use (max
error ≈ 1e-14), so the Ising Hamiltonian used by the quantum circuit is
confirmed to score every bitstring identically to the classical QUBO.
p layers, each consisting of a cost unitary built from
the Ising h/J coefficients (Rz rotations for the linear terms, CX–Rz–CX
for the quadratic coupling terms) followed by an Rx mixer layer, starting
from an equal superposition over all 2ᴺ bitstrings. The circuit is rebased
into the Quantinuum H2 native gateset (Rz, PhasedX, ZZPhase, ZZMax, Measure,
Reset) via pytket's AutoRebase before submission to nexus:H2-2E.page_size to embed more in the static export.nexus:H2-2E) and real
classical runs on live SGX market data (LOOKBACK_DAYS=365, K=2, 500 shots
unless noted), spanning 4 problem sizes × 3 circuit depths × 2 return-input
variants.
classical_baseline is
exhaustive search, it must find the true optimum on whatever data it was
given — so this can only mean the two files fetched slightly different live
market data (each file re-fetches fresh yfinance prices independently on
every run; there is no shared, cached snapshot between files yet). Don't use
this row as evidence of a quantum "win" — re-run both files against a
cached, identical data snapshot before drawing conclusions from it.
quantum_baseline N=20/p=3, ai_plus_quantum N=15/p=3). This was not a
free choice — at that N and depth, 500 shots pushed the job's estimated HQC
cost past what the Nexus/H2 account allows per job (Job cost exceeds
allowed cost, code 1002), so shots had to be reduced to get the job
accepted at all. Lower shot count independently reduces sampling quality, so
don't use those two rows to judge the effect of depth.GAMMA = 0.9, BETA = 0.7) identically at every QAOA layer, regardless of
depth — gammas = [GAMMA] * QAOA_DEPTH, betas = [BETA] * QAOA_DEPTH. Real
QAOA is expected to improve with depth only when each layer's (γ, β) is
independently tuned by an outer classical optimization loop, which this
implementation did not run. Repeating the same single-layer-tuned angles p
times is not equivalent to a properly variational depth-p circuit, and can
plausibly make the sampled distribution worse rather than better — which is
what Section 6.2 shows happening at N=5, 10 and 15.
The fix. We ran an offline statevector simulation (no hardware cost —
pure numerical simulation of the same QUBO at the same problem scale) to
grid-search better per-depth angles instead of guessing:
| Depth | Old (fixed) | Found by grid search | Improvement in simulated P(optimal) |
|---|---|---|---|
| p = 1 | GAMMA=0.90, BETA=0.70 | GAMMA=5.68, BETA=2.55 | ~5–15× |
| p = 2 | GAMMA=0.90, BETA=0.70 | GAMMA=5.09, BETA=0.39 | ~4–30× |
| p = 3 | GAMMA=0.90, BETA=0.70 | GAMMA=5.68, BETA=2.06 | ~2–18× (worse than default at N=15 in one check — not universal) |
portfolio_qaoa.py / portfolio_qaoa_ai.py as a
depth-indexed ANGLES_BY_DEPTH lookup. We attempted to re-run the p=2/p=3
cases on real H2 hardware to confirm the fix, but hit the same Job cost
exceeds allowed cost (code 1002) error described in Section 6.2 — the
account's per-job or remaining-balance cap is now the binding constraint,
not the circuit itself. The angle fix is therefore reported here as
identified, implemented, and offline-validated, but not yet re-confirmed
on hardware before this submission's deadline. We consider this more
defensible than either silently deleting the weaker results or leaving the
root cause unexplained.(μ, Σ, cost) snapshot per
Run and have all four files load from it.Job cost exceeds allowed cost (code 1002) error — needs
resolution with the organizers before it can be re-validated on hardware.(γ, β) per layer, rather than a single pair per
depth, for a complete picture of QAOA depth scaling.