arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2602.03400cs.SEcs.AI
收藏

实践中的精确性:基于工业期望的知识引导代码摘要

Precision in Practice: Knowledge Guided Code Summarizing Grounded in Industrial Expectations

School of Computer Science, Wuhan University, China(武汉大学计算机科学学院);Department of Computer Science and Engineering, The Hong Kong University of Science and Technology, China(香港科学与技术大学计算机科学与工程系);Department of Computer Science(计算机科学系)

Jintai Li, Songqiang Chen, Shuo Jin, Xiaoyuan Xie

AI总结:

ExpSum 通过整合元数据抽象和领域知识检索,生成符合工业期望的代码摘要,显著提升摘要质量与实用性。

摘要:

代码摘要对于帮助开发人员理解代码功能并减少维护和协作成本至关重要。尽管最近大型语言模型(LLMs)的进展显著提高了自动代码摘要能力,但在工业环境中的实际有用性仍不够深入。与 HarmonyOS 项目文档专家合作,我们进行了一项问卷研究,结果显示,超过 57.4% 的由最新方法生成的代码摘要因违反开发人员对工业文档的期望而被拒绝。除了与参考摘要的语义相似性外,开发人员还强调了其他要求,包括使用适当的领域术语、明确的功能分类以及避免冗余的实现细节。为解决这些期望,我们提出了 ExpSum,一种面向期望的代码摘要方法,它整合了函数元数据抽象、信息性元数据过滤、基于上下文的领域知识检索以及受约束的提示生成,以引导 LLM 生成结构化、符合期望的摘要。我们在 HarmonyOS 项目和广泛使用的代码摘要基准上评估了 ExpSum。实验结果表明,ExpSum 一致优于所有基线方法,在 HarmonyOS 上实现了 BLEU-4 提高 26.71%、ROUGE-L 提高 20.10% 的改进。此外,基于 LLM 的评估表明,ExpSum 生成的摘要在其他项目中更好地符合开发人员的期望,证明了其在工业代码文档中的有效性。

英文摘要:

Code summaries are essential for helping developers understand code functionality and reducing maintenance and collaboration costs. Although recent advances in large language models (LLMs) have significantly improved automatic code summarization, the practical usefulness of generated summaries in industrial settings remains insufficiently explored. In collaboration with documentation experts from the industrial HarmonyOS project, we conducted a questionnaire study showing that over 57.4% of code summaries produced by state-of-the-art approaches were rejected due to violations of developers' expectations for industrial documentation. Beyond semantic similarity to reference summaries, developers emphasize additional requirements, including the use of appropriate domain terminology, explicit function categorization, and the avoidance of redundant implementation details. To address these expectations, we propose ExpSum, an expectation-aware code summarization approach that integrates function metadata abstraction, informative metadata filtering, context-aware domain knowledge retrieval, and constraint-driven prompting to guide LLMs in generating structured, expectation-aligned summaries. We evaluate ExpSum on the HarmonyOS project and widely used code summarization benchmarks. Experimental results show that ExpSum consistently outperforms all baselines, achieving improvements of up to 26.71% in BLEU-4 and 20.10% in ROUGE-L on HarmonyOS. Furthermore, LLM-based evaluations indicate that ExpSum-generated summaries better align with developer expectations across other projects, demonstrating its effectiveness for industrial code documentation.

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

↑