Programmatic Context Augmentation for LLM-based Symbolic Regression

Hao Liu, Xiao-Wen Yang, Atharva Sehgal, Yixin Wang, Lan-Zhe Guo, Yu-Feng Li, Yisong Yue · Submission to ICLR 2026 · Rejected

TL;DR

Symbolic regression (SR)—the quest to find the mathematical equation that perfectly describes a dataset—has traditionally been a "blind" search for Large Language Models (LLMs), which usually only receive a single numerical error score as feedback. This paper introduces PROAUG (Programmatic Context Augmentation), a framework that allows LLMs to write and execute their own data analysis code to "see" the patterns in a dataset before proposing equations. This approach leads to a massive 3x reduction in error and significantly more stable, human-like scientific discovery.

What Problem Does This Paper Address?

Scientific discovery often relies on Symbolic Regression (SR): taking a pile of experimental data and finding the concise, interpretable formula (like $F=ma$ or $E=mc^2$) that explains it. While LLMs have recently been used to "guess" these formulas, they suffer from a major handicap: they are usually only given the Mean Squared Error (MSE) of their previous guesses.

Imagine trying to solve a complex physics problem where your only feedback is a teacher saying "you're getting warmer" or "you're getting colder." A real scientist wouldn't work that way; they would plot the data, check for correlations, and try logarithmic transforms to see if a power-law relationship exists. Existing LLM-based SR methods ignore this rich statistical context, leading to inefficient searches and a reliance on lucky guesses.

Methods

The authors propose PROAUG, a dual-task evolutionary framework that moves the LLM from a "guesser" to an "analyst."

  1. Programmatic Context Augmentation: Instead of just asking for an equation, the framework first prompts the LLM to write Python code to analyze the dataset. This code calculates descriptive statistics, linear correlations, and $R^2$ values for various transformations (like $\log(x)$, $\exp(x)$, or $\sin(x)$).
  2. Enriched Prompting: The results of this code execution (e.g., "Variable X has a 0.99 correlation with $\log(Y)$") are fed back into the LLM's prompt.
  3. Hypothesis Generation & Optimization: Armed with these "statistical hints," the LLM generates a Python function skeleton. An external solver (like BFGS) then fine-tunes the specific numerical constants within that skeleton.
  4. Evolutionary Loop: The best-performing equations are stored in an "experience buffer," allowing the model to refine its search over multiple iterations.

Datasets

The researchers evaluated PROAUG using LLM-SRBench, a rigorous benchmark designed to ensure LLMs aren't just reciting equations they memorized during training. It consists of two main parts:

  • LSR-Transform: 111 functions derived from famous Feynman physics equations but modified via variable substitution and symbolic rewriting to make them unrecognizable to simple pattern matching.
  • LSR-Synth: A collection of synthetic equations spanning Chemistry, Biology, Physics, and Material Science.

Key Insights and Ideas

  • Statistical Hints are a Force Multiplier: In a controlled case study, the authors showed that providing a "Statistical Hint" (like a high $R^2$ value for a log-log plot) allowed the model to find the ground-truth equation with an error of $10^{-13}$, whereas models without the hint failed to converge even after 100 iterations.
  • The "Smarter Model" Advantage: The benefits of PROAUG scale with the reasoning capability of the underlying LLM. While weaker models might get overwhelmed by the extra data analysis context, powerful models like DeepSeek-V3.1 use it to drastically prune the search space.
  • Stability Over Randomness: Standard LLM-based SR is notoriously "swingy"—one run might find the answer, while the next (with a different random seed) fails completely. PROAUG significantly reduces this variance, making the discovery process much more reliable.

Key Results

  • 3x Error Reduction: When using DeepSeek-V3.1, PROAUG achieved a 3x reduction in Normalized Mean Squared Error (NMSE) compared to the standard LLM-SR baseline on the LSR-Transform dataset.
  • Superior Win Rate: In head-to-head comparisons, PROAUG's "win rate" against the baseline started high (>50%) and climbed to over 80% as the evolutionary search progressed.
  • State-of-the-Art Performance: The method consistently outperformed baselines across multiple model backbones (Qwen3-4B, Qwen3-8B, and DeepSeek-V3.1) and across diverse scientific disciplines.

Limitations and Future Work

The authors acknowledge a few key constraints:

  • Template Dependency: The current system relies on a predefined (though lightweight) template for the data analysis code. This might limit the discovery of extremely "exotic" mathematical relationships that fall outside standard statistical tests.
  • Computational Cost: PROAUG requires two LLM calls per iteration (one for analysis, one for generation), doubling the inference cost compared to simpler methods. However, the authors argue this is a small price to pay for the massive gains in accuracy.
  • Future Direction: The next step is to enable the LLM to propose entirely novel analytical procedures without relying on a template, moving even closer to how a human polymath approaches a new scientific mystery.

Summary updated

BibTeX
@misc{liu2026programmatic,
  author = {Hao Liu and Xiao-Wen Yang and Atharva Sehgal and Yixin Wang and Lan-Zhe Guo and Yu-Feng Li and Yisong Yue},
  title = {{Programmatic Context Augmentation for LLM-based Symbolic Regression}},
  year = {2026},
  eprint = {2605.03101},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.03101},
}
Figure