paperbot · PL 论文追踪

全部论文 待读 收藏

P2 CCTEST: Testing and Repairing Code Completion Systems

CCTEST:代码补全系统的测试与修复
ICSE 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE)2023匹配度 4/10 · 论文研究 LLM 代码补全系统的黑盒测试与修复,属于 AI 系统测试方向,与用户关注的“在 ML/Agent 系统中应用静态分析”仅有间接关联;其变异测试方法并非静态分析,也未涉及浮点或贝叶斯程序分析。引用 117 inbox
Zongjie Li, Chaozheng Wang, Zhibo Liu, Haoxuan Wang, Dong Chen, Shuai Wang, Cuiyun Gao
crossref: 2026-09-12dblp: 2026-09-12arxiv: 2026-09-12

AI 速览

一句话:提出黑盒测试与修复框架 CCTEST,通过结构一致变异检测并修复 LLM 代码补全系统的错误输出。

基于大语言模型的代码补全系统(如 GitHub Copilot、GPT)已成为日常开发的重要工具,但它们经常输出可疑结果,且目前缺乏自动化的测试与增强框架。本文提出 CCTEST,在黑盒设定下对代码补全系统进行测试与修复。其核心是一组新颖的变异策略——程序结构一致性(PSC)变异,用于生成保持程序结构一致的补全输入;随后从所有补全结果中检测不一致输出,以定位可能的错误案例。在修复阶段,CCTEST 选择最能反映所有输出案例“平均”形态的结果作为系统最终输出。作者在八个主流 LLM 代码补全系统上使用约 1.8 万个测试输入,检测出 33,540 个可触发错误案例的输入(真阳性率 86%);修复后 BLEU 分数与 Levenshtein 编辑相似度分别显著提升 40% 与 67%。

问题
LLM 驱动的代码补全系统常输出可疑或错误的结果,但缺乏面向其黑盒行为的自动化测试与增强手段。
方法
提出 CCTEST,采用程序结构一致性(PSC)变异生成补全输入,检测不一致输出以识别错误案例,并通过选取最能反映所有输出“平均”形态的结果来修复补全输出。
评估
在八个主流 LLM 代码补全系统上使用约 1.8 万个测试输入进行实验,检测到 33,540 个触发错误案例的输入(真阳性率 86%),修复后 BLEU 与 Levenshtein 编辑相似度分别提升 40% 与 67%。
原文摘要(Abstract)

Code completion, a highly valuable topic in the software development domain, has been increasingly promoted for use by recent advances in large language models (LLMs). To date, visible LLM-based code completion frameworks such as GitHub Copilot and GPT are trained using deep learning over vast quantities of unstructured text and open source code. As the paramount component and the cornerstone in daily programming tasks, code completion has largely boosted professionals' efficiency in building real-world software systems. In contrast to this flourishing market, we find that code completion systems often output suspicious results, and to date, an automated testing and enhancement framework for code completion systems is not available. This research proposes CCTEST, a framework to test and repair code completion systems in black-box settings. CCTEST features a set of novel mutation strategies, namely program structure-consistent (PSC) mutations, to generate mutated code completion inputs. Then, it detects inconsistent outputs, representing possibly erroneous cases, from all the completed code cases. Moreover, CCTEST repairs the code completion outputs by selecting the output that mostly reflects the “average” appearance of all output cases, as the final output of the code completion systems. With around 18K test inputs, we detected 33,540 inputs that can trigger erroneous cases (with a true positive rate of 86%) from eight popular LLM-based code completion systems. With repairing, we show that the accuracy of code completion systems is notably increased by 40% and 67% with respect to BLEU score and Levenshtein edit similarity.

链接与引用

DOI 原文 · arXiv · PDF(开放获取) · DBLP

BibTeX
@inproceedings{LiWLWCWG23,
  title = {CCTEST: Testing and Repairing Code Completion Systems},
  author = {Zongjie Li and Chaozheng Wang and Zhibo Liu and Haoxuan Wang and Dong Chen and Shuai Wang and Cuiyun Gao},
  booktitle = {ICSE},
  year = {2023},
  doi = {10.1109/icse48619.2023.00110}
}