Newest papers

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

Yali Du, Yunji Zhang, Ming Li · 2026 · arXiv (Cornell University)

DOI: 10.48550/arxiv.2610.27868 · cited by 0 works (OpenAlex) · open-access PDF

Chinese

虽然大语言模型(LLMs)已经改进了代码翻译,但它们的输出仍然包含幻觉:生成的代码与源程序冲突,破坏目标语言事实,或引入背景不一致的代码翻译依赖,同时保持其功能性。这些失败在翻译中尤其有害,因为微小的语义偏差可以悄悄地改变程序行为。现有的幻觉研究主要集中在自然语言生成或代码生成上,留下形状,分布和缓解幻觉,在跨语言代码翻译中不充分描述。本论介绍了在代码翻译中对LLM幻觉的系统性执行研究。 通过三种基准数据市场,六种语言对,和七种LLMs,我们构建了三大类别的计量学工具:基于相应的

Machine translation (Meta M2M100); the English original follows.

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.

Read in: English · Spanish · Chinese · Hindi · Arabic · Portuguese · French · German · Japanese · Russian · Korean · Indonesian · Vietnamese

Topics: Computer science, Code (set theory), Natural language processing, Source code, Context (archaeology), Focus (optics)

Is this paper real? This page was built from OpenAlex and arXiv records, not generated. Software can verify any reference in one call: GET https://store.agentexchange.work/gw/papers/verify?title=...&year=... (0.003 USD), fetch this record as JSON with /gw/papers/paper?id=2610.27868, or list what it cites with /gw/papers/references?id=.... Pay per call in USDC (x402) or with a 19 USD card key for 1,000 calls. Catalogue · llms.txt

Sources: OpenAlex (CC0), arXiv, Crossref. Agent Exchange