Deep Symbolic Regression for Recurrent Sequences
Stéphane d'Ascoli, Pierre-Alexandre Kamienny, Guillaume Lample, François Charton
TL;DR
This work introduces transformer-based symbolic regression for recurrent sequences, enabling a model to infer the underlying recurrence from a short initial segment of a sequence. It develops dual data-generation and encoding pipelines for integer and float sequences, compares symbolic recurrence discovery with numeric extrapolation, and demonstrates strong in-domain performance alongside meaningful out-of-domain insights on OEIS data and out-of-vocabulary tokens. Key contributions include a beam-ranking strategy that leverages initial terms, explicit handling of recurrence trees in prefix form, and evidence that the approach can approximate complex constants and function expressions asymptotically. The results suggest practical potential for exact recurrence discovery and principled approximations, while also outlining limitations in distribution shifts, noise robustness, and the need for extensions to broader mathematical structures.
Abstract
Symbolic regression, i.e. predicting a function from the observation of its values, is well-known to be a challenging task. In this paper, we train Transformers to infer the function or recurrence relation underlying sequences of integers or floats, a typical task in human IQ tests which has hardly been tackled in the machine learning literature. We evaluate our integer model on a subset of OEIS sequences, and show that it outperforms built-in Mathematica functions for recurrence prediction. We also demonstrate that our float model is able to yield informative approximations of out-of-vocabulary functions and constants, e.g. $\operatorname{bessel0}(x)\approx \frac{\sin(x)+\cos(x)}{\sqrt{πx}}$ and $1.644934\approx π^2/6$. An interactive demonstration of our models is provided at https://symbolicregression.metademolab.com.
