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

Vietnamese

Bản dịch mã dựa chuyển đổi mã nguồn từ một ngôn ngữ lập trình sang ngôn ngữ khác trong khi duy trì chức năng của nó. Mặc dù các mô hình ngôn ngữ lớn (LLMs) đã cải thiện bản dịch mã, các sản phẩm của họ vẫn chứa ảo giác: mã được tạo ra xung đột với chương trình nguồn, phá vỡ các sự kiện ngôn ngữ mục tiêu, hoặc giới thiệu các phụ thuộc không nhất quán theo ngữ cảnh. Những thất bại này đặc biệt có hại trong bản dịch vì những sai lệch ngữ nghĩa nhỏ có thể làm thay đổi hành vi chương trình một cách thầm lặng. Các nghiên cứu ảo giác phản chiếu hiện có chủ yếu tập trung vào việc tạo ra ngôn ngữ tự nhiên hoặc tạo ra mã, để lại các hình thức, phân phối và giảm thiểu ảo giác trong bản dịch mã chéo không đủ đặc trưng. Bài báo này trình bày một nghiên cứu thực nghiệm có hệ thống về

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