LLM-SR: Scientific Equation Discovery via Programming with Large Language Models

Parshin Shojaee, Kazem Meidani, Shashank Gupta, Amir Barati Farimani, Chandan K Reddy
4/29/2024
cs.LGcs.AIcs.CL

Official code: deep-symbolic-mathematics/LLM-SR (278 stars, MIT, last commit 2025-07-31).

Abstract

Mathematical equations have been unreasonably effective in describing complex natural phenomena across various scientific disciplines. However, discovering such insightful equations from data presents significant challenges due to the necessity of navigating extremely large combinatorial hypothesis spaces. Current methods of equation discovery, commonly known as symbolic regression techniques, largely focus on extracting equations from data alone, often neglecting the domain-specific prior knowledge that scientists typically depend on. They also employ limited representations such as expression trees, constraining the search space and expressiveness of equations. To bridge this gap, we introduce LLM-SR, a novel approach that leverages the extensive scientific knowledge and robust code generation capabilities of Large Language Models (LLMs) to discover scientific equations from data. Specifically, LLM-SR treats equations as programs with mathematical operators and combines LLMs' scientific priors with evolutionary search over equation programs. The LLM iteratively proposes new equation skeleton hypotheses, drawing from its domain knowledge, which are then optimized against data to estimate parameters. We evaluate LLM-SR on four benchmark problems across diverse scientific domains (e.g., physics, biology), which we carefully designed to simulate the discovery process and prevent LLM recitation. Our results demonstrate that LLM-SR discovers physically accurate equations that significantly outperform state-of-the-art symbolic regression baselines, particularly in out-of-domain test settings. We also show that LLM-SR's incorporation of scientific priors enables more efficient equation space exploration than the baselines. Code and data are available: https://github.com/deep-symbolic-mathematics/LLM-SR

View on arXivView PDF

Code Implementations(1)

MIT

[ICLR 2025 Oral] This is the official repo for the paper "LLM-SR" on Scientific Equation Discovery and Symbolic Regression with Large Language Models

27853Shell, PythonApr 19, 20241 years agoMIT
ai4codeai4mathai4scienceequation-discoverylarge-language-models+4 more

Similar Papers

Cite this paper

@article{shojaee2024llmsr,
  title  = {LLM-SR: Scientific Equation Discovery via Programming with Large Language Models},
  author = {Parshin Shojaee and Kazem Meidani and Shashank Gupta and Amir Barati Farimani and Chandan K Reddy},
  year   = {2024},
  eprint = {2404.18400},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.18400v3},
  journal = {ICLR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2404.18400.svg)](https://codeofpaper.com/paper/2404.18400)

Discussion