mlsanityData to 14 Oct 2026

CodeTD: Topology of Attention Detects Hallucinations in Code LLMs

arXiv 2609.07779 ↗First posted 7 Sep 2026cs.SE cs.AI cs.CLcited by 0

Not on the map. Why?

Abstract (arXiv)

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.

Key facts. No citing papers in the map yet (data through 14 Oct 2026). Builds on 23 of its 31 references that are in the map. First posted on arXiv 7 Sep 2026.

Builds on

23 of 31 references.

References · 23

  1. 2017Attention Is All You Needcited by 60,361
  2. 2016XGBoost: A Scalable Tree Boosting Systemcited by 5,166
  3. 2021Program Synthesis with Large Language Modelscited by 3,637
  4. 2019What Does BERT Look At? An Analysis of BERT's Attentioncited by 1,003
  5. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
  6. 2019Are Sixteen Heads Really Better than One?cited by 816
  7. 2024BigCodeBench: Benchmarking Code Generation with Diverse Function Calls and Complex Instructionscited by 546
  8. 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 256
  9. 2024Don't Hallucinate, Abstain: Identifying LLM Knowledge Gaps via Multi-LLM Collaborationcited by 180
  10. 2017An introduction to Topological Data Analysis: fundamental and practical aspects for data scientistscited by 172
  11. 2024TruthX: Alleviating Hallucinations by Editing Large Language Models in Truthful Spacecited by 91
  12. 2019Do Attention Heads in BERT Track Syntactic Dependencies?cited by 88
11 more
  1. 2024Self-Alignment for Factuality: Mitigating Hallucinations in LLMs via Self-Evaluationcited by 80
  2. 2021Artificial Text Detection via Examining the Topology of Attention Mapscited by 49
  3. 2025Hallucination Detection in LLMs Using Spectral Features of Attention Mapscited by 43
  4. 2024CodeHalu: Investigating Code Hallucinations in LLMs via Execution-based Verificationcited by 34
  5. 2021Manifold Topology Divergence: a Framework for Comparing Data Manifoldscited by 31
  6. 2024InterrogateLLM: Zero-Resource Hallucination Detection in LLM-Generated Answerscited by 27
  7. 2022Acceptability Judgements via Examining the Topology of Attention Mapscited by 19
  8. 2025Hallucination Detection in LLMs with Topological Divergence on Attention Graphscited by 19
  9. 2024Collu-Bench: A Benchmark for Predicting Language Model Hallucinations in Codecited by 13
  10. 2022Topological Data Analysis for Speech Processingcited by 9
  11. 2024EyeTrans: Merging Human and Machine Attention for Neural Code Summarizationcited by 9

Built on by

Not cited yet.