Abstract
WaveCoder introduces a novel "Generator-Discriminator" framework designed to synthesize high-quality, diverse multi-task instruction data from open-source code repositories. By training on the resulting CodeSeaXDataset, the authors developed the WaveCoder series of models. These models demonstrate significant improvements in generalization across various software engineering tasks, including code repair and summarization. Notably, the WaveCoder-Ultra-6.7B model achieves state-of-the-art performance for its size, even rivaling GPT-4 on specific code-fixing benchmarks.
Introduction
While Large Language Models (LLMs) have achieved remarkable proficiency in code generation, current instruction-tuning paradigms often suffer from a narrow focus. Most existing datasets prioritize generating code from natural language descriptions, leaving models ill-equipped for broader tasks such as bug fixing (Code Repair) or code explanation (Code Summarization). Furthermore, many instruction-tuning methods rely on "teacher" models to brainstorm tasks from scratch, which often leads to repetitive and low-quality data.
WaveCoder addresses these limitations by leveraging the vast diversity of real-world open-source code. By "back-translating" existing code into instructions and utilizing a rigorous discrimination process, the framework produces a more versatile and robust training signal for Code LLMs.
Methodology
The WaveCoder pipeline consists of three primary stages: raw data collection, instruction data generation, and the training process.
1. Raw Code Coreset Selection
To ensure data diversity and efficiency, the researchers do not use all available open-source code. Instead, they employ the KCenterGreedy algorithm to select a "coreset" from a foundation dataset. This representative subset maximizes structural and functional diversity, ensuring the model encounters a wide array of programming patterns without redundant information.
2. Generator-Discriminator Framework
The core innovation of WaveCoder is its two-phase data generation strategy:
- Generation Phase: An LLM (GPT-3.5) takes raw code snippets and generates corresponding instructions, explanations, and solutions across four key tasks: Generation, Summarization, Translation, and Repair.
- Discrimination Phase: To ensure quality, a second LLM (GPT-4) acts as a critic. It evaluates the generated instances against specific logical rules, such as checking if the instruction specifies the programming language or if the solution is relevant to the input.
The CodeSeaXDataset
The result of this pipeline is the CodeSeaXDataset, a high-quality collection of 19,915 instruction instances. Despite its relatively small size compared to other datasets (some of which exceed 100,000 instances), the rigorous filtering provided by the Discriminator ensures a high signal-to-noise ratio. The authors also performed extensive decontamination to remove any data that might overlap with common benchmarks like HumanEval and MBPP, ensuring the evaluation results reflect genuine learning rather than memorization.
Experimental Results
WaveCoder models were evaluated across multiple benchmarks, demonstrating superior generalization:
- Generalization Performance: WaveCoder-Ultra-6.7B achieved a 78.6% pass@1 on HumanEval, setting a new benchmark for open-source models in its parameter class.
- Task Versatility: On the HumanEvalFix benchmark, WaveCoder-DS-6.7B scored 49.4%, outperforming GPT-4 (47.8%) in bug-fixing tasks.
- Efficiency: The WaveCoder-Pro-6.7B model showed a 22.6% absolute improvement on HumanEval over its base model, proving that high-quality, multi-task data is more effective than sheer volume.
Conclusion
WaveCoder demonstrates that multi-task instruction tuning creates a powerful synergy; for example, including code repair data significantly boosts a model's logical reasoning in standard generation tasks. By prioritizing data quality and diversity through the Generator-Discriminator framework, WaveCoder provides a scalable path toward more versatile and capable Code LLMs. Future work will focus on expanding the task variety to include areas like security vulnerability detection and reducing the reliance on high-end teacher models for discrimination.
Summary updated