Amortized Symbolic Regression with Transformers

42 concepts33 papers1 proposal

When scientists try to understand a physical system, they look for a mathematical formula that relates variables to one another—like $F = ma$ or $E = mc^2$. The task of automatically finding these equations from raw numerical data is known as symbolic regression.

Traditionally, symbolic regression has been treated as a discrete optimization problem solved via Genetic Programming. Genetic algorithms start with a random population of mathematical expressions and iteratively mutate and recombine them to fit the data. While powerful, this approach has a major flaw: it treats every new dataset as an isolated problem. The algorithm must search the massive, combinatorial space of mathematical expressions from scratch every single time, making it incredibly slow and computationally expensive.

A rapidly growing body of research fundamentally re-imagines this problem. Instead of searching for an equation via trial and error, what if a neural network could look at a collection of data points and instantly "read" the underlying mathematical law? By framing symbolic regression as a sequence-to-sequence translation task, recent architectures can bypass iterative search entirely, discovering complex formulas in a single forward pass.

Mathematics as a Language Translation Problem

The insight that makes this possible is that symbolic mathematics can be treated as a formal language. Just as a sentence in English has a syntax and a grammar, so does a mathematical equation.

To feed an equation into a sequence-to-sequence model, it must be flattened into a string of tokens. This is typically achieved by representing the equation as an expression tree and reading it out in prefix notation (or Polish notation). In prefix notation, operators precede their arguments. For example, the expression $3x + \sin(y)$ becomes the sequence:

$$\text{[+}, \text{\times}, \text{3}, \text{x}, \text{\sin}, \text{y]}$$

This representation eliminates the need for parentheses and ensures that every valid sequence uniquely maps to a specific mathematical structure.

Early work demonstrated that deep neural networks are surprisingly adept at mastering this grammar. David Saxton et al. showed that mathematical reasoning could be framed as a character-level sequence-to-sequence task, proving that neural architectures can learn to manipulate symbols without hard-coded rules. Similarly, Guillaume Lample et al. showed that transformers could outperform traditional symbolic engines at complex calculus tasks like symbolic integration by treating the problem as machine translation. This linguistic framing extends to simplification as well; Weijie Feng et al. demonstrated that neural sequence models can reduce highly obfuscated mathematical expressions to their minimal functional equivalents far faster than traditional rule-based solvers.

Expression Tree:          Prefix Notation Sequence:

+
     / \                  [+, ×, 3, x, sin, y]
    ×   sin
   / \   |
  3   x  y

Amortizing the Search Cost

If a transformer can translate one mathematical string to another, can it translate a set of numerical data points into a mathematical string?

This is the core idea behind Amortized Symbolic Regression. The strategy relies on large-scale pre-training. Instead of optimizing an expression for a specific dataset, a transformer model is trained upfront on millions of procedurally generated synthetic equations and their corresponding numerical evaluations.

As Luca Biggio demonstrated with the introduction of NeSymReS, this pre-training phase allows the network to learn the implicit mapping between numerical patterns and symbolic structures. The massive computational cost of searching the expression space is "amortized" during training. At inference time, when presented with an entirely new dataset, the model does not search; it performs a single, near-instantaneous forward pass to generate the formula.

The standard architecture for this task consists of two main components:

  1. A Permutation-Invariant Encoder: The input to a symbolic regression model is a set of data points $\{(x_1, y_1), (x_2, y_2), \dots, (x_n, y_n)\}$. Because the underlying physical law is independent of the order in which these points are measured, the encoder must be invariant to the permutation of the input points. As noted by N. Makke, adapting a transformer encoder to treat input data as an unordered set allows the model to build a robust latent representation of the underlying function's behavior.
  2. An Autoregressive Decoder: The decoder takes the latent representation from the encoder and generates the mathematical tokens of the prefix sequence one by one. At each step, it outputs a probability distribution over the mathematical vocabulary (variables, operators, and constants), conditioning its next choice on the tokens it has already generated.
Numerical Data
{(x₁, y₁), (x₂, y₂), ...} 
       │
       ▼
┌──────────────┐
│ Set-Invariant│
│   Encoder    │
└──────┬───────┘
       │ Latent Representation
       ▼
┌──────────────┐
│ Autoregressive│
│   Decoder    │
└──────┬───────┘
       │
       ▼
Symbolic Formula: [+, ×, 3, x, sin, y]

Bridging the Discrete and Continuous

One of the most difficult challenges in neural symbolic regression is handling continuous numerical constants. Transformers are naturally discrete engines; they excel at picking a token like $\text{[+ ]}$ or $\text{[\sin]}$, but they struggle to output precise continuous values like $\pi$ or a specific coefficient like $2.718$.

Early amortized models solved this by separating the problem into two steps: the transformer would predict an equation "skeleton" (e.g., $y = a \cdot x^2 + b$), and a classical non-linear optimization algorithm (like Levenberg-Marquardt) would be called post-hoc to find the exact values for the constant placeholders $a$ and $b$.

However, decoupling structure from constants discards valuable numerical context. To fix this, Jonas Kulhanek et al. developed SymFormer, an end-to-end architecture that predicts mathematical operators and numerical constants simultaneously within a single sequence generation process. By integrating constant regression directly into the transformer's token stream, the model can use the numerical values it is generating to better inform its structural decisions, leading to significantly higher accuracy.

Scaling to Dynamical Systems

The true power of amortized symbolic regression becomes apparent when moving from static data points to dynamical systems, where the goal is to discover the underlying differential equations governing a system over time.

Instead of encoding independent coordinate pairs, models designed for dynamical systems ingest continuous trajectories. For example, Sören Becker et al. developed NSODE, which reads noisy, irregularly sampled time-series trajectories and directly outputs the symbolic ordinary differential equations (ODEs) that generated them without requiring explicit derivative estimation. Similarly, Stéphane d'Ascoli et al. introduced ODEFormer, demonstrating that pre-trained transformers can perform zero-shot inference on complex multidimensional dynamical systems, outperforming traditional genetic algorithms in both speed and robustness against measurement noise.

By treating mathematical discovery as a sequence-to-sequence translation task, these models are even beginning to solve long-standing theoretical challenges. Alberto Alfarano et al. applied symbolic transformers to the discovery of global Lyapunov functions—a notoriously difficult problem in control theory used to prove the stability of dynamical systems. By training on synthetically generated pairs of systems and stability certificates, their model successfully discovered analytical solutions for complex, non-polynomial systems where no general algorithmic solvers previously existed.

Ultimately, by replacing slow, iterative combinatorial searches with fast, forward-pass pattern recognition, amortized symbolic regression transforms how computers interact with mathematical laws, turning the discovery of scientific equations into a language translation problem that transformers are uniquely equipped to solve.

Key Foundational Work

Analysing Mathematical Reasoning Abilities of Neural Models (2019) — contributed 1 concept elements to this direction.
Personalized Feedback for Open-Response Mathematical Questions using Long Short-Term Memory Networks (2017) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_transformer_based_symbolic_regression_54ad8c28,
  title = {transformer-based symbolic regression},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/transformer-based-symbolic-regression/rdr_54ad8c28c8b6479f8b24e18a629cad8b},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-25},
}

This exact version (version 1, frozen text):

@misc{lacuna_transformer_based_symbolic_regression_54ad8c28_v1,
  title = {transformer-based symbolic regression},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/transformer-based-symbolic-regression/rdr_54ad8c28c8b6479f8b24e18a629cad8b/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-25},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake