Skip to content

Add quantum execution intelligence engine with 5 core backends#161

Merged
ruvnet merged 10 commits intomainfrom
claude/blockchain-forensics-research-duFZc
Feb 12, 2026
Merged

Add quantum execution intelligence engine with 5 core backends#161
ruvnet merged 10 commits intomainfrom
claude/blockchain-forensics-research-duFZc

Conversation

@ruvnet
Copy link
Copy Markdown
Owner

@ruvnet ruvnet commented Feb 12, 2026

Summary

This PR transforms ruqu from a classical coherence monitor into a full-stack quantum execution intelligence engine -- a layered operating platform that decides how, where, and whether to run quantum workloads. The codebase expands from ~2K lines to ~24K lines of production Rust, adding five simulation backends, cost-model routing, error correction, and hardware abstraction.

Key Changes

New Simulation Backends

  • StateVector (state.rs): Dense state-vector simulator for exact simulation up to ~32 qubits
  • Stabilizer (stabilizer.rs): Aaronson-Gottesman tableau for Clifford-only circuits (millions of qubits)
  • TensorNetwork (tensor_network.rs): Matrix Product State for low-depth, locally-connected circuits
  • Clifford+T (clifford_t.rs): Stabilizer rank decomposition for moderate T-count circuits
  • Hardware (hardware.rs): Unified provider abstraction for IBM Quantum, IonQ, Rigetti, Amazon Braket, and local simulation

Cost-Model Execution Planning

  • Planner (planner.rs): Predicts memory, runtime, and selects optimal backend based on circuit structure
  • Decomposition (decomposition.rs): Partitions circuits into independent segments (temporal/spatial/hybrid strategies) for parallel execution
  • Backend Analysis (backend.rs, circuit_analyzer.rs): Structural circuit classification (gate count, T-count, entanglement, connectivity)

Quantum Error Correction

  • Decoder (decoder.rs): Ultra-fast surface code decoder with union-find clustering and partitioned MWPM
  • QEC Scheduler (qec_scheduler.rs): Minimizes feed-forward latency via deferred corrections and batch merging
  • Control Theory (control_theory.rs): Models QEC feedback loop as discrete-time control system

Error Mitigation & Noise

  • Mitigation (mitigation.rs): Zero-Noise Extrapolation, measurement error correction, Clifford Data Regression
  • Noise (noise.rs): Kraus-operator channels (depolarizing, amplitude damping, thermal relaxation) with device calibration

Execution Infrastructure

  • Pipeline (pipeline.rs): End-to-end orchestration (plan → decompose → execute → stitch → verify)
  • Verification (verification.rs): Cross-backend certification and statistical testing
  • Replay (replay.rs): Deterministic execution records for reproducibility
  • Confidence (confidence.rs): Statistical bounds, chi-squared tests, convergence monitoring
  • Benchmark (benchmark.rs): Comprehensive proof suite for routing, entanglement budgeting, adaptive decoding

Interoperability

  • OpenQASM 3.0 (qasm.rs): Circuit export with ZYZ Euler decomposition for arbitrary unitaries
  • Mixed Precision (mixed_precision.rs): Float32 state vectors for 2x memory savings

Documentation

  • Updated README from "Classical Nervous System" to "Quantum Execution Intelligence Engine"
  • Added architecture diagrams, capability matrix, and five-layer platform overview
  • Included research papers on blockchain forensics and Shor's algorithm projections

Implementation Highlights

  1. Trait-based backend abstraction: All simulators implement QuantumSimulator trait for pluggable execution
  2. Cost-model routing: Predicts memory/runtime for each backend; selects optimal one without trial-and-error
  3. Sublinear QEC decoding: Union-find decoder achieves O(n·α(n)) amortized time for surface code syndrome decoding
  4. Hardware provider registry: Unified interface for real devices and simulators with realistic metadata/calibration
  5. Deterministic reproducibility: Execution records capture all parameters (circuit, seed, noise, shots) for bit-for-bit replay

Testing & Validation

  • All modules include comprehensive docstring examples
  • Benchmark suite validates routing speedups, entanglement budgeting, and cross-backend certification
  • Confidence module

https://claude.ai/code/session_01FppgvMQdPUKXrpHADLPxfh

Maps ruvector's quantum error correction (ruQu) capabilities to blockchain
transaction forensics, identifying five novel contributions:
- Subpolynomial dynamic min-cut for real-time transaction graph decomposition
- QEC-inspired coherence gating for live transaction stream monitoring
- Anytime-valid e-value testing for court-defensible attribution
- Cryptographic witness chains for tamper-evident forensic audit trails
- Quantum-classical hybrid pipeline (QAOA + GNN + vector similarity fusion)

