Evaluating and Achieving Controllable Code Completion in Code LLM
Jiajun Zhang, Zeyu Cui, Lei Zhang, Jian Yang, Jiaxi Yang, Qiang Liu, Zilei Wang, Binyuan Hui, Liang Wang, Junyang Lin
TL;DR
This paper introduces $C^3$-Bench, the first instruction-guided benchmark for code completion, designed to evaluate both functional correctness and instruction adherence via ICC and SCC task types across 2,195 Python CCC instances derived from existing datasets. It provides a rigorous benchmark construction pipeline using AST-based middle-code extraction, multiple implementation generations, and automated scoring (Pass@1, IF, ES) with expert validation, revealing gaps between open-source and proprietary models in instruction-following. The authors further present a data-synthesis pipeline that leverages seed demonstrations and automated generation to train $Qwen2.5$-Coder-C$^3$, achieving state-of-the-art results on $C^3$-Bench while preserving performance on conventional benchmarks. Overall, the work highlights substantial gaps in instruction-following for code LLMs, demonstrates the value of automated instruction synthesis for fine-tuning, and provides open resources to spur further research in controllable code generation for open-source models.
Abstract
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.
