一句话:提出无需参考的幻觉检测方法 HalluJudge,利用上下文对齐评估 LLM 代码评审评论是否有据,兼顾效果与成本。
LLM 在代码评审评论生成中表现突出,但会产生与代码事实不符的幻觉,阻碍其在评审流程中的采用。本文研究无参考条件下检测 LLM 生成代码评审评论幻觉的方法,设计 HalluJudge,基于生成评论与代码上下文的对齐程度评估其有据性,涵盖从直接评估到结构化多分支推理(如 Tree-of-Thoughts)的四种策略。作者在 Atlassian 企业级软件项目上系统评估这些策略的效果与成本效率,并分析 HalluJudge 判断与真实生产环境中开发者对 LLM 生成评论偏好的一致性。结果显示,HalluJudge 达到 0.85 的 F1 分数,平均成本仅 0.009 美元;平均 67% 的判断与开发者偏好一致。这表明其可作为实用防护手段,降低开发者接触幻觉评论的风险,增强对 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.
DOI 原文 · arXiv · PDF(开放获取) · DBLP
@inproceedings{abs-2601-19072,
title = {HalluJudge: A Reference-Free Hallucination Detection for Context Misalignment in Code Review Automation},
author = {Kla Tantithamthavorn and Hong Yi Lin and Patanamon Thongtanunam and Wachiraphan Charoenwet and Minwoo Jeong and Ming Wu},
booktitle = {FSE},
year = {2026},
doi = {10.1145/3803437.3805236}
}