Back to articles
AI for Science

ScienceDiscovery Uses Tree Search to Iteratively Improve Scientific Code

3 min read

Introduction

Many research tasks are not solved by producing one correct program. They require a cycle of implementation, testing, diagnosis, and revision. OpenJiuwen’s ScienceDiscovery attempts to automate that cycle by treating scientific code as an artifact that can evolve. The underlying model is not retrained and its parameters are not adjusted; only the generated artifact changes from one iteration to the next.

A search tree for program evolution

Each program version becomes a node in a tree. The system selects an existing node, asks the model to rewrite it, runs the candidate in an isolated sandbox, scores the result, and attaches it as a new child. Failed runs, timeouts, and infinite loops are retained as failed nodes rather than disrupting the search.

The selection policy balances exploitation and exploration. Higher-scoring nodes receive more opportunities for further rewriting, while repeated visits reduce a node’s weight and encourage the system to revisit older, less-developed branches. This makes the process different from simply modifying the current best program. The platform also provides parallel candidate generation, sandbox evaluation, and result merging, so a new task can generally be defined by changing the starting artifact and the scoring function.

Reported experiments

  • For oscillatory integrals over a semi-infinite interval, the search produced 236 versions in about two hours. The final 247-line program first examines divergence and oscillation patterns, then selects an appropriate numerical method. The source reports an average relative error of 0.07% on 19 scoring problems.
  • For double-precision evaluation of the Gaussian hypergeometric function, 48 expansions took 598 seconds and produced a 199-line program. On 1,000 unseen points, average correct digits rose from 9.836 to 11.771.
  • On AlgoTune’s 154 code-optimization tasks, two runs achieved an average speedup of 2.279x. The prompts did not prescribe a particular optimization technique.
  • In an equation-discovery benchmark based only on numerical tables, 41.4% of 111 problems reportedly yielded the correct equation. The average was 16.5 model calls per problem using deepseek-v4-flash.

Significance and limits

The main contribution is not a single model spontaneously inventing an algorithm. It is the combination of a candidate generator with executable evaluation and a persistent record of alternatives. When correctness or speed can be checked in seconds, this arrangement can replace dozens of manual trial-and-error cycles with an unattended search.

The limitation is equally important. Laboratory experiments may take days or months, and a proxy score can diverge from the scientific objective. Extending this approach to materials science, biology, or experimental physics will require faster simulation, surrogate models, automated laboratories, and stronger validation. In practice, the scalability of scientific RSI depends not only on how well a model can rewrite an artifact, but also on how cheaply and reliably the system can decide whether the rewrite is better.

QbitAI

Comments

Checking sign-in status...

Loading comments...

Related articles

CCTest · Blog
Anthropic’s MHS aims to give AI agents a common language for hardware
AI for Science
cctest.ai
AI for Science

Anthropic’s MHS aims to give AI agents a common language for hardware

Anthropic has introduced a research preview of the Model Hardware Standard, an interface designed to connect AI agents with laboratory equipment, robots, and other physical systems. The proposal focuses first on scientific workflows, where integrating hardware from different vendors can be especially time-consuming.

Read more