A Systematic Literature Review of Code Hallucinations in LLMs: Characterization, Mitigation Methods, Challenges, and Future Directions for Reliable AI
Cuiyun Gao, Guodong Fan, Chun Yong Chong, Shizhan Chen, Chao Liu, David Lo, Zibin Zheng, Qing Liao

TL;DR
This paper systematically reviews hallucination in code-focused LLMs, analyzing causes, mitigation strategies, challenges, and evaluation benchmarks to improve reliability in AI-driven software engineering tasks.
Contribution
It provides a comprehensive synthesis of hallucination phenomena in code LLMs, highlighting specific challenges and summarizing mitigation approaches and evaluation methods.
Findings
Identified key causes of code hallucination such as data noise and semantic gaps.
Reviewed mitigation strategies including knowledge-enhanced generation and constrained decoding.
Highlighted the need for specialized benchmarks for hallucination detection.
Abstract
Model hallucination is one of the most critical challenges faced by Large Language Models (LLMs), especially in high-stakes code intelligence tasks. As LLMs become increasingly integrated into software engineering tasks, understanding and mitigating hallucination in code becomes essential. In this survey, we provide a systematic review of hallucination phenomena in code-oriented LLMs from four key perspectives. First, we begin by surveying 60 papers to define hallucination in the context of code and summarize its primary causes, such as data noise, exposure bias, and insufficient semantic grounding, while also tracing recent trends in literature across natural language processing (NLP) and software engineering communities. Second, we review model hallucination surveys in a broader span and summarize representative hallucination mitigation strategies, such as knowledge-enhanced…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Adversarial Robustness in Machine Learning · Security and Verification in Computing
