Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challenges

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Lee, Yunseo, Song, John Youngeun, Kim, Dongsun, Kim, Jindae, Kim, Mijung, Nam, Jaechang
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866909608407203840
author Lee, Yunseo
Song, John Youngeun
Kim, Dongsun
Kim, Jindae
Kim, Mijung
Nam, Jaechang
author_facet Lee, Yunseo
Song, John Youngeun
Kim, Dongsun
Kim, Jindae
Kim, Mijung
Nam, Jaechang
contents Recent technical breakthroughs in large language models (LLMs) have enabled them to fluently generate source code. Software developers often leverage both general-purpose and code-specialized LLMs to revise existing code or even generate a whole function from scratch. These capabilities are also beneficial in no-code or low-code contexts, in which one can write programs without a technical background. However, due to their internal design, LLMs are prone to generating hallucinations, which are incorrect, nonsensical, and not justifiable information but difficult to identify its presence. This problem also occurs when generating source code. Once hallucinated code is produced, it is often challenging for users to identify and fix it, especially when such hallucinations can be identified under specific execution paths. As a result, the hallucinated code may remain unnoticed within the codebase. This survey investigates recent studies and techniques relevant to hallucinations generated by CodeLLMs. We categorize the types of hallucinations in the code generated by CodeLLMs, review existing benchmarks and mitigation strategies, and identify open challenges. Based on these findings, this survey outlines further research directions in the detection and removal of hallucinations produced by CodeLLMs.
format Preprint
id arxiv_https___arxiv_org_abs_2504_20799
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challenges
Lee, Yunseo
Song, John Youngeun
Kim, Dongsun
Kim, Jindae
Kim, Mijung
Nam, Jaechang
Software Engineering
Artificial Intelligence
Recent technical breakthroughs in large language models (LLMs) have enabled them to fluently generate source code. Software developers often leverage both general-purpose and code-specialized LLMs to revise existing code or even generate a whole function from scratch. These capabilities are also beneficial in no-code or low-code contexts, in which one can write programs without a technical background. However, due to their internal design, LLMs are prone to generating hallucinations, which are incorrect, nonsensical, and not justifiable information but difficult to identify its presence. This problem also occurs when generating source code. Once hallucinated code is produced, it is often challenging for users to identify and fix it, especially when such hallucinations can be identified under specific execution paths. As a result, the hallucinated code may remain unnoticed within the codebase. This survey investigates recent studies and techniques relevant to hallucinations generated by CodeLLMs. We categorize the types of hallucinations in the code generated by CodeLLMs, review existing benchmarks and mitigation strategies, and identify open challenges. Based on these findings, this survey outlines further research directions in the detection and removal of hallucinations produced by CodeLLMs.
title Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challenges
topic Software Engineering
Artificial Intelligence
url https://arxiv.org/abs/2504.20799