HUB
Sign inSign up
quantumreservoir-lab logo

credkellar/quantumreservoir-lab

By credkellar

โ€ขUpdated 17 days ago

QuantumReservoir-Lab: quantum reservoir lab - memory capacity, parity readout, ESN baseline. Sim!!!!

Image
Machine learning & AI
Developer tools
Data science
1

185

credkellar/quantumreservoir-lab repository overview

โ QuantumReservoir-Lab ๐ŸŒŠโš›๏ธ

Quantum Reservoir Computing Lab โ€” Memory Capacity, Fading Memory & a Nonlinear Readout โ€” by Darion Kellar

Educational quantum reservoir computing lab in ONE pure-Python file: the QRC protocol simulated end to end on 5 qubits (32x32 density matrix) โ€” a fixed random Ising reservoir (all 10 ZZ pairs + 5 X fields, couplings drawn from an in-file splitmix64 PRNG seeded 20261118; U = exp(-i H tau) at tau = 5.0 by scaling-and-squaring Taylor, unitarity deviation 3.156e-13, never trained), an input protocol stated as one formula (reset qubit 0 to |s><s| (x) Tr_0[rho], evolve, read the 10 expectation features), and a from-scratch ridge readout graded on held-out data (washout 50 / train 300 / test 200). Memory: per-delay R2 0.963282, 0.725080, 0.725040, 0.659045, then the cliff to 0.000307 at delay 12 โ€” MC = 3.279379 against the classical echo-state baseline's 5.228467 (same readout width 10, same stream, spectral radius scaled 3.032799 -> 0.9). Parity of the last two input bits: quantum readout 0.805 accuracy against the trivial predictor's 0.560 and the baseline's 0.760. A from-scratch distance-weighted kNN labels the measured reservoir fading-memory from the lab's own policy.

Pure Python standard library. Zero dependencies. Zero network. Honest scope: the toy is too small to conclude anything about quantum advantage in either direction โ€” 5 simulated qubits, one seeded series, one readout โ€” and the classical baseline is printed for scale, not as a verdict. No quantum hardware is touched, no model is deployed, and a computed memory capacity is a statement about this teaching model at the stated inputs. Every advantage / deployment / hardware / scaling / vendor / forecasting use is a permanent HOLD gate (14 total).

โ ๐Ÿงฐ Tech Stack Badges & Full Architecture Tech Stack

โ ๐Ÿ’ป Core Programming Languages & Core Systems

