Power-Balanced Modular Neural Block
Implementation & benchmark of arXiv:2608.05143 — Port-Hamiltonian modelling of coupled rigid/flexible multibody systems
Source paper: Port-Hamiltonian modelling of coupled rigid/flexible multibody systems arXiv:2608.05143 ⓘ · analyzed Aug 31, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Represent each neural module as a Hamiltonian storage system and connect modules through a state-dependent skew or Dirac interconnection instead of arbitrary residual additions. The coupling may change with the hidden state, but its internal power contribution cancels exactly, so total stored energy is controlled only by external inputs and explicitly added dissipation.
Formulas
Mathematical statement
Let x be the concatenated states of K neural modules, H(x)=sum_i H_i(x_i) a nonnegative storage function, and e=gradient H(x) the effort vector. A practical port-Hamiltonian neural flow is x_dot = [J(x)-R(x)]e + B(x)u, where J(x) is skew-symmetric, R(x) is positive semidefinite, u is an external feature input, and B(x) is an input map. The skew coupling contributes e^T J(x)e=0 pointwise, even when J depends on x. Therefore H_dot = -e^T R(x)e + u^T B(x)^T e. The underlying Dirac interconnection enforces cancellation of paired internal powers e_c^T f_c and -e_c^T f_c between subsystems.
Implementation notes
Use this construction as a replacement for a residual MLP block or as the transition map of a recurrent or state-space layer. Split the hidden vector into K module states x_1 through x_K. Define H(x)=sum_i H_i(x_i), with each H_i implemented as softplus of a small scalar network plus epsilon times the squared norm of x_i; obtain e=gradient H(x) using automatic differentiation. Parameterize the coupling as J(x)=A(x)-A(x)^T, where A(x) is a small low-rank or block-sparse neural network. Parameterize dissipation as R(x)=L(x)L(x)^T+r_min I, with r_min nonnegative. Compute e, then J, L, R, and v=(J-R)e+B(x)u, and update x by Euler, RK4, or a stable semi-implicit integrator. Pseudocode: H=sum(H_i); e=grad(H,x); A=net_A(x); J=A-A.T; L=net_L(x); R=L@L.T+r_min*I; dx=(J-R)@e+B(x)@u; x=x+eta*dx. The paper supplies the power-cancellation construction; positivity of H, matrix parameterizations, and discretization are implementation choices. First experiment: compare this block with an unconstrained residual MLP and a fixed-skew block in a two-module MNIST MLP at matched parameter count. Log H, input power, energy drift, Jacobian singular values, and accuracy. The prediction is that with u=0, continuous-time H decreases whenever R is positive definite. For explicit Euler, the one-step energy defect is O(eta^2); halving eta should reduce the normalized power-balance error by about fourfold. Removing the skew constraint should create an O(eta) energy drift and earlier exploding trajectories.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Confirmed ✓
Stage 2 · Practical benchmark result: Significant win ✓
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 and ran a compact power-balanced block experiment with state-dependent skew coupling, positive dissipation, and an input port. The mechanism manifested: skew power cancellation was approximately 1.2e-15, Euler energy-defect scaling had observed slope 2.000, and the measured stability boundary agreed with 2r/(r^2+w^2) to 0.0625%. The PH model also reached much lower synthetic regression MSE, although that comparison was secondary and not parameter-matched.
- Agent confidence
- 9/10
- Baseline
- Residual MLP final MSE 3.02e-05; 212 parameters.
- Idea
- Power-balanced block final MSE 4.63e-16; 36 parameters; skew power -1.24e-15; Euler defect slope 2.000 predicted 2.000; stability boundary 0.43216 observed versus 0.43243 predicted.
Limitations: The regression task is synthetic and small, and the baseline was not exactly parameter-matched. The numerical verification uses a quadratic storage function, while the learned block uses diagonal dissipation rather than a full learned nonlinear H_i and dense state-dependent L(x).
How to run: python3 power_block_experiment.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2608.05143)
Beats the tuned baseline by 87.2% (p=0.0081, wins 8 / 8 paired seeds; metric: lower is better).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0.0005
- Idea mean
- 0.0001
- Effect (Δ)
- -0.0005 (−87.2%; negative = idea better)
- Wins
- 8 / 8 paired seeds
- p-value
- 0.0081 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±30.5%
- Mechanism
- Confirmed ✓
- Practical effect
- Helps
- Baseline tuning
- swept over 3 configs
Only the registered built-in dynamics track was tested, with 400 training and 400 test samples and 18 epochs. The implementation uses quadratic storage and diagonal dissipation rather than learned nonlinear module energies and dense state-dependent dissipation; no long-horizon rollout, parameter-count matching, skew ablation, or comparison against alternative stable recurrent architectures was 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 Worked ✓
Agent confidence: 9/10
The power-balanced recurrent block significantly outperformed the canonical GRU on the structurally matched registered dynamics track. It won on all 8 paired seeds, with mean test MSE 6.993e-05 versus 5.480e-04 and permutation p=0.0081; the trained-model signature also confirmed numerical skew-power cancellation.
- Baseline
- Tuned rnn_small GRU mean test MSE 0.0005480458421516232; best lr=0.01, epochs=18, weight_decay=0.0.
- Idea
- PowerBalancedRNN mean test MSE 0.00006993355623308162; best lr=0.003, epochs=18, weight_decay=0.0; all 8 paired wins.
Benchmark result
Beats the tuned baseline by 87.2% (p=0.0081, wins 8 / 8 paired seeds; metric: lower is better).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0.0005
- Idea mean
- 0.0001
- Effect (Δ)
- -0.0005 (−87.2%; negative = idea better)
- Wins
- 8 / 8 paired seeds
- p-value
- 0.0081 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±30.5%
- Mechanism
- Confirmed ✓
- Practical effect
- Helps
- Baseline tuning
- swept over 3 configs
Only the registered built-in dynamics track was tested, with 400 training and 400 test samples and 18 epochs. The implementation uses quadratic storage and diagonal dissipation rather than learned nonlinear module energies and dense state-dependent dissipation; no long-horizon rollout, parameter-count matching, skew ablation, or comparison against alternative stable recurrent architectures was tested.
How to run: python3 stage2_bench.py
Artifacts
- bench_report.json 3.3 KB View Raw
- power_block_experiment.py 4.1 KB View Raw
- report.md 1.3 KB View
- report_bench_2026-08-31T205841.md 5.0 KB View
- stage2_bench.py 5.2 KB View Raw