Abstract
Open-source code Large Language Models (LLMs) typically rely on instruction-tuning datasets generated by proprietary models like GPT-4. This dependency creates a performance ceiling and incurs significant API costs. We introduce InverseCoder, a suite of models trained using Inverse-Instruct, a novel self-improvement pipeline. By exploiting the fundamental asymmetry where models are more proficient at summarizing code into instructions than generating code from scratch, InverseCoder generates its own high-quality training data. Our results demonstrate that InverseCoder achieves state-of-the-art performance among open-source models, often surpassing the teacher models from which they were originally distilled.
Introduction
The current gold standard for training open-source code LLMs is instruction tuning via datasets like Evol-Instruct. While effective, this approach tethers open-source progress to the capabilities of closed-source giants. InverseCoder addresses this by enabling self-improvement. The core insight is the "Asymmetry Principle": code LLMs are significantly better at code-to-natural language (NL) summarization than NL-to-code generation. By leveraging this, a model can generate accurate instructions for existing code snippets, effectively creating a high-quality synthetic dataset for its own refinement.
Methodology: The Inverse-Instruct Pipeline
The Inverse-Instruct pipeline consists of three main stages designed to transform raw code into a robust instruction-tuning dataset.
- Code Preprocessing: The process begins with an existing instruction-tuning dataset (e.g.,
evol-codealpaca-v1). The natural language instructions are removed, leaving only the "clean" code snippets. - Code Summarization (The "Inverse" Step): Instead of generating code from a prompt, the model generates multiple possible instructions for a given code snippet. This "one-to-many" mapping allows the model to explore various user intents that a single piece of code might satisfy.
- Self-Evaluation & Data Selection: To filter out low-quality or hallucinated instructions, the model evaluates its own generated pairs. Rather than using unreliable numerical scores, the authors employ a pseudo-probability score based on the model's internal logits (the probability of answering "YES" vs. "NO" when asked if the code satisfies the instruction).
The Asymmetry Principle
A critical finding of this research is that instruction-tuned models are more reliable engines for data augmentation when performing summarization tasks compared to generation tasks.
As illustrated in the table above, leveraging the Code-to-NL path (summarization) provides a more stable and high-performing foundation for generating instruction-response pairs than direct natural language to code generation.
Key Results
InverseCoder consistently outperformed its base models and other state-of-the-art (SOTA) open-source competitors across several benchmarks:
- Python Benchmarks: InverseCoder-DS-6.7B (built on DeepSeek-Coder) achieved 79.9% on HumanEval+ and 78.6% on MBPP+, surpassing Magicoder and WizardCoder-GPT4.
- Multilingual Performance: On the MultiPL-E benchmark, the 7B model showed consistent improvements across six different programming languages, indicating that the self-improvement generalizes beyond Python.
- Data Science: On the DS-1000 benchmark, InverseCoder-DS-6.7B reached a score of 44.2%, the highest in its parameter class.
Discussion and Limitations
While Inverse-Instruct represents a major step forward, the authors noted diminishing returns after multiple rounds of optimization, suggesting a saturation point for this specific summarization logic. Furthermore, the method still requires a high-quality initial pool of code snippets to begin the "inverse" process. Future research may focus on generating both code and instructions entirely from scratch to achieve full autonomy in model improvement.
Summary updated