Includes comparative analysis against current SOTA (GNN-based, heuristic
clustering, commercial platforms) and 20-week implementation roadmap.

https://claude.ai/code/session_01FppgvMQdPUKXrpHADLPxfh
…riment)

Maps ruQu's implemented quantum primitives to known cryptanalytic attack
surfaces: variational factoring via VQE, Grover's search on symmetric keys,
QAOA for lattice problems, interference-based side channels, and a novel
self-learning cryptanalytic framework using the three-filter pipeline.

Key insight: the software stack for quantum cryptanalysis is closer to ready
than the hardware. Defensive recommendations included for post-quantum
migration planning.

https://claude.ai/code/session_01FppgvMQdPUKXrpHADLPxfh
Speculative but grounded projection of Shor's algorithm trajectory across
five decades: NISQ-to-fault-tolerant transition (2026-2036), routine
factoring era (2036-2046), post-cryptographic paradigm (2046-2056), and
long-term legacy (2056-2076). Includes hardware scaling estimates, wildcard
scenarios (lattice breaks, QEC breakthroughs, hardware walls), and how
ruQu's architecture positions for each phase.

Key thesis: the software stack (ruQu) is closer to ready than the hardware,
and Shor's lasting legacy is the urgency it created for PQC migration, not
the numbers it will eventually factor.

https://claude.ai/code/session_01FppgvMQdPUKXrpHADLPxfh
Scale the quantum simulator from 25 to 32+ qubits via 6 new modules:

- simd.rs: AVX2 SIMD gate kernels + rayon parallel dispatch
- stabilizer.rs: Aaronson-Gottesman tableau (millions of Clifford qubits)
- tensor_network.rs: Matrix Product State with QR truncation (hundreds-thousands)
- backend.rs: Circuit analysis + automatic backend routing
- circuit_analyzer.rs: Gate classification, Clifford detection, bond dim estimation
- mixed_precision.rs: f32 state vector for 2x memory savings (up to 33 qubits)

Bumps MAX_QUBITS from 25 to 32 for dense state vector.
253 tests pass across all backends.

https://claude.ai/code/session_01FppgvMQdPUKXrpHADLPxfh
Transform ruqu-core from a simulator into a scientific instrument and
QEC control plane. Adds ADR-QE-015 and 16 new modules across 4 layers:

Scientific instrument layer:
- qasm.rs: OpenQASM 3.0 export with ZYZ Euler decomposition
- noise.rs: Kraus channel noise (depolarizing, T1/T2, readout, crosstalk)
- mitigation.rs: ZNE via gate folding, measurement correction, CDR
- hardware.rs: provider HAL (IBM/IonQ/Rigetti/Braket adapters)
- transpiler.rs: basis gate decomposition + BFS qubit routing
- replay.rs: deterministic replay via seeded ChaCha20 RNG
- witness.rs: SHA-256 hash-chain tamper-evident witness logging
- confidence.rs: Wilson score, Clopper-Pearson, chi-squared, TVD
- verification.rs: automatic cross-backend comparison + certification

SOTA differentiation layer:
- planner.rs: cost-model circuit router (memory/runtime/fidelity)
- clifford_t.rs: Clifford+T via low-rank stabilizer decomposition
- decomposition.rs: hybrid circuit partitioning (interaction graph + min-cut)

QEC control plane:
- decoder.rs: union-find + partitioned surface code decoder (sublinear)
- qec_scheduler.rs: feed-forward minimizing QEC scheduling engine

Modified: stabilizer.rs (clone_with_seed for Clifford+T forking),
lib.rs (16 module declarations across 4 layers).

https://claude.ai/code/session_01FppgvMQdPUKXrpHADLPxfh
subpoly_decoder.rs (1207 lines):
- HierarchicalTiledDecoder: O(d^(2-epsilon)) expected-case complexity
  via recursive multi-scale tiling with boundary merging
- RenormalizationDecoder: coarse-grain syndrome lattice at multiple scales
- SlidingWindowDecoder: streaming O(w*d^2) per-round for real-time QEC
- ComplexityAnalyzer: provable complexity certificates and threshold theorems
- DefectGraphBuilder: spatial-hashed defect graph construction

benchmark.rs (790 lines):
- Proof 1: routing cost-model outperforms naive/heuristic selectors
- Proof 2: entanglement budgeting as deterministic compiler constraint
- Proof 3: real-time adaptive decoder with measurable latency gains
- Proof 4: cross-backend approximation certification with bounded error

