NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

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 LinarXiv 2026

TL;DR

This paper introduces C3-Bench, the first benchmark designed to evaluate how well Code LLMs follow fine-grained user instructions during code completion tasks. The authors reveal a massive gap in instruction-following capabilities between open-source and proprietary models, showing that open-source models often overfit traditional benchmarks. To solve this, they develop an automated data synthesis pipeline and train Qwen2.5-Coder-C3, achieving state-of-the-art performance in controllable code completion.

What Problem Does This Paper Address?

Traditional code completion benchmarks (like HumanEval or SAFIM) evaluate models based purely on functional correctness: given a prefix and a suffix, can the model fill in the middle code correctly?

However, this doesn't match how developers actually use modern AI tools like GitHub Copilot Chat or Cursor. In the real world, developers don't just want any valid code completion; they often provide specific instructions, such as "use an iterative DFS with a stack" or "complete only the next for loop block." Standard benchmarks completely overlook this instruction-following dimension, creating a blind spot where a model might pass a unit test but completely ignore the developer's architectural or algorithmic constraints.

Figure 1: Comparison between Controllable Code Completion and traditional code completion tasks. The former extends standard code context by in- corporating fine-grained instructions to guide the completion process.

Methods

The authors formalize this challenge as Controllable Code Completion (CCC) and break it down into two main task types:

  1. Implementation-Control Completion (ICC): Controls how the code is written (e.g., structural specifications, algorithmic choices, control flow, or critical parameters).
  2. Scale-Control Completion (SCC): Controls how much code is written (e.g., a partial line, a specific number of lines, or a specific statement block).

To evaluate these tasks objectively without human intervention, the authors built an automated evaluation pipeline:

  • Semantic Validation (for ICC): Uses an LLM-as-a-judge framework (powered by Claude 3.5 Sonnet) to verify if the generated code strictly adheres to the implementation instructions.
  • Structural Verification (for SCC): Uses Abstract Syntax Tree (AST) node matching and length-based verification to ensure the model didn't over-generate code.

Furthermore, to fix the lack of instruction-following data for code completion, the authors designed a two-phase bootstrapping pipeline. They used Claude 3.5 Sonnet to generate 1,000 high-quality seed pairs, which then guided Qwen2.5-Coder-32B-Instruct to synthesize 200,000 instruction-completion pairs from raw GitHub repositories.

Figure 2: Overview of the construction pipeline of C3-Bench.

Datasets

  • C3-Bench (New Benchmark): Contains 2,195 high-quality Python completion tasks derived from HumanEval and SAFIM, split into 1,286 ICC instances and 909 SCC instances.
  • Synthetic Training Dataset: A newly generated corpus of 200,000 instruction-completion pairs used for supervised fine-tuning (SFT).
  • Conventional Benchmarks (for cross-evaluation): CrossCodeEval, RepoEval, CrossCodeLongEval, ExecRepoBench, and SAFIM.

Key Insights and Ideas

  • The "Benchmark Overfitting" Illusion: While lightweight open-source code models frequently match or beat proprietary models on standard similarity-based benchmarks, they perform terribly on C3-Bench. This strongly implies that open-source models are over-optimized for standard context-matching but lack true generalization when guided by instructions.
  • Scale Control is Surprisingly Hard: Advanced proprietary models like DeepSeek-V3, GPT-4o, and Gemini series struggle significantly with scale-control tasks (e.g., stopping exactly after a statement block). This points to a fundamental limitation in current LLM training objectives, which typically favor generating complete, self-contained code blocks rather than strictly bounded snippets.
  • Instruction Tuning Doesn't Hurt Baseline Coding: Fine-tuning base models on instruction-completion pairs drastically improves their controllability without degrading their performance on traditional, instruction-free code completion benchmarks.

Key Results

  • Qwen2.5-Coder-32B-C3 achieved state-of-the-art performance on C3-Bench, boosting its average Instruction-Following (IF) rate from 22.8% (the standard Instruct version) to 66.6%.
  • This fine-tuned open-source model outperformed top-tier closed-source models, including OpenAI's o1-2024-12-17 (61.3% IF rate) and Claude 3.5 Sonnet (55.8% IF rate).
  • On traditional benchmarks like CrossCodeEval and RepoEval, Qwen2.5-Coder-32B-C3 maintained its top-tier status, proving that controllability can be added without sacrificing raw capability.

Limitations and Future Work

  • Language and Scope Constraints: C3-Bench currently only supports in-file code completion tasks written in Python. Real-world software engineering requires multi-language support and cross-file repository-level context.
  • Base Model Bottlenecks: While instruction tuning massively improves the Instruction-Following (IF) rate, the functional correctness (Pass@1) of the model remains strictly bounded by the capabilities of the underlying base model. Better base models are still required to solve highly complex algorithmic instructions.

Summary updated

BibTeX
@misc{zhang2026evaluating,
  author = {Jiajun Zhang and Zeyu Cui and Lei Zhang and Jian Yang and Jiaxi Yang and Qiang Liu and Zilei Wang and Binyuan Hui and Liang Wang and Junyang Lin},
  title = {{Evaluating and Achieving Controllable Code Completion in Code LLM}},
  year = {2026},
  eprint = {2601.15879},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.15879},
}
Figure