In-Context Symbolic Regression: Leveraging Large Language Models for Function Discovery
About
State of the art Symbolic Regression (SR) methods currently build specialized models, while the application of Large Language Models (LLMs) remains largely unexplored. In this work, we introduce the first comprehensive framework that utilizes LLMs for the task of SR. We propose In-Context Symbolic Regression (ICSR), an SR method which iteratively refines a functional form with an LLM and determines its coefficients with an external optimizer. ICSR leverages LLMs' strong mathematical prior both to propose an initial set of possible functions given the observations and to refine them based on their errors. Our findings reveal that LLMs are able to successfully find symbolic equations that fit the given data, matching or outperforming the overall performance of the best SR baselines on four popular benchmarks, while yielding simpler equations with better out of distribution generalization.
Related benchmarks
| Task | Dataset | Result | Rank | |
|---|---|---|---|---|
| Symbolic Regression | Lung Cancer with Chemo & Radio (LC-CR) (test) | MSE6.1 | 22 | |
| Symbolic Regression | Warfarin PK (Warf) (test) | MSE0.497 | 15 | |
| Symbolic Regression | COVID-19 (C-19) (test) | MSE1.03e-7 | 15 | |
| Symbolic Regression | Lung Cancer with Chemo (LC-C) (test) | MSE0.688 | 15 | |
| Symbolic Regression | Lung Cancer (LC) (test) | MSE0.407 | 15 | |
| Symbolic Regression | LLM-SRBench ID (test) | NMSE1.15 | 14 | |
| Symbolic Regression | LLM-SRBench OOD (test) | NMSE0.87 | 14 | |
| Symbolic Regression | LLM-SRBench Symbolic | Term Recall13.1 | 14 | |
| Symbolic Discovery of Ordinary Differential Equations | SIR(2D) ID | Residual NMSE2.80e-8 | 10 | |
| Symbolic Discovery of Ordinary Differential Equations | SIR 2D ID-Ext | Residual NMSE4.62e-9 | 8 |