arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2410.14748cs.SEcs.AIcs.CL
收藏

ETF:一种用于代码摘要幻觉检测的实体追踪框架

ETF: An Entity Tracing Framework for Hallucination Detection in Code Summaries

Indian Institute of Technology Bombay(印度理工学院班加罗尔分校);IBM Research India(IBM印度研究院);University of Texas at Austin(德克萨斯大学奥斯汀分校)

Kishan Maharaj, Vitobha Munigala, Srikanth G. Tamilselvam, Prince Kumar, Sayandeep Sen, Palani Kodeswaran, Abhijit Mishra, Pushpak Bhattacharyya

AI总结:

针对代码摘要中的幻觉问题,本文提出实体追踪框架ETF,结合静态分析与LLM验证,在约1万样本的CodeSumEval数据集上取得73%的F1分数,实现幻觉检测与错误定位。

摘要:

近年来,大型语言模型(LLMs)的进步显著增强了它们理解自然语言和代码的能力,推动了它们在自然语言到代码(NL2Code)和代码摘要等任务中的应用。然而,LLMs容易产生幻觉,即输出偏离预期含义。由于编程语言和自然语言之间的复杂交互,检测代码摘要中的幻觉尤为困难。我们首次引入了一个专门为代码摘要幻觉检测而设计的数据集CodeSumEval,包含约1万个样本。我们进一步提出了一种新颖的实体追踪框架(ETF),该框架a)利用静态程序分析从程序中识别代码实体,b)使用LLMs映射并验证这些实体及其在生成的代码摘要中的意图。我们的实验分析证明了该框架的有效性,F1分数达到73%。所提出的方法通过从摘要到代码追踪实体来检测幻觉,使我们能够评估摘要的准确性并定位摘要中的错误。

英文摘要:

Recent advancements in large language models (LLMs) have significantly enhanced their ability to understand both natural language and code, driving their use in tasks like natural language-to-code (NL2Code) and code summarisation. However, LLMs are prone to hallucination, outputs that stray from intended meanings. Detecting hallucinations in code summarisation is especially difficult due to the complex interplay between programming and natural languages. We introduce a first-of-its-kind dataset, CodeSumEval, with ~10K samples, curated specifically for hallucination detection in code summarisation. We further propose a novel Entity Tracing Framework (ETF) that a) utilises static program analysis to identify code entities from the program and b) uses LLMs to map and verify these entities and their intents within generated code summaries. Our experimental analysis demonstrates the framework's effectiveness, leading to a 73% F1 score. The proposed approach provides a method for detecting hallucinations by tracing entities from the summary to the code, allowing us to evaluate summary accuracy and localise the error within the summary.

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

↑