{
 "artifacts": [
  {
   "name": "bench_report.json",
   "url": "https://synthcore.org/code/1075/bench_report.json"
  },
  {
   "name": "experiment.py",
   "url": "https://synthcore.org/code/1075/experiment.py"
  },
  {
   "name": "report.md",
   "url": "https://synthcore.org/code/1075/report.md"
  },
  {
   "name": "report_bench_2026-09-02T002043.md",
   "url": "https://synthcore.org/code/1075/report_bench_2026-09-02T002043.md"
  },
  {
   "name": "stage2_bench.py",
   "url": "https://synthcore.org/code/1075/stage2_bench.py"
  }
 ],
 "category": "dynamics",
 "description": "Replace an unconstrained neural ODE vector field with a learned port-Hamiltonian vector field whose energy gradient drives the dynamics, whose interconnection matrix is skew-symmetric, and whose dissipation matrix is positive semidefinite. The resulting model remains expressive through state-dependent neural matrices while guaranteeing non-increasing learned energy in the unforced case.",
 "download_zip": "https://synthcore.org/download/1075",
 "formulas_latex": [
  "$$\\frac{\\mathrm{d}}{\\mathrm{d}t}{\\mathbf{x}}(t)=\\left(\\mathbf{J}({\\mathbf{x}}(t))-\\mathbf{R}({\\mathbf{x}}(t))\\right)\\nabla_{\\mathbf{x}}\\mathcal{H}({\\mathbf{x}}(t))+\\mathbf{B}\\mathbf{u}(t),\\qquad {\\mathbf{y}}(t)=\\mathbf{B}^{\\top}\\nabla_{\\mathbf{x}}\\mathcal{H}({\\mathbf{x}}(t))$$",
  "$$\\mathbf{J}(\\mathbf{x})^{\\top}=-\\mathbf{J}(\\mathbf{x}),\\qquad \\mathbf{R}(\\mathbf{x})\\succeq 0$$",
  "$$\\frac{\\mathrm{d}}{\\mathrm{d}t}\\mathcal{H}(\\mathbf{x}(t))=\\nabla\\mathcal{H}(\\mathbf{x})^{\\top}(\\mathbf{J}(\\mathbf{x})-\\mathbf{R}(\\mathbf{x}))\\nabla\\mathcal{H}(\\mathbf{x})=-\\nabla\\mathcal{H}(\\mathbf{x})^{\\top}\\mathbf{R}(\\mathbf{x})\\nabla\\mathcal{H}(\\mathbf{x})\\leq 0\\quad(\\mathbf{u}=0)$$",
  "$$\\dot{\\mathbf{z}}=\\left(\\mathbf{J}_{\\theta}(\\mathbf{z})-\\mathbf{R}_{\\theta}(\\mathbf{z})\\right)\\nabla_{\\mathbf{z}}\\mathcal{H}_{\\theta}(\\mathbf{z})+\\mathbf{B}_{\\theta}\\mathbf{u},\\quad \\mathbf{J}_{\\theta}(\\mathbf{z})=\\mathbf{A}_{\\theta}(\\mathbf{z})-\\mathbf{A}_{\\theta}(\\mathbf{z})^{\\top},\\quad \\mathbf{R}_{\\theta}(\\mathbf{z})=\\mathbf{L}_{\\theta}(\\mathbf{z})\\mathbf{L}_{\\theta}(\\mathbf{z})^{\\top}+\\varepsilon\\mathbf{I}$$"
 ],
 "id": 2904,
 "implementation": "1. Integration point: use this as the vector field of a latent neural ODE or continuous-time state-space model. Encode an observation sequence into an initial latent state z0∈R^d, integrate z with an ODE solver, and decode z(t) to predictions. At each function evaluation, feed z and optionally u(t) into three MLP heads: a scalar energy head h_theta(z), a matrix head A_theta(z), and a factor head L_theta(z). Define H_theta(z)=softplus(h_theta(z))+0.5 z^T Q z, with Q=Q_raw Q_raw^T+delta I and delta\u003e0, so the learned energy is bounded below and locally coercive. 2. Pseudocode: `g = grad_z(H_theta(z)); A = A_net(z); J = A - transpose(A); L = L_net(z); R = L @ transpose(L) + eps*I; dz = (J-R) @ g + B @ u; return dz`. Use fixed-step RK4 first, then compare with an adaptive solver. 3. Computed exactly from the mathematics: J is skew-symmetric, R is positive semidefinite, and the unforced energy derivative is nonpositive. Estimate empirically the trajectory loss, energy drift, Jacobian spectral abscissa, solver function evaluations, and long-horizon rollout error. For forced data, optionally add the balance residual `dH/dt - (y^T u - g^T R g)`; do not use symmetry or PSD penalties because the parameterization enforces them exactly. 4. First cheap experiment: fit a 2D or 4D nonlinear mass-spring-damper benchmark and compare against an equally sized unconstrained neural ODE and a standard Hamiltonian neural network. Train on short trajectories from random initial states with random forcing, then test rollouts 10–50 times longer. Success means lower long-horizon state error, no energy growth on unforced rollouts, and comparable one-step error at similar parameter count. Report wall-clock cost and ODE function evaluations as well.",
 "math_summary": "The paper models the state x(t) in R^N with the port-Hamiltonian equations dx/dt = (J(x)-R(x))∇_x H(x)+Bu(t) and y(t)=B^T∇_x H(x), where H:R^N→R is the Hamiltonian or stored energy, J(x)∈R^{N×N} is the interconnection matrix, R(x)∈R^{N×N} is the dissipation matrix, B is the input-port matrix, u(t) is the input, and y(t) is the output. The structural assumptions are J(x)^T=-J(x) and R(x)⪰0 for every x. For u=0, the energy derivative is dH(x(t))/dt = ∇H(x)^T(J(x)-R(x))∇H(x) = -∇H(x)^T R(x)∇H(x)≤0, because v^T Jv=0 for every vector v and v^T Rv≥0 when R is positive semidefinite. Implement these constraints by predicting an unconstrained A_theta(z) and L_theta(z), then setting J_theta(z)=A_theta(z)-A_theta(z)^T and R_theta(z)=L_theta(z)L_theta(z)^T+epsilon I with epsilon\u003e0. The latent state z∈R^d replaces x, H_theta(z) is a scalar neural energy, and B_theta may be fixed or learned. The explicit factorization is the transferable guarantee; it avoids penalty-only enforcement of symmetry or stability.",
 "math_tags": [
  "dynamical-systems",
  "linear-algebra",
  "control-theory",
  "geometry"
 ],
 "ml_areas": [
  "ssm",
  "world-model",
  "training",
  "regularization"
 ],
 "paper": {
  "arxiv_id": "2608.30788",
  "arxiv_url": "https://arxiv.org/abs/2608.30788",
  "summary_what_math_gives_to_ml": "The paper provides a directly transferable way to build neural dynamical systems whose learned vector field preserves port-Hamiltonian structure rather than merely fitting trajectories. The key asset is the factorization of the interconnection matrix as skew-symmetric and the dissipation matrix as positive semidefinite, which yields an energy balance and prevents the network from learning arbitrarily unstable dynamics. A practical adaptation is a latent neural ODE whose Hamiltonian, skew interconnection, and dissipation factors are all neural networks, allowing expressive state-dependent dynamics with a built-in Lyapunov-like energy law. This is most useful for long-horizon forecasting, system identification, differentiable simulators, and stable latent state-space models.",
  "title": "Model reduction of port-Hamiltonian systems via neural networks",
  "year": "2026"
 },
 "ratings": {
  "difficulty": 5,
  "novelty": 6,
  "usefulness": 8
 },
 "solves": [
  "stability",
  "accuracy",
  "generalization"
 ],
 "title": "Port-Hamiltonian Neural ODE",
 "url": "https://synthcore.org/idea/2904/port-hamiltonian-neural-ode",
 "verification": {
  "benchmark": {
   "track": "dynamics",
   "model": "rnn_small",
   "n_seeds": 8,
   "metric_direction": "lower is better",
   "comparison": {
    "baseline_mean": 0.5096767991781235,
    "idea_mean": 0.8012284114956856,
    "delta_mean": 0.2915516123175621,
    "per_seed_diffs": [
     0.2773745059967041,
     0.48068153858184814,
     0.46462124586105347,
     0.3270324468612671,
     0.27060773968696594,
     0.23612862825393677,
     0.2652696669101715,
     0.010697126388549805
    ],
    "idea_wins": 0,
    "n_pairs": 8,
    "p_value": 0.0081,
    "mde": 0.12250781647639007,
    "mde_rel_pct": 24.03637298655528,
    "verdict": "idea worse (significant)",
    "system_worked": false
   },
   "baseline": {
    "best_cfg": {
     "lr": 0.005,
     "weight_decay": 0
    },
    "sweep": [
     {
      "cfg": {
       "lr": 0.001,
       "weight_decay": 0
      },
      "mean": 0.7906209975481033
     },
     {
      "cfg": {
       "lr": 0.003,
       "weight_decay": 0
      },
      "mean": 0.6789352595806122
     },
     {
      "cfg": {
       "lr": 0.005,
       "weight_decay": 0
      },
      "mean": 0.5756678730249405
     }
    ],
    "full": {
     "mean": 0.5096767991781235,
     "std": 0.09851907442454794,
     "per_seed": [
      0.49524950981140137,
      0.5737435817718506,
      0.5768014788627625,
      0.6568769216537476,
      0.31393858790397644,
      0.5531363487243652,
      0.47284379601478577,
      0.4348241686820984
     ],
     "n": 8
    }
   },
   "idea": {
    "mean": 0.8012284114956856,
    "std": 0.20420508185800218,
    "per_seed": [
     0.7726240158081055,
     1.0544251203536987,
     1.041422724723816,
     0.9839093685150146,
     0.5845463275909424,
     0.789264976978302,
     0.7381134629249573,
     0.4455212950706482
    ],
    "n": 8
   },
   "mechanism_signature": {
    "confirmed": true,
    "math_sanity": {
     "max_dHdt": -0.000846284267026931,
     "max_identity_residual": 3.725290298461914e-9,
     "max_skew": 0,
     "min_R_eig": 0.03000270389020443
    },
    "max_energy_identity_residual": 1.4901161193847656e-8,
    "max_observed_dHdt": -0.0005119751440361142,
    "max_skew_residual": 0,
    "min_R_eigenvalue": 0.030000008642673492,
    "predicted": {
     "R_eigenvalue_ge_epsilon": true,
     "dHdt_le_zero": true,
     "skew_zero": true
    },
    "track_match": "stability/control -\u003e dynamics",
    "trained_model_samples": 8
   },
   "custom_track": null
  },
  "mechanism_confirmed": true,
  "peer_reviewed": false,
  "practical_verdict": "harms",
  "stage1_mechanism_check": {
   "worked": true,
   "confidence": 9,
   "verdict": "Built a port-Hamiltonian neural vector field with exact skew-symmetric J=A-A^T, PSD R=LL^T+epsilon I, and an autograd-computed learned energy gradient. The mechanism manifested: skew residual was exactly 0, the minimum R eigenvalue stayed at or above epsilon=0.03, and the continuous energy identity matched numerically to 3.3e-16 with no positive derivatives. The dissipation sweep confirmed the predicted quadratic dependence on factor scale, and the PH model had lower long-horizon RMSE than the unconstrained baseline, though with higher parameter count and training cost.",
   "metrics": {
    "baseline": "Unconstrained neural vector field: long-horizon RMSE 0.5380; 1,218 parameters; training time 0.561 s.",
    "idea": "Port-Hamiltonian neural ODE: long-horizon RMSE 0.1530; 3,757 parameters; training time 2.724 s; maximum skew residual 0; minimum R eigenvalue 0.030000; energy identity residual 3.33e-16; RK4 energy increases 0.",
    "predictions": "J antisymmetry predicted exact and observed maximum residual 0. R eigenvalue predicted \u003e= epsilon=0.03 and observed minimum 0.0300000. Dissipation dH/dt was predicted affine in lambda^2: slope -19.3686 predicted versus -19.4580 observed."
   },
   "how_to_run": "python3 experiment.py",
   "files": [
    "experiment.py"
   ],
   "limitations": "Only a small 2D damped nonlinear oscillator was tested, with fixed-step RK4, short training, and unequal parameter counts. Adaptive solvers, forced balance residuals, a standard Hamiltonian baseline, FLOP-matched training, and larger datasets were not tested. Discrete RK4 energy non-increase is empirical rather than an unconditional guarantee."
  },
  "status": "mech_ok_no_baseline",
  "status_label": "Mechanism confirmed, baseline not beaten",
  "updated_at": "2026-09-02T00:20:43",
  "verdict_source": "deterministic test code (paired-seed permutation statistics)"
 }
}
