Separable Hamiltonian Neural Networks
Hamiltonian neural networks (HNNs) are state-of-the-art models that regress
the vector field of a dynamical system under the learning bias of Hamilton's
equations. A recent observation is that embedding a bias regarding the additive
separability of the Hamiltonian reduces the regression complexity and improves
regression performance. We propose separable HNNs that embed additive
separability within HNNs using observational, learning, and inductive biases.
We show that the proposed models are more effective than the HNN at regressing
the Hamiltonian and the vector field. Consequently, the proposed models predict
the dynamics and conserve the total energy of the Hamiltonian system more
accurately.
Zi-Yu Khoo, Dawen Wu, Jonathan Sze Choong Low, Stéphane Bressan
# Separable Hamiltonian Neural Networks

###### Abstract

The modelling of dynamical systems from discrete observations is a challenge faced by modern scientific and engineering data systems. Hamiltonian systems are one such fundamental and ubiquitous class of dynamical systems. Hamiltonian neural networks are state-of-the-art models that unsupervised-ly regress the Hamiltonian of a dynamical system from discrete observations of its vector field under the learning bias of Hamilton's equations. Yet Hamiltonian dynamics are often complicated, especially in higher dimensions where the state space of the Hamiltonian system is large relative to the number of samples. A recently discovered remedy to alleviate the complexity between state variables in the state space is to leverage the additive separability of the Hamiltonian system and embed that additive separability into the Hamiltonian neural network. Following the nomenclature of physics-informed machine learning, we propose three _separable Hamiltonian neural networks_. These models embed additive separability within Hamiltonian neural networks. The first model uses additive separability to quadratically scale the amount of data for training Hamiltonian neural networks. The second model embeds additive separability within the loss function of the Hamiltonian neural network. The third model embeds additive separability through the architecture of the Hamiltonian neural network using conjoined multilayer perceptions. We empirically compare the three models against state-of-the-art Hamiltonian neural networks, and demonstrate that the separable Hamiltonian neural networks, which alleviate complexity between the state variables, are more effective at regressing the Hamiltonian and its vector field.

 Hamiltonian dynamical systems, physics-informed neural networks, physics properties, system symmetries, additive separability

## I Introduction

Modelling dynamical systems is a core challenge for science and engineering. The movement of a pendulum, the wave function of a quantum-mechanical system, the movement of fluids around the wing of a plane, the weather patterns under climate change, and the populations forming an ecosystem are spatio-temporal behaviours of physical phenomena described by dynamical systems. Hamiltonian systems [1] are a class of dynamical systems governed by Hamilton's equations, which indicate conservation of the Hamiltonian value of the system.

A recent advancement in the modelling of dynamical systems is Hamiltonian neural networks [2, 3], which are physics-informed neural networks with learning biases given by Hamilton's equations and their corollaries [4]. Hamiltonian neural networks are universal function approximators [5] capable of modelling non-linear multivariate functions [6]. They use a learning bias [4] based on physics information regarding Hamilton's equations [2, 3] to aid the neural network in converging towards solutions that adhere to physics laws [4]. Hamiltonian neural networks unsupervised-ly regress the vector field and the Hamiltonian of a dynamical system from discrete observations of its state space or vector field under the learning bias of Hamilton's equations, and outperform their physics-uninformed counterparts in doing so [7].

However, Hamiltonian dynamics are often complicated and chaotic, especially in higher dimensional systems such as the Toda Lattice and Henon Heiles systems. The state space of the Hamiltonian system is large relative to the number of samples. A redeeming feature of these systems is their additive separability. As highlighted by Gruver et al. in the ICML 2022 spotlight paper, additive separability "_allowed the physics-informed neural network to avoid[...] artificial complexity from its coordinate system_" (the input variables) and improve its performance [8]. This motivates further informing Hamiltonian neural networks of additive separability to alleviate the complexity between state variables of Hamiltonian systems.

The main technical contribution of this work is the embedding of additive separability into a Hamiltonian neural network to regress a Hamiltonian and vector field. We propose three Hamiltonian neural networks that independently embed additive separability using three modes of biases. We call this family of Hamiltonian neural networks, _separable Hamiltonian neural networks_. The three separable Hamiltonian neural networks follow the nomenclature of Karniadakis et al. [4] and embed additive separability using three modes of biases: observational bias, learning bias, and inductive bias. The first model embeds an observational bias by training on newly generated data that embody separability. The second model embeds a learning bias through the loss function of the Hamiltonian neural network. The third model embeds an inductive bias through the architecture of the Hamiltonian neural network by means of conjoined multilayer perceptrons.

We empirically evaluate the performance of the proposed models against a baseline Hamiltonian neural network on a variety of representative additively separable Hamiltonian systems. We compare their performances in regressing an additively separable Hamiltonian and a vector field.

