Efficient Code LLM Training via Distribution-Consistent and Diversity-Aware Data Selection

Weijie Lyu, Sheng-Jun Huang, Xuan XiaarXiv 2025 · DOI

Abstract

Traditional approaches to training Large Language Models (LLMs) for code generation often prioritize massive data volume, assuming that "more is better." However, large-scale datasets frequently contain redundancy and noise that can degrade model performance and increase training costs. This paper presents a novel parametric model-based data selection method that identifies a high-quality subset of code samples. By selecting just 10,000 Python samples from a 92,000-sample pool, we demonstrate that a model can achieve superior performance on benchmarks like HumanEval and MBPP compared to training on the full dataset. Our method significantly reduces selection time to 13.5 minutes, offering a highly efficient alternative to existing discrete selection algorithms.

Introduction: The Challenge of Data Quality in Code LLMs

The development of code-generating AI has largely followed a scaling law trajectory. Yet, massive datasets are often riddled with low-quality "noise" and structural redundancies. Existing data selection methods face three primary hurdles: high computational costs (especially when using LLMs for scoring), a lack of code-specific structural awareness, and inefficiency in ensuring subset diversity. Traditional "discrete" selection methods, which pick samples individually, are often too slow for large-scale applications and fail to guarantee that the final subset accurately represents the original data's distribution.

Methodology: Parametric Model-Based Selection

To address these issues, we introduce a parametric approach inspired by ActiveFT. Rather than operating on raw text, our method functions within a high-dimensional feature space.

1. Feature Encoding

Each code sample is transformed into a vector using a pre-trained encoder (all-mpnet-base-v2). This allows the selection process to consider semantic and structural relationships rather than just keyword frequency.

2. Parametric Optimization

Instead of selecting samples directly, we initialize a set of "ideal" parameters representing the target subset. We then optimize these parameters using gradient descent based on a dual-objective loss function:

  • Distribution Consistency: This ensures the selected subset reflects the overall distribution and edge cases of the original dataset.
  • Diversity Awareness: This objective forces the parameters to spread out, minimizing redundancy within the subset.
Conceptual overview of the parametric optimization process for data selection.

3. Sample Mapping

Once the parameters are optimized, the algorithm identifies the real-world data samples closest to those "ideal" points in the feature space. This shift from continuous optimization makes the process mathematically grounded and exceptionally fast.

Experimental Setup

We utilized a training pool named Mix-Python-92K, a curated mixture of three major open-source datasets: Evol-Instruct-Python-26K, CodeExercise-Python-27K, and OSS-Instruct-75K. Models were evaluated on HumanEval/HumanEval+ and MBPP/MBPP+, the standard benchmarks for Python code generation.

Key Results and Insights

Our experiments using a DeepSeek-Coder-Base-6.7B model yielded several critical findings regarding data efficiency and model performance.

The "Peak Performance" Phenomenon

We observed an inverted U-curve in model performance relative to data size. Performance typically peaks at a subset size of 10K–15K samples. Beyond this point, adding more data from the original 92K pool actually leads to a decline in benchmark scores. This confirms that excessive, unvetted data introduces noise that hinders the model's ability to generalize.

Performance comparison across different data sizes on HumanEval and MBPP benchmarks.

Superiority and Efficiency

The 10K subset selected by our method achieved 69.5% on HumanEval and 77.2% on MBPP, outperforming the model trained on the full 92K dataset by over 2% on both benchmarks. Furthermore, our method is remarkably efficient; it completes the selection process in just 13.5 minutes, making it over 80 times faster than traditional methods like DQ and significantly faster than K-Center.

Conclusion and Future Work

This research demonstrates that for Code LLMs, data quality and diversity are more impactful than sheer quantity. By optimizing in a continuous feature space, we can select highly effective training subsets at a fraction of the usual computational cost.

Future work will focus on expanding this methodology to other programming languages such as Java and C++, as well as testing the "10K rule" on larger model architectures (30B+ parameters). Additionally, integrating functional correctness checks—such as executing code in a sandbox—could further refine the selection quality.

Summary updated

BibTeX
@misc{lyu2025efficient,
  author = {Weijie Lyu and Sheng-Jun Huang and Xuan Xia},
  title = {{Efficient Code LLM Training via Distribution-Consistent and Diversity-Aware Data Selection}},
  year = {2025},
  eprint = {2507.02378},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2507.02378},
}
Figure