AI & ML
Hallucinations of Large Language Models in Cross-Language Code Translation: Phenomena and Mitigation
arXiv cs.SE0 views
arXiv:2610.27868v1 Announce Type: new Abstract: 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.
Source:https://arxiv.org/abs/2610.27868PreviousFrom Tokens to Files: Multi-Granularity Detection and Localization of AI-Involved CodeNextA Neuro-Symbolic Reasoning Engine for Compilation-Free Patch Presence Testing
Related posts
LifeVal
0OpenAI Blog
Claude’s new rules against game cloning won’t stop the AI copying boom
0Ars Technica

OpenAI pitches data center power plants as a way to protect nearby areas
0The Verge

Anthropic clamps down on Claude’s AI video game clones
0The Verge
Readwise takes on Amazon’s Kindle and Goodreads with its new app for book lovers
0TechCrunch
Five regression tests for channel-aware AI reply drafts
0dev.to