# Skew-Midpoint Neural Dynamics

- ID: 1185
- Canonical URL: https://synthcore.org/idea/1185/skew-midpoint-neural-dynamics
- API JSON: https://synthcore.org/api/idea/1185.json
- API Markdown: https://synthcore.org/api/idea/1185.md
- Verification status: mech_ok_no_baseline
- Source: [arXiv:2607.20245](https://arxiv.org/abs/2607.20245)
- Category: dynamics
- Solves: stability, generalization, accuracy
- ML areas: rnn, world-model, training-dynamics
- Math tags: dynamical-systems, symplectic, linear-algebra, numerical-analysis
- Ratings: usefulness 7/10; difficulty 5/10; novelty 5/10

## Idea description

Replace an unconstrained recurrent transition or latent ODE vector field with a port-Hamiltonian update whose metric is positive definite and whose interaction operator is skew-symmetric. Use an implicit midpoint step so the quadratic latent energy is preserved exactly in the unforced, constant-metric case, preventing long-horizon drift while retaining learnable nonlinear interactions.

## Mathematical statement

The paper writes finite-dimensional dynamics as \(\mathbf{M}\dot{\mathbf{e}}=\mathbf{J}\mathbf{e}+\mathbf{B}\mathbf{u}\), where \(\mathbf{M}=\mathbf{M}^{\top}\succ0\) is a symmetric positive-definite storage metric, \(\mathbf{J}=-\mathbf{J}^{\top}\) is a skew interconnection matrix, \(\mathbf{e}\) is the state, \(\mathbf{u}\) is an input, and \(\mathbf{B}\) maps inputs into the state. The quadratic Hamiltonian is \(H(\mathbf{e})=\tfrac12\mathbf{e}^{\top}\mathbf{M}\mathbf{e}\). For zero input, \(\dot H=\mathbf{e}^{\top}\mathbf{J}\mathbf{e}=0\). Implicit midpoint uses \(\mathbf{e}_{k+1/2}=(\mathbf{e}_{k+1}+\mathbf{e}_k)/2\) and preserves this quadratic energy exactly when \(\mathbf{M}\) and \(\mathbf{J}\) are constant and the nonlinear operator is evaluated consistently at the midpoint. In a neural layer, enforce the assumptions with \(\mathbf{M}=\mathbf{L}\mathbf{L}^{\top}+\epsilon\mathbf{I}\) and \(\mathbf{J}(\mathbf{e})=\mathbf{A}(\mathbf{e})-\mathbf{A}(\mathbf{e})^{\top}\), where \(\mathbf{L}\) is learned lower triangular, \(\epsilon>0\), and \(\mathbf{A}(\mathbf{e})\) is an unconstrained learned matrix.

## Key formulas

- $$\mathbf{M}\dot{\mathbf{e}}=\mathbf{J}\mathbf{e}+\mathbf{B}\mathbf{u},\qquad \mathbf{M}=\mathbf{M}^{\top}\succ0,\qquad \mathbf{J}=-\mathbf{J}^{\top},\qquad \mathbf{y}=\mathbf{B}^{\top}\mathbf{e}.$$
- $$H(\mathbf{e})=\frac12\mathbf{e}^{\top}\mathbf{M}\mathbf{e},\qquad \dot H=\mathbf{e}^{\top}\mathbf{J}\mathbf{e}+\mathbf{e}^{\top}\mathbf{B}\mathbf{u}=\mathbf{y}^{\top}\mathbf{u}.$$
- $$\mathbf{M}\frac{\mathbf{e}_{k+1}-\mathbf{e}_k}{\Delta t}=\mathbf{J}(\mathbf{e}_{k+1/2})\mathbf{e}_{k+1/2}+\mathbf{B}\mathbf{u}_{k+1/2},\qquad \mathbf{e}_{k+1/2}=\frac{\mathbf{e}_{k+1}+\mathbf{e}_k}{2}.$$
- $$\mathbf{M}=\mathbf{L}\mathbf{L}^{\top}+\epsilon\mathbf{I},\qquad \mathbf{J}(\mathbf{e})=\mathbf{A}(\mathbf{e})-\mathbf{A}(\mathbf{e})^{\top}.$$

## Implementation notes

Integrate this as a recurrent layer or latent-dynamics block between an encoder and decoder, operating on a latent vector \(\mathbf{e}\) of width \(d\). Learn a lower-triangular matrix \(\mathbf{L}\) and an interaction network that outputs an unconstrained matrix \(\mathbf{A}(\mathbf{e}_{\mathrm{mid}})\); construct \(\mathbf{M}=\mathbf{L}\mathbf{L}^{\top}+\epsilon\mathbf{I}\) and \(\mathbf{J}=\mathbf{A}-\mathbf{A}^{\top}\). Given \(\mathbf{e}_k\) and optional input \(\mathbf{u}_k\), solve the implicit residual \(R(\mathbf{z})=\mathbf{M}(\mathbf{z}-\mathbf{e}_k)/\Delta t-\mathbf{J}((\mathbf{z}+\mathbf{e}_k)/2)(\mathbf{z}+\mathbf{e}_k)/2-\mathbf{B}\mathbf{u}_{\mathrm{mid}}=0\) for \(\mathbf{z}=\mathbf{e}_{k+1}\). Use three to five damped Newton iterations, initialize \(\mathbf{z}=\mathbf{e}_k\), and obtain the residual Jacobian with automatic differentiation. Pseudocode: set z=e; repeat mid=(z+e)/2, M=L@L.T+eps*I, J=A_net(mid)-A_net(mid).T, R=M@(z-e)/dt-J@mid-B@u_mid, z=z-solve(dR/dz,R). Train encoder, decoder, and dynamics jointly with prediction loss. Measure \(H_k=0.5\mathbf{e}_k^T\mathbf{M}\mathbf{e}_k\) and its drift; this is estimated empirically, while positive definiteness and skew symmetry come directly from the parameterization. Start with a small GRU baseline on Lorenz trajectories or sequential MNIST. At equal latent width and FLOPs, success means lower long-horizon rollout error and nearly bounded unforced energy drift. Compare against an explicit Euler ablation to isolate the midpoint contribution.

## Verification

- Status: mech_ok_no_baseline
- Mechanism evidence: yes
- Mechanism confirmed: yes
- Practical verdict: inconclusive
- Verdict: Built a differentiable implicit-midpoint port-Hamiltonian layer with an SPD metric parameterization and skew-symmetric state-dependent interaction. The mechanism manifested: random SPD/skew systems conserved quadratic energy within 2.0e-14 over 1,000 steps, Euler energy growth matched its analytic law with relative error below 1.2e-14, and midpoint phase matched the Cayley-angle prediction. In rollout comparison, midpoint maintained constant energy while explicit Euler became highly unstable.

### Mechanism check

- Verdict: Built a differentiable implicit-midpoint port-Hamiltonian layer with an SPD metric parameterization and skew-symmetric state-dependent interaction. The mechanism manifested: random SPD/skew systems conserved quadratic energy within 2.0e-14 over 1,000 steps, Euler energy growth matched its analytic law with relative error below 1.2e-14, and midpoint phase matched the Cayley-angle prediction. In rollout comparison, midpoint maintained constant energy while explicit Euler became highly unstable.
- Confidence: 9/10
- Limitations: The benchmark is a low-dimensional harmonic oscillator rather than a learned GRU, Lorenz system, or sequential prediction task. The MVP handles one latent vector at a time, uses unoptimized per-component autograd Jacobians, and does not test training speed, batching, adaptive damping, or nonlinear model-learning accuracy.

### Practical benchmark

- Paired seeds: 8
- Baseline mean: 0
- Idea mean: 0
- p-value: 0.6253
- Paired wins: 6/8
- Benchmark verdict: no significant win

## Artifacts

- [bench_report.json](https://synthcore.org/code/471/bench_report.json)
- [bench_runner.py](https://synthcore.org/code/471/bench_runner.py)
- [experiment.py](https://synthcore.org/code/471/experiment.py)
- [nonlinear_check.py](https://synthcore.org/code/471/nonlinear_check.py)
- [report.md](https://synthcore.org/code/471/report.md)
- [report_bench_2026-08-31T131321.md](https://synthcore.org/code/471/report_bench_2026-08-31T131321.md)
- [results.json](https://synthcore.org/code/471/results.json)
- [skew_midpoint.py](https://synthcore.org/code/471/skew_midpoint.py)
- [Download all files as ZIP](https://synthcore.org/download/471)

## Disclaimer

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