https://claude.ai/code/session_01FppgvMQdPUKXrpHADLPxfh
control_theory.rs: formalizes the QEC classical control loop as a
discrete-time control system with provable stability conditions.

- QecControlLoop: plant/controller/state model for syndrome→decode→correct
- StabilityAnalyzer: derives convergence conditions (decode latency <
  syndrome period), critical error rates, stability margins
- ResourceOptimizer: Pareto-optimal allocation of physical qubits vs
  code distance vs decode parallelism
- LatencyBudgetPlanner: end-to-end timing model for QEC rounds
- BacklogSimulator: dynamic simulation of error accumulation under
  varying decode throughput
- ScalingLaws: classical overhead O(d^alpha) and logical error
  suppression p_L ~ (p/p_th)^(d/2) predictions

Completes the 20-module quantum execution intelligence engine.

https://claude.ai/code/session_01FppgvMQdPUKXrpHADLPxfh
Tighten module documentation and reduce verbosity while preserving
all public API surface and functionality.

https://claude.ai/code/session_01FppgvMQdPUKXrpHADLPxfh
- New title: "Quantum Execution Intelligence Engine" (was "Classical
  Nervous System for Quantum Machines")
- Platform Overview: simulate, optimize, execute, correct, verify
- Five-layer architecture diagram with all 30 modules
- Complete module reference tables with line counts per layer:
  Layer 0 (Core Engine, 13 modules), Layer 1 (Scientific Instrument, 9),
  Layer 2 (SOTA Differentiation, 3), Layer 3 (QEC Control Plane, 2),
  Layer 4 (Theoretical Foundations, 2), Layer 5 (Proof Suite, 1)
- Totals table: 30 modules, 24,676 lines, 5 backends, 4 hardware
  providers, 6 noise channels, 3 mitigation strategies, 5 decoders
- Coherence gating section preserved with validated results
- Honest limitations table with path forward for each gap
- Updated roadmap: v0.3 (execution engine) marked Done, v0.4 next
- Application domains table: healthcare, finance, QEC, cloud, hardware
- Ecosystem table linking all ruQu crates
- Trimmed tutorials to 5 (removed redundant ones)
- Removed emoji prefixes from section headers

https://claude.ai/code/session_01FppgvMQdPUKXrpHADLPxfh
… routing, min-cut, fidelity

Implements the four capabilities identified as missing in the README:

1. **pipeline.rs** (615 lines): End-to-end execution orchestration that
   chains plan -> decompose -> execute -> stitch -> verify. Includes
   PipelineConfig, PipelineResult, per-segment execution, and fidelity
   estimation. 8 tests.

2. **CliffordT backend routing**: Added BackendType::CliffordT variant
   to backend.rs. Integrated T-rank analysis into planner.rs cost model
   with memory prediction (2^t * n^2/4 bytes) and runtime prediction
   (2^t * n^2 * gates * 0.15ns). Routes circuits with >32 qubits and
   moderate T-count (<=40) to Bravyi-Gosset decomposition.

3. **Stoer-Wagner min-cut** (decomposition.rs): O(V^3) global minimum
   cut algorithm replacing greedy spatial partitioning.
   `spatial_decomposition_mincut` recursively bisects along min-cuts.
   4 tests validating linear, triangle, and barbell graph topologies.

4. **Fidelity-aware stitching** (decomposition.rs): `stitch_with_fidelity`
   models Schmidt coefficient loss at partition boundaries. Each cut
   entangling gate contributes F_cut = 2^(-k/2) fidelity penalty.
   StitchFidelity struct tracks per-boundary and overall fidelity. 2 tests.

Also updated classify_segment to route moderate T-count segments to
CliffordT instead of TensorNetwork, with threshold at 40 T-gates.

803 tests pass (602 lib + 40+37+77+36 integration + 11 doc-tests).

https://claude.ai/code/session_01FppgvMQdPUKXrpHADLPxfh
@ruvnet ruvnet merged commit 1fc6a1a into main Feb 12, 2026
5 checks passed
ruvnet added a commit that referenced this pull request Feb 20, 2026
Transforms ruqu from classical coherence monitor into full-stack quantum execution intelligence engine (~2K to ~24K lines).

New: StateVector, Stabilizer, TensorNetwork, Clifford+T, and Hardware simulation backends. Cost-model planner, surface code decoder (union-find O(n*alpha(n))), QEC scheduler, noise models, OpenQASM 3.0 export, deterministic replay, and cross-backend verification.

PR #161
@ruvnet ruvnet deleted the claude/blockchain-forensics-research-duFZc branch April 21, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants