发表机构
School of Computing and Communications, Lancaster University, UK; College of Engineering & Computer Science, VinUniversity(兰卡斯特大学计算与通讯学院; Vin大学工程与计算机科学学院)
机构由 AI 辅助整理,请以论文原文为准。AI 中文总结
研究旨在解决软件系统中源代码摘要缺失、不完整或过时的问题,通过结合特定任务Transformer模型和大语言模型,利用Transformer生成的摘要辅助提示工程,使LLMs创建更好的源代码摘要,提升了BLEU - 4等指标。
AI 中文摘要
神经源代码摘要(NSCS)旨在生成源代码的自然语言摘要,以增进开发者和维护者对代码的理解。在安全软件开发生命周期(SSDLC)的维护阶段,源代码摘要至关重要,它能提升维护者对代码的理解,减少软件系统中的错误和漏洞。然而,许多软件系统中的摘要往往缺失、不完整或过时。解决此问题的方法有使用小型特定任务的Transformer模型或代码感知大语言模型(LLMs)。特定任务的Transformer生成的摘要在许多自然语言生成(NLG)指标上得分不错,但这些指标奖励词汇重叠而非摘要质量。相反,LLMs捕捉语义并生成高质量摘要的能力为此问题提供了令人兴奋的解决方案。近年来LLMs可用性增加且工作站硬件有所改进,意味着一些LLMs现在可在开发者工作站上运行。但由于其抽象性质,LLM生成的代码摘要在词汇和短语使用上与开发者编写的摘要差异很大,导致在NLG指标上得分较低。我们展示了如何通过在提示工程中使用Transformer生成的摘要来结合这两种方法,使LLMs能够创建更好的源代码摘要,并帮助软件从业者维护安全系统。我们使用四个不同的提示来提示四个LLMs,在提示中使用特定任务的Transformer来辅助LLMs。我们提出了“基于Transformer辅助的基于大语言模型的源代码摘要”方法,通过该方法我们观察到BLEU - 4提高了7.8%,提升了5%。
英文摘要
Neural Source Code Summarisation (NSCS) aims to generate natural language summaries of source code to improve developers' and maintainers' understanding of code. Source code summaries are vital during the maintenance phase of the Secure Software Development Lifecycle (SSDLC), as they improve maintainers' understanding of code and help reduce the number of bugs and vulnerabilities in a software system. However, summaries are often missing, incomplete, or outdated in many software systems. Solutions to this problem use small, task-specific Transformer models or code-aware Large Language Models (LLMs). Task-specific Transformer-generated summaries often score well across many natural language generation (NLG) metrics, but these metrics reward lexical overlap rather than summary quality. Conversely, the ability of LLMs to capture semantics and produce high-quality summaries presents an exciting solution to this problem. This is especially relevant given the increased availability of LLMs and improvements in workstation hardware in recent years, which mean that some LLMs can now be run on developers' workstations. However, because of their abstractive nature, LLM-generated code summaries often differ greatly from developer-written summaries in the words and phrases they use, resulting in low scores across NLG metrics. We show how combining these two methods, by using Transformer-generated summaries in prompt engineering, may enable LLMs to create better source code summaries and help software practitioners maintain secure systems. We prompt four LLMs using four different prompts, with a task-specific Transformer used to assist the LLMs within the prompts. We present "Transformer-Assisted LLM-Based Source Code Summarisation", a method through which we observe an improvement of 7.8% in BLEU-4 and 5%.
Comments10 pages
Journal refNLPAICS 2026