In this paper, Section II presents the necessary background on dynamical, Hamiltonian and separable Hamiltonian systems. Section III synthesises the related work and positions the main contribution. Section IV introduces the proposed
separable Hamiltonian neural networks. Section V compares the proposed models against the baseline Hamiltonian neural network in regressing additively separable Hamiltonians and vector fields. Section VI concludes the paper.

## II Background

### _Dynamical Systems and Hamiltonian Systems_

Dynamical systems theory [9] studies the temporal dynamics, or time evolution, of dynamical systems. The phase or state space of a dynamical system is a \(\mathbb{R}^{2\times n}\) multidimensional space which represents all possible states of a dynamical system comprising the combination of the system's \(2\times n\) state variables [9], also called degrees of freedom, or parameters. Without loss of generality, we consider autonomous, time-independent systems. The dynamics of an autonomous system are captured by the vector field [9, 10] of dimension \(\mathbb{R}^{2\times n}\), formed by the time derivatives of the state variables.

A Hamiltonian system [1] is a dynamical system characterised by a smooth, real-valued scalar function of the state variables [10] called the Hamiltonian function or simply the Hamiltonian, \(H\in\mathbb{R}\). The Hamiltonian system is governed by Hamilton's equations [1], a system of \(2\times n\) differential equations given in Equation 1 that define the vector field \(F(x,y)=\left(\frac{\mathrm{d}x}{\mathrm{d}t},\frac{\mathrm{d}y}{\mathrm{d}t}\right)\)[1, 11]. A Hamiltonian with \(2\times n\) state variables has a dimension, or axis, of \(n\). Conventionally, the set of variables can be evenly split into two sets called generalised variables, noted \(\vec{x}\) for the position, and \(\vec{y}\) for momentum.

\[\frac{\mathrm{d}\vec{x}}{\mathrm{d}t}=\frac{\partial H(\vec{x},\vec{y})}{ \partial\vec{y}},\quad\frac{\mathrm{d}\vec{y}}{\mathrm{d}t}=-\frac{\partial H (\vec{x},\vec{y})}{\partial\vec{x}}. \tag{1}\]

A classic example of a Hamiltonian system is the non-linear pendulum. Figure 0(a) shows the vector field of a non-linear pendulum in its two-dimensional phase space with state variables position (angle when oscillating in a plane) and momentum (mass multiplied by velocity). The vector field is formed by the time derivatives of the state variables. For a non-linear pendulum of unitary mass, the Hamiltonian is the sum of kinetic and potential energy. The heatmap in Figure 0(a) shows the value of the Hamiltonian in the phase space.

### _Separable Hamiltonian Systems_

A Hamiltonian system is separable if the Hamiltonian can be separated into additive terms, each dependent on either \(\vec{x}\) or \(\vec{y}\), where \(\vec{x}\) and \(\vec{y}\) are disjoint subsets of the state variables of a Hamiltonian system [12]. The separable Hamiltonian is defined \(H(\vec{x},\vec{y})=T(\vec{x})+V(\vec{y})\) where \(T\) and \(V\) are arbitrary functions [12]. Furthermore, the mixed partial derivative of the separable Hamiltonian is zero following Equation 2.

\[\frac{\partial^{2}H}{\partial x\partial y}=\frac{\partial}{ \partial x}\left(\frac{\partial(T(\vec{x})+V(\vec{y}))}{\partial y}\right)= \frac{\partial}{\partial x}\left(\frac{\partial V(\vec{y})}{\partial y}\right) =0. \tag{2}\]

### _Examples of Separable Hamiltonian Systems_

For illustration and comparative empirical evaluation of the models presented, we consider eight Hamiltonian systems shown in Table I, of which five are classical and mechanical and three are abstract. These allow the models to demonstrate their performance in predicting a range of Hamiltonian dynamics comprising different functions, different values of \(n\), and well-behaved or chaotic dynamics, from observations.

## III Related Work

### _Predicting Function Values and Vector Fields_

There are multiple statistical methods to regress correlated vector-valued functions [13, 14, 15, 16]. Hastie et al. [6] addressed the regressing of vector fields using multiple output regression and machine learning. State-of-the-art works regress the vector field of a dynamical system using neural networks that model ordinary [17] and partial [18] differential equations.

For the regressing of Hamiltonian dynamical systems, Bertalan et al. [2] and Greydanus et al. [3] independently use physics-informed machine learning methods to regress the value of the Hamiltonian from multiple evenly-spaced samples along multiple Hamiltonian trajectories. Our work emulates theirs, by embedding Hamilton's equations within the loss function of a neural network to regress the Hamiltonian [3] and using automatic differentiation of the regressed Hamiltonian to yield the regressed vector field [3]. However, our work uses instantaneous observations of the Hamiltonian vector field, which are sufficient to train the Hamiltonian neural network.

