Introduction
Graph Neural Networks (GNNs) have become the standard for modeling relational data. However, two persistent challenges limit their effectiveness: over-smoothing and geometric rigidity. Over-smoothing occurs in deep GNNs when node features converge to a common mean as layers are added, rendering them indistinguishable. Geometric rigidity refers to the reliance on fixed Euclidean or Hyperbolic manifolds, which often fail to capture the "mixed" geometries—partially hierarchical and partially grid-like—found in real-world graphs.
To address these issues, we introduce the Hamiltonian Dynamic GNN (HDG). This framework treats graph node features as particles in a physical system, utilizing learnable Hamiltonian mechanics to guide information propagation. By conserving energy, HDG prevents feature collapse and automatically adapts to the underlying geometry of the graph.
Methodology: Hamiltonian Information Propagation
The core of HDG is the conceptualization of the graph as an $n$-body physical system. Each node $i$ is assigned a position $q_i$ (representing its features) and a learnable momentum $p_i$. Instead of traditional message passing, information propagates through the system via Hamiltonian flows.
As shown in the architecture above, the model learns a Hamiltonian energy function, $E_{net}$, which determines the interactions between nodes. The evolution of node states over "time" (equivalent to network depth) is governed by Hamiltonian equations: $$\dot{p}^i(t) = -\frac{\partial E_{net}}{\partial q_i}, \quad \dot{q}^i(t) = \frac{\partial E_{net}}{\partial p_i}$$ These differential equations ensure that the total energy of the system is conserved, providing a mathematical safeguard against the vanishing or exploding gradients that typically lead to over-smoothing.
Experimental Results
HDG was evaluated against state-of-the-art GNNs on various benchmarks, including citation networks (Cora, Citeseer) and low-hyperbolicity datasets (Airport, Disease).
Performance and Depth Stability
HDG demonstrated significant performance gains, particularly on the Airport dataset, where it outperformed the previous state-of-the-art (GIL) by 5.24%. More importantly, HDG exhibits remarkable stability in deep architectures. While standard GCNs experience a sharp decline in accuracy (dropping to ~20-40%) when expanded to 64 layers, HDG maintains a consistent accuracy of approximately 80% on the Cora dataset. This confirms that Hamiltonian dynamics effectively mitigate the over-smoothing problem.
Adapting to Mixed Geometries
Real-world graphs rarely conform to a single geometric manifold. HDG generalizes Riemannian GNNs by learning a flexible manifold rather than relying on fixed geodesics.
In tests on a custom "Airport+Cora" dataset—designed to simulate mixed geometry—HDG outperformed specialized hyperbolic models like Q-GCN by over 5%. This suggests that the learnable energy function allows the model to "feel out" and adapt to diverse local geometries within a single graph structure.
Robustness and Efficiency
Beyond accuracy, HDG shows enhanced robustness against adversarial perturbations. In evaluations using "Nettack," HDG maintained significantly higher accuracy than popular baselines like GAT, likely due to the inherent stability of energy-conservative systems.
While the use of ODE solvers introduces a slight computational overhead—with inference times of 5.76ms compared to 2.96ms for a standard GCN—the model remains efficient enough for real-time applications.
Conclusion
The Hamiltonian Dynamic GNN represents a significant step toward physics-informed graph representation learning. By leveraging energy conservation, it solves the over-smoothing problem and offers unprecedented flexibility in handling complex graph geometries. Future research will focus on implementing symplectic solvers to further improve energy preservation and exploring the theoretical links between the learned energy function and graph topology.
Summary updated