Transformer improvements boost symbolic equation solving with tree structures

Enhancing Transformer Representations of Symbolic ODE Expressions

Machine LearningArtificial Intelligence

Summary

Solving mathematical equations with computers often involves turning them into sequences of symbols. However, many equations are naturally shaped like trees, showing how parts connect hierarchically. This paper explores better ways to teach transformer models to understand these tree shapes, helping them learn math expressions more effectively. The authors also use a technique called contrastive learning to help the model grasp that some math operations can swap parts without changing the meaning. These improvements help transformers solve symbolic differential equations more accurately and quickly.

What this means in practice

Authors

Xiyue Fan, Adam Prugel-Bennett, Stuart E. Middleton

Abstract

Existing approaches to solving differential equations, such as symbolic regression, physics informed neural networks, and neural operators, typically focus on numerical approximations or blind symbolic search via fitting to numerical data. Less attention has been paid to learning structured representations of mathematical expressions that preserve commutative properties and could support mathematical reasoning in symbolic forms. Transformer models have shown strong capabilities in solving symbolic differential equations. However, standard positional embeddings in transformers are designed for sequence data. Symbolic differential equations are naturally represented by expression trees, so these positional embeddings may not efficiently capture their hierarchical structures. We investigate existing tree positional embeddings in symbolic ordinary differential equation (ODE) tasks. We systematically study their effectiveness under different settings. Our results show that tree positional embeddings aid learning in early epochs and continue to improve performance throughout, ultimately yielding consistent advantages across various data sizes and tasks. Based on learned structural representations, we apply contrastive learning to support the commutative property in mathematics. Ablation studies provide insight into how these methods interact in modelling symbolic mathematical structures.