Recent advancements in regressing Hamiltonian vector fields use neural ordinary differential equations [19, 20, 21, 22, 23] and leverage the symplectic property of the Hamiltonian. They use symplectic integration to regress the Hamiltonian vector field. Some further leverage Hamiltonian separability [19, 21] by using a Leapfrog integrator. Others additionally require the Hamiltonian to be mechanical [22]. Neural ordinary differential equations-based works require trajectories of the Hamiltonian system as input while our model only requires instantaneous observations of the Hamiltonian vector field.

### _Biases in Neural Networks_

Karniadakis et al. focus on three modes of biasing a regression model: observational bias, learning bias, and inductive bias [4]. Observational biases are introduced directly through data that embody the underlying physics, or carefully crafted data augmentation procedures. With sufficient data to cover the input domain of a regression task, machine learning methods

Fig. 1: (a) Non-linear pendulum vector field (black arrows) and Hamiltonian (heatamap), (b) Random samples of the non-linear pendulum vector field.
have demonstrated remarkable power in achieving accurate interpolation between the dots [4]. Learning biases are soft constraints introduced by appropriate loss functions, constraints and inference algorithms that modulate the training phase of a machine learning model to explicitly favour convergence towards solutions that adhere to the underlying physics [4]. Inductive biases are prior assumptions incorporated by tailored interventions to a machine learning model architecture, so regressions are guaranteed to implicitly and strictly satisfy a set of given physical laws [4]. Hamiltonian neural networks leverage learning biases and use Hamilton's equations as soft constraints in the loss function of the neural network to favour convergence toward the Hamiltonian [2, 3].

Seminal work on embedding additive separability within neural networks utilised block diagonal matrices to regress elements of an additively separable finite element problem [24].

Recently, Zhong et al. [22] leveraged the additive separability of mechanical Hamiltonians as an inductive bias to design neural ordinary differential equations. Gruver et al. [8] empirically examined these neural networks and found that their improved generalization resulted from the bias of a second-order structure [8], which arose from the additive separability of the modelled mechanical Hamiltonian and "_allowed the physics-informed neural network to avoid[...] artificial complexity from its coordinate system_ (the input variables)" and improve its performance [8]. Our work also exploits the additive separability of the modelled Hamiltonian.

Our work incorporates knowledge regarding the additive separability of the Hamiltonian function within the Hamiltonian neural network in the style of Karniadakis' physics-informed machine learning [4] so that regressions sought of the Hamiltonian function and vector field are guaranteed to implicitly or explicitly satisfy this separability.

## IV Methodology

Four Hamiltonian neural networks are compared for the task of regressing the Hamiltonian and vector field of a Hamiltonian system. One, the baseline, is uninformed of the additive separability of the Hamiltonian system. Three proposed models are informed via observational, learning and inductive biases respectively. Subsections IV-A, IV-B, IV-C, and IV-D introduce the four models. Section V empirically compares the models on their abilities to perform the task.

### _The Baseline Hamiltonian Neural Network_

We adapt Hamiltonian neural networks (HNNs) [2, 3] (leftmost, Figure 2) for the task of regressing the Hamiltonian and vector field of a Hamiltonian system from random samples of the vector field. Hamiltonian neural networks inform a neural network that a system is Hamiltonian by embedding a Hamiltonian learning bias into the neural network.

Equation 3 defines the loss function of the Hamiltonian neural network. \(f_{0}\) is an arbitrary pinning term that "pins" the regressed Hamiltonian to one among several solutions that are modulo and additive constant, and reduces the search space for convergence. \(f_{1}\) and \(f_{2}\) are Hamilton's equations corresponding to Equation 1. \(f_{0}\), \(f_{1}\) and \(f_{2}\) introduce biases that favour the convergence of the Hamiltonian neural network toward the underlying physics of the regressed Hamiltonian. Equation \(f_{*}\) defines the loss function of the neural network as a linear combination of equations \(f_{0}\) to \(f_{2}\). \(c_{k}\) is the coefficient of each \(f_{k}\). One can assume that \(c_{k}=1\) although additional knowledge of the system can be used to emphasise any \(f_{k}\)[2].

