TL;DR
The authors introduce a scalable pipeline that synthesizes nearly 800,000 high-quality instruction–reasoning–code–test quadruplets for training coding LLMs. By combining web mining, evolutionary task mutation, and strict containerized execution filtering, fine-tuning small models (like Phi-2 2.7B) on this data achieves large coding gains—matching or outperforming open-weights models with tens of billions of parameters without hurting general reasoning.
What Problem Does This Paper Address?
While modern LLMs excel at standard coding problems, they often struggle when faced with novel challenges requiring multi-step, systematic reasoning. A primary cause is training data design: most open-source code datasets provide only problem descriptions and final code implementations (the what), completely skipping the step-by-step thinking and logic that bridges the two (the how).
Moreover, small curated datasets (like competitive programming archives) lack the scale needed to train large models, while web-scraped code contains significant noise and non-functional scripts. Existing synthetic approaches rarely couple semantic diversity with rigorous execution checks and explicit reasoning traces.
Methods
The authors propose an end-to-end framework to generate and validate reasoning-augmented coding data at scale:
- Seed Curation & Classifier-Guided Web Mining: Starting with ~2.3k competitive programming problems (LeetCode, Codeforces, AtCoder), the team trained a FastText classifier to filter the 3-billion-document DCLM-Baseline corpus, extracting ~4 million high-confidence coding documents.
- Quadruplet Structuring: Using an open model (
Qwen2.5-Coder-7B-Instruct), raw problems are rewritten into a uniform schema: task instruction, intermediate step-by-step reasoning trace, and three candidate solution–test pairs. - Execution-Based Containerized Validation: Candidate solutions and unit tests are executed in isolated Python containers (Apptainer) with strict memory and time limits. Only instances where a candidate passes all tests are kept; all failing generations are discarded.
- Evolutionary Expansion (Genetic-Instruct): To avoid data repetition, tasks undergo genetic operations:
- Crossover: Blending problem constraints and concepts from multiple parent tasks to synthesize new ones.
- Mutation: Tightening constraints, deepening reasoning difficulty, or expanding scope.
- Judge LLM: Evaluates task clarity and verifies that generated code matches the reasoning trace.
- Deduplication and Decontamination: Dense embeddings (
MiniLM-L6-v2) with FAISS index search identify pairs with $>0.90$ cosine similarity, which are then semantically vetted by a locally hostedGemma-3-27B-ITmodel. Stringent hash matching against evaluation benchmarks confirmed zero data leakage into HumanEval and MBPP.
Raw Sources (Contests + Mined DCLM)
│
▼
Qwen2.5-Coder-7B-Instruct ──► Formulates [Instruction + Reasoning + Code + Tests]
│
▼
Apptainer Sandbox Execution ──► Multi-candidate test pass/fail check
│
▼
Genetic-Instruct Evolution ──► Crossover & Mutation + LLM Judge
│
▼
Deduplication & Decontamination ──► Final Dataset (~800k quadruplets)
Datasets
- Synthesized Dataset: Nearly 800,000 instruction–reasoning–code–test quadruplets in Python (released on GitHub and Hugging Face).
- Seed & Mining Datasets: LeetCode, Codeforces, AtCoder, and DCLM-Baseline (Common Crawl subset).
- Comparison / Baseline Datasets: EpiCoder-func-380k and Self-OSS-Instruct-SC2-Exec-Filter-50k.
- Evaluation Benchmarks:
- Code generation: HumanEval and MBPP (evaluated via the EvalPlus framework with both canonical and extended test suites).
- General reasoning: MMLU, HellaSwag, and WinoGrande to check for catastrophic forgetting.
Key Insights and Ideas
- Data Quality and Reasoning Over Parameter Scale: High-density, reasoning-guided data allows smaller models to overcome severe parameter deficits. Fine-tuning a 2.7B parameter model produced results rivaling 33B–70B parameter alternatives.
- Diversity Beats Raw Volume: In controlled comparisons with identical sample counts (5k), diverse subsets (curated after evolutionary steps and semantic deduplication) outperformed homogeneous subsets by 6.7 points on HumanEval, confirming that semantic diversity directly impacts out-of-distribution problem-solving.
- Reasoning Code Does Not Degrade General Intelligence: Fine-tuning specifically on code with explicit reasoning traces maintained model accuracy across MMLU, HellaSwag, and WinoGrande, avoiding domain over-specialization and catastrophic forgetting.
Key Results
Fine-tuning was conducted on a single 80GB NVIDIA A100 GPU using QLoRA:
- Phi-2 (2.7B) on Coding Benchmarks:
- HumanEval (Base / Extra tests): Baseline scored 45.7% / 40.9%. Fine-tuning on 25k synthetic samples boosted this to 56.1% / 51.8% (nearly a +10 absolute point jump). LeetCode fine-tuning only reached 47.6% / 42.1%.
- MBPP (Base / Extra tests): Baseline scored 62.7% / 51.6%, reaching 65.6% / 55.3% on 25k samples.
- Beating Larger Base Models: Phi-2 fine-tuned on 25k synthetic samples (56.1% HumanEval) surpassed CodeLlama-70B (55.5%), CodeQwen1.5-7B (51.8%), and DeepSeek-Coder-33B-base (51.2%).
- Cross-Model Generalization: Applied to CodeGemma-2B, the same 25k synthetic data jumped HumanEval base performance from 23.2% to 37.8% (+14.6 points) and MBPP from 55.6% to 62.4%.
- Head-to-Head Dataset Comparison (5k sample budget): On HumanEval, the proposed dataset scored 56.7%, outperforming EpiCoder (50.0%) and Self-OSS-Instruct (47.6%).
Limitations and Future Work
- Language Support: The pipeline is currently restricted to Python due to runtime sandbox dependencies for execution validation.
- Future Directions: Expanding the execution-validation harness to multilingual programming environments (e.g., C++, Java, JavaScript) and assessing the impact of synthetic reasoning quadruplets when injected during large-scale pretraining rather than purely post-training adaptation.
Summary updated