ScienceIDE Turns Scientific Code Into a Place Where Agents Can Actually Learn

13 minute read

Published:

The best scientific code in the world already knows how to check itself, and almost none of that checking power is available to an agent that is trying to learn.

Author: Koutian Wu; GitHub: ktwu01

I spend a lot of my own research time inside scientific codebases, the kind that simulate oceans, atmospheres, plasmas and particle flows. These programs carry decades of accumulated judgment. A single repository can encode how a research community thinks a physical system should behave, which numerical approximations are acceptable, which quantities must be conserved and how far a result is allowed to drift before it stops counting as the same science. That judgment lives in executable form, in solvers, tests, example problems and tolerances tuned by people who understood the physics. If an agent could learn inside that kind of code, it would be learning from science that can run, fail and tell you by how much it failed, which is much richer than text about science.

The hard part is that scientific code was never written to be a classroom. Toolchains differ from one project to the next, and many rules that decide whether an answer is right are never written down in one clean place. A scientific check has to ask whether a field of numbers matches a reference closely enough, whether a conserved quantity stayed conserved, and whether a difference comes from a real bug or from ordinary numerical wobble between two legitimate runs. Without that distinction, an agent gets rewarded for plausible code that quietly breaks the physics, and it gets punished for correct code that merely arranges its output in a different order. Our paper calls this gap the scientific experience bottleneck, and ScienceIDE is our attempt to close it. The full paper is at https://arxiv.org/abs/2609.19134 and I am one author in a large multi institution collaboration led by Hejia Geng, Zesen Huang and their coauthors, with Ling Yang among the corresponding authors.

The name carries the whole design in one word. An Integrated Development Environment, usually shortened to IDE and meaning the workspace where a programmer edits code, runs it, reads errors and tries again, is normally built for a human at a keyboard. ScienceIDE reimagines that workspace for an agent. The agent receives an editable workspace built from a real scientific module, it can inspect the code and the scientific inputs, run experiments, change the implementation and submit its work to a verifier that grades the science rather than the surface shape of the code. The environment remembers the runtime, the dependencies, the known hazards and the acceptance rules, so the same setting can be reused for different tasks, models and training methods.

Construction starts with production scientific software, not with toy problems written for a benchmark. An agent inspects a pinned revision of an upstream repository, builds the source and runs the official tests and examples, which reveal output formats, expensive paths, numerical variability and execution hazards that a static reading would miss. From that evidence the agent proposes a split into modules, where a module means a piece of code with one coherent scientific responsibility and enough executable coverage to test that responsibility on its own. A human domain expert then reviews the split, corrects the boundaries and decides which scientific outputs actually matter, so one repository can contribute several environments with a traceable link back to its source.

The step I find most important is how official tests become scientific checks. The team surveys the tests and shipped examples that belong to a module, traces each case back to the responsibility it covers, and either keeps it as a check, excludes it with a recorded reason, or marks it as a gap. A check pairs fixed inputs with graded outputs and a pass policy, and that policy is where scientific judgment becomes executable. In the pointwise form, every graded value is compared against a reference with a tolerance set after measuring how much the output naturally moves when inputs are perturbed slightly or when the same source is built in another legitimate way. In the invariants form, the check compares quantities such as moments, distributions, conserved values or integral norms, which is fairer when run to run variation is too large for a value by value comparison. Each check also carries a plain language warrant that names the observable, explains which scientifically relevant bias the tolerance can catch, and explains why a valid implementation can still pass. The suite is fixed before any tasks are authored, so later tasks can vary the work while the definition of good science stays stable.

Once an environment exists, a factory turns it into tasks at scale by combining reusable authoring procedures with the local knowledge of that environment, such as its active code paths and build recipe. The paper describes seven task families, covering acceleration, repair, discovery, reproduction, integration, calibration and implementation. Repair and implementation dominate in the current registry because they can be expanded in a controlled and reversible way, by injecting a defect into working code or by removing a routine that the agent must reconstruct. A candidate only becomes a real task after executable evidence shows that it is observable, solvable and trustworthy. For an injected repair, a known valid version must pass the checks, the defective starting point must fail in a way that leaves room to improve, and the reference repair must remove that failure. That discipline is the difference between a task bank you can train on and a pile of generated prompts that might be broken, ambiguous or impossible.

At the time of the paper, the registry holds 64 environments built from 27 scientific codebases, with 2812 manufactured tasks and 1076 executable checks of numerical outputs and physical invariants. Of those 2812 tasks, 2515 are repair tasks, 295 are implementation tasks and 2 are acceleration tasks so far, a split that honestly reflects where reliable automatic generation works today and where expert specified work is still needed. Every validated task exposes the same episode interface, where the harness records actions, observations, check rewards, execution status and resource use, separating scientific disagreement from incomplete delivery and from infrastructure failure. That single interface serves three purposes usually built as three separate systems. It supports evaluation with fixed tasks and budgets, it produces trajectories for Supervised Fine Tuning, usually shortened to SFT and meaning training a model to imitate verified successful behaviour, and it supplies rewards for Reinforcement Learning, usually shortened to RL and meaning training a model from scored attempts so that higher scoring behaviour becomes more likely.

