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

使用本地LLM的面向业务应用的分层仓库级代码摘要

Hierarchical Repository-Level Code Summarization for Business Applications Using Local LLMs

TCS Research, Tata Consultancy Services Ltd.(塔塔咨询服务有限公司TCS研究院)

Nilesh Dhulshette, Sapan Shah, Vinay Kulkarni

AI总结:

针对现有代码摘要方法难以处理大代码单元、忽略业务上下文的问题,提出结合语法分析与本地LLM的两步分层仓库级代码摘要方法,经电信BSS验证可提升摘要覆盖度与相关性。

摘要:

在大规模软件开发中,理解复杂代码库背后的功能与设计意图对高效开发和维护至关重要。尽管代码摘要已被广泛研究,但现有方法主要聚焦于函数等较小的代码单元,难以处理文件、包等更大的代码构件。此外,当前的摘要模型往往侧重底层实现细节,常忽略对实际应用至关重要的领域与业务上下文。本文提出一种面向业务应用的两步式分层仓库级代码摘要方法。首先,通过语法分析识别函数、变量等较小代码单元,使用本地LLM生成摘要;随后聚合这些摘要,生成更高层级的文件和包摘要。为确保摘要贴合业务上下文,我们设计了自定义提示词,可基于业务应用的领域与问题上下文捕捉代码构件的预期用途。我们在电信领域的业务支撑系统(BSS)上评估了该方法,结果表明,基于语法分析的分层摘要提升了覆盖度,而业务上下文锚定则增强了生成摘要的相关性。

英文摘要:

In large-scale software development, understanding the functionality and intent behind complex codebases is critical for effective development and maintenance. While code summarization has been widely studied, existing methods primarily focus on smaller code units, such as functions, and struggle with larger code artifacts like files and packages. Additionally, current summarization models tend to emphasize low-level implementation details, often overlooking the domain and business context that are crucial for real-world applications. This paper proposes a two-step hierarchical approach for repository-level code summarization, tailored to business applications. First, smaller code units such as functions and variables are identified using syntax analysis and summarized with local LLMs. These summaries are then aggregated to generate higher-level file and package summaries. To ensure the summaries are grounded in business context, we design custom prompts that capture the intended purpose of code artifacts based on the domain and problem context of the business application. We evaluate our approach on a business support system (BSS) for the telecommunications domain, showing that syntax analysis-based hierarchical summarization improves coverage, while business-context grounding enhances the relevance of the generated summaries.

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

↑