\[f_{0}=\left(\hat{H}(\vec{x_{0}},\vec{y_{0}})-H_{0}\right)^{2}, f_{1}=\left(\frac{\partial\hat{H}}{\partial\vec{y}}-\frac{ \mathrm{d}\vec{x}}{\mathrm{d}t}\right)^{2},\] \[f_{2}=\left(\frac{\partial\hat{H}}{\partial\vec{x}}+\frac{ \mathrm{d}\vec{y}}{\mathrm{d}t}\right)^{2}, f_{*}(\vec{x},\vec{y},\frac{\mathrm{d}\vec{x}}{ \mathrm{d}t},\frac{\mathrm{d}\vec{y}}{\mathrm{d}t};w)=\sum_{k=0}^{2}c_{k}f_{k}. \tag{3}\]

To perform the task of regressing the Hamiltonian and vector field of a \(n\) dimensional Hamiltonian system, the Hamiltonian neural network uses instantaneous, random samples of the \(2\times n\) state variables and the \(2\times n\) vectors, like those seen in Figure 1b. The state variables are input to the model. The output of the model is the regression surrogate, \(\hat{H}\), which is an estimator of the Hamiltonian \(H\). The training is supervised through the loss function, which uses the \(2\times n\) vectors corresponding to the \(2\times n\) state variables that were input to the model. Via gradient descent, \(f_{*}\) is minimised. The derivative of the surrogate \(\hat{H}\) at all input state variables
is the surrogate vector field. It is computed via automatic differentiation [25] of the Hamiltonian neural network.

The separable Hamiltonian neural networks introduced in subsections IV-B, IV-C and IV-D adopt the Hamiltonian learning bias of the Hamiltonian neural network and further embed biases regarding additive separability. They perform the task of regressing the Hamiltonian and vector field in the same way.

### _Embedding a Separability Observational Bias within a Hamiltonian Neural Network_

The baseline Hamiltonian neural network can be informed of additive separability by embedding an observational bias into the Hamiltonian neural network. Given data of the vector field comprising instantaneous state variables and vectors, additive separability is used to quadratically scale the amount of data. Training the Hamiltonian neural network on the new data embeds the observational bias and allows the model to regress a surrogate Hamiltonian that reflects the additive separability of the data. The model, with an embedded observational bias, is a separable Hamiltonian neural network.

Given original data comprising samples of tuples \((\vec{x},\vec{y})\), new samples are generated. Additive separability means the generation comprises new combinations of the \(\vec{x}\) and \(\vec{y}\) from the original data. As the Hamiltonian is additively separable, the first derivatives of the new samples are dependent solely on \(\vec{x}\) or \(\vec{y}\), and can be inferred from the original samples at the respective values of \(\vec{x}\) or \(\vec{y}\). The amount of data available to train the Hamiltonian neural network has increased.

Consider original data comprising two samples \((x_{1},y_{1})\) and \((x_{2},y_{2})\) in blue in Figure (a)a. With additive separability, two new samples created are \((x_{1},y_{2})\) and \((x_{2},y_{1})\) in red. Figure (b)b shows that as more samples from the original data (in blue) are available, quadratically more new samples (in red) can be created. Generally, up to \(N\times(N-1)\) new samples can be created from original data comprising \(N\) samples.

The observational bias creates more data to improve coverage of the input domain of the Hamiltonian regression task, and the regressed surrogate Hamiltonian reflects the additive separability of the data. This improves regression performance but increases the time taken for forward and backward propagation of the separable Hamiltonian neural network. In selecting the optimal number of samples, there is a trade-off between regression performance and training time.

### _Embedding a Separability Learning Bias within a Hamiltonian Neural Network_

The baseline Hamiltonian neural network can be informed of additive separability by embedding a learning bias. The resulting separable Hamiltonian neural network with learning bias (centre, Figure 2) favours convergence towards a surrogate Hamiltonian that is additively separable.

\(f_{3}\) in Equation 4 is the mixed partial derivative of the surrogate Hamiltonian \(\hat{H}\) corresponding to Equation 2. \(f_{*}^{sep}\) is the loss function of the separable Hamiltonian neural network with learning bias. It is a linear combination of equations \(f_{0}\) to \(f_{3}\) from Equation 3 and 4. It introduces a bias that favours convergence of the Hamiltonian neural network toward a surrogate Hamiltonian that is additively separable.

\[f_{3}=\left(\frac{\partial^{2}\hat{H}}{\partial x\partial y}\right)^{2}\forall x \in\vec{x},y\in\vec{y},\hskip 14.226378ptf_{*}^{sep}=\sum_{k=0}^{3}c_{k}f_{k}. \tag{4}\]

A larger \(c_{3}\) allows the separable Hamiltonian neural network to emphasise \(f_{3}\) and additive separability of the surrogate Hamiltonian, but may also decrease the emphasis of \(f_{0}\), \(f_{1}\) and \(f_{2}\), presenting a trade-off in the optimal value of \(c_{3}\).

Fig. 3: (a) \(N\times(N-1)=2\) new samples are created from \(N=2\) samples, (b) \(N\times(N-1)=12\) new samples are created from \(N=4\) samples.

Fig. 2: Architecture of the baseline Hamiltonian neural network and proposed separable Hamiltonian neural network with observational bias (left), proposed separable Hamiltonian neural network with learning bias (centre), and proposed separable Hamiltonian neural network with inductive bias (right).
### _Embedding a Separability Inductive Bias within a Hamiltonian Neural Network_

A baseline Hamiltonian neural network can be informed of additive separability by embedding an inductive bias. The resulting separable Hamiltonian neural network with inductive bias (rightmost, Figure 2) regresses a surrogate Hamiltonian that implicitly and strictly satisfies additive separability.

The proposed separable Hamiltonian neural network with inductive bias is not fully-connected. The model comprises two smaller neural networks with the same number of layers, conjoined only at the output layer. Each smaller conjoined neural network has one output. Their sum (indicated by the dotted lines in Figure 2) is the surrogate Hamiltonian. The architecture of the proposed separable Hamiltonian neural network ensures additive separability as each smaller conjoined neural network has an input of either \(\vec{x}\) or \(\vec{y}\), and is, therefore, a function of either \(\vec{x}\) or \(\vec{y}\). During forward propagation, the sum of the conjoined neural networks ensures the surrogate Hamiltonian is always the sum of two independent functions of \(\vec{x}\) and \(\vec{y}\). The mixed partial derivative of the surrogate Hamiltonian is by design always zero. Additive separability is strictly satisfied. The conjoined neural networks are trained simultaneously in parallel to minimise training time.

The separable Hamiltonian neural network has two smaller conjoined neural networks that can be trained consecutively or simultaneously in parallel. Furthermore, the summation layer of the separable Hamiltonian neural network can utilise a simple sum or introduce weights and biases. The different implementations for the separable Hamiltonian neural network with inductive bias present a trade-off in finding its optimal implementation.

## V Performance Evaluation

The four models are compared on the task of regressing the Hamiltonian and vector field of a Hamiltonian system. To reach the comparison, the proposed separable Hamiltonian neural networks must first be empirically studied and optimised. Thereafter, the baseline Hamiltonian neural network and three optimised models can be compared.

In Experiment 1, the optimal number of samples to create from the original data for the separable Hamiltonian neural network with observational bias is empirically studied and identified. In Experiment 2, the optimal value of \(c_{3}\) for the separable Hamiltonian neural network with learning bias is empirically studied and identified. In Experiment 3, the optimal implementation for the separable Hamiltonian neural network with inductive bias is empirically studied and identified. Finally, in Experiment 4, the baseline model and three optimised separable Hamiltonian neural networks are compared on the task of regressing the Hamiltonian and vector field, and their respective training times.

In finding the optimal implementations of the three informed variants, we only compare their performance on the task of regressing the vector field. This is because regressing the Hamiltonian involves finding the real-valued sum of the integrated vector field. Errors made by the models in regressing the vector field may be cancelled out when regressing the Hamiltonian. Therefore, a model that regresses the Hamiltonian well may not regress the vector field well, but a model that regresses the Hamiltonian vector field well can also regress the Hamiltonian well. For completeness, and to demonstrate this phenomenon, we regress and present results for both the Hamiltonian and the vector field in Experiment 4.

For the regression of the Hamiltonian, the performance of the models is measured by the absolute or L1-error between the surrogate Hamiltonian of a model and the true Hamiltonian from test data. The absolute error is computed following Equation 5. For the regression of the vector field, the performance of the models is measured by the vector error between the derivative of the surrogate Hamiltonian of a model and the true vector field from test data. The vector error is computed following Equation 6[26]. \(\hat{v}\) is the regressed vector and \(v\) is the true vector. The test data set comprises \(d=s^{2n}\) vectors, with \(s=10\) evenly spaced states in each dimension of the phase space for each system.

\[E_{H}=\frac{1}{d}\sum_{k=1}^{d}||\hat{H}_{k}-H_{k}||_{1}, \tag{5}\]

\[E_{V}=\frac{1}{d}\sum_{k=1}^{d}\frac{||\hat{v}_{k}-v_{k}||_{2}}{||v_{k}||_{2}}. \tag{6}\]

All experiments are evaluated over the Hamiltonian systems shown in Table I. The general experimental setup for all models in all experiments is as follows. Training data comprising \(512\) samples of the state variables and vector field are generated uniformly at random within the sampling domain for each Hamiltonian system. The sampling domains are shown in columns 2 and 3 of Table II. The samples comprise tuples of the state variables \((\vec{x},\vec{y})\) and their corresponding vectors or time derivatives. The models to be experimented on are designed with two hidden layers, an Adam optimizer and softplus activation. In training, 20% of the training data is set aside as validation data for a dynamic stopping criterion using validation-based early stopping [27] and a batch size of 80 is used. All models have an input layer with width \(2\times n\), two hidden layers with width shown in columns 6 and 8 of Figure II, and one output layer with width one. Samples of state variables are input to the models. Samples of the vector field are used in the loss function of the models. All models are trained until convergence. In order to find an optimal bias-variance trade-off, the training will terminate if there is no decrease in the validation loss for 4,000 epochs in a row. The output of the models is the surrogate Hamiltonian. The surrogate vector field is computed via automatic differentiation of the surrogate Hamiltonian with respect to its inputs \(\vec{x}\) and \(\vec{y}\). It is equivalent to the vector field following Equation 1. All models are trained in Pytorch on a GeForce GTX1080 GPU with 32 GB RAM. The complete code in Python and results for the models discussed are available at github.com/zykhoo/SeparableNNs. All experiments are repeated for 20 random seeds.
### _Experiment 1: Optimising the Separable Hamiltonian Neural Network with Observational Bias_

This subsection details the experimental setup to empirically study the trade-off between regression performance and regression time taken for the separable Hamiltonian neural network with observational bias, by determining the optimal number of new samples to create from data with \(N\) samples.

#### Iv-A1 Experimental Setup

With original training data of size \(512\), 20% of the data is first set aside as validation data. The remaining 80% or \(N=409\) of training data comprising samples \((\vec{x}_{i},\vec{y}_{i})\) and time derivatives \((\frac{\mathrm{d}\vec{x}_{i}}{\mathrm{d}t},\frac{\mathrm{d}\vec{y}_{i}}{ \mathrm{d}t})\forall i\in N\), is doubled by creating new data comprising samples \((\vec{x}_{i},\vec{y}_{i+1})\) with time derivatives \((\frac{\mathrm{d}\vec{x}_{i}}{\mathrm{d}t},\frac{\mathrm{d}\vec{y}_{i+1}}{ \mathrm{d}t})\forall i\in N\), then appending this new data to the original data. Generally, the training data can be increased \(m\) times by creating new data comprising samples \((x_{i},y_{i+m})\) and with time derivatives \((\frac{\mathrm{d}x_{i}}{\mathrm{d}t},\frac{\mathrm{d}\vec{y}_{i+m}}{ \mathrm{d}t})\forall m=[1,k]\), then appending all \(m\) sets of new samples to the original data. The separable Hamiltonian neural network with observational bias is set up following the leftmost architecture in Figure 2. All details of the setup, training and evaluation follow from the description above in Section V. The separable Hamiltonian neural network is trained and evaluated for models where \(k=\{1,2,3,4,5,10,20,30,40,50,100,200,300,400\}\).

#### Iv-A2 Experimental Results

We report the vector error and training time for the separable Hamiltonian neural network with observational bias in Tables III and IV.

Generally, from Tables III and IV, as \(k\) increases, the vector error decreases and training time increases. The decrease in vector error is not proportional to the amount of data. The marginal improvement in vector error decreases as \(k\) increases. Furthermore, the time taken for each epoch increases proportionately to \(k\). However, the training time does not, because as \(k\) increases, the number of epochs required for convergence decreases. The time taken for the model to converge when \(k=1\) (where the number of samples is doubled from the original data) is not 200 times more than the time taken for the model to converge when \(k=400\) (where the number of samples is four hundred times from the original data). These suggest that smaller values of \(k\) are sufficient to cover the input domain and emphasise the additive separability of the regression task. Nonetheless, in general, the model with \(k=400\) regresses the vector field best, and the model with \(k=1\) is the fastest. A good trade-off that balances reducing the vector error and training time is the model with \(k=2\).

### _Experiment 2: Optimising the Separable Hamiltonian Neural Network with Learning Bias_

This subsection details the experimental setup to empirically study the trade-off between emphasing additive separability of the Hamiltonian regression task and \(f_{0}\), \(f_{1}\) and \(f_{2}\) in Equation 3. The optimal value of \(c_{3}\) is empirically determined.

#### Iv-B1 Experimental Setup

The separable Hamiltonian neural network with learning bias is set up following the middle architecture in Figure 2 with loss function Equation 4. All details of the setup, training and evaluation follow from the description above in Section V. The separable Hamiltonian neural network is trained and evaluated for cases where \(c_{3}=\{0.25,0.50,1.00,2.00,4.00\}\).

#### Iv-B2 Experimental Results

We report the vector error calculated following Equation 6 for the separable Hamiltonian neural network with learning bias in Table V.

Table V shows that as \(c_{3}\) increases, the vector error decreases. Table VI shows that as \(c_{3}\) increases, the number of epochs and training time required increases. These suggest that as the value of \(c_{3}\) increases, the emphasis on additive separability increases, and the separable Hamiltonian neural network with inductive bias places less emphasis on learning Hamilton's equations. As a result, the number of epochs required for the model to learn the surrogate Hamiltonian and converge increases, increasing training time. The model with \(c_{3}=4.00\) regresses the vector field best. The model with \(c_{3}=0.25\) is the fastest. A good trade-off that balances the importance of additive separability and Hamilton's equations appears to be \(c_{3}=1.00\) as it often outperforms the model when \(c_{3}=2.00\). Using \(c_{3}=1.00\) is optimal, and balances the importance of additive separability and Hamilton's equations.

### _Experiment 3: Optimising the Separable Hamiltonian Neural Network with Inductive Bias_

This subsection details the experimental setup to empirically study the trade-off between different implementations of the separable Hamiltonian neural network with inductive bias.
#### Vi-C1 Experimental Setup

The separable Hamiltonian neural network with inductive bias is set up following the rightmost architecture in Figure 2. The width of each smaller conjoined neural network is shown in the second last column of Table II.

The proposed separable Hamiltonian neural network with inductive bias trains the two conjoined neural networks in two ways. Firstly, consecutively, where \(\vec{x}\) is first input to the first conjoined neural network, which outputs \(f(\vec{x})\), then \(\vec{y}\) is input to the second conjoined neural network, which outputs \(g(\vec{y})\). Their sum is the surrogate Hamiltonian. Secondly, simultaneously and in parallel, by designing each layer of the separable Hamiltonian neural network such that it appends the respective layers of the two conjoined neural networks. For the case where the model is trained in parallel, forward propagation through the proposed model is computed as \(x_{n}=\sigma(W_{n}\times x_{n-1}+B_{n})\) where \(\sigma\) is the activation function, \(x_{n}\) is the output of layer \(n\) calculated from the output of layer \(n-1\), \(W_{n}\) is the weight matrix of layer \(n\) of shape \(2\times L_{n}\times L_{n-1}\), and \(L_{n}\) and \(L_{n-1}\) are the widths of layers \(n\) and \(n-1\) respectively, and \(B_{n}\) is the bias matrix of layer \(n\) of shape \(2\times 1\times L_{n}\). The \(2\) in both the weight matrix and bias matrix corresponds to the _two_ disjoint subsets of the state variables of the additively separable Hamiltonian. With this architecture, both smaller conjoined neural networks are trained simultaneously in parallel, with each forward and backward propagation using one graphics processing unit.

The separable Hamiltonian neural network with inductive bias is also trained and evaluated for five possible implementations of the summation layer. The zeroth implementation is a simple summation (sHNN-I (0)). The first implementation is a linear layer with fixed and equal weights, and no bias (sHNN-I (1)). The second implementation is a linear layer with fixed and equal weights, and a trainable bias (sHNN-I (2)). The third implementation is a linear layer with trainable weights, and no bias (sHNN-I (3)). The fourth implementation is a linear layer with trainable weights and bias (sHNN-I (4)). For the zeroth and first implementations, the last column in Table II shows the number of parameters of the model. The second, third and fourth implementations have one, two and three additional parameters respectively. All other details of the setup, training and evaluation follow from the description above in Section V.

#### Vi-C2 Experimental Results

We report the vector error calculated following Equation 6 for the separable Hamiltonian neural network with inductive bias in Tables VII and IX.

From Table VII it is observed that training the conjoined neural networks in parallel and consecutively results in different vector errors and training time. Intuitively, they should have the same vector errors, but closer analysis reveals they have different floating point errors which cause their vector errors to diverge after many iterations. Generally, both separable Hamiltonian neural networks perform well in regressing the vector field as they have similar vector errors. However, from Table VIII, it is observed that the separable Hamiltonian neural network with conjoined neural networks trained in parallel is consistently faster than that which is trained consecutively. Therefore, it is preferred that the conjoined neural networks are trained in parallel.

From Table IX, it can be observed that the simple summation (sHNN-I (0)) and linear layer with fixed and equal
weights (sHNN-I (1)) have the same vector errors because they are identical in implementation. However, from Table X, it is observed that the simple summation (sHNN-I (0)) is consistently faster than the linear layer with fixed and equal weights (sHNN-I (1)). Generally, these two models also have the lowest vector errors among the five possible last-layer implementations. The second, third and fourth implementations have more trainable parameters but do not regress the vector field well. Additional trainable weights or a bias obfuscate the contributions of the conjoined neural network toward the surrogate Hamiltonian and introduce unnecessary complexities when regressing the surrogate Hamiltonian. Therefore, the zeroth implementation, with a simple summation, is the preferred implementation for the summation layer of the separable Hamiltonian neural network with inductive bias.

