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

Portuguese

Embora os Grandes Modelos de Idiomas (LLMs) tenham melhorado a tradução de código, suas saídas ainda contêm alucinações: código gerado que conflita com o programa de origem, viola os fatos da língua-alvo ou introduz dependências contextualmente inconsistentes na tradução de código. Esses fracassos são especialmente prejudiciais na tradução porque pequenas desvios semânticos podem alterar silenciosamente o comportamento do programa. Os estudos de alucinação existentes se concentram principalmente na geração de línguas naturais ou na geração de código, deixando as formas, a distribuição e a mitigação de alucinações na tradução de código cross-language insuficientemente caracterizadas. Este artigo apresenta um estudo empírico sistemático de alucinações LLM na tradução de código básico

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