arXiv:2505.06267cs.SEcs.AI2025-05

用对抗生成数据提升小模型代码生成能力,更高效更可靠

AKD : Adversarial Knowledge Distillation For Large Language Models Alignment on Coding tasks

  • 用对抗生成的合成数据训练小模型,模仿大模型的编程逻辑
  • 在CodeX和HumanEval数据集上,小模型性能逼近大模型
  • 适合追求低成本高效率代码生成的开发者和团队

大型语言模型(LLMs)在代码生成中的广泛应用,如GitHub Copilot已超百万用户,显著提升了开发效率。然而,其生成代码的质量、安全性和可靠性仍存隐患。随着模型规模扩大,边际效益递减,高质量训练数据日益稀缺。本文提出对抗性知识蒸馏(AKD),利用对抗生成的合成数据,将大模型的代码推理能力迁移到更小、更高效的模型中。通过系统性压力测试与优化,AKD增强了模型的鲁棒性、可靠性与安全性,同时提升参数效率。该方法在现有数据约束下,为实现可信自动化代码生成提供了可行路径。

原文摘要 · Abstract (English)

The widespread adoption of Large Language Models (LLMs) for code generation, exemplified by GitHub Copilot\footnote{A coding extension powered by a Code-LLM to assist in code completion tasks} surpassing a million users, highlights the transformative potential of these tools in improving developer productivity. However, this rapid growth also underscores critical concerns regarding the quality, safety, and reliability of the code they generate. As Code-LLMs evolve, they face significant challenges, including the diminishing returns of model scaling and the scarcity of new, high-quality training data. To address these issues, this paper introduces Adversarial Knowledge Distillation (AKD), a novel approach that leverages adversarially generated synthetic datasets to distill the capabilities of larger models into smaller, more efficient ones. By systematically stress-testing and refining the reasoning capabilities of Code-LLMs, AKD provides a framework for enhancing model robustness, reliability, and security while improving their parameter-efficiency. We believe this work represents a critical step toward ensuring dependable automated code generation within the constraints of existing data and the cost-efficiency of model execution.

代码生成知识蒸馏对抗训练

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