Next Article in Journal
Understanding Social Biases in Large Language Models
Previous Article in Journal
Learning the Style via Mixed SN-Grams: An Evaluation in Authorship Attribution
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

XNODE: A XAI Suite to Understand Neural Ordinary Differential Equations

by
Cecília Coelho
1,2,*,
Maria Fernanda Pires da Costa
2 and
Luís L. Ferrás
2,3,4
1
Institute for Artificial Intelligence, Helmut Schmidt University, 22043 Hamburg, Germany
2
Centre of Mathematics (CMAT), University of Minho, 4710-057 Braga, Portugal
3
Centro de Estudos de Fenómenos de Transporte, Faculty of Engineering, University of Porto, 4200-465 Porto, Portugal
4
ALiCE Associate Laboratory in Chemical Engineering, Faculty of Engineering, University of Porto, 4200-465 Porto, Portugal
*
Author to whom correspondence should be addressed.
AI 2025, 6(5), 105; https://doi.org/10.3390/ai6050105
Submission received: 17 April 2025 / Revised: 12 May 2025 / Accepted: 14 May 2025 / Published: 20 May 2025

Abstract

Neural Ordinary Differential Equations (Neural ODEs) have emerged as a promising approach for learning the continuous-time behaviour of dynamical systems from data. However, Neural ODEs are black-box models, posing challenges in interpreting and understanding their decision-making processes. This raises concerns about their application in critical domains such as healthcare and autonomous systems. To address this challenge and provide insight into the decision-making process of Neural ODEs, we introduce the eXplainable Neural ODE (XNODE) framework, a suite of eXplainable Artificial Intelligence (XAI) techniques specifically designed for Neural ODEs. Drawing inspiration from classical visualisation methods for differential equations, including time series, state space, and vector field plots, XNODE aims to offer intuitive insights into model behaviour. Although relatively simple, these techniques are intended to furnish researchers with a deeper understanding of the underlying mathematical tools, thereby serving as a practical guide for interpreting results obtained with Neural ODEs. The effectiveness of XNODE is verified through case studies involving a Resistor–Capacitor (RC) circuit, the Lotka–Volterra predator-prey dynamics, and a chemical reaction. The proposed XNODE suite offers a more nuanced perspective for cases where low Mean Squared Error values are obtained, which initially suggests successful learning of the data dynamics. This reveals that a low training error does not necessarily equate to comprehensive understanding or accurate modelling of the underlying data dynamics.

1. Introduction

Real-world systems such as those in the domains of physics, chemistry, biology, and mechanics are present in our daily lives and influence the world in which we live in; therefore, it is imperative to gain a comprehensive understanding of the evolution of these systems.
Traditionally, mathematical modelling relies on Differential Equations (DEs) to describe these systems and to establish relationships between the system variables and their rates of change. However, this process requires understanding the intricate interdependencies among variables, and often entails a laborious trial-and-error time-consuming approach for parameter estimation. Real-world systems often exhibit time-dependent behaviour as variables evolve over time, influenced by interactions among themselves and/or external forces.
Neural Networks (NNs) have emerged as a promising approach to describe the behaviour of these systems by learning from given data [1,2]. However, despite being universal approximators capable of modelling any data dynamics [3], NNs inherently model data using discrete-time functions, which is not ideal for capturing the natural time dependence of real systems. Additionally, due to their inability to perceive time, NNs face challenges with irregularly sampled data, as they cannot perceive the different time distances between data points. This only allows for predictions with a predetermined step size provided by the data.
Neural ODEs [4] were introduced as a promising solution to these challenges. They consist of NN architectures that fit an ODE to the data dynamics, allowing for prediction of the system states h ( t n ) = h n with t n = t 0 , , t N at arbitrary instants. This introduces time dependence into NNs, making them suitable for modelling real systems by capturing the continuous system dynamics.
For clarity, suppose that we have a collection of N + 1 ordered observations
x = { x 0 , x 1 , , x N } ,
which represent the state of a dynamical system at discrete time instants t i over the interval [ t 0 , T ] (with t N = T ). Each observation is given by
x i = ( x i 1 , x i 2 , , x i d ) R d , i = 0 , 1 , , N ,
and associated with the corresponding time t i .
We assume that these data can be modelled by the Initial Value Problem (IVP)
d x ( t ) d t = f ( t , x ( t ) ) , x ( t 0 ) = x 0 , t [ t 0 , T ] ,
which characterises the evolution of the dynamical system over the interval [ t 0 , T ] . Note that neither the solution x ( t ) R d nor the function f ( t , x ( t ) ) : R × R d R d is known a priori.
Neural ODEs offer a viable approach to approximate the IVP in (1) solely from the observations x . Let h ( t ) be an approximation of x ( t ) . In the Neural ODE framework, the differential equation is written as
d h ( t ) d t = f θ ( t , h ( t ) ) , h ( t 0 ) = x 0 , t [ t 0 , T ] ,
where the analytical function f ( t , x ( t ) ) is replaced by a neural network f θ ( t , h ( t ) ) . Here, θ represents the parameters (weights and biases) of the network, which are trained using only the observed data x .
The Neural ODE model comprises two main components:
  • A numerical ODE solver that computes the approximate solution of (2).
  • The neural network f θ ( t , h ( t ) ) , which is evaluated at each time step within the solver.
Because the output of the Neural ODE model at time t is a numerical approximation, we denote this approximate solution by h ^ ( t ) . Specifically, we can express the solution at the grid points as
h ^ i = ODESolve f θ ,   h 0 ,   [ t 0 , t f ] , i = 1 , , N .
Neural ODEs are trained in the same way as traditional NNs, that is, by minimising the error of the fit to the data. Thus, the goal is to optimise the parameters θ of the NN f θ such that the solution curve h ( t ) closely matches the training data. The end result of training a Neural ODE is an ODE like the one in Equation (2), that can be solved numerically and used to make predictions across the entire time domain with arbitrary time steps [4]. Due to these advantages over traditional NNs, Neural ODEs have been extensively used to model real systems (see [5,6] and the references therein).
A common problem across both traditional NNs and Neural ODEs is their black-box approach. While these models excel at capturing complex patterns and making predictions, the opacity of their internal mechanisms raises concerns about their application in critical domains.
In the context of interpreting Neural ODEs, there has been a growing interest in using well-known XAI techniques to unravel the inner workings of these complex models; however, the number of works on this subject is limited. In [7], the authors introduced the Tumour Dynamic Neural ODE framework. They demonstrated that the contribution of tumour dynamics to overall survival can be explained using SHapley Additive exPlanations (SHAP). Furthermore, [8] proposed the use of SHAP values to interpret Neural ODE prediction decisions, further illustrating the growing interest in post hoc explanation methods for these models. In [9], the authors introduced the Explainable Tensorized Neural ODE. This model incorporates an attention mechanism, which provides feature importance analysis to offer explainability about how the network uses the data to make predictions. While these approaches provide valuable insights, they overlook the potential of exploiting the resulting models as DEs to provide explainability.
Therefore, in this study we introduce a set of post hoc XAI techniques that are based on the properties of DEs and tailored specifically for Neural ODEs. These techniques draw inspiration from classical mathematical visualisation methods for DEs. In addition, we propose employing phase and vector plots as powerful tools to comprehend the ODEs generated by Neural ODEs. These plots allow us to depict trajectories, pinpoint equilibrium points, analyse bifurcations, and identify anomalies, thereby offering comprehensive insight into the model’s internal mechanisms and system dynamics. These methods not only enhance model transparency but also the model’s performance and reliability. Furthermore, the proposed XNODE framework is designed to deliver both local and global explanations, enabling users to interpret model behaviour for specific initial conditions and to gain a comprehensive understanding of the overall dynamical structure learned by the Neural ODE. These techniques complement those by [7,9], and we anticipate their adoption by researchers in future studies. Although this work employs simple mathematical tools, it should also serve as a guideline for researchers using Neural ODEs by providing a framework to effectively interpret and infer results.
The rest of this paper is organised as follows: Section 2 presents mathematical background on the existence and uniqueness of solutions and on the stability of the system of differential equations; Section 3 presents a brief review on Neural ODEs and XAI techniques together with the proposed eXplainable Neural ODE suite (XNODE) consisting of a collection of post hoc XAI techniques for Neural ODEs; Section 4 presents three case studies in which we train Neural ODEs to model real systems and show how the proposed techniques can be used to provide explainability to the models; finally, the paper ends with a summary and conclusions in Section 5.

2. Background on Systems of Differential Equations

A general system of first-order Ordinary Differential Equations (ODEs) involving n interrelated unknown functions with respect to a single independent variable (t) is provided by
d x 1 d t = f 1 ( t , x 1 , x 2 , , x n ) d x 2 d t = f 2 ( t , x 1 , x 2 , , x n ) d x n d t = f n ( t , x 1 , x 2 , , x n ) or ,   more   compactly : d x d t = f ( t , x ) ,
where x ( t ) R n and f ( t , x ) : R × R n R n .
The Picard–Lindelöf theorem (also known as the Cauchy–Lipschitz theorem) provides sufficient conditions for the existence and uniqueness of a local solution to an initial value problem.
Suppose that f ( t , x ) is continuous in t and x in the neighbourhood of ( t 0 , x 0 ) and is Lipschitz continuous in x , i.e., there exists L > 0 such that
f ( t , x 1 ) f ( t , x 2 ) L x 1 x 2 .
Then, there exists a unique vector function x ( t ) solving
d x d t = f ( t , x ) , x ( t 0 ) = x 0
on some open interval t ( t 0 ε , t 0 + ε ) .
When solving (2), the right hand side function is a neural network; therefore, the Lipschitz-continuous condition can work as a restriction on the optimization problem.
Note that these conditions guarantee local existence. For global existence, it is necessary to ensure that the solution does not blow up in finite time, which usually requires further bounds on f , leading to more restrictions on the neural network representing the function f .

Lyapunov Stability and Attractors, Repellers, and Saddle Points

Stability is also very important when dealing with these systems. The main goal is to determine whether the system will return to equilibrium or move further away from it under slight perturbations away from equilibrium. Consider the following system:
d x ( t ) d t = f ( t , x ( t ) )
where x ( t ) R n is the state vector and f ( t , x ( t ) ) is the vector field that depends on both the state x ( t ) and time t (non-autonomous system). The Lyapunov stability criterion applies to such systems, but with some additional challenges when compared to autonomous systems. The equilibrium point x * ( t ) satisfies d x ( t ) d t = f ( t , x * ( t ) ) = 0 ; for non-autonomous systems, the Lyapunov function V ( x , t ) is used to analyze stability.
A continuously differentiable function V ( x , t ) : R n × R R is called a Lyapunov function around the equilibrium point x * if there exists a neighborhood D R n of x * such that:
  • V ( x , t ) > 0 for all x D { x * } and all t,
  • V ( x * , t ) = 0 for all t,
  • The total derivative satisfies
    V ˙ ( x , t ) = V t + x V ( x , t ) · f ( t , x ) < 0 for   all   x x * .
