arXiv:2610.33465cs.AIOct 2026

Manuscript Offprint

arXiv:2610.33465

LegoSR: A Unified Framework for Self-improving Agent-Guided Scientific Discovery

Hao Mao, Xu T. Liu, Peng Zhao, Shuai Lu, Yuntian Chen

Abstract

Equation discovery solvers often use different data interfaces, equation representations and evaluation criteria, making their results difficult to compare. We present LegoSR, a unified framework for algebraic symbolic regression and differential equation discovery. LegoSR integrates seven solvers through a common equation representation and evaluation process, and supports searches constrained by partially known equations. Researchers can run solvers directly or use LegoSR Agent, which selects solvers and adapts searches based on solver knowledge, intermediate results and lessons from earlier tasks. On noisy ordinary and partial differential equation benchmarks, LegoSR Agent recovers nearly as many equations as the union of seven expert-tuned solvers and outperforms a generic agent with the same model, tools and budget by up to 29 percentage points. Three examples demonstrate basic use, adaptive solver selection and discovery guided by partial physical knowledge.

Keywords: Equation discovery, Symbolic regression, Partial differential equation, Large language model agent, Automated scientific discovery

*Corresponding author.

Email address: ychen@eitech.edu.cn (Yuntian Chen)

1. Introduction

Mathematical equations are fundamental to describing natural phenomena, understanding physical laws and predicting the behavior of complex systems. As scientific data accumulate, data-driven equation discovery has become an active topic in scientific computing and artificial intelligence [1]. Numerous methods for symbolic regression (SR) and ordinary and partial differential equation (ODE/PDE) discovery have been developed, including sparse regression [2, 3], evolutionary search [4, 5, 6], reinforcement learning [7, 8] and language models [9, 10]. These methods use different mathematical representations, search strategies and optimization schemes, each with strengths for particular scientific problems. However, most are developed as isolated solvers, with different data interfaces, ways of incorporating prior knowledge and evaluation procedures. In practice, scientific discovery is rarely a single run. Researchers must compare methods, analyze candidate equations and experimental results, and refine their approach based on previous findings. These activities require substantial manual effort, while results and knowledge are difficult to reuse across methods and experiments. Organizing heterogeneous solvers into a unified, continuous and traceable scientific discovery process therefore remains an important challenge.

To address this challenge, we introduce LegoSR, a unified and modular framework for symbolic regression and equation discovery. LegoSR integrates seven methods with different representations and search mechanisms, providing common task definitions and a shared Equation Intermediate Representation (Equation IR) for exchanging and reusing equations. A discovery task specifies the data and can incorporate prior knowledge through a Sketch, a partially specified equation. Reusable components support derivative computation, coefficient optimization, candidate evaluation and visualization. Solvers can use these components while retaining their native search and optimization procedures, without following a fixed pipeline. LegoSR also organizes experiment configurations, candidate equations, evaluation results and search records into a unified experiment management environment. Together, these capabilities support cross-method comparison, experiment tracking and reuse of previous results, turning separate solver runs into a continuous and traceable research process.

However, a unified experiment environment does not automatically determine how scientific discovery should proceed. Researchers still need to interpret experimental feedback and decide whether to continue a search, adjust its configuration or switch solvers. These decisions require knowledge of different solvers and experience from previous experiments. Recent advances in large language model (LLM) agents offer new possibilities for automating such multi-step tasks through planning and tool use [11]. Such agents have planned and carried out chemical experiments [12], generated and refined research hypotheses [13] and solved mechanics problems by writing and running finite element code [14]. Yet general-purpose agents often lack systematic knowledge of equation discovery methods and their applicable conditions. Generic prompts and tool calls alone make it difficult to use experimental history effectively and develop informed search strategies.

Building on LegoSR’s unified equation representation and experiment environment, we further develop LegoSR Agent, combining solver knowledge, structured experimental memory and feedback-driven decision making. The agent draws on solver papers and previous experiments to select suitable methods and configure searches. Across multiple rounds of experimentation, it evaluates candidate equations and search progress, deciding whether to continue, adjust configurations or switch solvers. Experimental results and decisions are recorded and reused to guide subsequent exploration, forming a closed-loop, adaptive scientific discovery process. In this way, LegoSR extends from a unified equation discovery framework to an agent-guided system that accumulates experimental experience and adapts its strategies based on feedback. On noisy ODE and PDE benchmarks, LegoSR Agent recovers nearly as many equations as all seven solvers combined under expert-tuned settings, and more than a generic agent with the same model, tools and budget.

References (49)