用上下文信息提升复杂数据传输任务的代码补全准确率
CCCI: Code Completion with Contextual Information for Complex Data Transfer Tasks Using Large Language Models
- 将数据库关系、对象模型等上下文融入大模型生成代码
- 在工业级数据上实现49.1%构建通过率和41.0%CodeBLEU分数
- 特别适合需要理解复杂数据结构的代码补全场景
与从零生成代码不同,代码补全需在现有代码库中插入新代码行或代码块。该过程需深入理解变量作用域、对象模型、API调用及数据库关系等上下文信息,以确保结果准确。当前模型往往难以有效利用这些复杂上下文,导致完成度低(接受率约30%),尤其在依赖特定数据结构与关系的数据传输任务中表现更差。本文提出CCCI方法,专为数据传输任务设计,通过将数据库表关系、对象模型和库细节等上下文信息整合进大语言模型(LLM),提升代码补全准确性。我们在289个来自819个实际生产脚本的Java片段上评估该方法,结果表明,CCCI达到49.1%的构建通过率和41.0%的CodeBLEU分数,与顶尖方法相当,且在复杂任务中表现更优。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。