Neuro-Symbolic ODE Discovery with Latent Grammar Flow

Karin Yu, Eleni Chatzi, Georgios Kissas

TL;DR

This paper introduces Latent Grammar Flow (LGF), a novel neuro-symbolic framework for discovering ordinary differential equations (ODEs) from data. LGF uniquely combines grammar-based representations with discrete latent space embeddings and flow models to generate interpretable ODEs, incorporating domain knowledge like stability.

What Problem Does This Paper Address?

Many natural and engineered systems are best understood and modeled using differential equations, which offer interpretability and transferability compared to black-box machine learning models. However, discovering these governing equations directly from data is a challenging task due to noise, uncertainty, and the vast search space of possible equations. Existing methods often struggle with either interpretability, computational efficiency, or the ability to incorporate crucial domain knowledge like system stability or order. This paper aims to bridge this gap by developing a method that can discover both explicit and implicit ODEs in a data-driven yet interpretable and knowledge-informed manner.

Methods

The core of LGF is a Grammar Quantisation Autoencoder (GQAE). Unlike traditional autoencoders that map to continuous latent spaces, GQAE embeds grammar-based representations of ODEs into a discrete latent space. This is achieved by quantizing the encoded latent vector, preserving the discrete nature of symbolic structures.

A key innovation is the introduction of a behavioural loss. This loss function encourages ODEs with similar dynamical behaviors (not just structural similarity) to be closer in the latent space. This is crucial because two ODEs with similar syntax might exhibit very different dynamics.

To generate candidate ODEs, LGF employs a discrete flow model. This model learns to transform a simple distribution into the complex target distribution of ODE representations in the discrete latent space. Crucially, this flow model can be conditionally guided by domain knowledge, such as the order or stability of the ODE, steering the discovery process towards more plausible solutions.

The overall process involves:

  1. Grammar-based representation: Equations are represented as sequences of grammar rules.
  2. Discrete latent embedding: GQAE maps these rule sequences into a discrete latent space.
  3. Behavioural loss: Encourages semantic similarity in the latent space.
  4. Discrete flow model: Generates new ODE representations, guided by domain knowledge.
  5. Scalar optimization: A Nelder-Mead algorithm refines the numerical constants of the discovered ODEs.

Datasets

The paper evaluates LGF on three benchmarks:

  • Benchmark 1: Contains 30 explicit one-dimensional first-order ODEs, sourced from ODEBench and prior work.
  • Benchmark 2: Consists of five linear and five nonlinear ODEs.
  • Benchmark 3: Includes seven dynamical systems, ranging from linearised pendulum to exponential stiffness, with partially observable systems and noise.

The paper does not introduce new datasets but uses existing ones to compare LGF against state-of-the-art methods.

Key Insights and Ideas

  • Discrete Latent Space for Symbolic Structures: Using a discrete latent space for grammar-based representations is more natural for symbolic structures than continuous spaces, potentially avoiding issues with ill-defined latent representations.
  • Behavioural Similarity is Crucial: Structural similarity of ODEs doesn't guarantee similar dynamics. Incorporating a behavioural loss is essential for discovering ODEs that truly capture the underlying system dynamics.
  • Domain Knowledge as Guidance: The ability to condition the generative process on domain knowledge (like ODE order or stability) significantly improves the relevance and plausibility of discovered equations, moving beyond purely data-driven approaches.
  • Hybrid Approach Benefits: LGF effectively combines the strengths of generative models (for exploration) and symbolic regression (for interpretability and structure), with the added benefit of guided sampling.

Key Results

LGF demonstrates competitive performance across the evaluated benchmarks:

  • Benchmark 1: LGF shows comparable accuracy to ODEFormer and GODE, with a mean complexity close to the ground truth.
  • Benchmark 2: LGF outperforms other methods in terms of mean relative L2 errors for both $u_t$ and $\dot{u}_t$, while using half the population size of GODE, indicating increased sampling efficiency.
  • Benchmark 3: LGF consistently outperforms PySR in accuracy across most ODE examples, particularly by correctly identifying dynamics and incorporating input functions, which PySR often misses. For instance, for the Pendulum ODE, LGF achieves a relative L2 error of 0.003 compared to PySR's 0.146.

Limitations and Future Work

  • Limitations:
    • The current framework is primarily validated on first- and second-order single-degree-of-freedom ODEs.
  • While stability is incorporated, it's based on intrinsic dynamics and Lyapunov's indirect method, which can be inconclusive for non-autonomous systems. Numerical approximation is used in such cases.
  • The complexity of the grammar and the discrete latent space can still pose challenges for very complex systems.
  • Future Work:
    • Extending LGF to higher-dimensional systems by adjusting the optimization objective function.
  • Generalizing LGF to systems of ODEs through appropriate grammar construction.
  • Incorporating additional dynamical properties beyond stability and autonomy.
  • Exploring broader classes of systems beyond ODEs.

Summary updated

BibTeX
@inproceedings{yu2026neuro,
  author = {Karin Yu and Eleni Chatzi and Georgios Kissas},
  title = {{Neuro-Symbolic ODE Discovery with Latent Grammar Flow}},
  booktitle = {SPIGM @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=1aBSOYespo},
}
Figure