arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2503.23231cs.SEcs.AI
收藏

CCCI:使用大型语言模型针对复杂数据传输任务的基于上下文信息的代码补全

CCCI: Code Completion with Contextual Information for Complex Data Transfer Tasks Using Large Language Models

PolyTechnique Montréal(蒙特利尔理工学院)

Hangzhan Jin, Mohammad Hamdaqa

AI总结:

针对数据传输任务中代码补全接受率低的问题,提出CCCI方法,通过将数据库表关系等上下文信息集成到LLMs中提升补全准确性,在289个Java片段上实现了49.1%的Build Pass率和41.0%的CodeBLEU分数。

摘要:

与从零开始创建代码的代码生成不同,代码补全侧重于将新的代码行或代码块集成到现有代码库中。这一过程需要深入理解周围上下文,例如变量作用域、对象模型、API调用和数据库关系,才能产生准确的结果。这些复杂的上下文依赖关系使得代码补全成为一个极具挑战性的问题。当前的模型和方法通常无法有效纳入此类上下文,导致补全不准确且接受率较低(约30%)。对于严重依赖特定关系和数据结构的任务(如数据传输),接受率甚至进一步下降。本研究引入了CCCI,这是一种生成上下文感知代码补全的新颖方法,专门设计用于解决数据传输任务。通过将数据库表关系、对象模型和库细节等上下文信息集成到大型语言模型(LLMs)中,CCCI提高了代码补全的准确性。我们使用289个Java代码片段评估了CCCI,这些片段提取自工业环境中的819多个操作脚本。结果表明,CCCI实现了49.1%的Build Pass率和41.0%的CodeBLEU分数,与通常难以完成复杂任务的现有最先进方法相当。

英文摘要:

Unlike code generation, which involves creating code from scratch, code completion focuses on integrating new lines or blocks of code into an existing codebase. This process requires a deep understanding of the surrounding context, such as variable scope, object models, API calls, and database relations, to produce accurate results. These complex contextual dependencies make code completion a particularly challenging problem. Current models and approaches often fail to effectively incorporate such context, leading to inaccurate completions with low acceptance rates (around 30\%). For tasks like data transfer, which rely heavily on specific relationships and data structures, acceptance rates drop even further. This study introduces CCCI, a novel method for generating context-aware code completions specifically designed to address data transfer tasks. By integrating contextual information, such as database table relationships, object models, and library details into Large Language Models (LLMs), CCCI improves the accuracy of code completions. We evaluate CCCI using 289 Java snippets, extracted from over 819 operational scripts in an industrial setting. The results demonstrate that CCCI achieved a 49.1\% Build Pass rate and a 41.0\% CodeBLEU score, comparable to state-of-the-art methods that often struggle with complex task completion.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