If these conditions hold, the equilibrium point x * is said to be uniformly asymptotically stable.
In XNODE, we take a simplified approach by focusing exclusively on attractors, repellers, and saddle points, intentionally bypassing the more intricate Lyapunov stability analysis. This Lyapunov analysis, which is inherently connected to the study of attractors, repellers, and saddle points, is further explained below.
An attractor is a set of states to which the system evolves as time progresses. In the presence of an attractor, solutions of the system tend to “attract” nearby trajectories. An attractor A is a set for which there exists a region U A within which solutions of the system starting in U converge to A as t :
lim t x ( t ) = A .
In Lyapunov stability terms, a system is asymptotically stable if its equilibrium point or attractor is a stable set.
A repeller is the opposite of an attractor, representing a set that pushes away trajectories. A repeller R is a set that, for any initial condition x ( 0 ) in the neighborhood of R , the trajectory moves away from R as time progresses:
lim t x ( t ) R .
Repellers are typically associated with unstable equilibrium points. The Lyapunov function for a repeller shows that V ˙ ( x ) > 0 near R .
Let x s be a critical point or an equilibrium point. To determine the local stability around x s , we can linearize the system around x s by considering the Jacobian matrix J ( t , x s ) of the function f ( t , x ) ,
J ( t , x s ) = f ( t , x ) x | x = x s .
If the matrix J ( t , x s ) has eigenvalues with both positive and negative real parts, then x s is a saddle point. Thus, a saddle point is an equilibrium point at which the system has both stable and unstable directions. Saddle points attract trajectories along certain directions (stable manifolds) and repel trajectories along others (unstable manifolds). Saddle points are unstable in the Lyapunov sense, as perturbations along the unstable direction grow, while those along the stable direction decay.
Note that the stability of the system can change dynamically when the right-hand side function f ( t , x ) depends on the time t. This means that different behaviours are observed over time, making it more difficult to understand the system’s behaviour.

3. Explainability and Neural ODEs

XAI includes a wide variety of techniques that aim to make the processes by which black-box models arrive at decisions more transparent and interpretable to humans. These techniques can be broadly categorised into three classifications: pre-modelling explainability (pre hoc), post-modelling explainability (post hoc), and interpretable models [10]. Pre-modelling explainability techniques applied before training involve data analysis, summarising, and transformation to uncover patterns and mitigate biases in data [11]. Post-modelling explainability methods employed after training aim to elucidate the internal decision-making of black-box models through local explanations that provide sample-specific insights [7] and global explanations that reveal overall feature contributions [12]. Additionally, interpretable models further enhance understanding of model predictions, either through inherently transparent models or through hybrid combinations that merge black-box performance with interpretability [10].
XAI in Neural ODEs is a largely unexplored research topic; therefore, in this section we introduce three novel post hoc XAI techniques (referred to as the XNODE suite) that take advantage of overlooked traditional mathematical techniques for DEs. Furthermore, we explain how these techniques can be used beyond enhancing Neural ODE explainability by aiding in data anomaly detection, model debugging, and performance enhancement.

3.1. The XNODE Suite

The XNODE suite comprises time series, state space, and vector field plots that provide insights into the dynamics of Neural ODEs, enabling the uncovering of hidden patterns and behaviours in continuous-time models and elucidating the mechanisms governing their evolution and decision-making processes. Applied after model training (see Figure 1), our techniques are both model-agnostic and architecture-agnostic, though they are applicable only when the function adjusted by the neural network is time-dependent. Additionally, the XNODE suite offers global explanations, which addresses SHAP’s limitation of focusing only on sample-by-sample analysis [7].

3.1.1. Time Series Plots

Time series plots represent solution trajectories of a system over time, capturing the temporal evolution of variables and enabling the identification of several features:
  • Stability: This involves identifying stable and unstable regions within the solution space. Stable equilibria feature trajectories that converge towards fixed points, whereas unstable equilibria exhibit divergence. These plots help to detect critical points and bifurcations, making stability analysis more intuitive (Figure 2a,b).
  • Periodicity: Repetitive patterns reveal the frequency, amplitude, and period of oscillations, aiding in the interpretation of rhythmic dynamics (Figure 2c).
  • Transience: Transient behaviours capture a system’s evolution from the initial conditions to a steady state. These plots highlight relaxation to equilibrium and responses to perturbations, making transient phenomena more cleare (Figure 2d).

3.1.2. State Space Plots

State space plots graphically represent a system’s variables on distinct axes, showing the system’s evolution over time (Algorithm 1). These plots help to identify stability, periodicity, and transience while also providing insights into other system characteristics.
  • Variable Dynamics: This visualization helps to identify relationships and patterns, enhancing the explanation of the system’s behavior (Figure 3).
The ability of state space plots to visualise variables not only helps in understanding the behaviour of individual variables but also aids in discovering intricate relationships and patterns among them. As a result, state space plots serve as a powerful tool to explain the complex dynamics of models such as Neural ODEs, making them more accessible and explainable in the broader context of XAI.
Algorithm 1 Construction of state space plots.
1:
Input: ODE f θ , initial condition h 0 , time interval [ t 0 , t f ] ;
2:
Step 1: Solve the ODE;
3:
{ h n } t n = t 1 , , t f O D E S o l v e ( f θ , h 0 , [ t 0 , t f ] ) ;
4:
Step 2: Plot for each pair or triple of variables;
5:
for  x , y in h  do
6:
      Plot: y n versus x n , t n [ t 0 , f f ] ;
7:
end for
8:
Output: One state space plot per pair or triple of variables in h ;

3.1.3. Vector Field Plots

Vector field plots capture solution evolution over time, displaying direction and magnitude at each point (Algorithm 2). Phase portraits help to identify critical points, stability, and periodic behavior.
Vector field plots are a powerful tool for enhancing the explainability of Neural ODE models by providing visually insights into the system’s dynamic behaviour. Identification of attractors, repellers, and saddle points contributes to a more transparent and comprehensive understanding, which promotes the goals of XAI to make complex models more transparent and explainable, Figure 4.
Algorithm 2 Construction of two-dimensional vector field plots.
  1:
Input: ODE f θ , initial condition h 0 , time interval [ t 0 , t f ] ;
  2:
Step 1: Define a grid;
  3:
for  x , y in h  do
  4:
      Define x f grid points: x 0 , , x n , t n [ t 0 , t f ] ;
  5:
      Define y f grid points: y 0 , , y n , t n [ t 0 , t f ] ;
  6:
end for
  7:
Step 2: Evaluate the vector field;
  8:
for  i , j = 1 : f do
  9:
       d x i j ( t ) d t , d y i j ( t ) d t f θ ( x [ i ] , y [ j ] ) ;
10:
end for
11:
Step 3: Plot the vectors whose direction correspond to the direction of change and whose magnitude represents the magnitude of that change;
12:
for  i , j = 1 : f do
13:
     Plot at ( x [ i ] , y [ j ] ) the tangent vector d x i j ( t ) d t , d y i j ( t ) d t ;
