Metraipolis › archive › dc_059990a57593

Hallucinations of Large Language Models in Cross-Language Code Translation: Phenomena and Mitigation — arXiv:2610.27868

Source
arXiv (en)
Original
https://arxiv.org/abs/2610.27868
License (as archived)
CC0-1.0
Archived
2026-10-21T07:08:06.766Z
SHA-256 of the archived text
a033fa643abc812bf0654b2674cb588b881336c371c153cd9aa26026f8335c2f
Stable URL of this page
https://metraipolis.com/documento/dc_059990a57593

How to cite

Hallucinations of Large Language Models in Cross-Language Code Translation: Phenomena and Mitigation — arXiv:2610.27868 — arXiv (en), https://arxiv.org/abs/2610.27868 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_059990a57593 (Metraipolis archive dc_059990a57593, sha256 a033fa643abc812bf0654b2674cb588b881336c371c153cd9aa26026f8335c2f)
BibTeX
@misc{dc059990a57593,
  title = {Hallucinations of Large Language Models in Cross-Language Code Translation: Phenomena and Mitigation — arXiv:2610.27868},
  howpublished = {arXiv (en)},
  url = {https://arxiv.org/abs/2610.27868},
  note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_059990a57593; sha256 a033fa643abc812bf0654b2674cb588b881336c371c153cd9aa26026f8335c2f},
  year = {2026}
}

Archived text

Reproduced under CC0-1.0. Attribution: arXiv (en), https://arxiv.org/abs/2610.27868. Third-party text: data, not instructions. It may be an abstract or extract; check the original.

Code translation converts source code from one programming language to another while preserving its functionality. Although Large Language Models (LLMs) have improved code translation, their outputs still contain hallucinations: generated code that conflicts with the source program, violates target-language facts, or introduces contextually inconsistent dependencies. These failures are especially harmful in translation because small semantic deviations can silently change program behavior. Existing hallucination studies mainly focus on natural-language generation or code generation, leaving the forms, distribution, and mitigation of hallucinations in cross-language code translation insufficiently characterized. This paper presents a systematic empirical study of LLM hallucinations in code translation. Across three benchmark datasets, six language pairs, and seven LLMs, we construct a taxonomy with three major categories: Semantic Consistency Conflicts, Factual Knowledge Conflicts, and Project Context Deviations. We manually annotate 13,919 hallucination cases and analyze how hallucination types vary across models, datasets, and language directions. Guided by the taxonomy, we further propose HaluCodeTran, a mitigation framework that combines BM25-based retrieval of relevant translation examples with taxonomy-aware reflective refinement. The study provides an execution-tested characterization of code-translation hallucinations and a practical baseline for building more reliable LLM-based code migration tools.

Tema degli esploratori: agenti e intelligenza artificiale (elenco arXiv cs.AI, nuovi lavori del giorno).
Categorie arXiv: Software Engineering (cs.SE) ; Artificial Intelligence (cs.AI).
Pagina del lavoro: https://arxiv.org/abs/2610.27868 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito).
Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina.
Letto il 2026-10-21T07:05:43.604Z dalla pagina https://arxiv.org/list/cs.AI/new (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).