L2G-SR: Learning to Guide LLM-based Symbolic Regression
Organizations: Peking University
Abstract
Symbolic regression searches for an equation that explains observed data. Numerical error is commonly used to guide the search, but it alone can favor an accurate surrogate over a candidate with the right structure. We propose L2G-SR, a framework for LLM-based symbolic regression that guides search with a learned structural verifier. We construct structural supervision signal using tree edit distance (TED), accounting for commutative operators and alternative expression forms. A verifier first aligns numerical observations with the formulas, then learns to score a candidate's structural similarity to the target formula. At search time, the target formula is hidden and the verifier complements numerical error in parent selection. An analyst then uses verifier feedback and diagnostic tools to propose revisions, which a generator converts into refined expressions. On LLM-SRBench, L2G-SR achieves state-of-the-art numerical fit, equation level accuracy and TED across the evaluated LLM backbones and domains. L2G-SR demonstrates the value of learned structural guidance for LLM-based symbolic regression.
Figures & tables
| Transform | Physics | Materials | Chemistry | Biology | ||||||
| Method | NMSE | NMSE | NMSE | NMSE | NMSE | |||||
| Llama3.1-8B-Instruct | ||||||||||
| LLMDirect | 2.95e-1 | 34.23 | 9.95e-3 | 0.00 | 8.16e-2 | 24.00 | 1.22e0 | 2.78 | 1.29e-1 | 4.17 |
| LLM-SR | 2.42e-1 | 34.23 | 3.00e-3 | 6.82 | 2.16e-1 | 60.00 | 5.24e-2 | 16.67 | 1.76e-2 | 12.50 |
| LaSR | 2.62e-1 | 33.33 | 6.07e-3 | 9.09 | 9.47e-4 | 32.00 | 1.82e-3 | 8.33 | 6.40e-3 | 0.00 |
| SGA | 3.52e-1 | 0.90 | 1.55e-1 | 2.27 | 4.35e-2 | 12.00 | 4.58e-2 | 8.33 | 2.42e-1 | 0.00 |
Appendix figures & tables25 assets
Supplementary material from the paper’s appendix.
Appendix
| Candidate | Reference | TED | ||||
|---|---|---|---|---|---|---|
| (a) | ||||||
| (b) | ||||||
| (c) | ||||||
| (d) | ||||||
| (e) |
| Candidate | Reference | TED | ||||
|---|---|---|---|---|---|---|
| (f) | ||||||
| (g) | ||||||
| (h) | ||||||
| (i) | ||||||
| (j) | ||||||
| (k) |
| Quantity | Outcome | Probability | Quantity | Outcome | Probability |
|---|---|---|---|---|---|
| 1–2 | 0.001000000 | Variables | 1 | 0.127767302 | |
| 3–7 | 0.030000000 | 2 | 0.352240995 | ||
| 8–15 | 0.321712885 | 3 | 0.282177813 | ||
| 16–30 | 0.440506600 | 4–5 | 0.196282613 | ||
| 31–50 | 0.184595015 | 6–8 | 0.041531276 | ||
| 51–70 | 0.018782916 | 9–10 | 0 |
| Binary operator | Probability | Unary operator | Probability |
|---|---|---|---|
| Add | 0.219895438 | Neg | 0.034145627 |
| Sub | 0.114883686 | Inv | 0.015434137 |
| Mul | 0.509631078 | Abs | 0.012666583 |
| Div | 0.135253958 | Sqrt | 0.117837361 |
| Pow | 0.020335839 | Pow2 | 0.278049997 |
| Pow3 | 0.073586740 |
| interval | Probability | interval | Probability |
|---|---|---|---|
| 0.000248984 | 0.297092815 | ||
| 0.037271548 | 0.313650602 | ||
| 0.062787186 | 0.059584268 | ||
| 0.046988624 | 0.011093352 | ||
| 0.171282619 | 0 |
| Family | Probability | Count values: probabilities |
|---|---|---|
| Point relabeling | 0.20 | : |
| Unary insertion/deletion | 0.15 | : |
| Branch insertion/deletion | 0.05 | : |
| Subtree replacement | 0.15 | : |
| Crossover/promotion | 0.05 | : |
| Mixed families | 0.40 | : |
| Family | Maximum count | |
|---|---|---|
| Point / unary | for ; for ; for ; otherwise | 0.30 |
| Branch / subtree | for ; for ; otherwise | 0.35 |
| Crossover/promotion | for ; otherwise | 0.20 |
| Mixed | for ; for ; otherwise | 0.40 |
| TED interval | Edited count | Random count | (edit) | (random) |
|---|---|---|---|---|
| 1,562,156 | 106,540 | 1 | 0 | |
| 2,578,355 | 148,986 | 1 | 0 | |
| 3,802,093 | 478,678 | 1 | 0 | |
| 3,536,928 | 1,073,557 | 0.908795814 | 0.091204186 | |
| 2,699,071 | 2,321,306 | 0.778598241 | 0.221401759 | |
| 2,159,613 | 6,491,726 | 0.501534776 | 0.498465224 |
| Setting | Stage 1 | Stage 2 |
|---|---|---|
| Global batch size | 256 | 256 |
| Updates | 55,000 | 100,000 |
| Learning rate | peak | to |
| Schedule | Warmup–stable–decay | Warmup + cosine decay |
| Warmup updates | 2,000 | 2,000 |
| Stable / decay updates | 48,000 / 5,000 | — |
| Setting | Value |
|---|---|
| Backbone for both roles / temperature | Llama3.1-8B-Instruct / 0.8 |
| Islands / capacity / M and T quotas | 4 / 64 / 32 each |
| Initialization / rounds / children | 40 / 90 / 4 |
| M rounds / T rounds | 45 / 45 |
| Tournament sizes, M / T | 3 / 2, with replacement |
| Credibility threshold / exploration cap | Validation NMSE / 8 |
| Transform | Physics | Materials | Chemistry | Biology | ||||||
| Method | NMSE SD | SD | NMSE SD | SD | NMSE SD | SD | NMSE SD | SD | NMSE SD | SD |
| Llama3.1-8B-Instruct | ||||||||||
| RESTART | 7.06e-3 | 1.88 | 3.47e-3 | 4.73 | 6.91e-5 | 6.11 | 1.23e-6 | 3.21 | 1.91e-2 | 6.36 |
| SR-Scientist | 1.94e-3 | 1.38 | 3.18e-3 | 1.31 | 1.49e-3 | 0.00 | 7.47e-5 | 2.78 | 4.53e-2 | 4.17 |
| Qwen3-4B-Instruct-2507 | ||||||||||
| RESTART | 1.08e2 | 1.04 | 5.48e-2 | 2.62 | 1.14e-3 | 4.00 | 3.81e-2 | 8.49 | 2.61e0 | 2.41 |
| Method | Successful calls per problem | Input tokens per problem | Output tokens per problem |
|---|---|---|---|
| RESTART (reproduced) | 422.7 | 715,609 | 103,528 |
| SR-Scientist (reproduced) | 519.2 | 1,517,007 | 63,266 |
| L2G-SR | 189.2 | 847,822 | 48,130 |
| Oscillation 1 | Oscillation 2 | |||
|---|---|---|---|---|
| Method | NMSE | NMSE | ||
| Llama3.1-8B-Instruct | ||||
| LLMDirect | 6.38e-7 ±4.34e-7 | 100.00 ±0.00 | 2.31e-5 ±1.89e-5 | 88.79 ±9.37 |
| LLM-SR | 1.21e-5 ±1.67e-5 | 94.31 ±9.86 | 4.51e-4 ±7.17e-4 | 63.97 ±34.95 |
| LaSR | 9.61e-4 ±3.66e-4 | 16.26 ±3.35 | 8.36e-4 ±3.27e-4 | 31.37 ±9.05 |
| SGA | 2.23e-4 ±3.76e-4 | 68.78 ±44.14 | 4.74e-3 ±2.15e-3 | 7.96 ±1.71 |
| Physics | Materials | Chemistry | Biology | |||||
| Method | NMSE | NMSE | NMSE | NMSE | ||||
| Llama3.1-8B-Instruct | ||||||||
| A-SR | 6.55e3 | 25.00 | 6.90e-4 | 100.00 | 2.06e0 | 25.00 | 1.08e0 | 45.83 |
| RESTART | 2.13e2 ±1.89e2 | 10.08 ±4.84 | 6.65e-3 ±5.61e-3 | 90.28 ±4.81 | 7.79e-1 ±2.44e-1 | 41.90 ±4.36 | 2.10e1 ±2.26e1 | 18.84 ±6.64 |
| SR-Scientist | 7.70e1 ±7.36e1 | 21.71 ±2.69 | 9.09e-2 ±7.82e-2 | 75.00 ±11.02 | 2.33e0 ±2.53e0 | 35.24 ±4.36 | 7.49e3 ±1.30e4 | 23.19 ±2.51 |
| L2G-SR | 2.13e-3 ±1.42e-3 | 90.70 ±2.33 | 2.27e-5 ±2.21e-5 | 100.00 ±0.00 | 1.92e-1 ±8.96e-2 | 69.22 ±7.27 | 1.99e-1 ±1.56e-1 | 66.67 ±5.02 |
| Oscillation 1 | Oscillation 2 | |||
|---|---|---|---|---|
| Method | NMSE | NMSE | ||
| Llama3.1-8B-Instruct | ||||
| LLMDirect | 1.03e-2 ±0.88e-2 | 45.06 ±18.89 | 3.83e-3 ±3.01e-3 | 52.51 ±14.82 |
| LLM-SR | 3.95e-2 ±4.49e-2 | 23.52 ±33.64 | 6.28e-3 ±0.76e-3 | 29.80 ±18.29 |
| LaSR | 1.98e-1 ±2.44e-1 | 4.60 ±4.91 | 1.75e-2 ±1.56e-2 | 13.99 ±5.65 |
| SGA | 3.19e-1 ±2.78e-1 | 37.22 ±50.88 | 2.30e-2 ±1.46e-2 | 7.12 ±3.86 |
| Setting | Value |
|---|---|
| Backbone / temperature | Llama3.1-8B-Instruct / 0.8 |
| Training / internal-validation fractions | 0.8 / 0.2 |
| Islands / generations / slots per generation | 10 / 100 / 4 |
| LLM-generated candidate budget | 400 slots per problem |
| Refinement and memory | E2E-assisted refinement / concept library |
| Maximum fit rows / constants | 4,096 / 10 |
| Method | Counted LLM search budget | Additional search or optimization |
|---|---|---|
| LLMDirect | 5 generated candidates | BFGS constant refinement for each hypothesis. |
| LLM-SR | 1,000 generated candidates | Island evolution and BFGS constant refinement; these operations act on the counted candidates. |
| LaSR | 1,000 LLM-generated candidates | More than 453,000 random non-LLM mutations, in addition to PySR fitting and selection. |
| SGA | 1,000 generated candidates | Adam-based inner-loop optimization of continuous parameters. |
| DE | At most 400 generated candidates ( ) | Diagnostic tools, BFGS constant fitting, and reflective-memory updates are outside the candidate count. |
| RESTART (ours) | 400 proposal slots ( ) | Numerical/E2E initialization and E2E calls do not consume proposal slots; constant fitting follows the shared BFGS limits. |
Symbolic Regression
Symbolic regression searches data for compact mathematical expressions that balance predictive accuracy with interpretability.
See all 148 papers