14:
end for
15:
Output: 2-dimensional vector field plots;

3.2. Beyond Improving Explainability

While the XNODE suite techniques are simple, they wield considerable power in enhancing the explainability of Neural ODE models. In addition to their impact on model explainability, these techniques provide effective means to address several intrinsic challenges associated with Neural ODEs. Notably, they offer valuable insights into detecting issues related to data anomalies, model inconsistencies, and optimising overall model performance.
  • Data Anomaly Detection. The XNODE suite techniques allow for the visualisation of the model dynamics through time, enabling detection of unusual or unexpected behaviours. Anomalies such as sudden deviations, irregular patterns, and unexpected behaviour when subjected to scrutiny by domain experts may serve as indicators warranting attention. Such occurrences may indicate possible poor data quality, which can emerge as anomalies, errors, or outliers. The identification of possible data anomalies is essential for ensuring the reliability of the resulting models.
  • Debugging. In the process of modelling real-world systems based on data, large amounts of high-quality data are indispensable for Neural ODEs to effectively capture the intrinsic dynamics of a system and yield robust models. Unfortunately, the scarcity of such large amounts of high-quality data is a prevalent challenge that compromises the output quality of the generated models. In addition, the black-box nature of NNs makes the identification of such problems more difficult. This issue becomes particularly problematic when the systems under consideration are governed by well-defined physical principles that are known a priori; in such cases, the failure of NN models to successfully extract these governing rules from the available data results in non-meaningful predictions, causing field experts to distrust the use of NNs. The proposed XNODE suite techniques can mitigate this issue by providing field experts with insights into the level at which Neural ODE models satisfy physical constraints, i.e., their success (or lack thereof) in extracting the underlying rules from the data. These techniques assist in identifying potential problems by pointing out regions of instability or non-conformance to the expected dynamics. By offering a nuanced understanding of model performance, the XNODE suite can represent a valuable tool for mitigating the challenges posed by data scarcity and ensuring the reliability of the models in scenarios where adherence to known physical principles is crucial.
  • Performance Optimisation. The visualisation of Neural ODE model dynamics is a valuable tool for enhancing model performance by providing insights into the optimisation of training hyperparameters. This visual examination enables field experts to determine necessary adjustments, especially concerning the choice of integration schemes employed within the Neural ODE solver. Through application of the XNODE suite techniques, field experts can systematically compare the dynamics produced by different integration schemes showing which scheme aligns more closely with the anticipated behaviour of the modelled systems.

4. Experiments

In this section, to showcase the capability of the XNODE suite in enhancing the explainability of Neural ODE models, three distinct case studies are considered: a Resistor–Capacitor (RC) circuit with two capacitors; the Lotka–Volterra predator–prey system; and a synthetic chemical reaction system. For each case study, a Neural ODE is employed to capture and learn the underlying dynamics of the system, the XNODE suite techniques are systematically applied to analyse and interpret the resulting Neural ODE models, and the outcomes are discussed. Additionally, to provide a comprehensive understanding of the learned dynamics, the XNODE suite techniques are used to visualise the training datasets. These visual representations are a reference for comparing and evaluating the accuracy of the dynamics learned by the Neural ODE models.
All computations were performed in a machine of type C2-standard-16 with an Intel Cascade Lake 16 vCPU and 64GB RAM. All implementations were in Python with Pytorch as the deep learning library. The code to replicate the case studies can be found at https://github.com/CeciliaCoelho/XNODE, accessed on 13 May 2025.
Note that while comparisons with other XAI methodologies serve as valuable benchmarks for validation, it is paramount to recognise that our suite presents a distinct array of capabilities (post hoc, global, and model-agnostic) tailored to address broader interpretability challenges in Neural ODEs, which renders direct comparisons inappropriate.

4.1. RC Circuit System

RC circuits find widespread application in various electronic systems and signal processing devices due to their ability to filter and shape electrical signals.
In this work, we consider a RC circuit with two capacitors connected in series, each coupled with a resistor ( R 1 and R 2 , respectively). The evolution of this system through time can be mathematically formulated as two ODEs expressing the rate of change in the voltage with respect to the time for each capacitor, accounting for the flow of current through the resistors and the charging and discharging dynamics of the capacitors:
d V 1 ( t ) d t = V in V 1 ( t ) R 1 × C 1 d V 2 ( t ) d t = V 1 ( t ) V 2 ( t ) R 2 × C 2
where V 1 ( t ) and V 2 ( t ) are the respective voltages of the two capacitors, V in is the input voltage, R 1 and R 2 are the respective resistances of the two resistors, and C 1 and C 2 are the respective capacitances of the two capacitors.
The system in (4) was solved numerically using an ODE solver over a time interval t = [ 0 , 10 ] discretized in 1000 time steps with initial conditions V 1 ( 0 ) = 0 and V 2 ( 0 ) = 0 . We set R 1 = 1.0 , R 2 = 2.0 , C 1 = 0.1 , and C 2 = 0.2 .
The solutions resulting from solving (4) were then used to train a Neural ODE with the goal of learning the dynamics of the RC circuit system f θ . We used a neural network with an input layer consisting of two neurons and a hyperbolic tangent (tanh) activation function, a hidden layer with 50 neurons and an Exponential Linear Unit (ELU) activation function, a hidden layer with 108 neurons and the tanh activation function, and an output layer with two neurons. The Adam optimiser was used with a 1 × 10 4 learning rate over 10,000 iterations.
To perform a comparative analysis, XNODE suite plots were generated for both the ground-truth solutions (Figure 5) and the Neural ODE model predictions (Figure 6a).
First, we examine the plots generated using the Neural ODE models. Figure 6a illustrates the temporal evolution of the capacitor voltages V 1 ( t ) and V 2 ( t ) , which exhibit similar patterns until equilibrium is achieved. Moreover, the rate of increase in V 2 ( t ) is observed to be comparatively slower than that of V 1 ( t ) . In Figure 6b, an initial linear relationship can be seen between V 1 ( t ) and V 2 ( t ) , indicating a simultaneous increase. This linear correlation persists until the maximum voltage is reached by V 1 ( t ) , while V 2 ( t ) continues its ascent until that point. The vector field plot in Figure 6c accentuates the ascending trend of the respective voltages, which slows down until a voltage magnitude of 1.0 is reached.
As demonstrated through the plots generated by the XNODE suite, these visualisations offer clear insight into the reasoning and conclusions drawn by the Neural ODE model based on the training data. The information provided by these plots facilitates a comprehensive understanding of the decision-making process employed by the model, enhancing its explainability while contributing to a more transparent and comprehensible representation of the learned dynamics.
Furthermore, the plots in Figure 6 can be compared with the expected plots in Figure 5 to assess the quality of the dynamics learned by the Neural ODE. This comparative analysis reveals that the Neural ODE was able to successfully extract the intrinsic dynamics of the system with a high degree of fidelity. Such close alignment underscores the robustness of the learned model, demonstrating that it was able to comprehensively capture the inter-variable relationships within the system. This also corroborates the loss function value, as provided by the Mean Squared Error (MSE), for ending the training at 3.2 × 10 4 .

