Code Hallucination
Not on the map. Why?
Abstract (arXiv)
Generative models such as large language models are extensively used as code copilots and for whole program generation. However, the programs they generate often have questionable correctness, authenticity and reliability in terms of integration as they might not follow the user requirements, provide incorrect and/or nonsensical outputs, or even contain semantic/syntactic errors - overall known as LLM hallucination. In this work, we present several types of code hallucination. We have generated such hallucinated code manually using large language models. We also present a technique - HallTrigger, in order to demonstrate efficient ways of generating arbitrary code hallucination. Our method leverages 3 different dynamic attributes of LLMs to craft prompts that can successfully trigger hallucinations from models without the need to access model architecture or parameters. Results from popular blackbox models suggest that HallTrigger is indeed effective and the pervasive LLM hallucination have sheer impact on software development.
Key facts. Cited by 5 papers in the map (data through 7 Oct 2026). Builds on 17 of its 32 references that are in the map. First posted on arXiv 5 Jul 2024.
Builds on
17 of 32 references.
References · 17
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
- 2022A Systematic Evaluation of Large Language Models of Codecited by 360
- 2024INSIDE: LLMs' Internal States Retain the Power of Hallucination Detectioncited by 317
- 2023CodeGeeX: A Pre-Trained Model for Code Generation with Multilingual Benchmarking on HumanEval-Xcited by 294
- 2022Factuality Enhanced Language Models for Open-Ended Text Generationcited by 200
- 2023Planning with Large Language Models for Code Generationcited by 179
- 2023ClassEval: A Manually-Crafted Benchmark for Evaluating LLMs on Class-level Code Generationcited by 166
- 2024Beyond Functional Correctness: Exploring Hallucinations in LLM-Generated Codecited by 106
5 more
- 2023How Secure is Code Generated by ChatGPT?cited by 77
- 2023ICE-Score: Instructing Large Language Models to Evaluate Codecited by 50
- 2023SALLM: Security Assessment of Generated Codecited by 35
- 2024CodeHalu: Investigating Code Hallucinations in LLMs via Execution-based Verificationcited by 32
- 2024Unsupervised Evaluation of Code LLMs with Round-Trip Correctnesscited by 23
Built on by
Citing papers per year: 2024: 2; 2025: 2; 2026: 1.
5 papers.
- 2024CodeMMLU: A Multi-Task Benchmark for Assessing Code Understanding & Reasoning Capabilities of CodeLLMscited by 18
- 2025Robustness in Large Language Models: A Survey of Mitigation Strategies and Evaluation Metricscited by 12
- 2025SPENCER: Self-Adaptive Model Distillation for Efficient Code Retrievalcited by 5
- 2024Toward Automated Validation of Language Model Synthesized Test Cases using Semantic Entropycited by 3
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Codecited by 1
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Code6 May 2026
- 2025SPENCER: Self-Adaptive Model Distillation for Efficient Code Retrieval1 Aug 2025
- 2025Robustness in Large Language Models: A Survey of Mitigation Strategies and Evaluation Metrics24 May 2025
- 2024Toward Automated Validation of Language Model Synthesized Test Cases using Semantic Entropy13 Nov 2024
- 2024CodeMMLU: A Multi-Task Benchmark for Assessing Code Understanding & Reasoning Capabilities of CodeLLMs2 Oct 2024