△ Mechanism confirmed, baseline not beaten 2026

Passivity-Constrained Neural State-Space Layer

Implementation & benchmark of arXiv:2607.10439 — A Physics-Inspired Classical Digital Twin of Cortical Dynamics: A Band-Stratified Metriplectic Port-Hamiltonian Neural Network Learned from Brain-Computer-Interface EEG

Usefulness7/10
Difficulty4/10
Novelty6/10

Source paper: A Physics-Inspired Classical Digital Twin of Cortical Dynamics: A Band-Stratified Metriplectic Port-Hamiltonian Neural Network Learned from Brain-Computer-Interface EEG arXiv:2607.10439 ⓘ · analyzed Aug 30, 2026

AI-generated research hypothesis, automatically tested. Not peer-reviewed.

Idea description

Replace an unconstrained recurrent transition or latent neural-ODE vector field with a port-Hamiltonian transition. The layer separates conservative mixing from dissipative contraction, guaranteeing non-increasing latent storage energy when the external input is zero and bounding energy growth under driven inputs.

Formulas

$$\dot{\mathbf{x}}=\bigl[\mathbf{J}(\mathbf{x})-\mathbf{R}(\mathbf{x})\bigr]\nabla_{\mathbf{x}}\mathcal{H}(\mathbf{x})+\mathbf{G}\mathbf{u}(t)$$
$$\dot{\mathcal{H}}=-\nabla\mathcal{H}^{\top}\mathbf{R}\,\nabla\mathcal{H}+\mathbf{y}^{\top}\mathbf{u}(t)\;\leq\;\mathbf{y}^{\top}\mathbf{u}(t),\qquad \mathbf{y}=\mathbf{G}^{\top}\nabla\mathcal{H}(\mathbf{x})$$
$$\mathcal{H}(x)=\tfrac12x^{\top}Qx,\quad Q=L_QL_Q^{\top}+\epsilon I,\quad J=A-A^{\top},\quad R=BB^{\top}+\operatorname{diag}(\operatorname{softplus}(r))$$
$$x_{k+1}=x_k+\Delta t\left[(J-R)\nabla\mathcal{H}(x_k)+Gu_k\right]$$

Mathematical statement

The paper defines the continuous-time state equation $\dot{\mathbf{x}}=[\mathbf{J}(\mathbf{x})-\mathbf{R}(\mathbf{x})]\nabla_{\mathbf{x}}\mathcal{H}(\mathbf{x})+\mathbf{G}\mathbf{u}(t)$, where $\mathbf{x}\in\mathbb{R}^d$ is the latent state, $\mathcal{H}:\mathbb{R}^d\to\mathbb{R}_{\geq 0}$ is stored energy, $\mathbf{J}(\mathbf{x})^\top=-\mathbf{J}(\mathbf{x})$ is the conservative routing operator, $\mathbf{R}(\mathbf{x})\succeq0$ is the dissipative operator, $\mathbf{u}(t)$ is an external input, and $\mathbf{G}$ maps inputs into the state. With output $\mathbf{y}=\mathbf{G}^\top\nabla\mathcal{H}(\mathbf{x})$, the power balance is $\dot{\mathcal{H}}=-\nabla\mathcal{H}^\top\mathbf{R}\nabla\mathcal{H}+\mathbf{y}^\top\mathbf{u}(t)\leq\mathbf{y}^\top\mathbf{u}(t)$. Therefore, when $\mathbf{u}=0$, stored energy cannot increase. A practical parameterization is $\mathcal{H}(x)=\tfrac12x^\top Qx$ with $Q=L_QL_Q^\top+\epsilon I\succ0$, $\mathbf{J}=A-A^\top$, and $\mathbf{R}=BB^\top+\operatorname{diag}(\operatorname{softplus}(r))\succeq0$, making all constraints hold for every parameter value.

Implementation notes

