Tasks/Math & Scientific Computing/Symbolic Regression

Symbolic Regression — discover model families that generalise (single CPU)

Propose an equation family that extrapolates, not just fits

symbolic_regression Math & Scientific Computing Symbolic Regression
instruction.mdthis is what the agent is given

You inherit a naive symbolic-regression model family: a Python function func(x, params) that currently predicts a plain linear combination of the inputs. Your task is to evolve it into a richer family that can express the kind of structure real scientific laws carry — so that, after its parameters are fit to data, it recovers the underlying law and extrapolates correctly.

You do not submit a formula for one equation. A sealed verifier takes several hidden scientific-style equations (the kinds of laws that turn up across physics, chemistry and engineering), fits your func's parameters to each one's training points, and scores how well the fitted family predicts on held-out points those equations never showed you. The hidden equations differ from anything in this workspace, so a formula hardcoded for a specific equation earns nothing — only a family that generalises across unseen laws scores.

Hard Constraints

  • Submit a model family (the methods/main/ directory), not an answer. The verifier re-imports methods/main/sr_program.py, fits params from scratch, and scores it.
  • Keep the exact contract in methods/main/sr_program.py:
  • func(x, params) -> np.ndarray: x is (n_samples, n_features) with n_features in 1..3; params is 1-D of length NUM_PARAMS; return shape (n_samples,).
  • NUM_PARAMS: int — the verifier optimises a params vector of this length by multi-restart BFGS, so func may be non-linear in params: an entry of params may appear anywhere in the expression, not only as a linear coefficient, and it is still fitted for you — e.g. a parameter sitting inside a non-linear call, params[k] * g(params[j] * x[:, 0]), is optimised just as a plain coefficient is.
  • Numerical safety: never return NaN or Inf — clip exponent arguments, keep denominators away from zero, guard sqrt/log. Any sample that yields a non-finite value is scored as a miss.
  • Budgets (integrity): methods/main total size ≤ 262,144 bytes and NUM_PARAMS ≤ 200, so a lookup table or precomputed constants cannot be smuggled in as "code". No network at grade time.

What You Have

  • /app/ (/app/README.md orients you):
  • methods/main/sr_program.pythe graded file: the naive linear func + NUM_PARAMS.
  • DATA_CARD.md — the contract, the public practice equations, and the budgets.
  • Your self-check surface (free): python /app/selfcheck.py runs your func through the exact fit-then-extrapolate pipeline on five public practice equations (different from the graded ones) and prints the raw mean extrapolation accuracy. Treat it as a proxy only — the sealed equations differ, so keep margin and stay general.

What You Submit

Edit /app/methods/main/sr_program.py so that func is a family expressive enough for the laws the verifier will fit it to, while remaining numerically safe, and raise NUM_PARAMS to match the parameters your family needs. There is no submit step and no per-attempt feedback — self-check as long as your window allows, then leave your best methods/main in place; it is fit and graded once at the end.

How It Is Judged

For each hidden equation the verifier fits your params (multi-restart BFGS on that equation's training points), then predicts on a wider-range held-out set and measures the extrapolation fit:

per hidden equation:  score = max(0, R^2)   on the held-out extrapolation points   (1.0 = perfect)
metric             =  mean of that score across all hidden equations               (higher is better)

The verifier owns the fitting and the scoring and re-runs your func on data it never revealed, so neither the fit nor the score can be gamed.

The grading budget, in full — size your family against it. You get no per-attempt feedback, so these numbers are published rather than left for you to guess:

grading run free selfcheck.py
BFGS fits of your func 500 (several hidden equations × several data draws × 10 restarts) 40 (5 practice equations × 8 restarts)
iteration cap per restart 100 100 (identical)
wall-clock budget 3600 s total none
resources 2 CPU cores, 1024 MB 4 CPU cores, 2048 MB

So grading costs about 12× a self-check run (500 fits vs 40, same per-fit cap): time one python /app/selfcheck.py, multiply by ~12, and compare against 3600 s. Two things drive that cost:

  • BFGS differentiates your func numerically, so one iteration costs about NUM_PARAMS + 1 calls. Total calls per grade ≈ 50,000 × (NUM_PARAMS + 1): about 1.8 million at NUM_PARAMS = 35 and 11 million at the maximum NUM_PARAMS = 200.
  • So the budget is really a per-call budget: 3600 s ÷ 11e6 ≈ 330 µs per call at NUM_PARAMS = 200 (and ~2 ms per call at NUM_PARAMS = 35). A lean vectorised func is a few tens of µs; one that rebuilds a large (n_samples, NUM_PARAMS) basis matrix on every call is several hundred µs and is tight at the top of the range. Time your own func and do the arithmetic — NUM_PARAMS is only free if the extra parameters do not also make each call slower.

If the budget does run out, you are not zeroed: the equations whose predictions are already written are scored normally and the unfinished ones count as misses, so a slow family degrades gradually instead of falling off a cliff. It is still lost score — finishing is strictly better.

Metric

mean held-out extrapolation accuracy over the sealed equations · higher is better

max(0, R^2) on a wider-range OOD set after multi-restart BFGS, over 10 hidden equations x 5 data seeds

anchorvisible setheld-outreward
Binherited linear family, 12 params0.070.130.00
Rreference solution0.790.300.30
Sexpert (sota) family0.9450.9920.60
metric ceiling R^2=1, not a rung1.00.6035
normalisation
m <= B0
B < m <= R0.3 * (m - B) / (R - B)
R < m <= S0.3 + 0.3 * (m - R) / (S - R)
m > S1 - 0.4 * exp(-(m - S) / tau)

m = this run's held-out metric  ·  B = inherited linear family, 12 params  ·  R = reference solution  ·  S = expert (sota) family

tau = 0.4*(S-R)/0.3, fixed by continuity at S. Scores are averaged per seed, then over seeds; the single mean is mapped once.

Rollouts

94 minwall clock
$33.39spend
54.1Mtokens
52versions, 10 kept
0 0.2 0.4 0.6 0.8 1.0 $0 $7.5 $15 $22 $30 cumulative spend on the run self-check on the 5 public practice equations, higher better expert · visible · 0.945 v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 v20 v21 v22 v23 v24 v25 v26 v27 v28 v29 v30 v31 v32 v33 v34 v35 v36 v37 v38 v39 v40 v41 v42 v43 v44 v45 v46 v47 v48 v49 v50 v51
keptrevertedno scoreturning point
  1. v0Inherited 12-parameter linear baseline0.07110 min · $0.15
  2. v1Complete cubic plus ridge sine, exp, root and rational primitives; 45 paramsTrades one linear form for a cubic core plus scientific primitives, so a single family can express many kinds of law.0.99933 min · $0.44
  3. v2Per-restart selection among octic poly, harmonic, exp and algebraic branches0.63229 min · $1.21
  4. v3Sine, exp, root and rational residualized against the cubic Taylor basis0.483112 min · $1.59
  5. v4Appended bounded Gaussian, tanh and log-quadratic primitives; 65 params0.499213 min · $1.83
  6. v5Gaussian/tanh/log-quadratic hard-gated, each on ~21% of restarts; 68 params0.964715 min · $2.25
  7. v6Lean choice of cubic plus two sines, two exps, radial root or rational; 32 params0.777816 min · $2.63
  8. v7Two branches: cubic+exp versus cubic+sine+root+rational; 43 params0.887817 min · $2.82
  9. v8Three restart classes: 40% cubic+sine, 25% cubic+exp, 35% cubic+root+rational0.762118 min · $3.01
  10. v9Two-way split reallocated to 75% sine/root/rational, 25% exp0.887819 min · $3.21
  11. v10Canonicalized redundant sine, exp, root and rational coordinates; 42 params0.7220 min · $3.42
  12. v11tanh-bounded sine/root/rational slopes, exp rates to +/-2, exponent to +/-120.880120 min · $3.63
  13. v12Bounded only exp slopes to +/-2.5 and exponent arguments to +/-120.993922 min · $4.00
  14. v13Additionally bounded sine frequencies to +/-30.991723 min · $4.42
  15. v14Exponent clipping to +/-12 without the bounded exp rate coordinate0.975724 min · $4.85
  16. v15Exp rate bound tightened from +/-2.5 to +/-1.50.845525 min · $5.05
  17. v16Exp rate bound loosened from +/-2.5 to +/-40.963225 min · $5.26
  18. v17Polynomial core completed through total degree four; 60 params0.593226 min · $5.54
  19. v18Appended a 25%-restart hard-gated homogeneous quartic tail; 61 params0.715627 min · $5.82
  20. v19Gated quartics moved into dormant slots, keeping param count and restart draws0.795728 min · $6.06
  21. v20Dormant d=1/2 slots reused for gated Gaussian, tanh and log-quadratic terms0.981330 min · $6.49
  22. v21d=2 optional tanh/log blocks replaced by a gated signed affine ratio0.985731 min · $6.90
  23. v2221%-restart generalized radial power, fitted exponent in [-2,2], dormant slots0.995233 min · $7.33
  24. v23Generalized-power gate probability raised from 21% to 50%0.985134 min · $7.82
  25. v24Exp exponent augmented with fitted non-positive diagonal quadratic terms0.995536 min · $8.33
  26. v25Gaussian-structure gate probability raised to 50%0.953137 min · $8.83
  27. v26Gaussian gate probability set to one third0.967838 min · $9.22
  28. v27Gated second low-dimensional harmonic in the dormant slots0.979139 min · $9.69
  29. v28Sine parameters reinterpreted as linear sine/cosine quadratures on 21%0.976940 min · $10.17
  30. v2921% of d=1/2 restarts reserved as clean cubic+sine fits0.99542 min · $10.80
  31. v30A further 21% of restarts reserved as cubic+exp only0.99543 min · $11.30
  32. v31Negative 21% tail used for clean cubic plus diagonal-radial-root fits0.99545 min · $11.90
  33. v32Redundant d=3 exp offset reused as a sine-only selector0.99546 min · $12.51
  34. v33All cubic contributions removed; core is complete quadratic plus primitivesReads the cubic core as an extrapolation contaminant, not capacity, and deletes it at fixed params and restart draws.0.994551 min · $14.16
  35. v3421% of d=1/2 restarts reserved as pure cubic-polynomial candidates0.97352 min · $14.52
  36. v3521% exp-only restarts; the other 79% fit quadratic+sine+root+rationalSplits restarts by structure so the explosive exponential is fitted alone, instead of competing inside every fit.0.999554 min · $15.34
  37. v36Negative 21% tail reserved as quadratic+sine only0.999556 min · $16.16
  38. v37Negative 21% tail omits sine, fitting quadratic+root+rational0.999558 min · $17.07
  39. v38Negative 21% tail becomes quadratic+tanh only0.999561 min · $18.56
  40. v39Tail split into 10% anisotropic-Gaussian-only and 20% tanh-only0.999563 min · $19.44
  41. v40Added a 10% quadratic plus protected-affine-ratio slice0.999565 min · $20.22
  42. v41Added another 10% protected-log-only slice; general core down to 29%0.919965 min · $20.59
  43. v42Every exp-only restart generalized to affine-prefactor ridge exponential0.923471 min · $22.71
  44. v43Affine exp prefactors limited to half of the exp-only restarts0.923472 min · $23.10
  45. v44A 46th parameter added to extend the selector portfolio to d=30.803572 min · $23.49
  46. v45Portfolio extended to d=3 at 45 params by normalizing the d=3 rational floor0.999574 min · $24.34
  47. v46A d=3-only 10% slice for a protected complete-quadratic-over-affine family0.999580 min · $26.64
  48. v47d=3 tanh selector interval returned to the general core0.999588 min · $29.90
  49. v48Six d=3 core-root params reinterpreted as a fitted-exponent radial power0.999590 min · $30.83
  50. v49Gaussian, tanh and exp-only branch backgrounds reduced to affine0.923490 min · $31.25
  51. v50Only Gaussian and tanh backgrounds made affine; exp keeps its quadratic0.999592 min · $32.18
  52. v51Documentation cleanup and bytecode removal; behavior identical to v460.999594 min · $33.16

52 snapshots in 94 min, $33.39. Each candidate was screened on the public 5, then ranked on a private 32-law bank at 10 restarts x 3 draws.

On the hidden set

held-out metricreward
inherited linear family, 12 params0.130.00
reference solution0.300.30
expert (sota) family0.9920.60
metric ceiling R^2=1, not a rung1.00.6035
this run0.84110.5346
216 minwall clock
$19.41spend
26.2Mtokens
6versions, 6 kept
0 0.2 0.4 0.6 0.8 1.0 $0 $4 $8 $12 $16 cumulative spend on the run practice-5 accuracy on the agent's own bench, higher better expert · visible · 0.945 v0 v1 v2 v5 v6 v7
keptrevertedno scoreturning point
  1. v0Inherited naive linear family, 12 params0.07113 min · $0.41
  2. v1Rational core plus gated sin, exp, power-law, sqrt and log units; P=58Swaps one linear form for a dictionary of scientific primitives, so a single family can express many kinds of law.0.66378 min · $1.06
  3. v2Same maths as cached feature matrices and BLAS dots; 91us -> 39us0.653233 min · $3.20
  4. v5Soft sparsifying map c -> c^5/(1+c^4) on every output coefficientA 9-param sin-only family recovered sin(2x) where the 58-param one scored 0; interference, not capacity, was binding.dev61 bank only: 0.759995 min · $9.15
  5. v6Hardened freeze: float64 params, column clamp, checksum-keyed cache0.7731145 min · $14.38
  6. v7Per-channel master gates: each restart searches a random subset; P=65Seven gate params switch whole channels off as a unit, so restarts search subsets. +0.067 +- 0.022 paired on dev-61.0.9215167 min · $15.81

Six snapshots, 216 min, $19.41, most of it measurement: a private 61-law dev bank and an exact best-of-10 restart estimator.

On the hidden set

held-out metricreward
inherited linear family, 12 params0.130.00
reference solution0.300.30
expert (sota) family0.9920.60
metric ceiling R^2=1, not a rung1.00.6035
this run0.81650.5239
27 minwall clock
$5.80spend
7.4Mtokens
23versions, 7 kept
0 0.2 0.4 0.6 0.8 1.0 $0 $1.5 $3 $4.5 cumulative spend on the run self-check on the 5 public practice equations, higher better expert · visible · 0.945 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 v20 v21 v22 v23
keptrevertedno scoreturning point
  1. v1Inherited 12-parameter linear baseline0.07110 min · $0.14
  2. v267-param mixture: quartic poly, sin and exp ridges, rational, root, logTurns the linear form into a dictionary of primitives. It scored badly, but every later version is a pruning of this set.0.36842 min · $0.36
  3. v3Pruned to one sine, exp, rational and root component; 44 paramsReads v2's failure as an optimiser problem, not a capacity one, and cuts the dictionary until fits converge in budget.0.68763 min · $0.50
  4. v4Six linear coefficients on fixed unit-frequency sin/cos atoms, 50 params0.88974 min · $0.65
  5. v5Dropped cubic and quartic univariate terms, kept quadratic and crosses0.99226 min · $0.94
  6. v6Exponent becomes intercept-free affine plus diagonal quadratic, 46 params0.75837 min · $1.10
  7. v7Exponent curvature forced to -q^2 so Gaussian tails cannot grow0.89848 min · $1.22
  8. v8Half-gated negative-square curvature; negative init disables the block0.8988 min · $1.36
  9. v9Protected affine/affine reciprocal for hyperbola and saturation, 52 params0.55569 min · $1.51
  10. v10Denominator becomes gated constant plus absolute and squared affine, 46 params0.780410 min · $1.65
  11. v11One protected affine-log ridge, 49 params0.5962$1.91
  12. v12Bounded decaying-envelope sinusoid, 53 params0.923613 min · $2.17
  13. v13Ellipsoidal root replaced by protected sqrt of a diagonal quadratic0.986614 min · $2.48
  14. v14Removed the redundant exponent intercept from A*exp(b + w.x), 43 paramsFirst version picked on three data seeds and a worst-seed number (0.9022/0.7780 vs v5 0.8565/0.7499), not one fixed draw.0.937315 min · $2.75
  15. v15Rational denominator scale normalised to 1+z^2, 42 params0.973816 min · $3.00
  16. v16Ellipsoidal-root scale normalised, another 1-param reduction, 42 params0.983818 min · $3.50
  17. v17Three fixed signed-log1p atoms, 46 params0.78919 min · $3.70
  18. v18Learned sine/exp/rational/root amplitudes rescaled by 0.30.596720 min · $3.95
  19. v19The same amplitudes rescaled by 2.00.899620 min · $4.11
  20. v20Dropped the three fixed cosine atoms, kept learned phase, 40 params0.945322 min · $4.50
  21. v21Four-param protected generalised absolute monomial for fractional powers0.598922 min · $4.71
  22. v22Removed the three root centre shifts, kept centred norms, 40 params0.945323 min · $4.88
  23. v23Removed only the rational denominator's affine shift, 42 params0.961524 min · $5.28

23 snapshots in 27 min, $5.80. From v5 on, each version is a single-block ablation off one leader, v5 then v14; 16 of 23 were reverted.

On the hidden set

held-out metricreward
inherited linear family, 12 params0.130.00
reference solution0.300.30
expert (sota) family0.9920.60
metric ceiling R^2=1, not a rung1.00.6035
this run0.65170.4525
18 minwall clock
$0.78spend
3.8Mtokens
11versions, 6 kept
0 0.2 0.4 0.6 0.8 1.0 $0 $0.2 $0.4 $0.6 cumulative spend on the run self-check on the 5 public practice equations, higher better expert · visible · 0.945 v0 v1 v2 v3 v4 v5 v6 v7 v8 v10 v11
keptrevertedno scoreturning point
  1. v0Inherited 12-parameter linear baseline0.07112 min · $0.10
  2. v1Shared basis rational function, 10 affine-inner nonlinear terms; 79 paramsReplaces the linear form with one rational family over a shared basis of sin, cos, exp, sqrt and log primitives.0.59653 min · $0.15
  3. v2Denominator coefficients scaled by 0.1 at initialisation0.68424 min · $0.19
  4. v3Hybrid basis: 18 fixed univariate features beside the parameterized ones; 85 params0.66136 min · $0.24
  5. v4Denominator scaling tightened from 0.1 to 0.010.49687 min · $0.28
  6. v5Denominator cut to a fixed 6-coefficient quadratic; 59 paramsReads the poor fits as vanishing gradients, not missing capacity, and leaves only 5 nonlinear inners to optimise.0.71378 min · $0.34
  7. v6Fixed univariate features shifted to g(x)-1 so padded columns vanishZero-padding every input to 3 columns made cos, exp and sqrt emit duplicate constants; the shift removes the collinearity.0.79849 min · $0.39
  8. v7Ten parameterized nonlinear terms instead of five; 84 params0.62611 min · $0.44
  9. v8Four parameterized nonlinear terms; 54 params0.777712 min · $0.50
  10. v10Denominator scaling set to 0.05 on top of v60.58116 min · $0.66
  11. v11Three pure cubic terms added to the numerator; 62 params0.558618 min · $0.75

11 snapshots in 18 min, $0.78, one practice self-check each and no holdout bank; v6 was restored as the submission after v8, v10 and v11 fell short.

On the hidden set

held-out metricreward
inherited linear family, 12 params0.130.00
reference solution0.300.30
expert (sota) family0.9920.60
metric ceiling R^2=1, not a rung1.00.6035
this run0.43850.36
123 minwall clock
-spend
-tokens
18versions, 4 kept
0 0.2 0.4 0.6 0.8 1.0 0 25 50 75 100 agent step (this harness reports no tokens or timestamps) self-check on the 5 public practice equations, higher better expert · visible · 0.945 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18
keptrevertedno scoreturning point
  1. v1Inherited 12-parameter linear baseline0.0711
  2. v2Kitchen-sink cubic poly, many unaries and affine nonlinear inners; 88 paramsAsks whether more bases help: all five fit training exactly and collapsed outside it, which set the identifiability rule.3-restart: 0.3046
  3. v3Identifiable family without cubics: quadratic, trig, log1p, rational, exp; 55 paramsOne cubic lets BFGS Taylor-fake an exponential inside the training box, so degree 3 is banned for the rest of the run.0.9881
  4. v4Masks plus Michaelis-Menten, Arrhenius, damped and 3-var gravity templates; 88 params0.7165
  5. v5Feature-presence masks only, no new templates; 55 paramsA mask per feature lets a restart switch whole basis blocks off, so unused columns stop bending the fit outside the box.0.999
  6. v630 linear extras: cubic, Kepler, MM grid, Arrhenius grid, damped, gravity, Gaussian0.5918
  7. v721 bounded linear extras for MM, Arrhenius, decaying oscillator, gravity; 76 params0.9327
  8. v8Seven 3-D-only templates: triple product, cyclic gravity, 3-D Coulomb; 62 params0.9951
  9. v9Targeted nonlinear MM, Arrhenius, damped and gravity terms on x0; 65 params0.9852
  10. v10Structural-hole terms: cos*cos, sin*sin, xyz and cyclic gravity; 65 params0.9968
  11. v11Inverse-square and Coulomb inners replaced by linear grids; 55 params0.9666
  12. v12Nested product-rationals x_i x_j / (1 + a^2 x_k^2); 58 params0.9983
  13. v13Compact affine-unary EQL: 3 affine features through scientific unaries; 51 params0.7903
  14. v143-D Coulomb pair swapped for xyz and x0 x1/(0.5 + x2^2); 55 params0.999
  15. v15One linear cubic term x0^3 added; 56 params0.912
  16. v16Fixed sin(2 x0) and cos(2 x0) atoms added; 57 params0.7975
  17. v173-D Coulomb slot reused for a second x0 exponential; 55 params0.8982
  18. v18Submitted v5 unchanged, with sin and cos algebraically hoisted0.999

18 snapshots, 123 min; the harness reports no cost or tokens. Each version was screened on practice-5, then a written dev bank and frozen holdout.

On the hidden set

held-out metricreward
inherited linear family, 12 params0.130.00
reference solution0.300.30
expert (sota) family0.9920.60
metric ceiling R^2=1, not a rung1.00.6035
this run0.41400.3494