Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
Hallucinations in LLM Code Comprehension
Blekinge Institute of Technology, Faculty of Computing, Department of Software Engineering.
2026 (English)Independent thesis Advanced level (degree of Master (Two Years)), 20 credits / 30 HE creditsStudent thesis
Abstract [en]

Background: Large language models (LLMs) are increasingly used to support software engineering tasks, including code comprehension. However, LLM-generated explanations may contain hallucinations that provide incorrect, unsupported, or misleading information about source code. These hallucinations can take different forms, making it important to systematically categorize them when evaluating LLM-generated code explanations.

Objectives: This thesis aims to identify, categorize, and investigate hallucinations in LLM-generated code explanations. To achieve this, the study first organizes hallucination symptoms reported in existing research and develops a taxonomy. The taxonomy is then contextualized for source-code explanations to develop criteria for identifying different hallucination types. Finally, these criteria are used to investigate the occurrence and frequency of hallucinations in LLM-generated source-code explanations.

Methods: The study employed two research methods: theoretical analysis and observational evaluation. Theoretical analysis was used to organize hallucination symptoms reported in existing research, and develop a taxonomy. Observational evaluation was then used to investigate the occurrence and frequency of hallucinations in LLM-generated code explanations.

Results: The study developed a taxonomy consisting of five hallucination categories: Missing Information, Overconfident Response, Factual Mismatch, Requirement Violation, and Logical Errors. The observational evaluation identified seven hallucinations in the generated explanations. Five were classified as Overconfident Response and two as Factual Mismatch. No hallucinations were classified as Missing Information, Requirement Violation, or Logical Errors in the evaluated explanations.

Conclusions: The findings show that hallucinations in LLM-generated source-code explanations can take different forms. Distinguishing these forms is useful for identifying specific problems in an explanation rather than treating all hallucinations as the same type of error. The developed taxonomy provides a structured framework for describing these hallucination behaviours and can support future studies of hallucinations in LLM-generated code explanations.

Place, publisher, year, edition, pages
2026. , p. 43
Keywords [en]
Hallucinations, Large Language Models, Code Explanation, Code Comprehension, Taxonomy
National Category
Software Engineering
Identifiers
URN: urn:nbn:se:bth-30653OAI: oai:DiVA.org:bth-30653DiVA, id: diva2:2113912
Subject / course
PA2534 Master's Thesis (120 credits) in Software Engineering
Educational program
PAASW Master's Programme in Software Engineering 120,0 hp
Presentation
2026-09-21, J1650, Blekinge Institute of Technology, 371 79 Karlskrona, Karlskrona, 13:00
Supervisors
Examiners
Available from: 2026-11-02 Created: 2026-10-29 Last updated: 2026-11-02Bibliographically approved

Open Access in DiVA

fulltext(336 kB)0 downloads
File information
File name FULLTEXT01.pdfFile size 336 kBChecksum SHA-512
b16ac0fc6a6c9ae19e1328e5224e2a0f36efe2ab398427423b761cfe66c637cf07889dc7ffcdf8302df58bbe115777f33563738a5b4090b3d782f2525fd1605d
Type fulltextMimetype application/pdf

By organisation
Department of Software Engineering
Software Engineering

Search outside of DiVA

GoogleGoogle Scholar
The number of downloads is the sum of all downloads of full texts. It may include eg previous versions that are now no longer available

urn-nbn

Altmetric score

urn-nbn
Total: 19 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf