首个指令可控代码补全基准,揭示大模型指令遵循能力差距
Evaluating and Achieving Controllable Code Completion in Code LLM
- 构建2195个指令引导的代码补全任务,评估模型遵从用户指令能力
- 开源模型在新基准上表现最优,开放所有数据与代码供复现
- 适合研究代码大模型指令遵循、编程辅助工具优化的研究者
代码补全已成为软件工程中核心任务,随着基于大语言模型(LLM)的工具兴起而备受关注。尽管近期进展显著提升了模型的代码补全能力,但评估方法未同步发展。现有基准多仅关注代码功能正确性,忽视了用户指令引导下的补全能力——这在实际编程中极为常见。为此,我们提出首个指令引导的代码补全基准C3-Bench,包含2,195个精心设计的任务。对40余种主流模型在C3-Bench与传统基准上的综合评估显示,开源模型与先进专有模型在指令遵循能力上存在显著差距。此外,我们开发了一条基于Qwen2.5-Coder的数据合成流水线,生成高质量指令-补全对用于监督微调(SFT)。由此训练出的Qwen2.5-Coder-C3模型在C3-Bench上达到领先性能。研究结果为提升代码补全与指令遵循能力提供了重要启示,并为未来代码大模型研究指明方向。为促进可复现性与进一步研究,我们开源全部代码、数据集与模型。
原文摘要 · Abstract (English)
Code completion has become a central task, gaining significant attention with the rise of large language model (LLM)-based tools in software engineering. Although recent advances have greatly improved LLMs' code completion abilities, evaluation methods have not advanced equally. Most current benchmarks focus solely on functional correctness of code completions based on given context, overlooking models' ability to follow user instructions during completion-a common scenario in LLM-assisted programming. To address this limitation, we present the first instruction-guided code completion benchmark, Controllable Code Completion Benchmark (C3-Bench), comprising 2,195 carefully designed completion tasks. Through comprehensive evaluation of over 40 mainstream LLMs across C3-Bench and conventional benchmarks, we reveal substantial gaps in instruction-following capabilities between open-source and advanced proprietary models during code completion tasks. Moreover, we develop a straightforward data synthesis pipeline that leverages Qwen2.5-Coder to generate high-quality instruction-completion pairs for supervised fine-tuning (SFT). The resulting model, Qwen2.5-Coder-C3, achieves state-of-the-art performance on C3-Bench. Our findings provide valuable insights for enhancing LLMs' code completion and instruction-following capabilities, establishing new directions for future research in code LLMs. To facilitate reproducibility and foster further research in code LLMs, we open-source all code, datasets, and models.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。