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

HalluJudge: 代码审查自动化中上下文错位的无参考幻觉检测

HalluJudge: A Reference-Free Hallucination Detection for Context Misalignment in Code Review Automation

Monash University Australia(墨尔本大学澳大利亚);The University of Melbourne Australia(墨尔本大学澳大利亚);Atlassian USA(Atlassian美国)

Kla Tantithamthavorn, Hong Yi Lin, Patanamon Thongtanunam, Wachiraphan Charoenwet, Minwoo Jeong, Ming Wu

AI总结:

提出无参考幻觉检测方法HalluJudge,通过上下文对齐评估生成评论的根基性,采用多分支推理策略,在F1=0.85且成本$0.009下与开发者偏好67%一致。

摘要:

大型语言模型(LLM)在代码审查自动化(如审查评论生成)中表现出强大能力,但它们存在幻觉——生成的审查评论与实际代码无根基——这对LLM在代码审查工作流程中的应用构成重大挑战。为解决此问题,我们探索了无需参考的、有效且可扩展的方法来检测LLM生成的代码审查评论中的幻觉。在这项工作中,我们设计了HalluJudge,旨在基于上下文对齐评估生成评论的根基性。HalluJudge包括四种关键策略,从直接评估到结构化多分支推理(例如,思维树)。我们在Atlassian的企业级软件项目中对这些评估策略进行了全面评估,以检验HalluJudge的有效性和成本效率。此外,我们分析了HalluJudge的判断与实际生产环境中LLM生成的代码审查评论的开发人员偏好之间的一致性。我们的结果表明,HalluJudge中的幻觉评估具有成本效益,F1得分为0.85,平均成本为0.009美元。平均而言,67%的HalluJudge评估与在线生产中实际LLM生成的审查评论的开发人员偏好一致。我们的结果表明,HalluJudge可以作为实用的保障措施,减少开发人员接触幻觉评论,从而促进对AI辅助代码审查的信任。

英文摘要:

Large Language models (LLMs) have shown strong capabilities in code review automation, such as review comment generation, yet they suffer from hallucinations -- where the generated review comments are ungrounded in the actual code -- poses a significant challenge to the adoption of LLMs in code review workflows. To address this, we explore effective and scalable methods for a hallucination detection in LLM-generated code review comments without the reference. In this work, we design HalluJudge that aims to assess the grounding of generated review comments based on the context alignment. HalluJudge includes four key strategies ranging from direct assessment to structured multi-branch reasoning (e.g., Tree-of-Thoughts). We conduct a comprehensive evaluation of these assessment strategies across Atlassian's enterprise-scale software projects to examine the effectiveness and cost-efficiency of HalluJudge. Furthermore, we analyze the alignment between HalluJudge's judgment and developer preference of the actual LLM-generated code review comments in the real-world production. Our results show that the hallucination assessment in HalluJudge is cost-effective with an F1 score of 0.85 and an average cost of $0.009. On average, 67% of the HalluJudge assessments are aligned with the developer preference of the actual LLM-generated review comments in the online production. Our results suggest that HalluJudge can serve as a practical safeguard to reduce developers' exposure to hallucinated comments, fostering trust in AI-assisted code reviews.

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

↑