mlsanityData to 14 Oct 2026

Hallucination in LLM-Based Code Generation: An Automotive Case Study

arXiv 2508.11257 ↗First posted 15 Aug 2025cs.SE cs.AIcited by 2

Not on the map. Why?

Abstract (arXiv)

Large Language Models (LLMs) have shown significant potential in automating code generation tasks offering new opportunities across software engineering domains. However, their practical application remains limited due to hallucinations - outputs that appear plausible but are factually incorrect, unverifiable or nonsensical. This paper investigates hallucination phenomena in the context of code generation with a specific focus on the automotive domain. A case study is presented that evaluates multiple code LLMs for three different prompting complexities ranging from a minimal one-liner prompt to a prompt with Covesa Vehicle Signal Specifications (VSS) as additional context and finally to a prompt with an additional code skeleton. The evaluation reveals a high frequency of syntax violations, invalid reference errors and API knowledge conflicts in state-of-the-art models GPT-4.1, Codex and GPT-4o. Among the evaluated models, only GPT-4.1 and GPT-4o were able to produce a correct solution when given the most context-rich prompt. Simpler prompting strategies failed to yield a working result, even after multiple refinement iterations. These findings highlight the need for effective mitigation techniques to ensure the safe and reliable use of LLM generated code, especially in safety-critical domains such as automotive software systems.

Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Builds on 14 of its 22 references that are in the map. First posted on arXiv 15 Aug 2025.

Builds on

14 of 22 references.

References · 14

  1. 2023GPT-4 Technical Reportcited by 18,396
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  3. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  4. 2022Survey of Hallucination in Natural Language Generationcited by 2,075
  5. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
  6. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
  7. 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 733
  8. 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 331
  9. 2023An Empirical Study of the Non-determinism of ChatGPT in Code Generationcited by 137
  10. 2024LLM Hallucinations in Practical Code Generation: Phenomena, Mechanism, and Mitigationcited by 93
  11. 2023Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issuescited by 79
  12. 2024CodeHalu: Investigating Code Hallucinations in LLMs via Execution-based Verificationcited by 34
2 more
  1. 2024De-Hallucinator: Mitigating LLM Hallucinations in Code Generation Tasks via Iterative Groundingcited by 15
  2. 2025Hallucination by Code Generation LLMs: Taxonomy, Benchmarks, Mitigation, and Challengescited by 11

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 1; 2026: 1.

2 papers.