- The paper presents the Multisage framework that constructs and verifies multi-semantic representations to guide LLM-based code translation.
- It employs static analysis, multi-task LLMs, and execution validators to systematically reduce dependency and parsing errors, achieving up to a 2.22× success rate improvement.
- Empirical evaluations on HumanEval-X demonstrate significant functional and structural gains, particularly enhancing translation robustness for small and mid-scale models.
Verified Multi-Semantic Augmentation for Improving LLM-Based Code Translation
Introduction
"Enhancing LLM-Based Code Translation with Verified Multi-Semantic Representations" (2606.11863) presents Multisage, a framework that explicitly addresses key deficiencies in LLM-based code translation pipelines. The study identifies that the majority of practical translation failures can be attributed to intervenable semantic errors—especially those involving dependency reasoning and data parsing—rather than irreducible model capacity or stochastic decoding limits. Multisage systematically constructs and verifies rich, complementary semantic representations directly from source code and leverages them to guide LLM-based code translation. This process yields robust, theoretically principled improvements across a range of state-of-the-art code LLMs and translation architectures.
Failure Modes in LLM Code Translation
The authors perform a structural analysis of translation failures in LLM-based pipelines. They categorize most errors into: (A) dependency and logical errors, (B) data parsing errors, and (C) model-specific (i.e., uncorrectable) failures.


Figure 1: Categories of LLM-based code translation failures: (a) Dependency and logical errors; (b) Data parsing errors; (c) Model-specific errors.
A statistical breakdown across various LLM scales reveals that, even as capacity increases, (A) and (B) dominate failure cases, confirming that a large proportion of errors are intervenable through improved semantic constraints.
Figure 2: Proportion of code translation failure types across LLM scales, indicating the clear predominance of dependency and parsing errors for all but the smallest models.
A controlled example further demonstrates that explicit semantic guidance (e.g., summaries, API descriptions, test cases) directly and systematically eliminates errors that vanilla prompting cannot resolve.

Figure 3: Impact of explicit semantic information on code translation: (a) without explicit semantic guidance, and (b) with explicit guidance, which corrects behavioral mismatches in the generated target code.
The Multisage Framework
The proposed Multisage framework consists of three complementary modules that form a pipeline for constructing, augmenting, and calibrating semantic representations from source code. These representations are then used as structured prompt guidance for the translation LLM.
Figure 4: Workflow of Multisage, highlighting the orchestration of semantic representation parsing, augmentation, and calibration.
Semantic Representation Parsing
Multisage initiates with semantic parsing of the source code. Using static analysis tools (AST/CFG parsers and dependency extractors), it derives machine-interpretable representations covering control flow, type constraints, and external interfaces. The outputs comprise the Rbase​ set and serve as a foundation for subsequent augmentation.
Multi-Semantic Augmentation
Rich, orthogonal semantic signals—including natural-language summaries, function-level and API-level test cases, and API-oriented documentation—are constructed and verified in a data-driven manner. The process leverages multi-task LLMs to ensure cross-objective consistency, and employs an execution validator to guarantee the executability and alignment of the generated test artifacts.
Figure 5: Workflow of the Multi-Semantic Augmentation Module, depicting the construction, validation, and refining rounds for semantic signals.
Semantic Consistency Calibration
To mitigate noise and inconsistency in automatically generated semantics, the calibration module synthesizes semantics-preserving program variants using static transformations. Cross-variant semantic overlap is quantified by token-wise Jaccard similarity and stability is enforced by majority support. Semantic units that are consistently reproduced across program variants are retained as reliable input signals for downstream translation.
Empirical Results and Ablation Studies
Extensive evaluation is performed on the HumanEval-X benchmark using a diverse set of LLM architectures and sizes. Multisage achieves highly significant improvements in functional correctness, measured as the translation execution success rate, as well as robust gains in structural metrics such as CodeBLEU.
Figure 6: Translation success rates under different Multisage settings, illustrating the dominant improvement achieved by the framework.
When compared to both classical translation models and recent LLM-based baselines, Multisage exhibits a 2.22× improvement in success rate over vanilla prompting in the most challenging settings. Gains are most pronounced for small and mid-scale models, indicating that systematic semantic guidance most strongly benefits models with weaker intrinsic reasoning capacity.
Multisage demonstrates substantial advantage over alternative semantic enhancement strategies, such as chain-of-thought prompting or CoT-augmented semantic descriptions, with up to 1.42× higher success rates for small LLMs.
Figure 7: Comparison of translation success rates under different semantic augmentation strategies, indicating the superiority of verified multi-semantic guidance over CoT and structure-based prompts.
Rigorous ablation studies show that each module—structural parsing, semantic test case augmentation, and consistency calibration—provides non-redundant improvements. Removal of any module results in marked degradation in both functional and structural metrics.
Distribution shifts in error types further demonstrate that Multisage alters the translation error landscape, markedly reducing dependency and data parsing failures across all scales.





Figure 8: Error distribution shifts under Multisage and Multisage (Repair), decomposed by error type and model family.
Implications and Outlook
The study makes a strong claim that most code translation failures in current LLM-based systems are not inherent to model capacity, but instead arise due to missing or unreliable semantic grounding during translation. Multisage provides a model-agnostic mechanism for constructing and leveraging source-level program semantics, yielding benefits even for SOTA LLMs like GPT-4 Turbo and DeepSeek-V3, as well as open models (StarCoder2, Qwen2.5-Coder) and classical neural translation systems.
Key theoretical implications include:
- Explicit, multi-faceted semantic grounding can compensate for parameter insufficiency in weak LLMs.
- Cross-variant semantic stability, as enforced by static equivalence-preserving mutation plus majority-vote, is an effective filter for robust semantic augmentation.
- The decoupling of surface-level structure (measured by CodeBLEU) from functional correctness is further emphasized by the experiments, aligning with prior results showing over-optimism of static similarity metrics in program translation.
On a practical level, Multisage can be deployed without access to external metadata or test suites, as all semantic artifacts are constructed automatically from the source. The framework is thus well-suited for legacy codebases or proprietary monolingual repositories where robust cross-language migration is needed.
Future Directions
The theoretical foundation and empirical performance of Multisage motivate several future directions:
- Integration with repository-level translation to handle global constraints, multi-file interface contracts, and library migration.
- Dynamic or interactive prompt adaptation where the system solicits human feedback on ambiguous or low-confidence semantic signals.
- Application to security-sensitive translation tasks (e.g., C to Rust), where preservation of memory and type safety contracts is critical.
- Further exploration of unsupervised or semi-supervised regime transfer, leveraging semantic alignment for domain-specific languages or low-resource settings.
Conclusion
The Multisage framework constitutes a comprehensive, empirically validated methodology for mitigating semantic errors in LLM-based code translation by constructing, augmenting, and verifying multi-view semantic representations from source code. Explicit semantic grounding and self-calibration yield robust gains in translation success rate and correctness across all model sizes and architectures, underscoring the centrality of semantic information over further parameter scaling for code translation reliability.
(2606.11863)