4.2. Lotka–Volterra Predator–Prey System

The Lotka–Volterra predator–prey differential equations are a mathematical framework that enables modelling of nonlinear interactions within ecological systems. These equations describe the interplay between predator and prey populations in a biological community. Formulated as two ODEs, the equations translate the temporal evolution of changes in the populations of both predators and prey:
d N ( t ) d t = r × N ( t ) a × N ( t ) × P ( t ) d P ( t ) d t = s × P ( t ) + b × N ( t ) × P ( t )
where N ( t ) and P ( t ) denote the quantities of prey and predator individuals, respectively, r is the growth rate of the prey species, A ( t ) is the predation rate that affects the prey species, s is the mortality rate of the predator species in the absence of prey, and B ( t ) is the growth rate of the predator species in the presence of prey species [13].
In this work, we set r = 0.1 , a = 0.02 , s = 0.3 , and b = 0.01 . Equation (5) was numerically solved over a time interval of t = [ 0 , 50 ] comprising 100 regular time steps. An ODE solver was employed with initial conditions set at N ( 0 ) = 40 and P ( 0 ) = 9 . The solutions obtained from solving the system in (5) were then used as a training dataset for a Neural ODE. The goal was for the Neural ODE to learn the predator–prey population dynamics from the training data f θ . We used a neural network with an input layer consisting of two neurons and a tanh activation function, one hidden layer with 50 neurons and an ELU activation function, and an output layer with two neurons. The Adam optimiser was used with a 1 × 10 5 learning rate over 20,000 iterations.
The ground truth solutions were used to generate the three expected plots that comprise the XNODE suite (Figure 7).
To analyse the relationships learned by the Neural ODE and how its decisions were made, the three plots of the XNODE suite (Figure 8) were constructed as well. In Figure 8a, the time plot illustrates the dynamics of predator and prey populations over time. Upon analysis, it becomes apparent that the Neural ODE model exhibits a learning pattern in which the predator population undergoes minimal changes while the prey population experiences varying rates of decline as time progresses. In Figure 8b, the state space plot presents the direct relationship between predator and prey populations. The Neural ODE model has learned from the data that an increase in the prey population is associated with a decrease in the predator population until a critical turning point is reached, typically around a prey population of 30; beyond this threshold, the model indicates a linear increase in the predator population with the concurrent rise in the prey population. Analysing the vector field plot in Figure 8c reveals that the Neural ODE model has learned that at lower prey population, the predator population increases while the prey population decreases. For higher prey populations, the predator population increases; when the number of predators is larger, there is an increase in the prey population and a slight decrease in the predator population.
Furthermore, when comparing the plots obtained from the Neural ODE model in Figure 8 with the expected plots in Figure 7, it becomes evident that the Neural ODE model was not able to successfully capture the dynamics of the system. This discrepancy suggests potential issues related to the architecture of the NN and the selection of the hyperparameters. The observed divergence between the model’s predictions and the expected behaviour underscores the need for a careful re-evaluation and optimisation of the model’s design and parameter choices in order to improve its performance in capturing the underlying system dynamics.
This example demonstrates that the XNODE suite can contribute to enhancing the explainability of models and aid in the detection of architectural and training issues. In this case, the MSE value when training ended was 5.40 × 10 1 after 20,000 iterations, hinting at the need to improve the ODE model.

4.3. Chemical Reaction System

In a chemical reaction, the participating species interact with each other, which can lead to the creation of new chemical species. In this example, we consider a synthetic chemical reaction involving four species: A ( t ) , B ( t ) , C ( t ) , and D ( t ) . At the initial time, only species A ( t ) and B ( t ) are present. As time evolves, these two species undergo a chemical reaction, resulting in the formation of species C ( t ) and D ( t ) . The reaction can be mathematically formulated as a system of four ODEs [14,15]:
d A ( t ) d t = k 1 × A ( t ) × B ( t ) d B ( t ) d t = k 1 × A ( t ) × B ( t ) + k 2 × C ( t ) d C ( t ) d t = k 1 × A ( t ) × B ( t ) k 2 × C ( t ) d D ( t ) d t = k 1 × A ( t ) × B ( t )
where k 1 and k 2 are the respectively rates of the reactions and A ( t ) , B ( t ) , C ( t ) , and D ( t ) are the respective masses of each species.
In this work, we set k 1 = 0.1 and k 2 = 0.05 . The system in (6) was numerically solved over a time interval of t = [ 0 , 100 ] discretized in 100 time steps with initial conditions A ( 0 ) = 1 , B ( 0 ) = 1 , C ( 0 ) = 0 , D ( 0 ) = 0 .
The solutions obtained from solving the system in (6) were then used as the training dataset for a Neural ODE. The goal was for the Neural ODE to learn the chemical species reaction dynamics from the data. We used a neural network with an input layer consisting of four neurons and a tanh activation function, three hidden layers with 50, 64, and 50 neurons and tanh, ELU, and tanh as the activation functions, respectively, and an output layer with four neurons. The Adam optimiser was used with a 1 × 10 5 learning rate over 10,000 iterations.
The solutions from (6) were used to generate the expected plots of the system dynamics, as shown in Figure 9, Figure 10 and Figure 11.
To study the dynamics learned by the Neural ODE and investigate its decision-making process, the XNODE suite plots in Figure 12, Figure 13 and Figure 14 were generated. Figure 12 reveals a pattern in which the decrease in species A ( t ) and B ( t ) corresponds to an increase in species C ( t ) and D ( t ) . Subsequently, a decline in species C ( t ) and D ( t ) contributes to an increase in species B ( t ) . The six state-space plots in Figure 13 provide insights into the decision-making process of the Neural ODE model within the high-dimensional space. The observations can be summarised as follows: an increase in A ( t ) initially leads to a decrease in B ( t ) until a turning point is reached, after which both increase simultaneously (Figure 13, top left); an increase in A ( t ) results in a rapid increase in C ( t ) until a turning point is reached, beyond which further increases in A ( t ) lead to a decrease in C ( t ) (Figure 13, top middle); generally, an increase in A ( t ) correlates with a decrease in B ( t ) in an almost linear fashion (Figure 13, top right); a decrease in B ( t ) leads to a linear increase in C ( t ) until a turning point, after which C ( t ) starts decreasing when B ( t ) increases again (Figure 13, bottom left); initially, a decrease in B ( t ) results in an increase in D ( t ) until B ( t ) starts increasing again while D ( t ) continues to increase (Figure 13, bottom middle); and an increase in C ( t ) corresponds to an increase in D ( t ) until a turning point is reached, after which a decrease in C ( t ) leads to a relatively constant value of D ( t ) (Figure 13, bottom right).
The six vector field plots in Figure 14 provide additional insights into the workings of the Neural ODE model. Moving from the upper left to the lower right quadrant, when C ( t ) , D ( t ) = 0 and A ( t ) < 0.4 , there is a discernible trend of decreasing B ( t ) with varying magnitudes of velocity, including regions of slower and faster flow. At higher values of A ( t ) , B ( t ) generally decreases (Figure 14, top left); under condition B = 1 and D = 0 , there is an observed increase in C ( t ) as A ( t ) decreases (Figure 14, top middle); in scenarios where B ( t ) = 1 and C ( t ) = 0 , D ( t ) tends to increase within the range 0.2 < A ( t ) < 1.0 (Figure 14, top right); outside of this range, D ( t ) demonstrates a decreasing trend (Figure 14, bottom left); with A ( t ) = 1 and D ( t ) = 0 , there is a general decrease in B ( t ) with respect to C ( t ) except when B 0.4 , where C ( t ) exhibits an increasing pattern (Figure 14, bottom middle); when A ( t ) = 1 and C ( t ) = 0 , the dynamics resemble those of the B ( t ) vs. C ( t ) relationship, with the exception that D ( t ) consistently exhibits an increasing trend. Under the conditions A ( t ) , B ( t ) = 1 , when C ( t ) < 0.3 , D ( t ) displays an increase as C ( t ) decreases; beyond this range, both C ( t ) and D ( t ) show an upward trajectory (Figure 14, bottom right).
We note that in order to generate the vector field plots in Figure 11 and Figure 14, the remaining variables were set to the initial values, namely, A ( t ) = 1 , B ( t ) = 1 , C ( t ) = 0 , and D ( t ) = 0 . In this case, a comparative analysis cannot be performed between the vector field plots and the state space plots dynamics (Figure 10 and Figure 13, respectively).
The visualisations in Figure 12, Figure 13 and Figure 14 provided by the the XNODE suite techniques provide insights into the workings and relations learned by the Neural ODE model. From these plots, we can easily understand how changing the input values results in changes to the output, thereby enhancing model explainability.
Furthermore, when comparing the plots obtained from the Neural ODE model (Figure 12, Figure 13 and Figure 14) with the expected plots (Figure 9, Figure 10 and Figure 11), it is apparent that the time series plots in Figure 9 and Figure 12 are similar. However, the state space plots in Figure 10 and Figure 13 reveal distinctions between the expected and predicted dynamics, with particular emphasis on the B ( t ) vs. C ( t ) plot, where the relationship deviates significantly. Although minor inconsistencies are observed in the other state space plots, the discrepancies in the B ( t ) vs. C ( t ) plot stand out, indicating that the Neural ODE model did not fully capture the expected interdependencies between species. These deviations are not merely numerical inaccuracies but can correspond to fundamentally incorrect qualitative behaviours such as misplaced attractors or misrepresented stability properties. Such differences may significantly alter the system’s long-term predictions.
Furthermore, a closer inspection of the vector field plots in Figure 11 and Figure 14 exposes how these subtle differences impact the dynamics learned by the Neural ODE. The vector field plots highlight a pronounced disparity between the expected dynamics and those captured by the model, further evidencing the importance of employing the XNODE suite techniques. This shows how the XNODE suite techniques complement each other in enhancing explainability and detecting erroneous dynamics in NN models. Interestingly, the MSE value when training ended was 2.8 × 10 5 after 10,000 iterations. At first glance, this might suggest successful learning of the data dynamics; however, use of the proposed XNODE suite techniques reveals a more nuanced perspective, indicating that this low training error does not necessarily equate to a comprehensive understanding or accurate modelling of the underlying data dynamics.

5. Conclusions