(1) Integration point: replace the transition in a GRU-free recurrent model, latent ODE, or small state-space model with a port-Hamiltonian vector field. Let the input sequence be $u_k\in\mathbb{R}^m$ and latent state be $x_k\in\mathbb{R}^d$. Use a linear decoder $\hat z_k=Cx_k$, or attach the block before an existing prediction head. Start with constant $J$, $R$, $Q$, and $G$ for each layer; later test input-conditioned low-rank factors. (2) Pseudocode: initialize unconstrained parameters $A$, $B$, $L_Q$, vector $r$, and input matrix $G$. Compute $Q=L_QL_Q^\top+10^{-4}I$, $J=A-A^\top$, and $R=BB^\top+\operatorname{diag}(\operatorname{softplus}(r))$. For each time step, compute $g_k=Qx_k$, $v_k=(J-R)g_k+Gu_k$, and update $x_{k+1}=x_k+\Delta t v_k$. Decode $x_{k+1}$ and backpropagate through the rollout. For numerical stability, use two half-step updates or a differentiable adaptive ODE solver while retaining the same vector field. (3) Compute from the mathematics: construct $J$ and $R$ exactly from the antisymmetric and Gram-factor parameterizations, and calculate the certificate $\Delta H_k=H(x_{k+1})-H(x_k)$. Estimate empirically only discretization error, prediction loss, and the fraction of unforced steps with $\Delta H_k>0$. Initially train with prediction loss alone; optionally add a small penalty on positive energy increments to compensate for Euler discretization. (4) First cheap experiment: compare this layer against a vanilla tanh RNN and a diagonal SSM with matched hidden width on sequential MNIST or PhysioNet waveform forecasting. Measure one-step MSE, free-running 100- to 500-step rollout error, gradient norms, and latent energy drift after setting $u=0$. The expected signal is similar short-horizon accuracy but fewer exploding or chaotic rollouts, monotone or near-monotone unforced energy, and lower long-horizon error at equal parameter count. Also scale input amplitude and verify that energy growth tracks the supplied power $y_k^\top u_k$ rather than growing autonomously.

Verification

Mechanism confirmed, baseline not beaten

Stage 1 · Toy mechanism gate: Passed ✓

Stage 2 · Mechanism transferred to benchmark: Confirmed ✓

Stage 2 · Practical benchmark result: Inconclusive

Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works

Stage 1 — Mechanism check agent confidence 9/10

Built a passivity-constrained port-Hamiltonian recurrent layer with Q=L L^T+epsilon I, J=A-A^T, and R=B B^T+diag(softplus(r)), plus a matched tanh RNN baseline. The mechanism was confirmed: continuous unforced dH/dt had maximum -4.33 with zero violations, the Euler stability boundary was 1.47059 predicted versus 1.47074 observed, and the discretization residual scaled as dt^2 with observed slope 2.00. The forecasting task showed worse one-step MSE for the idea (0.0475 vs 0.0329), but unforced energy decreased by 2.15 overall, so passivity worked while prediction accuracy did not improve.

Agent confidence
9/10
Baseline
one_step_mse=0.0328883
Idea
one_step_mse=0.0475324; unforced energy drift=-2.15039; energy increase steps=1; continuous passivity max dH/dt=-4.32615; Euler boundary predicted=1.470588, observed=1.470741; residual slope=2.0000

Limitations: Only a small synthetic sinusoid forecasting task was tested; no sequential MNIST, PhysioNet, long free-running rollout comparison, adaptive integration, input-conditioned operators, parameter-count matching, or systematic input-amplitude/power-balance sweep was performed.

How to run: python3 passivity_experiment.py

Stage 2 — Benchmark vs. tuned baseline (arXiv:2607.10439)

No significant difference vs. the tuned baseline (+7.1%, p=0.4607, wins 2 / 8 paired seeds).

Benchmark
Dynamics forecasting
Model
rnn_small
Paired seeds
8
Baseline mean
0
Idea mean
0
Effect (Δ)
0 (+7.1%; negative = idea better)
Wins
2 / 8 paired seeds
p-value
0.4607 (permutation test, 20 000 shuffles)
Smallest detectable effect
n/a
Mechanism
Confirmed ✓
Practical effect
Inconclusive
Baseline tuning
swept over 3 configs
Limitations:

Only the registered dynamics track and short training schedule were tested; longer rollouts and adaptive integration were not tested.

How to run: python3 stage2_bench.py

Verdict computed by deterministic test code from paired-seed statistics — not by the language model.

Stage 2 — Benchmark latest Failed ✗

Agent confidence: 9/10

The port-Hamiltonian recurrent layer was evaluated against the matched GRU baseline on the registered dynamics track. Passivity held on the trained model, but the idea had higher test MSE and no significant win.

Baseline
MSE=1.7729581827552465e-05
Delta mean
1.2578293535625562e-06
Idea
MSE=1.898741118111502e-05
P value
0.46065

Benchmark result

No significant difference vs. the tuned baseline (+7.1%, p=0.4607, wins 2 / 8 paired seeds).

Benchmark
Dynamics forecasting
Model
rnn_small
Paired seeds
8
Baseline mean
0
Idea mean
0
Effect (Δ)
0 (+7.1%; negative = idea better)
Wins
2 / 8 paired seeds
p-value
0.4607 (permutation test, 20 000 shuffles)
Smallest detectable effect
n/a
Mechanism
Confirmed ✓
Practical effect
Inconclusive
Baseline tuning
swept over 3 configs
Limitations:

Only the registered dynamics track and short training schedule were tested; longer rollouts and adaptive integration were not tested.

How to run: python3 stage2_bench.py

Artifacts

Implementation overview ⬇ Download all as ZIP 6 files · code, reports and structured results