For public evaluation we built ScienceIDE-Hard, a validated subset of 85 hard tasks drawn from 18 environments based on PLUTO, Athena++, MITgcm, LAPS and PHANTOM, covering astrophysical flows, plasma physics, ocean and atmospheric modelling and particle simulations, with 52 repair tasks and 33 implementation tasks in codebases of ten thousand to one hundred thousand lines. We compared fifteen model and harness systems from eight providers through interfaces such as Codex, Claude Code or Gemini CLI, each given the same container and instructions, no extra hints, and a one hour budget. Success is strict, since a task counts as solved only when delivered outputs agree with private scientific references under the acceptance criteria, not merely when the code runs. The strongest system, Fable 5.1, solved 67.1 percent of the 85 tasks, where the percentage is solved tasks divided by all 85 tasks. Opus 5 followed at 64.6 percent of the 85 tasks solved, Astra reached 63.1 percent of the 85 tasks solved, and Sol reached 55.0 percent of the 85 tasks solved, while the remaining eleven systems each solved below 40 percent of the 85 tasks. Even the leaders left roughly one third unsolved, and the paper notes that the top estimates overlap enough that they should not be read as a firmly established ranking. Budget exhaustion alone reached 37.3 percent on a task balanced measure, where the figure is budget exhausted episodes divided by all measured episodes after balancing across tasks, which tells me these are genuinely long horizon problems.

The efficiency results break a lazy assumption I hear often, because spending more did not reliably buy more science. Fable reached its success at an estimated 7.90 dollars per task, while Astra reached 63.1 percent at 3.56 dollars per task, averaging 9.4 minutes and 13.9 thousand output tokens per task against 16.8 minutes and 85.7 thousand output tokens per task for Fable. At ten minutes into the episodes, Astra had solved 49.6 percent of the tasks it would be measured on, where the percentage is tasks solved by that time divided by all tasks in the comparison, against 25.9 percent for Fable at the same point, and Fable only moved ahead at around 31 minutes. Time and cost are part of the scientific result here, not footnotes to it.

The training half of the paper asks whether experience gathered inside these environments makes models better, and the answer so far is yes in a way that reaches beyond the original tasks. We collected demonstrations with GPT-5.6-sol, kept only trajectories that passed the numerical equivalence verifier, and fine tuned Qwen3.5-4B, Qwen3.5-9B and Qwen2.5-72B-Instruct, releasing the family as PhAI-IDE-4B, PhAI-IDE-9B and PhAI-IDE-72B. The training partition held 4567 trajectory segments from 564 tasks, with no task identifier shared with validation. On held out repair tasks judged by the original numerical checks, the 4B model on PLUTO-Particles-Dust moved from a mean repair reward of 0.0000 to 0.3333 on a scale from 0 to 1, a gain of 33.33 points where points are one hundred times the reward difference, and the 9B model on LAPS moved from 0.3125 to 0.5000, a gain of 18.75 points on the same scale. Gains also appeared on public benchmarks unrelated to these simulators. The 4B model improved on HumanEvalFix JavaScript by 10.98 percentage points, where the percentage points are the fine tuned score minus the starting score with each score computed as correct items divided by all items in that benchmark, and the 9B model on BBH Word Sorting moved from 0.240 to 0.576, a gain of 33.60 percentage points on the same basis. The paper reports fifteen comparisons with gains of at least 3 percentage points, spanning code, reasoning and knowledge. I read that as positive transfer, where getting real physics code right teaches careful reading, respect for conventions and persistence through execution feedback.

The online learning study pushes the same idea further by using the verifier reward from compiling modified code and running the underlying simulation directly to train Qwen3.5-4B on LAPS and MITgcm-biogeo, a hard setting because reward arrives only at the end of an episode that can run for tens of turns and tens of thousands of tokens. The team also found and fixed a subtle failure mode that deserves attention beyond this paper. When an episode was cut off by a budget limit rather than finished, treating it as a plain failure taught the model to write shorter and shorter responses, and tokens per turn fell by more than a factor of three while reward collapsed below its starting point. The fix keeps truncated episodes in the group baseline that rewards are compared against, but masks their tokens out of the loss. With that fix, held out reward after 30 training steps rose on LAPS from 0.357 to 0.857, which is 2.4 times the starting reward where the multiplier is the final reward divided by the starting reward, and on MITgcm-biogeo from 0.286 to 0.571, which is 2.0 times the starting reward on the same basis. Truncation also fell from 39.5 percent of episodes in the early recorded steps to 6.6 percent of episodes in the late recorded steps on LAPS, where each percentage is truncated episodes divided by all episodes in those steps.

The paper is honest about its limits, and I want to keep that honesty here. The evidence covers reference verifiable software tasks, mostly repair and implementation in computational physics and geoscience, not open ended discovery with no fixed reference to grade against. A larger release toward one thousand environments remains a development target rather than a finished fact. Agreement with selected observables inside calibrated tolerances does not prove correctness outside those checks, and factories reduce expert effort rather than removing it. The SFT gains concern selected public benchmarks and the RL gains concern held out tasks inside the training environments with hints provided, so neither yet proves transfer to entirely unseen codebases.

My own stake in this work is personal as well as technical. I work on evaluating agents that modify scientific software, including land surface modelling code in my own research, and I know how easily an evaluation can drift into rewarding fluent edits that no scientist would accept. ScienceIDE takes the opposite stance by treating the expert contract already hidden inside a codebase, its tests, its tolerances and its conserved quantities, as the source of truth. If the machinery keeps growing, the loop becomes genuinely exciting, since science supplies grounded experience for learning, better agents return to do maintenance, reproduction, acceleration and eventually discovery oriented work, and their interactions create new verified experience in return. That loop, run openly across many codebases and many institutions, is the future this paper is trying to make practical, and I am glad to have played a part in it.