Dirac-Coupled Energy-Shaping Optimizer
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
Construct optimizer variables as interconnected Hamiltonian subsystems: parameters store potential energy, momentum stores kinetic energy, and a skew coupling transfers energy between them without net creation. Positive-semidefinite resistance removes energy and provides an explicit damping knob, separating conservative exploration from dissipative convergence.
Formulas
Mathematical statement
Let theta be the model parameters, p the optimizer momentum, z=(theta,p), and H(theta,p)=L(theta)+0.5 p^T M^{-1}p, where L is the training loss and M is a positive-definite mass matrix. Define z_dot=[J(z)-R(z)] gradient_H(z)+B xi_t, where J(z) is skew-symmetric, R(z) is positive semidefinite, and xi_t represents the stochastic minibatch gradient as an external port. In the deterministic autonomous case, H_dot=-gradient_H^T R gradient_H <= 0. With minibatch forcing, the injected power is xi_t^T B^T gradient_H. A practical diagnostic is the energy drift after subtracting this injected power; it should be nonpositive up to time-discretization error.
Implementation notes
Integrate this mechanism into the optimizer rather than the network forward pass. Maintain theta and p for every parameter tensor. Begin with the canonical interconnection J0=[[0,I],[-I,0]] and optionally add a learned low-rank skew term J(z)=J0+A(z)-A(z)^T. Use R=diag(r_theta I,r_p I), or start with R=diag(0,gamma I) so momentum is damped while position and momentum exchange energy. At minibatch t, compute the batch gradient g_t, set the external forcing xi_t=(g_t,0), evaluate e_t=gradient_H(theta_t,p_t), and update z by z <- z+eta*((J-R)e_t+B xi_t). For improved numerical behavior, integrate the skew Hamiltonian part with symplectic Euler or leapfrog and apply damping implicitly. Pseudocode: g=backprop(batch); H=loss+0.5*p.T@inv(M)@p; e=grad(H,[theta,p]); A=skew_net(theta,p); J=J0+A-A.T; R=positive_damping(); z=z+eta*((J-R)@e+B@concat(g,zeros_like(p))). The paper supplies the interconnection and exact internal power cancellation; minibatch noise statistics and discretization effects must be measured. First experiment: train a small ResNet or three-layer MLP on CIFAR-10 and compare against SGD, momentum SGD, and Adam over identical step-size grids. Log H, gradient norm, momentum norm, injected batch power, and q_hat. The predicted signature is that after subtracting injected power, mean energy drift is nonpositive up to discretization error. For a first-order implementation, the residual should scale approximately linearly with eta; doubling eta should approximately double the residual before instability. An unconstrained J should show positive systematic energy drift and a lower maximum stable learning rate.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Not reproduced ✗
Stage 2 · Practical benchmark result: Significantly worse ✗
Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works
Stage 1 — Mechanism check agent confidence 8/10
Built a PyTorch Dirac-coupled optimizer with per-parameter momentum, canonical skew exchange, damping, and a quadratic verification suite. The predicted symplectic stability boundary matched six settings within 0.02%, and the curvature scaling sqrt(lambda)*eta_max was 1.9996 versus the predicted 2.0. However, the nonlinear MLP benchmark showed no practical win: Dirac reached loss 0.1149 and 94.25% validation accuracy, versus momentum SGD at loss 0.0863 and 98.50%.
- Agent confidence
- 8/10
- Baseline
- MomentumSGD: final loss 0.0863484, validation accuracy 0.9850; plain SGD: final loss 0.1968625, validation accuracy 0.9525.
- Idea
- DiracCoupled: final loss 0.1148715, validation accuracy 0.9425; mean raw energy delta -4.37e-05, with 30.1% positive minibatch energy changes. Stability-bound relative error was at most 0.000196; observed sqrt(lambda)*eta_max was 1.999608 for lambda 1, 4, 16, and 64.
Limitations: Only a one-dimensional quadratic and a small synthetic two-dimensional MLP were tested. CIFAR-10, larger networks, stochastic injected-power subtraction, hyperparameter grids, wall-clock/FLOP analysis, learned low-rank skew terms, and multiple random seeds were not evaluated.
How to run: python3 verify_dirac_optimizer.py && /home/maxwelhelp/main/bin/python3 mini_experiment.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2608.05143)
Significantly WORSE than the tuned baseline (+620.2%, p=0.0081, wins 0 / 8 paired seeds).
- Benchmark
- Tabular regression (Friedman)
- Model
- mlp_tiny
- Paired seeds
- 8
- Baseline mean
- 6.8269
- Idea mean
- 49.168
- Effect (Δ)
- 42.3411 (+620.2%; negative = idea better)
- Wins
- 0 / 8 paired seeds
- p-value
- 0.0081 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±222.8%
- Mechanism
- Not confirmed ✗
- Practical effect
- Hurts
- Baseline tuning
- swept over 9 configs
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Stage 2 — Benchmark latest Failed ✗
Agent confidence: 10/10
The full Stage-2 protocol was run on the registered tabular track with 8 paired seeds and a tuned Adam baseline. Dirac-Coupled was significantly worse: test MSE 49.1680 versus Adam 6.82695, paired delta +42.3411, permutation p=0.0081. The trained-model mechanism signature was also not confirmed because the residual drift was strongly positive.
- Baseline
- Adam best_cfg={lr:0.01,damping:0.2}; full mean test MSE=6.826947689056396, std=0.4311780984262861.
- Comparison
- delta_mean=42.34107279777527, idea_wins=0/8, p_value=0.0081, verdict=idea worse (significant).
- Idea
- Dirac best_cfg={lr:0.01,damping:0.8}; full mean test MSE=49.168020486831665, std=16.72596587548227.
Benchmark result
Significantly WORSE than the tuned baseline (+620.2%, p=0.0081, wins 0 / 8 paired seeds).
- Benchmark
- Tabular regression (Friedman)
- Model
- mlp_tiny
- Paired seeds
- 8
- Baseline mean
- 6.8269
- Idea mean
- 49.168
- Effect (Δ)
- 42.3411 (+620.2%; negative = idea better)
- Wins
- 0 / 8 paired seeds
- p-value
- 0.0081 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±222.8%
- Mechanism
- Not confirmed ✗
- Practical effect
- Hurts
- Baseline tuning
- swept over 9 configs
Artifacts
- bench_dirac.py 5.4 KB View Raw
- bench_report.json 6.0 KB View Raw
- dirac_optimizer.py 2.1 KB View Raw
- mini_experiment.py 3.2 KB View Raw
- mini_results.json 7.0 KB View Raw
- report.md 1.6 KB View
- report_bench_2026-08-31T214357.md 8.2 KB View
- results.json 3.4 KB View Raw
- verify_dirac_optimizer.py 4.5 KB View Raw