arXiv:2504.12687cs.CL2025-04被引 6

通过精选高质量代码数据并优化分词,提升小样本下大模型的生成性能与训练效率。

Data-efficient LLM Fine-tuning for Code Generation

  • 按数据复杂度筛选高价值代码,保持原分布
  • 用40%数据达到66.9%性能,超全量数据
  • 训练提速32%,显存降低31%,适合资源有限场景

大型语言模型在代码生成任务中展现出巨大潜力,但开源模型与闭源模型间仍存在性能差距。现有方法常依赖大量合成数据微调,导致训练低效。本文提出一种数据选择策略,通过优先选取高复杂度数据并确保采样子集与原始数据分布一致,有效筛选高质量训练数据。同时,采用“动态打包”技术优化分词过程,减少填充标记,降低计算开销。实验表明,在仅使用40% OSS-Instruct数据的情况下,DeepSeek-Coder-Base-6.7B模型平均性能达66.9%,优于全量数据下的66.1%。单轮训练时间从47分钟降至34分钟,峰值GPU显存由61.47 GB降至42.72 GB。CodeLlama-Python-7B在Evol-Instruct数据集上也呈现相似改进。该方法通过优化数据选择与分词,兼顾性能与效率。

原文摘要 · Abstract (English)

Large language models (LLMs) have demonstrated significant potential in code generation tasks. However, there remains a performance gap between open-source and closed-source models. To address this gap, existing approaches typically generate large amounts of synthetic data for fine-tuning, which often leads to inefficient training. In this work, we propose a data selection strategy in order to improve the effectiveness and efficiency of training for code-based LLMs. By prioritizing data complexity and ensuring that the sampled subset aligns with the distribution of the original dataset, our sampling strategy effectively selects high-quality data. Additionally, we optimize the tokenization process through a "dynamic pack" technique, which minimizes padding tokens and reduces computational resource consumption. Experimental results show that when training on 40% of the OSS-Instruct dataset, the DeepSeek-Coder-Base-6.7B model achieves an average performance of 66.9%, surpassing the 66.1% performance with the full dataset. Moreover, training time is reduced from 47 minutes to 34 minutes, and the peak GPU memory decreases from 61.47 GB to 42.72 GB during a single epoch. Similar improvements are observed with the CodeLlama-Python-7B model on the Evol-Instruct dataset. By optimizing both data selection and tokenization, our approach not only improves model performance but also improves training efficiency.

代码生成高效微调数据筛选模型压缩

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。