Conditional-GQE (H-cGQE) is an artificial intelligence framework that automatically designs quantum computing circuits for chemistry and materials science.
Traditional Quantum Virtual Eigensolvers (VQEs) rely on manual, human-designed quantum circuits that are either too deep for real quantum hardware or get trapped in mathematical dead-ends called barren plateaus and diagonal collapse.
H-cGQE pairs a Chemical Graph Neural Network (GNN) and a Transformer with Quality-Diversity Reinforcement Learning (QD-GRPO) to amortize ansatz design: conditioned on molecular structure and the electronic Hamiltonian, the model proposes compact operator sequences whose continuous angles are refined classically (L-BFGS-B). The goal is chemical accuracy ($\le 1.6 \text{ mHa}$) within stated active spaces on simulators, with selective hardware checks.
Sub-chemical accuracy ($\le 1.6 \text{ mHa}$) in a controlled 8q comparison (results/phase3_final/benchmark_ch3i_consolidated.json). Distinct from the larger GIC methyl_iodide_cas12 Hamiltonian.
Hydrogen ($\text{H}_2$)
4 Qubits
$1.48 \text{ mHa}$ GPU↔AWS SV1 gap
Shot-noise simulator cross-check
Cross-backend energy discrepancy on a shallow circuit (results/eval/simulator_validation.json); not an FCI error.
IQM Emerald QPU
8 Qubits
$87.5%$ state fidelity
Ideal bitstring target
1024-shot hardware run; fidelity is to the expected computational-basis string, not energy accuracy on QPU.
Benzene ($\text{C}_6\text{H}_6$)
40q (QSCI/MPS path)
QSCI subspace estimate (~19 s)
Full SV OOM / infeasible
Runtime scaling demonstration; not a claim of exact FCI/CASCI match. See results/phase3_final/qsci/.
Ethylene ($\text{C}_2\text{H}_4$)
28 Qubits
MPS bond-dim. sweep ($D=32\ldots256$)
Full SV stressful / often impractical
~300 s single-GPU MPS convergence study; accuracy depends on bond dimension.
GIC molecule suite
4q – 28q
Conditioned generation + collapse mitigations
Diagonal / commuting collapse is a known GQE failure mode
UCCSD pools + entanglement constraints are designed to suppress Z-only collapse. Suite-wide chemical-accuracy rates should be reported from eval JSONs, not assumed 100%.
Notes: Chemical accuracy ≈ $1.6 \text{ mHa}$ ($\approx 1 \text{ kcal/mol}$). Where “exact” references appear below, they mean CASCI/FCI within the stated active space, not full CI in the complete basis. Held-out / zero-shot molecule generalization remains an open evaluation item.
Unlike standard NLP transformers, C-GQE features an Edge-Aware Message-Passing Graph Neural Network (src/gqe/models/chemistry_encoder.py) that encodes the physical topology of the molecule — conceptually analogous to how AlphaFold's Evoformer processes structural relationships:
Edge Features: Chemical bond types, 3D interatomic distances $R_{ij}$, conjugation, ring membership.
Global Invariants: Active space qubit count $N_q$, total electron count $N_e$, spin multiplicity $2S+1$.
Mechanism: 3 layers of edge-weighted message passing → dual pooling (mean + max) → projection to soft prompt tokens that prefix-condition the decoder's cross-attention.
Why GNN? The molecular graph topology (bond connectivity, atom types) determines which fermionic excitations are chemically relevant. A flat MLP on atom counts would miss the graph structure — the GNN captures local chemical environments (e.g., "this carbon is in an aromatic ring with two neighbors") that inform operator selection.
2. Solving "Diagonal Sequence Collapse"
In early GQE implementations, AI agents discovered a "lazy shortcut": generating commuting $Z$-basis operators (e.g., $IZIZ$, $ZZII$). Because these operators commute with the Hartree-Fock state, their energy gradients are identically zero ($\frac{\partial E}{\partial \theta} = 0$). Classical optimizers trap them at $E = E_{\text{HF}}$, killing training gradient variance (std(rewards) = 0).
UCCSD Operator Pool: Built from fermionic single/double excitations mapped via Jordan-Wigner, guaranteeing entangling $X/Y$ operations. Zero Z-only operators by construction.
Entanglement Enforcement: force_entanglement=True in the decoder masks Z-only tokens during sampling, ensuring at least one multi-qubit entangler per sequence.
Verified pool statistics: H₂ (4q): 16 Pauli words, 0 Z-only, 192 pool entries. LiH (12q): 1,408 Pauli words, 0 Z-only. N₂ (20q): 11,088 Pauli words, 0 Z-only. BeH₂ (14q): 3,456 Pauli words, 0 Z-only.
3. Quality-Diversity RL: QD-GRPO with MAP-Elites
Standard Policy Gradient methods (PPO/GRPO) suffer from mode collapse, finding only one circuit structure. We implement MAP-Elites QD-GRPO (src/gqe/rl/map_elites.py):
2D Feature Space: The archive space is discretized into a 10×10 grid indexed by Entanglement Density (ratio of multi-qubit $X/Y$ terms) and Circuit Depth.
Adaptive Novelty Bonus: Rewards the policy not just for low energy, but for filling unvisited cells in feature space:
$$\text{Reward} = w_1 \cdot \left(-\frac{E}{|E_{\text{ref}}|}\right) + w_2 \cdot \text{Entanglement} + \lambda \cdot \text{Novelty}$$
As coverage exceeds $50%$, $\lambda$ decays adaptively to shift focus to energy refinement.
Diagram 7 — MAP-Elites Archive
4. L-BFGS-B Angle Fine-Tuning
For a generated sequence $[A_1, A_2, \dots, A_k]$, each operator $A_i = e^{i\theta_i \hat{P}i}$ requires a continuous rotation angle $\theta_i \in \mathbb{R}$. The energy landscape is:
$$E(\boldsymbol{\theta}) = \langle \psi_0 | U{j_k}^\dagger \cdots U_{j_1}^\dagger \hat{H} U_{j_1} \cdots U_{j_k} | \psi_0 \rangle$$
Diagram 8 — L-BFGS-B Fine-Tuning
Truncated mode (RL training): 3–5 iterations, $\theta_0 = 0.01$, Spearman $\rho \approx 0.5$ with converged energies, $50\times$ faster than full opt.
Why L-BFGS-B? BFGS approximates the inverse Hessian $H^{-1}$ using rank-2 updates from gradient evaluations — no explicit Hessian computation needed. The bounded variant (L-BFGS-B) handles box constraints on $\theta_i \in [-\pi, \pi]$.
DedupCache: MD5 hash of operator sequence → energy. Identical circuits are never re-evaluated. SQLite-backed for persistence across training runs.
5. B200 Energy Cache & Offline RL Pretraining
Diagram 9 — B200 Energy Cache
SQLite Cache: 24,000+ entries keyed by MD5 hash of operator sequence (results/train/rl_energy_cache.sqlite).
Offline Pretraining: src/gqe/data/cache_to_pretrain.py recovers 17,408 (operators, energy) pairs by replaying deterministic circuit generation. This allows replay-buffer mixing of known-good circuits without CUDA-Q.
Cache-only mode: --cache-only returns HF energy for cache misses (no CUDA-Q). Useful for buffer imitation, but on-policy rollouts rarely hit the fixed cache → flat rewards → DAPO advantage collapse. For real RL, use write-through (drop --cache-only) so misses are evaluated and stored. See bash scripts/train_rl.sh full.
6. Scaling to 40 Qubits: QSCI & FMO2
Direct statevector simulation breaks above 28 qubits ($2^{28} \approx 268$M amplitudes). To tackle 32–40 qubit systems required by the GIC challenge, we deploy two scientific scaling pillars:
Diagram 10 — QSCI & FMO2 Scaling
QSCI (Quantum Selected Configuration Interaction): Samples circuits to build a determinant subspace, then classically diagonalizes a reduced Hamiltonian. Used here as a scaling path for ~40q systems (e.g. benzene) when full statevector is infeasible — report subspace energies and wall time, not “exact FCI match,” unless an independent CASCI/FCI reference is provided.
FMO2 (Fragment Molecular Orbital): Fragments large macromolecules into 8–12 qubit sub-units, evaluates them on quantum hardware, and reassembles parent energies via pairwise additive correction:
$$E_{\text{FMO2}} = \sum_i E_i - \sum_{i<j} (E_{ij} - E_i - E_j)$$
7. Comparative Architectural Analysis: H-cGQE vs. SpinGQE & GPT-QE
To contextualize C-GQE against contemporary generative quantum eigensolvers, the table below compares H-cGQE with GPT-QE (NVIDIA / U. Toronto / St. Jude, arXiv:2401.09253) and SpinGQE (Mindbeam AI, March 2026, arXiv:2603.24298):
UCCSD Excitations + Commutator Loss + Entropy Floor
Generalization
Single instance
Single instance
Conditioned for cross-molecule generation (held-out energy tables still needed)
Core Methodological Advances over SpinGQE & GPT-QE
Cross-Molecule Conditioning via Encoder-Decoder:
SpinGQE & GPT-QE Limit: Decoder-only models are typically trained for a single fixed Hamiltonian; changing geometry often means retraining.
H-cGQE Approach: HamiltonianEncoder + ChemistryEncoder (MPNN) condition a shared policy on $(H, \text{graph})$. This enables multi-molecule amortization; rigorous leave-one-family-out energy evaluation is the right test of whether that conditioning generalizes.
Policy Optimization (DAPO RL) vs. Weighted MSE Loss:
SpinGQE Limit: SpinGQE uses a heuristic weighted MSE loss $L = \sum w(E) \cdot (\text{logits}_t - E_t)^2$ to force discrete categorical token logits to regress onto continuous energy values. This leads to vanishing gradients near energy plateaus.
H-cGQE Solution: We frame circuit design as pure Reinforcement Learning via DAPO (Decoupled Clip + Dynamic Sampling Policy Optimization) with group-relative advantage $A_i = \frac{R_i - \mu_R}{\sigma_R}$. Asymmetric clipping ($\epsilon_{\text{low}}=0.2, \epsilon_{\text{high}}=0.28$) and token-level loss stabilize RL updates without surrogate MSE regression.
Decoupled Two-Stage Optimization (Topology vs. Continuous Rotation Angles):
SpinGQE & GPT-QE Limit: Both models discretize continuous evolution times into discrete vocabulary tokens ($e^{i P_j t_k}$ for $t_k \in {0.01, 0.05, 0.1, \dots}$), causing vocabulary explosion and limiting expressivity.
H-cGQE Solution: We decouple discrete structural topology from continuous parameterization. Stage 1 (Transformer) generates the discrete operator sequence $(P_{j_1}, P_{j_2}, \dots)$. Stage 2 (L-BFGS-B) optimizes the continuous rotation angles $\vec{\theta}$ over the exact CUDA-Q expectation landscape using nvidia-mqpu.
SpinGQE & GPT-QE Limit: Autoregressive transformers naturally collapse into generating commuting, single-qubit, or Z-only operators (diagonal sequence collapse) because they carry zero entanglement overhead.
H-cGQE Solution: We maintain a 2D MAP-Elites archive (Entanglement Density $\times$ Circuit Depth). Rollouts discovering unoccupied topological niches receive intrinsic novelty bonuses, forcing the agent to learn non-commuting $X/Y$ entangling operators.
1bash scripts/train_rl.sh smoke # 2 epochs, 2 molecules (~2 min)2bash scripts/train_rl.sh full # write-through RL from SFT (skips cache-only)3bash scripts/evaluate_rl.sh all # infer → eval → optimize → report4# Optional: MAX_QUBITS_OVERRIDE=28 bash scripts/train_rl.sh full
train_rl.sh modes:full / online-rl use write-through caching (CUDA-Q evaluates misses and stores them). Prefer these for real learning. full always starts from the SFT checkpoint (ignores any stale *_rl_warmup.pt). cache-warmup (--cache-only) is kept for buffer-imitation experiments only — on-policy samples almost never hit the precomputed MD5 keys, so misses get a flat HF penalty and DAPO/GRPO advantages collapse.
GPU auto-detection: env_gpu.sh reads compute capability and sets CUDA-Q gate fusion level (Hopper CC 9.0 → fusion 5, Blackwell CC 10.0 → +FP32 emulation, Ampere CC 8.0 → fusion 4). Molecule lists are auto-generated from the Hamiltonians JSON filtered by GPU-specific qubit limits (train_rl.sh defaults to ≤22q on H200).
Import order note: Triton (torch.compile) and CUDA-Q both embed LLVM. train_rl_dapo.py lazy-imports CUDA-Q aftertorch.compile. Do not import cudaq before compiling the model in the same process.
1bash scripts/launch_b200_training.sh sft # supervised warm-start2bash scripts/launch_b200_training.sh ablation # RL from scratch (ablation)3bash scripts/launch_b200_training.sh cache # precompute energy cache (≤28q only)4bash scripts/launch_b200_training.sh both # SFT → RL main pipeline
Energy cache: SQLite-backed circuit→energy store for fast RL. Default cap CACHE_MAX_QUBITS=28. Do not precompute 32–40q SV caches — use QSCI/FMO2 instead. train_rl.sh defaults to ≤22q on H200 (override with MAX_QUBITS_OVERRIDE).
--energy-cache: Path to SQLite file from Stage 1. DedupCache / PersistentEnergyCache loads precomputed energies.
--cache-only: Skips CUDA-Q; uncached circuits get HF penalty. Prefer without--cache-only (write-through) when CUDA-Q is available so novel circuits get real energies. On qBraid: bash scripts/train_rl.sh full.