_Experiment 4: Comparing the Four Variants on the Task of Regressing the Hamiltonian and Vector Field_

This subsection details the experimental setup to empirically compare the four models on the task of regressing the Hamiltonian and vector field of a Hamiltonian system. The four models are the baseline Hamiltonian neural network and the three proposed separable Hamiltonian neural networks with observational, learning and inductive biases.

#### Iv-D1 Experimental Setup

The Hamiltonian neural network is set up following the leftmost architecture in Figure 2. From subsections V-A, V-B and V-C, the optimal implementations of the various separable Hamiltonian neural networks are used. These are the separable Hamiltonian neural network with observational bias where \(k=2\), the separable Hamiltonian neural network with learning bias where \(c_{3}=1.00\) and the separable Hamiltonian neural network with inductive bias with a summation in the last layer. All details of the setup, training and evaluation follow from the description above in Section V.
#### V-C2 Experimental Results

We report the L1-error in regressing the Hamiltonian following Equation 5 and the vector error calculated following Equation 6 for all models in Table XI and Table XII respectively. We report the time taken to train each model in seconds in Table XIII.

From Tables XI and XII, we observe that in general, all proposed separable Hamiltonian neural networks regress the Hamiltonian and vector field with a lower absolute error and vector error than the baseline Hamiltonian neural network. The proposed models leverage physics information regarding separability to penalise or prevent interaction between the state variables and this reduces the complexity of the Hamiltonian regression problem. The regression of the Hamiltonian and vector field are therefore improved. However, from Table XIII, the baseline model is faster than all proposed models.

Generally, from Tables XI, XII and XIII, we observe that among the three proposed models, the separable Hamiltonian neural network with observational bias has the lowest absolute error and vector error, while the separable Hamiltonian neural network with inductive bias is the fastest. The observational bias generates more samples of the data, and this emphasises additive separability and covers the input domain of the Hamiltonian system to ease the interpolation task of the model. Conversely, the models with learning and inductive bias only rely on emphasising additive separability to regress the Hamiltonian and vector field. The additional effect of the observational bias in covering the input domain of the Hamiltonian system allows the model to regress the vector field and Hamiltonian better. The model with inductive bias generally outperforms the model with learning bias as it restricts regressions of the Hamiltonian and vector field to strictly satisfy separability, therefore forcing the model to simplify a complex regression problem into two smaller ones.

It is also observed that the relative performance of the models between Tables XI and XII changes. Regressing the Hamiltonian involves finding the sum of the integrated vector field and errors made by the models in regressing the vector field may be cancelled out when regressing the Hamiltonian.

From Table XIII, the proposed models generally require fewer epochs to converge as the knowledge of additive separability reduces the complexity of the Hamiltonian regression problem. However, the baseline model is the fastest to train. This is because the time taken for each epoch for the proposed models is longer. Compared to the baseline model, the proposed model with inductive bias is slower due to its conjoined architecture with higher dimensional weight and bias matrices that slightly increase the forward and backward propagation time for each epoch. The proposed model with learning bias is even slower due to the additional time taken to compute the mixed partial derivative. The proposed model with observational bias is the slowest as it has several times more samples that linearly scale the training time per epoch given the same batch size. Among the proposed models, the model with inductive bias generally requires the fewest number of epochs to converge and less time per epoch. It is the fastest proposed model.

The separable Hamiltonian neural network with inductive bias is the optimal separable Hamiltonian neural network as it outperforms the baseline in regressing the Hamiltonian and vector field and has the smallest trade-off in training time.

## VI Conclusion

Four models are compared for the task of regressing the Hamiltonian and vector field of a Hamiltonian system from
discrete observations of the vector field. One, the baseline Hamiltonian neural network, is uninformed of the additive separability of the Hamiltonian system. Three proposed separable Hamiltonian neural networks are informed via observational, learning and inductive biases respectively. All proposed separable Hamiltonian neural network models leverage additive separability to avoid artificial complexity between state variables. They are more effective than the baseline in regressing Hamiltonian vector fields and can converge within fewer epochs, but are generally slower in training. The best model is the separable Hamiltonian neural network with inductive bias as it outperforms the baseline in the regression tasks and has the smallest trade-off in training time.

We are now studying separable Hamiltonian neural networks that are simultaneously embedded with multiple biases. Preliminary results show that models embedded with both observational and inductive biases can regress Hamiltonian vector fields best. We are also working on using an inductive bias to recover the kinetic and potential energies of a Hamiltonian system for better interpretability, and dynamically testing for and embedding separability as an inductive bias by rewiring the Hamiltonian neural network on the fly.