揭示代码洞见:利用 GitHub 工件实现更深入的代码理解
Uncovering Code Insights: Leveraging GitHub Artifacts for Deeper Code Understanding
AI总结:
本文提出利用 GitHub 中的拉取请求、议题和提交信息等自然语言工件增强 LLM 代码理解,并通过提取、解释和验证三组件系统生成无幻觉的代码洞见,用户研究表明其解释有帮助且非平凡。
摘要:
理解源代码的用途是软件维护、新人上手和现代化改造中的一项关键任务。尽管大语言模型(LLMs)在生成代码解释方面已展现出潜力,但它们往往缺乏更广泛的软件工程上下文作为依据。我们提出一种新方法,利用来自 GitHub 的自然语言工件——例如拉取请求描述、议题描述与讨论以及提交信息——来增强基于 LLM 的代码理解。我们的系统由三个组件组成:一个负责提取并结构化相关的 GitHub 上下文,另一个利用该上下文生成关于代码用途的高层解释,第三个负责验证该解释。我们将该系统实现为一个独立工具,同时也作为 Model Context Protocol(MCP)中的一个服务器,从而能够与其他 AI 辅助开发工具集成。我们的主要用例是利用系统生成的代码洞见来增强标准的基于 LLM 的代码解释。为评估解释质量,我们开展了一项小规模用户研究,参与者包括多个开源项目的开发者以及专有项目的开发者。我们的用户研究表明,当生成洞见时,这些洞见通常是有帮助的、非平凡的,并且不存在幻觉。
英文摘要:
Understanding the purpose of source code is a critical task in software maintenance, onboarding, and modernization. While large language models (LLMs) have shown promise in generating code explanations, they often lack grounding in the broader software engineering context. We propose a novel approach that leverages natural language artifacts from GitHub -- such as pull request descriptions, issue descriptions and discussions, and commit messages -- to enhance LLM-based code understanding. Our system consists of three components: one that extracts and structures relevant GitHub context, another that uses this context to generate high-level explanations of the code's purpose, and a third that validates the explanation. We implemented this as a standalone tool, as well as a server within the Model Context Protocol (MCP), enabling integration with other AI-assisted development tools. Our main use case is that of enhancing a standard LLM-based code explanation with code insights that our system generates. To evaluate explanations' quality, we conducted a small scale user study, with developers of several open projects, as well as developers of proprietary projects. Our user study indicates that when insights are generated they often are helpful and non trivial, and are free from hallucinations.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。