Python Stdlib Only Network Deterministic License Memory Capacity Parity

  • ๐Ÿ Python 3.12, pure standard library (math, cmath, hashlib, json, sys) โ€” zero dependencies, zero network, deterministic (double-run byte-identical)
  • ๐ŸŽฒ Determinism core: an in-file splitmix64 PRNG (seed 20261118) written out in full โ€” one stream drawn in a fixed order (reservoir couplings โ†’ input series โ†’ baseline weights), so a stochastic-looking topic still produces byte-identical output on every machine
  • ๐ŸŒŠ Reservoir core from scratch: Kronecker-product Hamiltonian (all 10 ZZ pairs + 5 X fields), the propagator exp(โˆ’iHฯ„) by scaling-and-squaring Taylor (unitarity deviation 3.156e-13, asserted), partial trace + input reset on a 32ร—32 density matrix, expectation features read off the diagonal
  • ๐ŸŽฏ Readout core: ridge regression solved from scratch โ€” normal equations (Xแต€X + ฮปI)w = Xแต€y by Gaussian elimination with partial pivoting; memory scored by squared Pearson correlation (Jaeger's MC measure), parity by thresholded accuracy against the trivial majority predictor
  • ๐Ÿ“Š Classical baseline: a 9-unit tanh echo-state network whose readout has the same width (10) as the quantum one, spectral radius estimated by power iteration on Wแต€W and scaled to 0.9, trained by the identical ridge path
  • ๐Ÿง  TinyML kNN regime classifier (from scratch, stdlib, distance-weighted, k = 3): high-memory / fading-memory / nonlinear-capable / washed-out from (MC, delay-1 Rยฒ, parity accuracy, feature variance on a log scale), labels from the lab's own policy
  • ๐Ÿช‘ Council seats: Gemini Argon 4 DECIDER (names-only, tighten-only) + Muse advisor (never overrides HOLD) + Google Flow plan-only (rendered = False, live = 0)
โ โ›“๏ธ Web3 & Infrastructure
  • ๐Ÿšซ Not applicable โ€” honestly. No blockchain, no Web3, no tokens: the "infrastructure" in this lab is one offline file holding a density matrix, a ridge solver, and a seeded input series. Quantum-advantage and deployment claims are permanent HOLD gates, not features. No fake badges here.
โ โš™๏ธ Platform Support & Hardware Architecture

Linux macOS Windows

  • ๐Ÿ–ฅ๏ธ Pure Python โ€” runs anywhere Python 3.12+ runs (Linux, macOS, Windows), plus the python:3.12-slim Docker image
  • ๐Ÿ”’ No hardware is controlled, ever: real quantum devices, readout electronics, and cryostats are permanent HOLD gates (see the gate table below). This lab simulates a reservoir classically; it does not run one
โ โšก Low-Level Infrastructure & Performance
  • ๐Ÿšซ No low-level code โ€” honestly. No C, no C++, no GPU, no compiled extensions: this is one interpreted Python file on purpose, so every matrix entry can be read, checked, and diffed. Performance here means honest algorithms โ€” a scaling-and-squaring exponential instead of a library call, an exact partial trace instead of a sampling shortcut, and the whole 550-step experiment cached once per process โ€” all deterministic and byte-identical between runs.
โ ๐Ÿ› ๏ธ DevOps & Build Tools

Docker GitHub Actions pytest Git

  • ๐Ÿณ Docker (python:3.12-slim), GitHub Actions CI + Docker Publish (delivered in the paste pack)
  • ๐ŸŽฏ Target image: credkellar/quantumreservoir-lab:latest
  • ๐Ÿงช Tests: pytest (33 tests) + the built-in CHECKS suite (51 checks) in main.py
โ โ˜๏ธ Cloud Providers
  • ๐Ÿšซ None โ€” honestly. No cloud provider is used or needed: the lab runs fully offline on your own machine or in a local Docker container. Docker Hub appears only as the registry the publish workflow pushes the image to.

โ ๐Ÿณ Quick start

docker pull credkellar/quantumreservoir-lab:latest
docker run --rm credkellar/quantumreservoir-lab:latest

The default command runs the full demo plus the built-in self-checks (CHECKS 51/51).

Run a specific command instead:

docker run --rm credkellar/quantumreservoir-lab:latest python3 main.py checks     # CHECKS 51/51
docker run --rm credkellar/quantumreservoir-lab:latest python3 main.py reservoir  # couplings, protocol, unitarity receipt (JSON)
docker run --rm credkellar/quantumreservoir-lab:latest python3 main.py memory     # per-delay R2 table + MC, quantum vs classical (JSON)
docker run --rm credkellar/quantumreservoir-lab:latest python3 main.py parity     # parity accuracy vs trivial predictor (JSON)
docker run --rm credkellar/quantumreservoir-lab:latest python3 main.py baseline   # echo-state baseline report (JSON)
docker run --rm credkellar/quantumreservoir-lab:latest python3 main.py features   # per-feature statistics over the test window (JSON)
docker run --rm credkellar/quantumreservoir-lab:latest python3 main.py classify   # kNN verdicts: high-memory / fading-memory / nonlinear-capable / washed-out
docker run --rm credkellar/quantumreservoir-lab:latest python3 main.py holds      # 14 HOLD gates

โ ๐Ÿ”ฌ What's inside

  • One seeded stream โ€” splitmix64 (seed 20261118) draws couplings, then the input series, then the baseline weights, in a stated order; the whole experiment is byte-identical across runs and machines.
  • The reservoir, receipted โ€” all-pairs Ising H built from Kronecker products; U = exp(-iH tau) by scaling-and-squaring Taylor with unitarity deviation 3.156e-13 asserted in CHECKS; the reservoir is never trained.
  • Input protocol as a formula โ€” rho -> |s><s| (x) Tr_0[rho] with |s> = sqrt(1-s)|0> + sqrt(s)|1>, then rho -> U rho U+; a fresh injection's <Z_0> = 1 - 2s is asserted at four input values.
  • Features with vital signs โ€” bias + <Z_i> + <Z_i Z_{i+1}> read off the density matrix; per-feature statistics over the test window (mean signal variance 0.008048, Z1 variance 0.017960) prove the reservoir is alive.
  • Memory, measured per delay โ€” test R2 0.963282 / 0.725080 / 0.725040 / 0.659045 for delays 1-4, the cliff at delay 5 (0.092422), 0.000307 at delay 12; MC = 3.279379 over the stated floor of 3.0, fading asserted.
  • Parity, graded against trivial โ€” XOR of the last two input bits: quantum accuracy 0.805 vs trivial 0.560 (margin +0.245 over the asserted +0.10), NMSE 0.619474.
  • The baseline in the same table โ€” 9-unit tanh ESN, readout width 10, radius scaled to 0.9: MC 5.228467 (it wins memory), parity 0.760 (it loses parity). Both printed; the toy is too small to conclude anything.
  • TinyML kNN classifier โ€” high-memory / nonlinear-capable / fading-memory / washed-out from (MC, delay-1 R2, parity, log-scaled feature variance); the measured reservoir reads fading-memory, dead features are vetoed to washed-out, and kNN == policy is asserted on all scenarios and all 120 grid points (leave-one-out).
  • Advisory seats โ€” Gemini Argon 4 DECIDER (names-only, tighten-only, sha256 trace), Muse advisor (can never override HOLD), Google Flow plan-only (rendered = False, live = 0).

โ โœ… Verified

  • pytest: 33 passed
  • Built-in checks: CHECKS 51/51
  • Deterministic: double-run byte-identical
  • Base image: python:3.12-slim

โ ๐Ÿท๏ธ Categories

Science ยท Developer tools ยท Machine learning & AI

  • License: MIT ยฉ 2026 Darion Kellar
  • Image: credkellar/quantumreservoir-lab:latest
Tag summary
Recent tags
Content type
Image
Digest
sha256:d7bf63068โ€ฆ
Size
41.6 MB
Last updated
17 days ago
docker pull credkellar/quantumreservoir-lab:latest