"""Render the measured hardware-surrogate results as a Markdown subsection.""" import json from pathlib import Path p=Path(__file__).resolve().parent d=json.loads((p/'hardware_results.json').read_text()) def interval(a,scale=1): return f"{a['mean']*scale:.3f} [{a['mean_ci95'][0]*scale:.3f}, {a['mean_ci95'][1]*scale:.3f}]" opt='\n'.join(f"|{r['phase_bits']}|{r['drift_std_rad']*1000:.1f}|{r['readout_std_normalized']:.3f}|{interval(r['top1_agreement'],100)}|{interval(r['top4_recall'],100)}|{interval(r['calibrated_certified_fraction'],100)}|" for r in d['photonic']['summary']) neu='\n'.join(f"|{r['candidate_fragments']}|{interval(r['dense_trace_mse'])}|{interval(r['immediate_bandit_mse'])}|{interval(r['dense_over_sparse_host_speed_ratio'])}|{interval(r['approx_trace_touch_ratio_dense_over_sparse'])}|" for r in d['neuromorphic']['summary']) cost='\n'.join(f"|{r['shape'][0]}×{r['shape'][1]}|{r['phase_mode']}|{r['loss_dB']:.2f}|{r['static_power_W']:.3f}|{r['digital_time_ns']:.3f}|{r['optical_time_ns']:.3f}|{r['digital_energy_nJ']:.3f}|{r['optical_energy_nJ']:.3f}|" for r in d['hardware_cost_model']['rows'] if r['weight_reuse']==1000000) text=r'''# M7–M8: photonic and event-driven implementation study **Status:** executed digital simulations and host Python timings, with a separate analytical hardware scenario model. No photonic chip, neuromorphic chip, GPU power sensor, or physical accelerator was accessed. These studies do not demonstrate accelerated end-to-end learning on photonic hardware. ## M7 — Photonic screening compiler ### Operation that maps to optics Given a candidate-fragment compatibility matrix \(W\in\mathbb R^{m\times n}\) and a task/intervention signature \(x\in\mathbb R^n\), calculate \(s=Wx\). This is a linear score used to shortlist proposed learning-algorithm fragments. Matrix multiplication is the only operation mapped to a simulated optical primitive. Typed program checking, guide editing, proof checking, nonlinear decisions, replay, and loss evaluation remain digital. We use \(W=U\Sigma V^T\), with orthogonal factors represented by Givens rotations and diagonal singular-value attenuators. Each Givens angle is rounded to a finite phase grid and perturbed by independent Gaussian drift fixed during a 256-input calibration block. This is an idealized real coherent-interferometer model with logical Givens connectivity; it is not a layout-level simulation of a fabricated nearest-neighbour MZI mesh. The singular attenuators, input DAC, and signed output ADC are quantized to eight bits. Signed outputs assume balanced coherent homodyne readout; direct intensity detection cannot recover arbitrary signed amplitudes without another encoding or reference beam. The effective measured score is \[ \widetilde s=Q_{\rm ADC}\bigl(\widetilde U\widetilde\Sigma\widetilde V^TQ_{\rm DAC}(x)+\eta\bigr), \qquad \eta_i\sim N(0,\sigma_r^2). \] The effective matrix is renormalized through a calibration gain. Optical loss is accounted for in the separate photon/energy model, rather than silently setting propagation time equal to learning time. A fixed normalized noise level is a simulation input, not a measured detector specification or complete shot-noise spectrum. Thermal drift is represented by angle perturbations; full correlated thermomechanical dynamics are outside this surrogate. ### Conservative screening and interaction with M9 Assume calibration has identified the effective matrix \(\widetilde W\) with a known rowwise error allowance. With exact calibration as used here, let \[ B_i(x)=\|\widetilde W_i-W_i\|_2\|x\|_2 +\|\widetilde W_i\|_1\Delta_{\rm DAC}/2 +\sigma_r\sqrt{2\log(2mN/\alpha)}+\Delta_{\rm ADC}/2. \] For \(N\) input vectors and unsaturated converters, the Gaussian union bound and triangle inequality give \[ \Pr\{\forall i,b:\ |\widetilde s_{ib}-s_{ib}|\le B_i(x_b)\}\ge1-\alpha. \] Real calibration error must add its own row bound to \(B_i\); this study does not estimate that error from a physical device. The simulated test uses \(\alpha=0.001\) per 256-input block. A top-score candidate \(c\) is certified only if \[ \widetilde s_c-B_c>\max_{i\ne c}(\widetilde s_i+B_i). \] This can be consumed by the M9 lock: reject or shortlist only when bounds establish the relevant comparison, otherwise return to the digital validator. The certificate preserves a *linear screening decision*, not an algorithm's general learning capability. It cannot replace the capability certificate. If calibration cost, fallback cost, and digital validation dominate, optical screening loses. The source also reports an a posteriori certificate based on the true maximum error computed from exact \(Wx\). It is useful for diagnosis only and is explicitly not an implementable shortcut: obtaining that error requires the digital answer. ### Executed simulation The experiment uses 12 independent matrix/data seeds, 256 normalized random signatures per seed, and a 64×32 spectral-normalized random matrix. The score target is synthetic fragment ranking, with no claim that random signatures reproduce LLM algorithm search. Confidence intervals are bootstrap intervals over the 12 seed means; individual vectors within one fixed matrix are not treated as independent seed replicates. |Phase bits|Drift standard deviation, mrad|Read noise standard deviation|Top-1 agreement, % [95% CI]|Exact winner retained in top 4, % [95% CI]|Conservative calibrated certificate coverage, % [95% CI]| |---:|---:|---:|---:|---:|---:| OPTTABLE No certified top-1 error occurred in the simulated blocks. This finite observation does not prove universal correctness or validate real calibration. At eight phase bits and low drift, replacing exact selection with unvalidated top-1 selection is materially unreliable. Keeping four candidates usually retains the exact winner, but even 99.967% measured recall is not a deterministic guarantee. Conservatively certifying a decision eliminates most apparent shortcut opportunities. This is a useful negative result: approximate optical ranking needs fallback or retention-aware selection. ### End-to-end scenario model Let \(R\) be the number of score evaluations reusing one programmed matrix, \(B\) the host batch size, and \(C\) the number of evaluations per calibration. The latency model is \[ T_o=T_{\rm launch}/B+T_{\rm interface}+T_{\rm DAC}+T_{\rm prop}+T_{\rm ADC} +T_{\rm program}/R+T_{\rm calibration}/C. \] For a digital reference with MAC throughput \(F_d\) and bandwidth \(\beta\), \[ T_d=T_{\rm launch}/B+\max\{mn/F_d,\;2(mn/R+m+n)/\beta\}. \] With \(N_\gamma\) detected photons per output, wall-plug efficiency \(\eta_w\), wavelength \(\lambda\), local-oscillator multiplier \(a_{\rm LO}\), and power transmission \(\tau\), \[ E_{\rm laser}=\frac{a_{\rm LO}mN_\gamma hc}{\lambda\tau\eta_w}, \quad \tau=10^{-L_{\rm dB}/10}, \quad L_{\rm dB}=L_0+\ell(m+n). \] \[ E_o=E_{\rm laser}+nE_{\rm DAC}+mE_{\rm ADC}+P_{\rm static}T_o +N_\phi E_{\rm program}/R+E_{\rm calibration}/C+(m+n)E_{\rm IO}. \] The digital energy includes MAC, I/O, amortized weight-memory terms, and an assumed 0.5 W controller/static allowance multiplied by digital latency. The optical model separately uses a 0.5 W shared control allowance plus phase-control static power. These equations intentionally expose conversion and static phase-power terms. They remain an incomplete architecture model: physical fan-out, crosstalk, heat transport, nonlinear learning, synchronization, and layout are unresolved, so favorable values are neither a feasibility proof nor a performance prediction for a named product. All numerical assumptions are exposed in `CostAssumptions` and copied into the JSON results. Selected inputs are 10 TMAC/s and 0.5 pJ/MAC for an abstract digital reference; 512 GB/s memory bandwidth; 50 ns host launch amortized over 1,024 vectors; 1 ns DAC, 0.1 ns propagation, 2 ns ADC, 5 ns electronic interface; 50 µs matrix programming; 100 µs calibration every 100,000 vectors; 2 pJ/DAC sample and 5 pJ/ADC sample; 20% laser wall-plug efficiency; 1550 nm wavelength; 100,000 received photons per output; a 10× local-oscillator allowance; fixed optical loss 6 dB plus 0.03 dB per assumed mesh stage. Phase controls are assigned either 5 mW static power each (thermo-optic scenario) or 1 µW each (a low-static hypothesis), plus 0.5 W shared control. **These are transparent scenario choices, not literature-derived specifications, vendor claims, or measured properties.** The resulting loss of a large monolithic mesh is intentionally not hidden. The following subset fixes \(R=10^6\). The JSON also includes \(R=100\) and \(10^4\), where programming is less well amortized. |Matrix|Phase-power scenario|Assumed loss, dB|Static power, W|Digital latency, ns|Optical latency, ns|Digital energy, nJ|Optical energy, nJ| |---|---|---:|---:|---:|---:|---:|---:| COSTTABLE The 128×128 and 512×512 thermo-optic cases violate the study's 50 W static-power envelope. The low-static 512×512 scenario has a modeled latency advantage but a substantial energy disadvantage because loss increases laser demand. No result establishes an optical advantage for the small prototype. Partitioned low-loss tiles or reused wavelengths are sensible future hypotheses; they have routing, fan-out, and interface costs and are not silently substituted into these results. ### Architecture decisions and prior-art boundary MZI meshes support coherent linear transformations; wavelength-division multiplexing could evaluate independent signatures concurrently when phase/memory settings and readout lanes permit; microring banks offer an alternative weighted-sum implementation with resonance tuning and crosstalk constraints. These are established photonic concepts, not inventions claimed here. AION screening does not require all three simultaneously. Photonic/optoelectronic memory could reduce repeated programming only if retention, update energy, drift, and calibration are characterized. Fully forward optical learning and integrated backpropagation concern physical training; this prototype neither reproduces them nor invents a new optical gradient rule. In-situ gradients could calibrate or train the compatibility matrix, but the measured digital experiment is inference/screening only. A full learning-speed comparison must include training, weight programming, fallback, capability checks, search control, and test quality. ## M8 — Event-driven delayed-credit selector ### Learning equations At event \(t\), a fragment \(i_t\in\{1,\ldots,K\}\) emits signed amplitude \(a_t\in\{-1,1\}\). Define \(x_t=a_t e_{i_t}\), with \(x_t=0\) before the stream starts. A finite-horizon eligibility state is \[ e_t=\sum_{j=0}^{H-1}\rho^j x_{t-j} =\rho e_{t-1}+x_t-\rho^H x_{t-H}. \] The modulatory prediction error and update are \[ \widehat r_t=w_t^T e_t,\quad \delta_t=r_t-\widehat r_t,\quad w_{t+1}=w_t+\eta\delta_t e_t. \] This is exact online gradient descent for squared error in a *linear eligibility-feature model*, not full recurrent spiking-network training. Delayed credit enters through previous fragment events remaining in \(e_t\). The signed event code can be represented physically by two nonnegative event channels; the source simulates signed scalar events directly. The dense implementation decays, reads, and updates \(K\) entries per event. The sparse implementation stores the distinct fragment indices appearing within the last \(H\) events and removes a trace when its last contributing event expires. It requires at most \(H\) active traces. With one event per step, time is \(O(K)\) versus \(O(\min(K,H))\), and trace payload is \(O(K)\) versus \(O(\min(K,H))\). Both retain \(K\) learned weights, so total weight memory is still \(O(K)\). Python dictionary overhead is not included in the reported float64 payload; payload bytes must not be called total resident memory. **Equivalence:** induction on the recurrence establishes that the sparse dictionary equals the nonzero entries of the dense trace, apart from floating-point rounding. The same prediction and gradient then produce the same weights. This efficient representation is a standard sparse event implementation; it is not a new credit-assignment theorem or independent evidence of RSI. For a conventional spiking neuron with hidden state \(h_j^t\), an eligibility recursion instead propagates local derivatives through \(\partial h_j^t/\partial h_j^{t-1}\) and multiplies by a neuron learning signal. E-prop approximates difficult global learning signals while retaining local eligibility dynamics. BrainTrace further provides model-agnostic linear-memory online learning. Those are relevant stronger baselines for a genuine recurrent SNN study. They are discussed from primary literature, not benchmarked by this linear source; superiority over them is unestablished. ### Executed comparison Eight seeds generate a previously unseen stream per run. Each stream has 12,000 training and 3,000 test events; weights freeze before test while traces continue through the stream, so test is subsequent-time generalization on the same synthetic generator, not a new task-family benchmark. Ground truth is \(r_t=\theta^Te_t+\xi_t\) with Gaussian \(\theta\) and noise standard deviation 0.1. We fix \(H=12\), \(\rho=0.9\), and learning rate 0.035 without a test-set tuning loop. Timing excludes data generation and includes prediction/training/test-stream bookkeeping. Execution orders alternate by seed to reduce systematic timing-order bias. No claim of isolated microarchitectural benchmarking is made. The immediate-event bandit uses \(\widehat r_t=w_{i_t}a_t\) and updates only that event. It intentionally lacks delayed features and serves as a diagnostic baseline. The dense eligibility learner is the compute-relevant strong baseline because it uses exactly the same learning rule and information as sparse M8. A lower MSE than the immediate bandit cannot establish algorithmic novelty. |Fragment count K|Dense and sparse held-out MSE [95% CI]|Immediate-event bandit MSE [95% CI]|Dense runtime / sparse runtime [95% CI]|Estimated trace-entry touch ratio [95% CI]| |---:|---:|---:|---:|---:| NEUTABLE The sparse implementation is slower for small dictionaries despite fewer arithmetic touches; Python dictionary overhead dominates. At 16,384 fragments, it is faster on this host while preserving the dense result. Poorer MSE at large \(K\) reflects insufficient observations per independently unknown fragment under a fixed event budget, and is not concealed. This is a runtime scaling result for exact sparse representation, not evidence that the selector improves the ability to invent learning algorithms. Across the full study, the maximum dense/sparse learned-weight difference is MAXWEIGHT and the maximum individual squared-test-error difference is MAXERROR. The large reduction in touched entries should not be equated to the measured speed ratio or to energy savings. No hardware energy was measured for M8. ### Interaction with algorithm discovery and a decisive follow-up Events can denote fragment activation, guide rewrite, retained capability, or a delayed validation outcome. Eligibility then routes a later measured validation signal to still-active guide decisions. An appropriate ablation replaces sparse M8 by dense exact eligibility, which should preserve learning quality while changing cost. Replacing it by an immediate bandit changes its information and addresses a different question. A strong follow-up uses the same typed-fragment candidate stream across e-prop/BrainTrace-compatible spiking selectors, dense linear eligibility, and sparse linear eligibility; the metric must be held-out discovery quality per *total search cost*, including dictionary and validation overhead. ## Reproduction and provenance `hardware_study.py` needs Python and NumPy only. Execute: ```bash OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1 python hardware_study.py --output . ``` `--quick` uses smaller seed/event counts and produces a distinct reduced run; it is not the published full configuration. Five self-checks cover Givens reconstruction, orthogonality, dense/sparse weight equality, dense/sparse test-error equality, active-horizon/positive-cost constraints. They are numerical checks, not independently reviewed proofs. `hardware_results.json` contains all per-seed rows, assumptions, environment, summary intervals, host timings, and self-check results. `write_hardware_report.py` generates this report from that file. ### Primary references 1. Xue et al., *Fully forward mode training for optical neural networks*, Nature 632, 280–286 (2024), DOI: [10.1038/s41586-024-07687-4](https://doi.org/10.1038/s41586-024-07687-4). The source establishes a physical forward optical training method; no architecture-specific performance number from it is used in this scenario model. 2. *Integrated photonic neural network with on-chip backpropagation training*, Nature (2026), DOI: [10.1038/s41586-026-10262-8](https://doi.org/10.1038/s41586-026-10262-8). Relevant physical-training prior art; not reproduced. 3. Bellec et al., *A solution to the learning dilemma for recurrent networks of spiking neurons*, Nature Communications 11, 3625 (2020), DOI: [10.1038/s41467-020-17236-y](https://doi.org/10.1038/s41467-020-17236-y). Eligibility propagation is established prior art. 4. Wang et al., *Model-agnostic linear-memory online learning in spiking neural networks*, Nature Communications 17, 1745 (2026), DOI: [10.1038/s41467-026-68453-w](https://doi.org/10.1038/s41467-026-68453-w). BrainTrace is relevant online-learning/compiler prior art. 5. Hejda et al., *SEPhIA: spiking electro-photonic integrated tiled architecture leveraging multi-wavelength lasers for scalable optical neuromorphic computing*, npj Unconventional Computing 3, 56 (2026), DOI: [10.1038/s44335-026-00102-3](https://doi.org/10.1038/s44335-026-00102-3). Relevant physics-aware electro-photonic architecture prior art; the present study does not reproduce its circuits or task accuracy. ''' text=text.replace('OPTTABLE',opt).replace('COSTTABLE',cost).replace('NEUTABLE',neu) text=text.replace('MAXWEIGHT',f"{max(r['max_weight_difference'] for r in d['neuromorphic']['rows']):.3e}") text=text.replace('MAXERROR',f"{max(r['max_squared_error_difference'] for r in d['neuromorphic']['rows']):.3e}") (p/'hardware.md').write_text(text) print(p/'hardware.md')