Port-Hamiltonian Neural Networks
- Port-Hamiltonian Neural Networks are hybrid models that combine the energy-based structure of port-Hamiltonian systems with neural network expressivity.
- They parameterize energy storage, dissipation, interconnection, and input/output mappings through constrained neural architectures to ensure physical consistency and stability.
- Their modular design supports compositional learning and subsystem identification, enabling applications in digital twins, robotics, and multi-physics system modeling.
Port-Hamiltonian Neural Networks (pHNNs) are a class of machine learning models that fuse the geometric, compositional, and passivity properties of nonlinear port-Hamiltonian systems with the expressive power of neural networks. They achieve physically consistent modeling of nonlinear, interconnected, and potentially multi-physics dynamical systems, including the principled identification of subsystem dynamics from input–output data when only external measurements are available. The pHNN framework parameterizes the energy storage, interconnection, dissipation, and input/output mappings of a port-Hamiltonian system via neural networks with carefully enforced structural constraints, yielding models that are interpretable, stable, modular, and robust to noise (Otterdijk et al., 2024).
1. Port-Hamiltonian System Formulation and Neural Parameterization
A continuous-time port-Hamiltonian (pH) system is given by
where is the state, the input, the output, is the Hamiltonian (total stored energy), is the skew-symmetric interconnection matrix, is the positive semi-definite dissipation matrix, and is the port mapping. Passivity (dissipativity) is encoded by the inequality
given is bounded below.
In a pHNN, each block is realized via a small neural network with structural constraints:
- Hamiltonian : scalar-valued MLP, with a final activation (e.g., ELU plus constant) to enforce a lower bound;
- Dissipation : MLP whose output is used as , guaranteeing symmetry and positive semi-definiteness;
- Interconnection : MLP output , with , enforcing skew-symmetry;
- Input/Output Map : MLP or a directly learned constant, as required.
These parametrizations guarantee by construction that the learned model always remains within the set of physically admissible pH structures (Otterdijk et al., 2024).
2. Output-Error Identification and Noise Robustness
pHNNs are trained from data using an output-error (OE) simulation approach. The identification dataset consists only of input–output sequences; internal states are unobserved. The OE structure proceeds as follows:
- Simulate trajectories from the pHNN model using an ODE solver (e.g., RK4), producing simulated outputs .
- The learning objective is the mean-squared output simulation loss:
No explicit regularization is required beyond the neural architecture constraints; the OE formulation provides native robustness to measurement noise by simulating outputs over prediction windows and matching them to observed outputs (Otterdijk et al., 2024).
3. Compositional Learning and Subsystem Identification
A central property of pH systems is compositionality: when multiple subsystems (each pH) are interconnected—through a known skew-symmetric coupling —the composite system remains pH, with global matrices formed as block-diagonal aggregations plus coupling. The compositional identification algorithm (SUBNET strategy) proceeds by:
- Decomposing data into overlapping windows of length .
- Using an encoder to estimate initial states from past input/output histories.
- Simulating forward via the pHNN over each window using the composite .
- Accumulating windowed simulation loss, backpropagating gradients through the ODE solver, pH blocks, and encoder, then updating parameters via Adam.
By enforcing the block-diagonal structure of , subsystems can be reliably identified from input–output data alone, without access to their internal states. This modularity enables learned subsystems to be recomposed into new interconnection topologies, even across heterogeneous physics domains (Otterdijk et al., 2024).
4. Empirical Results and Case Studies
The pHNN paradigm has been validated in nonlinear, high-noise, and multi-physics settings:
- Interconnected mass–spring–damper (MSD) networks with nonlinearity (cubic damping): A three-mass MSD network was accurately identified from noisy velocity measurements using the OE-SUBNET architecture (encoder: 2-layer ResNet; pH blocks: MLPs, 16 hidden units, tanh). The pHNN reached noise-floor prediction accuracy on independent test multisines.
- Cross-domain subsystem transfer: A learned MSD block was swapped into a composite pHNN including an ideal-gas reservoir (thermo-mechanical coupling), with simulated mass-velocity and gas-pressure outputs matching measured values at noise level—demonstrating modular transferability (Otterdijk et al., 2024).
5. Advantages, Limitations, and Theoretical Guarantees
Advantages:
- Physical interpretability: Each learned block—Hamiltonian, interconnection, dissipation, and input map—admits direct physical meaning.
- Passivity and stability: Constraints on and embed global energy-dissipation and stability properties natively.
- Noise robustness: OE identification formulation (and inherent energy structure) yields consistent models under measurement noise.
- Compositionality: Subsystems identified in situ within larger systems can be reused and recomposed, essential for scalable digital twins and complex networks.
Limitations:
- Known interconnection: The structure must be known a priori. Learning both interconnections and subsystems jointly—especially with state-dependent or unknown coupling—remains an open challenge.
- Identifiability: Conditions for unique recovery of subsystem dynamics in general nonlinear pH interconnections have not been fully characterized.
Theoretical aspects:
- The structure-preserving pHNN identification aligns with the underlying geometric theory of pH systems.
- Passivity is enforced by construction, guaranteeing stability as long as the Hamiltonian is bounded below and dissipative blocks are positive semi-definite (Otterdijk et al., 2024).
- The methodology is compositional: model error in the composite is bounded in terms of errors in the individual submodels and interconnection block (cf. modularity results in (Neary et al., 2022)).
6. Applications and Extensions
pHNNs enable modular, physics-consistent identification and digital twin construction for a wide range of networked dynamical systems:
- Robotics: Modeling and control of robotic networks, particularly where only external actuation and sensing are available.
- Multi-physics networks: Interconnected thermal, electrical, and mechanical subsystems.
- Power and biochemical systems: Compositionality supports scalable surrogate models of grids or biochemical reaction networks.
- Digital twins: The ability to learn subsystems in operational context and reintegrate them supports scalable continual-learning digital twin architectures.
Notable future directions include learning the interconnection structure jointly with subsystems, incorporating inequality constraints (e.g., saturation) or stochastic port terms, combining pHNNs with model-predictive control (MPC), deploying graph neural network encoders for large-scale networks, and conducting a formal analysis of identifiability in nonlinear port-Hamiltonian contexts (Otterdijk et al., 2024).
7. Summary Table: Key Architectural and Methodological Features
| Component | Neural Parametrization | Structural Guarantee |
|---|---|---|
| Hamiltonian | MLP, ELU final activation | Lower-bounded, scalar |
| Dissipation | , MLP | Symmetric, PSD |
| Interconnection | , MLP | Skew-symmetric |
| Input map | MLP or learned constant | Free |
| Encoder | 2-layer ResNet (example) | State estimate from I/O |
| Identification loss | Output-error simulation MSE | Robust to noise |
This structure ensures physical, compositional, and robust port-Hamiltonian learning, enabling accurate, interpretable, and transferable dynamical system identification from input–output data alone (Otterdijk et al., 2024).