arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~

CodeTD:注意力拓扑检测代码大语言模型中的幻觉

CodeTD: Topology of Attention Detects Hallucinations in Code LLMs

Daria Voronkova, Ilya Trofimov, Anton Dmitriev, Eduard Tulchinskii, Evgeny Burnaev, Serguei Barannikov

arXiv 2609.07779首次发表:更新:

发表机构

Applied AI Institute; AXXX; IMJ CNRS(应用人工智能研究院; AXXX; 法国国家科学研究中心IMJ实验室)

机构由 AI 辅助整理,请以论文原文为准。

AI 中文总结

本文提出CodeTD,利用注意力图拓扑数据分析在代码执行前检测代码大语言模型生成的幻觉,实验表明其优于现有基线且可跨基准迁移。

AI 中文摘要

随着AI代码助手工具的广泛使用,自动评估生成代码的正确性成为一项重大挑战。代码大语言模型容易产生幻觉,可能导致生成的代码无法解决所需问题,甚至包含严重的安全漏洞。本文提出了CodeTD——首个基于代码大语言模型注意力图拓扑数据分析(TDA)的代码正确性预执行评估方法。我们的方法利用注意力图的拓扑模式量化提示与生成之间的不匹配。我们在常见基准(HumanEval、MBPP、BigCodeBench、MultiPL-E)、5种编程语言和10个参数规模高达34B的代码大语言模型上进行了实验。实验结果表明,所提出的方法优于最近的基线方法。此外,CodeTD在编码基准之间具有可迁移性。

英文摘要

As AI-code assistant tools become widespread, automatic assessment of the correctness of generated code becomes a significant challenge. Code LLMs are prone to hallucinations, which may lead to code that does not solve the required problem, or even to code with severe security vulnerabilities. In this paper, we introduce CodeTD -- the first approach to pre-execution assessment of code correctness based on topological data analysis (TDA) of Code LLMs' attention maps. Our method quantifies prompt-generation mismatch using topological patterns of attention maps. We carry out experiments with common benchmarks (HumanEval, MBPP, BigCodeBench, MultiPL-E), 5 programming languages and 10 Code LLMs of size up to 34B parameters. The experimental results show that the proposed method outperforms recent baselines. Moreover, CodeTD is transferable between coding benchmarks.

Journal refEMNLP 2026 (main track, oral presentation)

论文原文

arXiv 摘要页 · PDF 原文 · HTML 原文

↑