In this paper, we have proposed a suite of post hoc XAI techniques tailored specifically for Neural ODEs, drawing inspiration from traditional mathematical visualisation techniques for DEs such as time series, state space, and vector field plots. Choosing traditional mathematical visualisation techniques for DEs over general XAI methods offers a more rigorous, intuitive, and mathematically grounded approach to comprehending Neural ODE models, ultimately enhancing the quality of our insights and enabling more precise model understanding and development. We note that the proposed XNODE suite techniques can also be applied to any NN architecture that adjusts continuous-time functions, provided that the state variables reside in a space that is interpretable or projectable into lower dimensions.
To showcase the effectiveness of our proposed XNODE suite, we applied it to three case studies. For each case study, the XNODE techniques were applied to the resulting Neural ODE models and the generated plots were analysed and discussed. The results show how our XNODE suite provides a detailed understanding of the model’s learned dynamics and decision-making process. Furthermore, the case studies provide valuable insights into the limitations of relying solely on the final value of the training losses as a direct performance measure for assessing model efficacy. Although a low training loss value might suggest successful learning of data dynamics on the part of the model, our comprehensive analyses conducted using the XNODE suite techniques offer a more transparent perspective. The results of the case studies underscore the importance of our proposed XNODE suite in guiding more informed and refined assessments of model dynamics. The role of the XNODE suite techniques extends beyond traditional metrics, providing the means to uncover hidden complexities, identify areas for improvement, and ultimately refine models for more robust and accurate representations of real-world data dynamics.
Although the case studies presented in this paper focus on systems with two to four variables in order to facilitate direct visualisation, the XNODE suite is designed to remain applicable as the dimensionality of the Neural ODE increases. In higher-dimensional settings where full vector field or state space plots become impractical, the suite can be adapted to visualise projections onto relevant two- or three-dimensional subspaces. These can be selected based on domain knowledge, variable importance, or statistical techniques such as principal component analysis. This modular approach allows researchers to isolate and interpret meaningful dynamics within complex models. Additionally, the XNODE suite can be integrated with complementary explainability tools such as saliency maps and attention mechanisms, further supporting its application in more complex real-world systems.
The overarching goal of the XNODE suite is to demystify the inherent complexity of Neural ODEs, making their output models more transparent and explainable. Through the identification of stable and unstable regions, periodicity, and transient dynamics, the XNODE suite aims to create a visual narrative that not only helps to anticipate long-term behaviours but also fosters trust in the predictions of the model. In this way, the XNODE suite can serve as a valuable tool for unravelling the intricacies of Neural ODEs, in turn helping to promote transparency and reliability in a variety of applications.

Author Contributions

Conceptualization, C.C.; methodology, C.C.; validation C.C., M.F.P.d.C. and L.L.F.; formal analysis, C.C. and L.L.F.; investigation, C.C.; writing—original draft preparation, C.C.; writing—review and editing, C.C., M.F.P.d.C. and L.L.F.; supervision, M.F.P.d.C. and L.L.F. All authors have read and agreed to the published version of the manuscript.

Funding

