TL;DR
SciWalker is a novel framework that automatically synthesizes high-quality, multi-step scientific coding problems by mapping open-source library APIs into structured "operator graphs" and using LLMs with execution feedback to refine the tasks. Training a compact Qwen3.5-9B model on this synthesized data via reinforcement learning yields massive performance leaps, not only in scientific coding (+9.9% on SciCode) but also across general code repair and mathematical reasoning benchmarks.
What Problem Does This Paper Address?
While large language models (LLMs) excel at general programming, their performance plummets when tackling complex, multi-step scientific computing tasks (e.g., simulating quantum circuits or modeling fluid dynamics). Improving these capabilities requires high-quality training data.
However, creating realistic scientific coding datasets is incredibly bottlenecked: it requires human experts to manually formulate scientific contexts, stitch together multi-step algorithmic workflows, write reference solutions, and design robust test suites. Furthermore, systematically covering the vast landscape of scientific subdomains and algorithmic combinations is nearly impossible to do manually.
Methods
To scale up data generation without sacrificing scientific accuracy or executability, the authors introduce SciWalker, a framework consisting of four main stages:
- Operator Construction: The framework categorizes APIs from 79 scientific Python libraries (like SciPy, NumPy, and SymPy). It pairs each API with an "operation mode" (e.g., single execution, parameter scan, or result check) to define a distinct computational building block called an operator.
- Operator Graph Sampling: Operators within a scientific subdomain are organized into a directed graph based on input/output compatibility. The framework samples paths through this graph via random walks, creating "operator chains" that serve as realistic structural cues for a computational workflow.
- Problem Generation: Guided by these operator chains, an LLM (DeepSeek-V4-Flash) generates a multi-turn problem structure consisting of a main problem and sequential subproblems, complete with background context, input/output specifications, and test cases. Crucially, it generates two versions of the code: a reference implementation (using basic numerical functions) and an oracle implementation (using high-level library APIs).
- Validation and Repair: The framework runs differential testing between the reference and oracle implementations. If any test fails, the execution error messages are fed back into the LLM to iteratively repair the problem statement, code, or test cases.
To leverage this data for training, the authors use Group Sequence Policy Optimization (GSPO), a reinforcement learning algorithm that optimizes the target model (Qwen3.5-9B) using step-level execution rewards (1 if all tests pass, 0 otherwise).
Datasets
Using SciWalker, the authors constructed a massive new dataset containing 8,178 high-quality scientific coding problems, encompassing 37,820 computational substeps.
The dataset provides comprehensive coverage across 5 major scientific domains and 32 subdomains:
- Mathematics (e.g., optimization, matrix decomposition)
- Physics (e.g., dynamics, quantum computing)
- Chemistry (e.g., molecular dynamics)
- Biology (e.g., genomics, population genetics)
- Materials Science (e.g., crystallography)
For evaluation, the authors tested the trained model across 16 diverse benchmarks, including SciCode (expert-curated scientific coding), DS-1000 (data science), HumanEval, LiveCodeBench, MATH-500, and GSM8K.
Key Insights and Ideas
- APIs as Structural Anchors: Instead of letting LLMs hallucinate scientific workflows from scratch, using real-world library APIs as graph nodes provides a rigid, realistic backbone. This ensures the synthesized problems mirror actual scientific workflows.
- The Necessity of Execution Loops: Generating multi-step code is fragile. The authors found that only 12.2% of the initial candidate operator chains survived the entire generation, validation, repair, and quality filtering pipeline. This highlights how critical automated execution feedback is for filtering out silent failures in synthetic data.
- Cross-Domain Generalization: One of the most striking findings is that training on scientific coding trajectories significantly boosts performance on out-of-domain tasks like general code repair and pure mathematical reasoning. Rigorous multi-step scientific coding seems to inherently teach better general reasoning capabilities.
Key Results
Applying GSPO reinforcement learning with the SciWalker dataset to Qwen3.5-9B yielded substantial performance gains across the board:
- SciCode Benchmark: Subproblem accuracy jumped by 9.9 percentage points (from 29.3% to 39.2%). This allowed the 9B model to outperform much larger models like Qwen3-32B (36.0%) and match frontier models like GPT-5 mini (39.0%).
- Coding & Data Science: On DS-1000, performance surged by 17.3 percentage points (45.6% to 62.9%). LiveCodeBench Code Generation v6 saw a 13.0 point increase.
- Reasoning & Math: Despite not being trained on pure math word problems, the model improved by 6.0 percentage points on MATH-500 (86.1% to 92.1%) and 4.9 points on GSM8K.
Limitations and Future Work
While highly effective, SciWalker has a few limitations noted in the text:
- High Rejection Rate: Because the pipeline filters data aggressively to maintain high quality (retaining only 12.2% of initial candidates), the generation process can be computationally expensive and heavily reliant on powerful generator models like DeepSeek-V4-Flash.
- Library Dependency: The framework's scope is inherently bounded by the availability and documentation of open-source scientific Python libraries. Expanding to fields without mature library ecosystems remains a challenge.
Future directions include exploring synthetic generation for languages beyond Python and integrating multi-modal scientific contexts (like charts or textbook figures) into the problem generation loop.
Summary updated