Introduction
The development of high-performing Code Large Language Models (LLMs) typically follows a well-established three-stage pipeline: pretraining, Supervised Fine-Tuning (SFT), and Reinforcement Learning (RL). Despite its ubiquity, the internal dynamics and interactions between SFT and RL remain largely opaque. Researchers often treat these stages as independent modules, leaving critical questions unanswered: Does RL introduce novel capabilities or merely align existing ones? Which data types are most pivotal for generalization? Can the SFT stage be bypassed entirely?
This study by researchers from ByteDance Seed aims to "unlock" these correlations. By utilizing a controlled, synthetic environment, the team isolated training variables and eliminated data contamination, providing a clear view of how SFT and RL contribute to a model's coding proficiency.
Methodology: A Synthetic Data Pipeline
To rigorously test the interactions between training stages, the authors developed a novel three-step data synthesis pipeline designed to create complex, verifiable programming tasks from simple components.
- Atomic Function Crafting: The process begins with 100 manually written "basis" Python functions. These atomic functions cover fundamental programming topics such as basic math, sorting algorithms, and string operations.
- Synthetic Function Generation: These atomic units are then automatically chained together (e.g., the output of one function becomes the input for another). This "compositional" approach allows for the generation of complex, multi-step tasks from a small set of primitives.
- Verification: To ensure quality, a code sandbox executes the generated synthetic code against unit tests. Only valid, non-trivial programs are graduated to the training set.
The experiments utilized a 1.5B parameter GPT2-like model. The RL phase employed the Proximal Policy Optimization (PPO) algorithm, using unit test pass rates as the primary reward signal.
Datasets and Experimental Setup
The study utilized several key datasets to evaluate performance and generalization:
- Atom_base: The core set of 100 manually crafted basic functions.
- Composite_A, B, & C: Synthetic function sets generated via chaining. Notably, Composite_C was reserved as an out-of-distribution (OOD) test set to measure generalization.
- HumanEval & MBPP: Standard benchmarks used to assess the model's performance on real-world, human-authored coding problems.
Key Insights: The Synergy of SFT and RL
The "Atomic" Necessity in SFT
A primary finding is that SFT requires a substantial volume of "atomic" data to master basic logic, but only a minimal amount of "synthetic" data to learn composition. The researchers found that a mixture of 1% synthetic data combined with 600% up-sampled atomic data yielded the best results.
As shown in the figure above, the model achieves its peak zero-shot pass@1 score (approximately 54.7%) when the synthetic data is kept at a small fraction (1%). Increasing the synthetic data to 10% or decreasing it to 0.1% results in lower performance, suggesting a delicate balance is required for optimal supervised learning.
RL as a Generalization Engine
The study reveals that RL acts as a powerful engine for generalization. When RL was initialized from an SFT checkpoint and trained on the same prompts used during SFT, the performance on Composite_C jumped from 54.7% to 72.5%—an absolute improvement of 17.8%. This indicates that RL is not just selecting the best answers from the SFT distribution but is actively exploring the solution space more effectively than supervised learning alone.
Overcoming the SFT Overfitting Trap
Models trained exclusively with SFT showed a high propensity for overfitting to their specific training distribution. While they might perform well on synthetic tests, their performance on general benchmarks like HumanEval was often poor.
Interestingly, the researchers experimented with "RL from scratch" (skipping SFT). While these models had lower raw scores on the target synthetic domain, they exhibited greater stability and less overfitting on HumanEval and MBPP. Furthermore, "untuned-RL" models tended to produce shorter, cleaner code and avoided the "hallucinated" assertions frequently observed in models that underwent both SFT and RL.
Conclusion and Future Directions
This research clarifies the roles of SFT and RL in Code LLM training: SFT provides the essential atomic building blocks and basic compositional rules, while RL serves as the critical driver for generalization and error correction.
While the 1.5B parameter model provided valuable insights, the authors acknowledge that scaling to larger models (70B+) and broader programming environments is necessary to confirm these trends. Future work will focus on automating the discovery of atomic functions from large-scale code corpuses and extending the study to other programming languages.
Summary updated