The authors acknowledge funding by Fundação para a Ciência e Tecnologia (Portuguese Foundation for Science and Technology) through CMAT projects UIDB/00013/2020 and UIDP/00013/2020, funding by an FCT and Google Cloud partnership through projects CPCA-IAC/AV/589164/2023 and CPCA-IAC/AF/589140/2023, and the support of the High-Performance Computing Center at the University of Évora funded by FCT I.P. under the project “OptXAI: Constrained Optimization in NNs for Explainable, Ethical and Greener AI”, reference 2024.00191.CPCA.A1, platform Vision. C. Coelho would like to thank FCT funding through the scholarship with reference 2021.05201.BD and the KIBIDZ project funded by dtec.bw—Digitalization and Technology Research Center of the Bundeswehr; dtec.bw is funded by the European Union—NextGenerationEU. This work was also financially supported by national funds through the FCT/MCTES (PIDDAC) under the project 2022.06672.PTDC—iMAD (Improving the Modelling of Anomalous Diffusion and Viscoelasticity: solutions to industrial problems), DOI 10.54499/2022.06672.PTDC (https://doi.org/10.54499/2022.06672.PTDC, accessed on 13 May 2025); and by the projects LA/P/0045/2020 (ALiCE), UIDB/00532/2020, and UIDP/00532/2020 (CEFT). It was also financially supported by Fundação “la Caixa”|BPI and FCT through project PL24-00057: “Inteligência Artificial na Otimização da Rega para Olivais Resilientes às Alterações Climáticas”.

Data Availability Statement

The original data presented in the study are openly available on GitHub at https://github.com/CeciliaCoelho/XNODE.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Ibrahim, A.; Kashef, R.; Corrigan, L. Predicting Market Movement Direction for Bitcoin: A Comparison of Time Series Modeling Methods. Comput. Electr. Eng. 2021, 89, 106905. [Google Scholar] [CrossRef]
  2. Yemelyanov, V.; Chernyi, S.; Yemelyanova, N.; Varadarajan, V. Application of Neural Networks to Forecast Changes in the Technical Condition of Critical Production Facilities. Comput. Electr. Eng. 2021, 93, 107225. [Google Scholar] [CrossRef]
  3. Hornik, K.; Stinchcombe, M.; White, H. Multilayer Feedforward Networks Are Universal Approximators. Neural Netw. 1989, 2, 359–366. [Google Scholar] [CrossRef]
  4. Chen, R.T.; Rubanova, Y.; Bettencourt, J.; Duvenaud, D.K. Neural ordinary differential equations. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, Montréal, QC, Canada, 3–8 December 2018; Volume 31. [Google Scholar]
  5. Xing, Y.; Ye, H.; Zhang, X.; Cao, W.; Zheng, S.; Bian, J.; Guo, Y. A Continuous Glucose Monitoring Measurements Forecasting Approach via Sporadic Blood Glucose Monitoring. In Proceedings of the 2022 IEEE International Conference on Bioinformatics and Biomedicine (BIBM), Las Vegas, NV, USA, 6–8 December 2022; pp. 860–863. [Google Scholar] [CrossRef]
  6. Su, X.; Ji, W.; An, J.; Ren, Z.; Deng, S.; Law, C.K. Kinetics Parameter Optimization via Neural Ordinary Differential Equations. arXiv 2022. [Google Scholar] [CrossRef]
  7. Laurie, M.; Lu, J. Explainable Deep Learning for Tumor Dynamic Modeling and Overall Survival Prediction Using Neural-ODE. arXiv 2023. [Google Scholar] [CrossRef] [PubMed]
  8. Dinh, P.; Jobson, D.; Sano, T.; Honda, H.; Nakamura, S. Understanding Neural ODE prediction decision using SHAP. In Proceedings of the 5th Northern Lights Deep Learning Conference (NLDL), Tromsø, Norway, 9–11 January 2024; Proceedings of Machine Learning Research. Lutchyn, T., Ramírez Rivera, A., Ricaud, B., Eds.; American Psychological Association: Washington, DC, USA, 2024; Volume 233, pp. 53–58. [Google Scholar]
  9. Gao, P.; Yang, X.; Zhang, R.; Huang, K.; Goulermas, J. Explainable Tensorized Neural Ordinary Differential Equations for Arbitrary-Step Time Series Prediction. IEEE Trans. Knowl. Data Eng. 2023, 35, 5837–5850. [Google Scholar] [CrossRef]
  10. Minh, D.; Wang, H.X.; Li, Y.F.; Nguyen, T.N. Explainable Artificial Intelligence: A Comprehensive Review. Artif. Intell. Rev. 2022, 55, 3503–3568. [Google Scholar] [CrossRef]
  11. Rajput, S.; Kapdi, R.; Raval, M.; Roy, M. Interpretable Machine Learning Model to Predict Survival Days of Malignant Brain Tumor Patients. Mach. Learn. Sci. Technol. 2023, 4, 025025. [Google Scholar] [CrossRef]
  12. Rojat, T.; Puget, R.; Filliat, D.; Del Ser, J.; Gelin, R.; Díaz-Rodríguez, N. Explainable Artificial Intelligence (XAI) on TimeSeries Data: A Survey. arXiv 2021. [Google Scholar] [CrossRef]
  13. Elsonbaty, A.; Elsadany, A.A. On Discrete Fractional-Order Lotka-Volterra Model Based on the Caputo Difference Discrete Operator. Math. Sci. 2023, 17, 67–79. [Google Scholar] [CrossRef]
  14. Coelho, C.; Costa, M.F.P.; Ferrás, L.L. Synthetic Chemical Reaction. 2023. Available online: https://www.kaggle.com/datasets/cici118/synthetic-chemical-reaction (accessed on 20 November 2023).
  15. Coelho, C.; Costa, M.F.P.; Ferrás, L.L. A Two-Stage Training Method for Modeling Constrained Systems With Neural Networks. J. Forecast. 2025. [Google Scholar] [CrossRef]
Figure 1. Schematic representation of the workflow applying the post hoc XNODE suite.
Figure 1. Schematic representation of the workflow applying the post hoc XNODE suite.
Ai 06 00105 g001
Figure 2. Time series plots showing (a) stable, (b) unstable, (c) periodic, and (d) transient behaviours.
Figure 2. Time series plots showing (a) stable, (b) unstable, (c) periodic, and (d) transient behaviours.
Ai 06 00105 g002
Figure 3. State space plot showing how the variables x and y evolve over time.
Figure 3. State space plot showing how the variables x and y evolve over time.
Ai 06 00105 g003
Figure 4. Vector field plot showing a point at the origin, where: (left) all the trajectories of the system are moving towards an attractor; (center) all the trajectories of the system are moving away from a repeller; (right) the trajectories of the system approach the point along the y-axis and move away from the point along the x-axis, i.e., a saddle point.
Figure 4. Vector field plot showing a point at the origin, where: (left) all the trajectories of the system are moving towards an attractor; (center) all the trajectories of the system are moving away from a repeller; (right) the trajectories of the system approach the point along the y-axis and move away from the point along the x-axis, i.e., a saddle point.
Ai 06 00105 g004
Figure 5. RC circuit expected plots.
Figure 5. RC circuit expected plots.
Ai 06 00105 g005
Figure 6. RC circuit Neural ODE model plots.
Figure 6. RC circuit Neural ODE model plots.
Ai 06 00105 g006
Figure 7. Lotka–Volterra Predator–Prey expected plots.
Figure 7. Lotka–Volterra Predator–Prey expected plots.
Ai 06 00105 g007
Figure 8. Lotka–Volterra predator–prey Neural ODE model plots.
Figure 8. Lotka–Volterra predator–prey Neural ODE model plots.
Ai 06 00105 g008
Figure 9. Chemical reaction expected time series plot.
Figure 9. Chemical reaction expected time series plot.
Ai 06 00105 g009
Figure 10. Chemical reaction expected state space plots.
Figure 10. Chemical reaction expected state space plots.
Ai 06 00105 g010
Figure 11. Chemical reaction expected vector field plots.
Figure 11. Chemical reaction expected vector field plots.
Ai 06 00105 g011
Figure 12. Chemical reaction Neural ODE model time series plot.
Figure 12. Chemical reaction Neural ODE model time series plot.
Ai 06 00105 g012
Figure 13. Chemical reaction Neural ODE model state space plots.
Figure 13. Chemical reaction Neural ODE model state space plots.
Ai 06 00105 g013
Figure 14. Chemical reaction Neural ODE model vector field plots.
Figure 14. Chemical reaction Neural ODE model vector field plots.
Ai 06 00105 g014
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Coelho, C.; da Costa, M.F.P.; Ferrás, L.L. XNODE: A XAI Suite to Understand Neural Ordinary Differential Equations. AI 2025, 6, 105. https://doi.org/10.3390/ai6050105

AMA Style

Coelho C, da Costa MFP, Ferrás LL. XNODE: A XAI Suite to Understand Neural Ordinary Differential Equations. AI. 2025; 6(5):105. https://doi.org/10.3390/ai6050105

Chicago/Turabian Style

Coelho, Cecília, Maria Fernanda Pires da Costa, and Luís L. Ferrás. 2025. "XNODE: A XAI Suite to Understand Neural Ordinary Differential Equations" AI 6, no. 5: 105. https://doi.org/10.3390/ai6050105

APA Style

Coelho, C., da Costa, M. F. P., & Ferrás, L. L. (2025). XNODE: A XAI Suite to Understand Neural Ordinary Differential Equations. AI, 6(5), 105. https://doi.org/10.3390/ai6050105

Article Metrics

Back to TopTop