arXiv:2606.11863v1 [cs.SE] 10 Jun 2026
E NHANCING LLM-BASED C ODE T RANSLATION WITH V ERIFIED M ULTI -S EMANTIC R EPRESENTATIONS
Yufu Wang School of Software Dalian University of Technology Dalian 116024, China [email protected]
He Jiang School of Software Dalian University of Technology Dalian 116024, China [email protected]
Peiyu Zou School of Computer Science and Artificial Intelligence Liaoning Normal University Dalian 116029, China [email protected]
Hao Lin School of Software Dalian University of Technology Dalian 116024, China [email protected] Ang Jia School of Software Dalian University of Technology Dalian 116024, China [email protected]
Zhilei Ren School of Software Dalian University of Technology Dalian 116024, China [email protected]
Xiaochen Li School of Software Dalian University of Technology Dalian 116024, China [email protected]
June 11, 2026
A BSTRACT Large language models (LLMs) have shown great promise for automated code translation. However, existing approaches mainly rely on token-level statistical patterns for mapping, rather than generating target code based on a sufficient understanding of program semantics. As a result, translation outputs often contain intervenable logical and semantic errors. Such errors can potentially be mitigated by incorporating high-quality semantic guidance, such as functional descriptions and test cases. However, in real-world scenarios, these external semantic resources are often unavailable, making it necessary to construct semantic information directly from the source code to guide translation. This gives rise to two key challenges: first, how to construct semantic information that is sufficiently rich and diverse to characterize program behavior from multiple complementary perspectives; second, how to ensure that such semantics are accurate and reliable enough to effectively guide LLMs in code translation even in the absence of external resources. To address these challenges, we propose Multisage, a multisemantic augmentation and self-calibration framework for LLM-based code translation. Multisage comprises three core modules. First, a semantic representation parsing module extracts structured base semantic representations from source code, including data-flow graphs, type-constraint analysis, and external API information. These representations capture intrinsic program semantics and provide the foundation for subsequent augmentation. Second, a multi-semantic augmentation module builds upon these base semantic representations to construct augmented semantics, such as function-level test cases, code summaries, and API-oriented descriptions and test cases, thereby expanding semantic coverage across different aspects of program behavior. Finally, a semantic consistency calibration module introduces semantics-preserving code mutations and cross-semantic consistency verification to automatically filter, calibrate, and refine the augmented semantics, ensuring their accuracy and reliability. Extensive experiments on the HumanEval-X code translation benchmark show that Multisage improves translation success rates by up to 2.22× across diverse backbone models. It consistently outperforms vanilla prompting, instruction-tuned LLMs, and Chain-of-Thought (CoT)
A PREPRINT - J UNE 11, 2026
reasoning, with the largest relative gains observed on smaller models with limited capacity. These results demonstrate that explicit semantic augmentation effectively strengthens the reliability of LLM-based code translation. Keywords Code translation · Large language model · Semantic augmentation · Semantic calibration · Software reliability Code translation refers to the automated process of converting source code from one programming language to another while preserving functional equivalence [1], [2]. It plays a critical role in cross-language migration and software modernization, enabling developers to maintain and evolve large-scale systems more efficiently. As software ecosystems continue to expand and multiple programming paradigms coexist, code translation has become an essential component of software reengineering. In practice, many enterprise systems still rely on legacy programming languages whose limitations hinder maintainability, scalability, and security, leading to substantial migration and integration costs. In this context, machine learning–based automatic code translation has emerged as a promising research direction [3], [4], [5]. These approaches learn behavioral and functional constraints from source code and generate functionally equivalent constructs in the target language, enabling high-quality translation without extensive manual intervention [6], [7], [8]. Compared with rule-based systems or handcrafted conversion templates, learning-driven code translation substantially improves efficiency, reduces semantic deviation, and provides essential support for downstream tasks such as crosslanguage program understanding [9], automated bug repair [10], and knowledge transfer [11]. With the advent of the Transformer architecture [12], LLMs pre-trained on extensive code corpora have further advanced the field of automatic code translation. For example, CodeBERT [13] achieves strong performance across multiple downstream code-related tasks through pre-training on large-scale code data. Meanwhile, TransCoder [4] combines unsupervised learning with back-translation and is trained on massive monolingual code datasets to acquire code translation capabilities. However, despite these advances, such approaches often struggle to capture key semantic constraints when handling complex cross-language differences, leading to logical or functional inconsistencies [14], [7]. Recent studies have attempted to improve translation reliability by introducing additional semantic information to guide generation [15], [16], [17], [18]. For example, Rozière et al. [15] incorporate language-agnostic semantic abstractions to enhance model understanding of source programs, while Yang et al. [17] employ automatically generated test cases to validate model outputs. Although these approaches provide stronger constraints for translation models, they typically address only localized failure modes and remain insufficient for handling complex semantic dependencies in real-world programs. When program semantics involve intricate dependencies and significant cross-language differences, models still struggle to preserve logical consistency and functional equivalence. A closer analysis of translation outputs reveals that many failures are in fact intervenable, including logical inconsistencies, dependency misalignment, and data-parsing errors [14], [7]. These errors exhibit structured patterns rather than purely stochastic behavior, suggesting that they often stem from a common root cause: the lack of explicit and reliable semantic information during translation, as well as the absence of mechanisms to verify and calibrate such information. Consequently, models rely on token-level probabilistic associations for alignment, which can produce unstable outputs in complex scenarios [14], [19]. To mitigate this issue, prior work introduces external semantic resources such as test cases, documentation, or formal specifications to strengthen translation constraints [17], [15]. However, such resources are often unavailable in real-world software systems. Therefore, improving the reliability of LLM-based code translation requires systematically constructing and enforcing key semantic constraints directly from source code. This requirement gives rise to two key challenges: • Constructing multi-semantic information: In program analysis and code understanding, semantics refers to information that characterizes program behavior, logical relations, and functional constraints [20]. Such information directly determines the functional correctness and consistency of translation results [21, 22]. Prior studies [23, 24] show that different semantic perspectives capture complementary aspects of program behavior, including control relations along execution paths, value propagation, and constraints governing function and API usage. However, these perspectives differ in representation and focus, and any single semantic form typically captures only a limited facet of program behavior. Consequently, relying on a single semantic representation makes it difficult to cover the diverse semantic constraints required across execution contexts. A key challenge is therefore how to systematically construct multiple complementary semantic forms directly from source code to improve overall semantic coverage. • Ensuring the accuracy and reliability of semantic information: Semantic information is often constructed through static inference, approximate assumptions, or limited contextual evidence, making it susceptible to noise, incompleteness, and bias [21]. Different semantic perspectives may therefore introduce conflicting or inconsistent constraints. When such imperfect semantics are directly used to guide translation models, they may fail to correct errors and even mislead the model to produce outputs that appear plausible but deviate 2
A PREPRINT - J UNE 11, 2026
from the intended behavior [25, 26]. A key challenge is thus how to systematically verify, filter, and calibrate semantic information so that it provides reliable guidance during translation. To address these challenges, we propose Multisage, a multi-semantic augmentation and self-calibration framework for LLM-based code translation. Multisage consists of three core modules. First, a semantic representation parsing module extracts structured semantic units from source code through static analysis. Second, a multi-semantic augmentation module generates complementary semantic views, including code summaries, API usage information, and function-level test cases, to enhance semantic coverage. Third, a semantic consistency calibration module performs semanticspreserving mutations and cross-view consistency verification to filter unreliable semantic signals. Together, these modules construct, verify, and calibrate semantic information, enabling LLMs to utilize not only richer semantics but also explicitly modeled and reliable semantic guidance during translation. We conduct a systematic study on the HumanEval-X benchmark using LLMs with diverse architectures and parameter scales to evaluate the effectiveness and cross-model generalization of Multisage. Under vanilla prompting, Multisage improves translation success rates by up to 2.22×, with consistent gains across all evaluated models. We further compare Multisage with representative specialized code translation models, such as TransCoder, under identical evaluation settings. Multisage achieves substantially higher CodeBLEU scores while maintaining competitive execution success rates, indicating that explicit multi-semantic augmentation provides more comprehensive implementation-level semantic constraints than approaches relying primarily on structural modeling or model-specific design. Compared with alternative semantic enhancement strategies such as CoT reasoning and single-stage semantic prompting, Multisage consistently improves translation success rates by up to 1.42× on small-scale models, 1.28× on mid-scale models, and 1.17× on large-scale models. Overall, these results demonstrate that Multisage provides strong and stable performance gains across diverse model configurations, effectively reducing intervenable semantic errors and enhancing the reliability of LLM-based code translation. The main contributions of this work are summarized as follows: • We identify and analyze a key limitation of existing LLM-based code translation: most failures are intervenable semantic errors caused by the lack of explicitly modeled and reliable semantic constraints, rather than insufficient model capacity or randomness. Detailed error categorization and quantitative statistics are presented in Section 1.3. • We propose Multisage, a multi-semantic augmentation and self-calibration framework for LLM-based code translation. Multisage integrates three cooperative components: semantic representation parsing, multisemantic augmentation, and semantic equivalence tuning, to systematically construct diverse and complementary semantic forms solely from source code. The framework constructs and calibrates diverse semantic representations from source code to provide reliable and controllable semantic guidance for translation. • We conduct comprehensive evaluations on HumanEval-X with multiple LLMs of varying scales, showing that Multisage consistently improves translation success rates across models, achieving gains of up to 2.22×, and outperforming representative semantic enhancement strategies.
1
Background and Motivation
1.1
LLM-Based Code Translation
Automatic code translation aims to convert programs from one programming language into semantically equivalent implementations in another [3], [16]. With the rapid development of LLMs, recent LLM-based approaches have significantly advanced the state of the art in code translation [13], [4]. By leveraging large-scale pretraining on code corpora and strong generative capabilities, LLMs can produce target-language code that is syntactically fluent and stylistically consistent, often resembling human-written implementations [27], [8]. Despite their impressive performance, LLM-based code translation systems face fundamental challenges inherent in the generative nature of LLMs. Code translation is a strictly semantics-preserving task, where even subtle deviations in control flow, data dependencies, or API usage may result in incorrect program behavior. However, LLMs primarily model token-level probability distributions and lack built-in mechanisms for explicit semantic verification. As a result, they may generate translations that appear plausible on the surface but violate essential semantic constraints [26]. Most existing LLM-based code translation methods are built upon large-scale code corpora, from which they learn statistical correspondences between source and target languages. While this data-driven paradigm works well for common translation patterns, it often struggles when accurate translation requires a deeper understanding of program intent, execution behavior, or the semantics of external libraries. As a result, LLMs may generate translations that are 3
A PREPRINT - J UNE 11, 2026
(a)
(b)
(c)
Figure 1: Categories of LLM-Based Code Translation Failures. (a) Dependency and Logical Errors. (b) Data Parsing Errors. (c) Model-Specific Errors.
syntactically valid but semantically incorrect, especially for programs involving complex logic, conditional structures, or non-trivial API interactions [14]. Importantly, such errors arise not only from model capacity limitations but also from the absence of explicit mechanisms for exposing and enforcing semantic constraints during generation [7], [17]. 1.2
Semantic Information
Program semantics describes the meaning and behavior of a program, including how inputs are processed, how internal states evolve, and what outputs are produced [20], [21]. Prior studies show that program semantics can be represented through multiple complementary forms that capture different aspects of program behavior [21]. Among these forms, natural-language code summaries provide high-level descriptions of program functionality and developer intent, which have been shown to improve downstream tasks such as code search and understanding [21], [23]. In addition, test cases serve as practical carriers of semantic constraints by explicitly specifying input–output behaviors and expected program functionality [24], [22]. For LLM-based code generation and translation, such semantic information helps bridge the gap between surface-level code patterns and deeper program understanding. By providing explicit semantic signals such as summaries, API properties, and test cases, models can better align generated code with the intended functionality. This capability is particularly important for code translation, where semantic preservation is required. 1.3
Motivation
To better understand the limitations of existing LLM-based code translation approaches, we conduct a systematic empirical analysis of translation outputs across multiple models. The results indicate that a substantial proportion of failures can be attributed to intervenable semantic errors, which typically arise from missing or misinterpreted semantic constraints. Meanwhile, a smaller portion of failures is associated with model capacity limitations or stochastic decoding behaviors. These findings suggest that improving the reliability of code translation hinges on systematically introducing explicit and verifiable semantic constraints. To further analyze the structure of these failures, we categorize common failure modes into three types, as illustrated in Fig. 1 [7, 14]. The first category, dependency and logical errors, includes issues such as unresolved dependencies, incorrect API usage, or flawed control-flow reasoning. The second category, data parsing errors, involves structural or type-level inconsistencies, such as mismatched return formats or invalid type handling. These two categories correspond to intervenable translation errors, as they primarily arise from missing or misinterpreted semantic constraints and can, in principle, be mitigated through appropriate semantic guidance or auxiliary analysis [7], [14]. In contrast, the third category, model-specific errors, refers to meaningless or ill-formed outputs produced by the model itself, which cannot be effectively corrected through semantic constraints and are largely determined by the model architecture and decoding process. To quantify the prevalence of these error types, we analyze models with different parameter scales and architectures. As shown in Fig. 2, models are grouped into three categories: high-performance large models (HP-LLMs, >100B parameters), mid-scale models (MS-LLMs, 10B–100B), and lightweight models (ℓLMs, <10B). Across HP-LLMs and 4
A PREPRINT - J UNE 11, 2026
Figure 2: Proportion of Code Translation Failure Types Across LLM Scales. Percentages are rounded to the nearest integer and may not sum to exactly 100%.
most large models, the majority of translation failures fall into the intervenable category, whereas model-specific errors account for only a small fraction. Even for lightweight models, model-specific errors typically represent only 10%–23% of failures, indicating that most translation errors are potentially correctable. Fig. 3 provides a concrete example. When translating a C++ function that validates identifiers using std::regex_match, a vanilla StarCoder2-15B model generates syntactically valid Java code but performs partial pattern matching instead of enforcing a full match. By providing explicit semantic guidance such as a code summary, API semantics specifying full-match requirements, and minimal test cases, the model produces a semantically correct translation. This example illustrates that many failures arise not from code generation ability but from the absence of explicit semantic constraints. Taken together, these observations point to a key insight: improving LLM-based code translation therefore does not primarily require larger models, but rather mechanisms that expose and leverage semantic information during translation. Since many failures are intervenable, incorporating explicit semantic signals offers a practical path toward more reliable and semantics-preserving code translation. While these findings highlight the importance of semantic grounding, simply exposing semantic information is insufficient. Program semantics are inherently multi-faceted, encompassing functional intent, API constraints, type relations, and control dependencies. A single representation therefore, cannot fully capture the complex behavior of real-world programs. A key challenge is how to systematically derive complementary semantic representations from source code to provide comprehensive guidance for translation. Another challenge concerns the reliability of constructed semantics. Because semantic information is often derived through approximate inference, it may contain noise or inconsistencies. Without proper filtering and calibration, such imperfect semantics may mislead the model. Therefore, effective semantic mediation requires mechanisms to both construct diverse semantic representations and verify their reliability. In the next section, we present such a framework, which operationalizes multi-semantic construction and self-calibration to provide reliable semantic guidance for code translation. 5
A PREPRINT - J UNE 11, 2026
(a)
(b)
Figure 3: Impact of Explicit Semantic Information on Code Translation. (a) Translation without Explicit Semantic Guidance. (b) Translation with Explicit Semantic Guidance.
Figure 4: Workflow of Multisage.
2
Framework
2.1
Overview
Multisage is a multi-semantic augmentation and self-calibration framework for LLM-based code translation. As illustrated in Fig. 4, it consists of three modules: semantic representation parsing, multi-semantic augmentation, and semantic consistency calibration. Given a source-language function, the framework first reconstructs structured semantic 6
A PREPRINT - J UNE 11, 2026
representations from the code, then generates diverse semantic views, and finally calibrates these semantics before providing them together with the original code to the LLM as semantically grounded guidance for translation. The semantic representation parsing module performs static analysis on the input program to construct a languageagnostic semantic representation that captures control flow, type constraints, and API dependencies. This structured base semantic representation serves as the foundation for subsequent semantic augmentation and calibration. The multi-semantic augmentation module then derives complementary semantic views from the parsed base semantic representations, including code summaries, API semantic descriptions, and function-level test cases. These heterogeneous views capture program behavior, constraints, and usage intent from different perspectives, improving the model’s ability to preserve semantic dependencies during translation. Finally, the semantic consistency calibration module improves the reliability of the constructed semantics through semantics-preserving code mutations and cross-view consistency checking. It identifies and filters unreliable semantic signals and organizes the calibrated semantics into a structured prompt together with the original code. This process provides stable semantic guidance for the LLM and improves the functional correctness and robustness of translation. 2.2
M1: Code Representation Parsing Module
The code representation parsing module aims to structurally parse and reconstruct semantic representations from source code, focusing on three explicit and machine-interpretable semantic aspects: control flow, type constraints, and external interfaces. The module performs static analysis to generate structural templates and dependency descriptions, which provide logical foundations and structural constraints for subsequent semantic augmentation and cross-language code generation. The resulting set of structured semantics is collectively referred to as the basic semantic representation (Rbase ), which serves as the input to the subsequent multi-semantic augmentation module. Control Flow Extraction. Control flow forms the backbone of a function’s logic, capturing the execution order and branching behavior among statements. To extract this structure, we perform static analysis over the source program using an abstract syntax tree (AST) parser1 and a control flow graph (CFG) generator2 , where the AST provides structural boundaries for statements and control constructs, and the CFG captures the corresponding execution paths. The CFG captures the control-flow structure of program execution, where nodes correspond to statement blocks and edges denote execution paths, including conditional branches, loops, and exception handling. The extracted CFG is then linearized into a structured execution template using block-ordering techniques, which is included as one component of the Rbase . The linearization follows a depth-first traversal over the CFG, where conditional and loop structures are explicitly encoded as structured control tokens. For example, consider the following C++ function: int maxValue ( int a , int b ) { if ( a > b ) return a ; else return b ; }
Its control flow can be represented as: Entry → Condition ( a > b ) → { True : return a | False : return b } → Exit
Type Constraint Parsing. Since our focus is on preserving functional semantics rather than implementation details, we extract only the function interface and its input–output types. Using the AST derived from the parser, we analyze function signatures to identify formal parameters and return types. These constraints are encoded into a structured type-constraint representation and injected into the LLM prompt to regulate variable declarations and return-value inference during code generation, thereby encouraging type-consistent generation and improving semantic alignment. External Interface Extraction. External interfaces define how a function interacts with its surrounding environment, including library dependencies, API invocations, and input–output behaviors that are not fully captured by internal control or type structures. To model these aspects, we analyze function bodies using the AST to identify external symbols, such as library function calls, object method invocations, and imported modules. These elements are further normalized into a structured interface representation, where each external interaction is abstracted into a canonical form consisting of the invoked entity, its arguments, and its functional role (e.g., I/O 1 2
https://tree-sitter.github.io/tree-sitter https://github.com/joernio/joern
7
A PREPRINT - J UNE 11, 2026
operation, container manipulation, or numerical computation). This abstraction reduces language-specific variability while preserving essential semantic intent. The extracted interface information is incorporated into Rbase as a complementary semantic component, enabling the model to better align external behaviors across programming languages. By explicitly exposing these dependencies, the model is guided to generate target code that preserves critical interactions with external systems and libraries. 2.3
M2: Multi-Semantic Augmentation Module
The multi-semantic augmentation module aims to enrich the base semantic representation Rbase by introducing diverse and complementary semantic signals that are not fully captured by structural analysis alone. Given Rbase as input, this module constructs and refines multiple forms of explicit semantic information, including functional summaries, test cases, and API-level descriptions, to provide comprehensive semantic guidance for code translation. The overall workflow of this module is illustrated in Fig. 5. Specifically, the module operates in three stages: (1) multisemantic data construction, where diverse semantic views are generated and validated; (2) multi-semantic augmentation model fine-tuning, where a unified model is trained to capture cross-semantic relationships; and (3) multi-semantic augmentation model inference, where multiple semantic signals are jointly produced and iteratively refined. The resulting augmented semantics serve as a richer and more reliable semantic representation for subsequent semantic consistency calibration. Multi-Semantic Data Construction. Due to the lack of high-quality datasets that comprehensively cover multiple semantic dimensions of source code, existing large language models often struggle to learn complex code semantics sufficiently from a single supervision signal. To address this limitation, we propose an LLM-based automatic multisemantic data construction approach, whose overall workflow is illustrated as Step 1 in Fig. 5. We first adopt the composite code datasets XLCoST [26] and XCodeEval [28] as the raw seed code–text datasets, both of which provide natural-language functional requirements paired with corresponding code snippets and thus serve as structured input–output templates for multi-task modeling. We then treat the source code P as the core modeling unit and, based on the base semantic representation Rbase produced by the code representation parsing module, leverage an LLM-based semantic generation agent to construct a Multi-Semantic Dataset that covers diverse semantic perspectives, including function-level code summaries, function-level test cases, and API-level semantic descriptions with associated test cases. To ensure the reliability and task consistency of the generated semantic information, we further introduce an execution validator that performs executability checking over the generated function-level and API-level test cases. Samples that pass validation are directly added to the Multi-Semantic Dataset, whereas those that fail trigger the generation of a Corrective Signal, which drives multi-round semantic refinement and correction. Guided by this feedback signal, the LLM regenerates or locally adjusts the corresponding semantic outputs, enabling test-case–like samples to gradually converge toward semantically consistent and logically complete states across different semantic perspectives. Representative prompting templates for semantic generation and refinement are provided in Appendix A. Multi-Semantic Augmentation Model Fine-Tuning. To achieve cross-semantic sharing and dynamic optimization balancing, Multisage introduces a multi-task joint fine-tuning mechanism inspired by FAMO [29] and MFTCoder [30] during the training of the multi-semantic augmentation model. This mechanism adaptively adjusts the loss weights of different semantic tasks throughout training, thereby dynamically coordinating their convergence speeds and improving the overall stability and robustness of optimization. Unlike traditional single-task fine-tuning or naive multi-task training, Multisage treats each semantic task as an independent optimization objective, which is jointly optimized within a shared parameter space. Assume there are N semantic generation tasks, and each task Ti is associated with a training dataset Di = (j) (j) (j) (j) i {(xi , yi )}M denotes the j-th input sample drawn from the Multi-Semantic Dataset, yi reprej=1 , where xi sents the corresponding task-specific target, and Mi is the total number of samples for task Ti . The overall optimization objective of Multisage is defined as a weighted multi-task loss:
L(θ) =
N X
wi ·Li (θ)
(1)
i=1
where Li (θ) is the loss function of the i-th task with model parameters denoted as θ, and wi denotes the i-th normalized adaptive task weight, which dynamically balances the importance and convergence rate of different tasks during training. The adaptive weights wi are updated according to the relative improvement of each task during training, enabling automatic coordination of task convergence. 8
A PREPRINT - J UNE 11, 2026
Figure 5: Workflow of Multi-Semantic Augmentation Module.
Detailed formulations of the weighting strategy and optimization procedure are provided in Appendix B. Multi-Semantic Augmentation Model Inference. During inference, given a source code P , we first obtain its base semantic representation Rbase from the code representation parsing module and feed Rbase into the multi-semantic augmentation model. The model then generates multiple forms of explicit semantic outputs in parallel, including function-level code summaries, API-level semantic descriptions, API-level test cases, and function-level test cases. To ensure the practical usability of the generated semantics, the API-level and function-level test cases are automatically submitted to an execution validator, which only checks whether the test cases can be successfully compiled and executed. If a test case passes validation, the corresponding semantic output is retained; otherwise, the system triggers regeneration of the test cases for the associated function or API. During this multi-round refinement process, only test cases related to failed functions or APIs are regenerated, while previously validated outputs remain unchanged. The generate–validate loop is executed for at most three refinement rounds. If validation still fails after three rounds, further refinement is skipped, and the sample is marked as a low-confidence instance to be handled uniformly by the subsequent semantic consistency calibration module. 9
A PREPRINT - J UNE 11, 2026
2.4
M3: Semantic Consistency Calibration Module
To further improve the accuracy and reliability of the constructed semantic guidance, Multisage introduces a semantic consistency calibration module. The core idea is that semantically equivalent programs should induce highly consistent semantic representations, even if their surface forms differ. Therefore, instead of directly trusting the initial augmented semantics S0 , we evaluate its stability by comparing it against semantics reconstructed from semantics-preserving program variants. Concretely, given the source code P , the equivalence mutator generates an equivalent mutant set {P ′ }. Each mutant P ′ is then processed by the modules M1 and M2, to obtain its mutant base semantics set R′base and the corresponding mutant augmented semantics set {S ′ }. The consistency evaluator computes a consistency score C between the S0 and {S ′ }. When C exceeds a predefined threshold τ , we regard S0 as sufficiently reliable and directly use it as the final semantic guidance. Otherwise, the semantic calibration unit is activated to selectively integrate the most consistent semantic components across S0 and {S ′ }, producing the calibrated final semantics Sf inal . This mechanism enables Multisage to automatically filter noisy or contradictory semantics and provide the LLM with stable, semantically grounded guidance for code translation. Equivalence Mutator. The equivalence mutator generates a small set of semantics-preserving program variants to assess the stability of augmented semantics. The underlying principle is that semantically equivalent programs, despite syntactic differences, should induce consistent semantic representations. Therefore, instability across equivalent variants indicates potential noise or overfitting in the constructed semantics. Given a source program P , the mutator produces a set of equivalent variants {P ′ } through static rule-based transformations applied to its AST and CFG representations. These transformations are designed to preserve program behavior for all valid inputs. We instantiate the mutator along three transformation dimensions: 1) Expression-level rewrites, which apply algebraic or logically equivalent transformations to side-effect-free expressions; 2) Control-flow–preserving rewrites, which restructure conditional and loop constructs while maintaining equivalent execution paths; 3) API-level substitutions, which replace library calls with verified equivalent alternatives under identical preconditions. All transformations are purely static and deterministic, operating on AST, CFG, and symbol-table representations without learned components. Variants that fail compilation or execution checks are discarded by the downstream validator, ensuring that only behaviorally consistent mutants are retained. The complete set of transformation rules is provided in Appendix C. In practice, we generate 3–5 equivalent variants for each input program. Consistency Evaluator. The consistency evaluator measures the stability of the initial augmented semantics S0 by comparing it against the mutant augmented semantics set {S ′ } reconstructed from the equivalent mutants. Our design is grounded in a well-established conclusion in [31] that equivalent mutants behave identically to the original program for all possible inputs, and thus preserve the same observable semantics despite syntactic differences. Prior work [32] on program semantics and code representation learning further argues that semantic representations should remain invariant under semantics-preserving program transformations, rather than being tied to surface-level syntax. Motivated by these findings, we assume that semantically equivalent programs should induce highly consistent semantic representations, and large deviations mainly indicate instability or noise in the constructed semantics. Directly requiring natural-language descriptions in S0 and {S ′ } to be exactly identical is, however, unrealistic, since semantically equivalent descriptions may differ in wording or structure. To address this, we normalize each semantic output into a set of semantic units U (S), where a unit corresponds to an API-usage constraint, a functional intent statement, or a behavioral assertion in a test case. We then compare semantic units based on token-level similarity rather than exact string matching. For each semantic unit u ∈ U (S0 ), we define the set of mutants in which u can be matched as: M(u) = {S ′ ∈ {S ′ } | ∃v ∈ U (S ′ ) s.t. sim(u, v) ≥ δ}
(2)
The similarity function sim(u, v) is implemented as token-level Jaccard similarity: sim(u, v) =
|T (u) ∩ T (v)| |T (u) ∪ T (v)|
(3)
with T (u) and T (v) denoting the sets of normalized tokens extracted from u and v, respectively. Token normalization includes lowercasing, stop-word removal, and preserving identifiers, API names, and key action verbs. This lightweight 10
A PREPRINT - J UNE 11, 2026
metric has been widely used in software-engineering text analysis, and allows us to measure semantic overlap without introducing additional neural models. We introduce a similarity threshold δ to determine whether two semantic units are considered matched, i.e., they are treated as aligned only when their informative tokens sufficiently overlap. The support of semantic unit u is defined as the fraction of mutants in which u can be matched: supp(u) =
|M(u)| |{S ′ }|
(4)
We then define the stable semantic unit set as U stable = {u ∈ U (S0 ) | supp(u) ≥ ρ}
(5)
where ρ is the majority-support threshold. We adopt a majority-support threshold of ρ = 0.5 when determining whether a semantic unit is stable. This design follows the classical majority-vote principle: if more than half of the equivalent mutants reproduce the same semantic unit (under similarity threshold δ), the unit is highly likely to reflect the true program semantics rather than noise introduced during augmentation. Finally, the consistency score C ∈ [0, 1] between the S0 and {S ′ } is computed as: C=
|U stable | |U (S0 )|
(6)
which quantifies the proportion of semantic units in S0 that are consistently supported by the equivalent mutants under similarity threshold δ. In all experiments, we set the consistency threshold τ to 0.6. This value reflects the following rationale: each semantic unit must be confirmed by the majority of equivalent mutants to be considered stable, while τ = 0.6 further requires that most units in S0 are stable, yet allows moderate variation in wording and coverage. Empirically, higher thresholds over-filter useful semantics, whereas lower thresholds tend to admit noisy or unstable semantics. If C ≥ τ , we regard S0 as stable and reliable, and it is directly used as the final semantic guidance. Otherwise, the semantic calibration unit is triggered to selectively aggregate the most consistent semantic units across S0 and {S ′ }, yielding the calibrated final semantics Sf inal . This design enables Multisage to explicitly quantify semantic reliability and suppress spurious artifacts introduced during augmentation, thereby providing the translation model with semantically grounded and cross-implementation–consistent guidance. Semantic Calibration Unit. When the consistency score C is below the reliability threshold τ , the initial augmented semantics S0 may contain unstable or noisy components. In this case, Multisage activates the Semantic Calibration Unit, which aggregates only the semantic units that obtain majority support across the initial and mutant semantics, and reconstructs a calibrated final semantic set Sf inal . We first construct the candidate semantic unit pool by collecting semantic units from both the initial semantics and the mutant semantics: U all = U (S0 ) ∪
[
U (S ′ )
(7)
S ′ ∈{S ′ }
For each unit u ∈ U all , its support is computed as equation(7). A semantic unit is considered reliable if it satisfies the majority-support condition supp(u) ≥ ρ. We then define the consensus semantic unit set as: U cons = u u ∈ U all and supp(u) ≥ ρ
(8)
Finally, the calibrated semantics are obtained by reconstructing the structured semantic representation from the consensus unit set: Sfinal = Aggregate(U cons )
(9)
where Aggregate(·) denotes the reconstruction of a structured semantic representation (including summaries, API-level semantics, and test-case constraints) from the consensus unit set. In practice, the aggregation preserves the task structure 11
A PREPRINT - J UNE 11, 2026
Table 1: Statistics of the C++ samples in the seed code-text datasets. Source Dataset
# C++ Samples
XCodeEval
95,425
XLCoST
11,198
Total
106,623
of S0 (e.g., summary, API-level semantics and test constraints), while replacing or supplementing unstable components using majority-supported units from U cons . This allows Multisage to deliver stable, cross-implementation–consistent, and noise-suppressed semantic guidance to the translation model, even when the initial semantics are unreliable. The semantic consistency calibration module involves three threshold-based parameters: the unit-level similarity threshold δ, the majority-support ratio ρ, and the global consistency threshold τ . These parameters control how strictly Multisage filters unstable or contradictory semantics. In this work, we set the default values to δ = 0.7, ρ = 0.5, and τ = 0.6. These choices reflect intuitive design considerations: δ = 0.7 enforces a relatively high but not prohibitive similarity requirement at the semantic-unit level, ρ = 0.5 requires at least majority agreement across variants, and τ = 0.6 ensures that global semantic instability triggers calibration only when sufficiently strong evidence accumulates. We stress that these values are not the result of fine-tuning for peak performance. As shown later in Section 4.5, Multisage remains stable across wide parameter ranges, indicating that our framework is robust to reasonable variations in these thresholds.
3
Experimental Setup
3.1
Datasets
Seed Code–Text Datasets. We leverage two publicly available code–text datasets, XCodeEval [28] and XLCoST [26], as the seed corpora for multi-semantic data construction. Both datasets provide executable source code paired with natural-language comments or summaries, enabling alignment between program logic and textual semantics. XCodeEval is a large-scale multilingual benchmark derived from the Codeforces platform3 , containing approximately 7,514 algorithmic problems with diverse executable contexts. XLCoST is collected from GeeksForGeeks4 and provides paired code and natural-language descriptions across multiple programming languages such as C++ and Java. Table 1 summarizes the statistics of the extracted C++ samples. Since our study focuses on C++→Java translation, we extract the corresponding C++ programs and apply standard preprocessing, including comment removal and dataset deduplication. Multi-Semantic Augmented Dataset. Leveraging the proposed Multi-Semantic Data Construction pipeline, we systematically augment the original XCodeEval and XLCoST datasets. For each source instance, we generate 2–3 multi-semantic augmented samples, resulting in a large-scale dataset comprising 309,212 C++ samples and 311,890 Java samples. Test Dataset. We evaluate our approach on the cross-lingual version of the HumanEval-X [33] benchmark suite, which consists of 164 distinct programming challenges. Each task is accompanied by a validated unit test harness and a reference implementation, enabling rigorous in terms of functional correctness and semantic consistency. Although HumanEval-X originates from code generation benchmarks, its cross-lingual setting provides functionally equivalent implementations and executable test suites, enabling reliable evaluation of semantic equivalence in code translation. 3.2
Baselines
LLM baselines. To investigate the performance boost provided by Multisage across various LLM parameter scales, we selected models spanning the current mainstream parameter ranges. Specifically, we chose DeepSeek-V3 [34], GPT-4 Turbo [35], and Qwen-Plus [36] to represent HP-LLMs. Qwen2.5-Coder-Instruct-33B [37] and StarCoder2-15B [38] 3 4
https://codeforces.com/ https://www.geeksforgeeks.org/
12
A PREPRINT - J UNE 11, 2026
were selected as MS-LLM baselines. Finally, StarCoder2-7B and Qwen2.5-Coder-7B serve as our baselines for ℓLMs. This selection enables a systematic evaluation of Multisage’s generalization capability across different model scales. Specialized code translation baselines. To compare Multisage with established code translation techniques, we select four representative methods covering different translation paradigms: (1) TransCoder [4], which represents a Transformer-based neural machine translation approach; (2) DOBF [39], a deobfuscation-based structured translation method designed to preserve program semantics and structure; (3) TransCoder-ST [15], which incorporates structured information such as AST to guide the translation process; (4) TransCoder-IR [40], which employs an intermediate representation as a translation bridge to enhance semantic preservation; and (5) INTERTRANS [41], which introduces intermediate languages as transitive bridges to facilitate cross-language translation by decomposing the translation process into multi-step transformations, and is implemented on top of the StarCoder2-15B model. Semantic Augmentation Capability Baselines. To assess the effectiveness of the proposed Multi-Semantic Augmentation Module (M2) and examine the role of specialized augmentation models, we select state-of-the-art HP-LLMs as auxiliary baselines, including DeepSeek-V3, GPT-4 Turbo, and Qwen-Plus. We evaluate the ability of these generalpurpose LLMs to directly generate semantic constraints, such as code summaries and unit tests, under zero-shot or few-shot prompting. Their generated constraints are then compared with those produced by the specialized M2 model in terms of accuracy, executability, and robustness. These baselines are introduced to support a dedicated evaluation of semantic augmentation quality in subsequent experiments. 3.3
Evaluation Metrics
Code Translation Success Rate. The Code Translation Success Rate measures the correctness of translated code in terms of executability and functional equivalence. We perform rigorous functional verification using the integrated unit test suite provided by the HumanEval-X benchmark. A translation is considered successful only if the generated target code passes all corresponding test cases, indicating that its functional behavior is consistent with the reference implementation. Given that the primary objective of code translation is to ensure executability and functional correctness, we do not treat purely static similarity-based metrics as the main evaluation criterion. Prior studies have shown that relying solely on static similarity measures can be misleading, as models may achieve high scores while producing code that fails to compile or execute correctly. Accordingly, we adopt execution-based functional validation as the primary metric, and only incorporate structure- and data-flow–aware static metrics as complementary analysis tools. CodeBLEU. CodeBLEU [42] is a structure-aware evaluation metric designed for code translation tasks and is used to complement execution-based validation by characterizing semantic consistency at the implementation level. Unlike static metrics that rely solely on n-gram matching, CodeBLEU extends BLEU with AST matching and data-flow analysis, enabling it to partially capture consistency in structural organization, variable dependencies, and data propagation patterns between the source and translated code. In particular, the data-flow component can be regarded as an approximation of semantic consistency at the implementation level. It should be emphasized that CodeBLEU does not guarantee functional equivalence, but instead provides complementary insights into the structural and semantic alignment of translation results beyond execution outcomes. 3.4
Implementation Details
Multisage is primarily implemented in Python, utilizing the PyTorch deep learning framework and Hugging Face’s Transformer library for model construction and management. Multi-Semantic Data Augmentation. In the data construction phase of the Multi-Semantic Augmentation Module, we employ GPT-4 Turbo as a semantic generation agent to produce high-level semantic constraints, including unit tests and API information. This agent operates via carefully engineered prompts and an execution validation feedback loop to ensure the quality and diversity of the generated semantic constraints. Multi-Semantic Augmentation Model Training. We fine-tuned the Multi-Semantic Augmentation Model based on the configurations derived from [30] to facilitate multi-task learning. During the training process, we employed the Adam optimizer, setting the per-GPU batch size to 2, and aggregating the global batch size to 128. For the learning rate schedule, we set the initial learning rate to 2 × 10−4 and used a cosine annealing strategy with a warmup ratio of 3 × 10−2 , with the minimum learning rate set at 1 × 10−5 . For the fine-tuning strategy, we utilized the QLoRA INT4 quantization mode proposed in [30] and maintained a consistent fine-tuning parameter ratio of 2.52% with the original work. Furthermore, to ensure optimal convergence and generalization performance for each model, we implemented an Early Stopping strategy to determine the model’s termination point. 13
A PREPRINT - J UNE 11, 2026
All experiments were conducted on a multi-GPU server equipped with NVIDIA A6000 GPUs. During inference, Multisage operates without additional fine-tuning and relies on prompt-based semantic augmentation, with an optional lightweight repair step applied to failed translations. All experiments were executed with fixed random seeds to ensure reproducibility. 3.5
Research Question
To evaluate the effectiveness of the Multisage, we formulate the following research questions (RQs): RQ1: How does the Multisage improve the performance of LLM-based code translation and mitigate intervenable errors? We evaluate two usage modes: (1) direct augmentation, where Multisage is applied during initial translation, and (2) repair-based augmentation, where additional semantic guidance is injected only for initially failed translations to assess recovery capability. Performance is measured in terms of functional correctness, CodeBLEU, and error-type distribution shifts. RQ2: How does Multisage perform against state-of-the-art code translation baselines? We compare Multisage with specialized translation models and instruction-tuned (IT) LLMs under the same benchmark and evaluation metrics. RQ3: What is the quality of the semantic augmentation generated by Multisage? We assess semantic quality from three perspectives. (1) Intrinsic validity: We adopt a back-translation protocol in which generated semantics are used to reconstruct target-language implementations. The evaluation is reported using the BT-Pass@k metric, defined as the probability of recovering a functionally correct implementation. (2) Comparative efficacy: we compare Multisage-generated semantics with reasoning-based baselines such as CoT. (3) Generative quality: we directly contrast the semantic representations produced by Multisage and HP-LLMs under identical targets. RQ4: How do individual components of Multisage contribute to the overall translation performance? To address this question, we performed an ablation study to analyze and quantify the contribution of each component to the code translation task. By selectively removing key modules and examining the resulting performance changes, we isolate the distinct value that each component adds to the final generation quality. RQ5: How sensitive is Multisage to the threshold parameters in the semantic consistency calibration module? We analyze the sensitivity of three parameters, namely the similarity threshold δ, the majority-support ratio ρ, and the global consistency threshold τ , by varying each parameter independently while keeping the others fixed at their default values, and observe the resulting performance changes.
4
Results and Analysis
4.1
RQ1: How does the Multisage improve the performance of LLM-based code translation and mitigate intervenable errors?
Fig. 6 and Table 2 report the translation performance under three settings: vanilla prompting, Multisage, and Multisage (Repair). Across all evaluated models, Multisage consistently improves translation success rates over the vanilla setting. The gains are particularly pronounced for small and mid-scale models. For example, the success rate of StarCoder2-15B increases from 46.95% to 71.34%, while StarCoder2-7B improves from 14.02% to 31.10%. In addition to higher execution success rates, Multisage also improves CodeBLEU scores across all models, indicating better alignment in code structure and data-flow semantics. For instance, the CodeBLEU score of StarCoder2-15B increases from 30.86% to 42.88%. These results suggest that explicit semantic augmentation improves not only functional correctness but also the structural quality of generated code. The Multisage (Repair) setting provides an additional complementary mechanism. Instead of augmenting all translations, semantic guidance is selectively applied only to instances that fail during the initial generation. Although the overall success rate of Multisage (Repair) does not always exceed direct Multisage, it often achieves comparable or higher CodeBLEU scores. For weaker models, the repair setting can further improve the success rate beyond direct Multisage. 14
A PREPRINT - J UNE 11, 2026
Figure 6: Translation success rates under different Multisage settings.
For example, StarCoder2-7B increases from 31.10% under Multisage to 35.37% with Multisage (Repair), indicating that targeted semantic guidance can recover a subset of previously failed translations. To better understand how these improvements arise, we further analyze the distribution of translation errors before and after applying Multisage. The detailed error statistics are reported in Appendix D. Overall, errors related to dependency reasoning and data interpretation decrease substantially after semantic augmentation, particularly for small and mid-scale models. This observation suggests that many translation failures stem from missing or misinterpreted semantic constraints, which can be effectively mitigated through explicit semantic guidance. Meanwhile, model-specific errors remain relatively stable across settings, indicating that such failures are primarily determined by model capacity rather than the availability of semantic information. 4.2
RQ2: How does Multisage perform against state-of-the-art code translation baselines?
Table 3 compares Multisage with representative state-of-the-art code translation baselines under identical evaluation settings, including specialized neural translation models and instruction-tuned LLMs. Compared with specialized translation models, Multisage significantly improves execution success rates. In particular, Multisage (15B) achieves 71.34% success rate, surpassing the strongest baseline INTERTRANS (67.34%) as well as earlier approaches such as TransCoder and DOBF by a large margin. These results indicate that semantic reliability modeling provides more effective guidance for preserving functional correctness than prior structural or intermediaterepresentation–based methods. In terms of CodeBLEU, INTERTRANS achieves the highest score (69.47%), suggesting that its multi-step translation process is effective in preserving surface-level structural similarity. In contrast, Multisage achieves moderate but consistent improvements over instruction-tuned LLMs, increasing CodeBLEU from 28.79 to 34.51 at the 7B scale and from 41.73 to 42.88 at the 15B scale. This indicates that Multisage improves structural alignment while primarily focusing on functional correctness. When compared with instruction-tuned LLM baselines at the same model scale, Multisage consistently improves both success rate and CodeBLEU. At the 7B scale, the success rate increases from 38.11% to 46.95%, while at the 15B scale it improves substantially from 51.22% to 71.34%. These results demonstrate that Multisage enhances both functional correctness and semantic consistency beyond what can be achieved by instruction tuning alone. Overall, the results highlight a clear distinction between structural similarity and functional correctness. While some methods (e.g., INTERTRANS) achieve higher CodeBLEU scores, Multisage delivers superior execution performance, demonstrating the effectiveness of explicitly modeling semantic reliability in code translation. 15
A PREPRINT - J UNE 11, 2026
Table 2: Translation success rate and CodeBLEU under different settings. Success CodeBLEU Rate (%) (%)
Model
Setting
DeepSeek-V3
Vanilla Multisage Multisage (Repair)
79.88 95.73 92.07
43.72 52.35 55.37
GPT-4 Turbo
Vanilla Multisage Multisage (Repair)
67.68 82.32 76.83
39.23 47.42 52.18
Qwen-Plus
Vanilla Multisage Multisage (Repair)
69.51 90.24 85.37
41.90 48.19 49.56
Qwen2.5-Coder -Instruct-33B
Vanilla Multisage Multisage (Repair)
80.49 84.15 85.37
42.17 53.60 53.80
StarCoder2-15B
Vanilla Multisage Multisage (Repair)
46.95 71.34 65.85
30.86 42.88 43.25
StarCoder2-7B
Vanilla Multisage Multisage (Repair)
14.02 31.10 35.37
15.44 30.24 25.68
Qwen2.5 -Coder-7B
Vanilla Multisage Multisage (Repair)
50.00 62.80 57.93
28.39 38.78 38.43
Table 3: Performance comparison with state-of-the-art code translation baselines. Method (Scale)
4.3
Succ. (%)
CodeBLEU (%)
TransCoder
21.06
61.24
DOBF
31.71
64.87
TransCoder-ST
40.24
60.09
TransCoder-IR
45.12
55.63
INTERTRANS
67.34
69.47
IT-LLM (7B Avg.)
38.11
28.79
Multisage (7B Avg.)
46.95
34.51
IT-LLM (15B)
51.22
41.73
Multisage (15B)
71.34
42.88
RQ3: What is the quality of the semantic augmentation generated by Multisage?
Intrinsic validity. Table 4 reports the back-translation performance under different semantic input configurations. Results show that semantic representations with higher information density consistently lead to stronger intrinsic validity. For example, using code summaries alone substantially outperforms API-level comments, indicating that global semantic descriptions capture functional intent more effectively than localized interface documentation. Adding executable constraints further improves semantic fidelity. When API-level test cases are combined with API comments, BT-Pass@1 increases from 62.94% to 78.41%, and BT-Pass@3 rises from 74.26% to 88.69%. An even larger improvement is observed when combining code summaries with function-level test cases, achieving the highest reconstruction success (93.05% for BT-Pass@1 and 97.82% for BT-Pass@3). 16
A PREPRINT - J UNE 11, 2026
Table 4: Intrinsic validity evaluation using back-translation under different semantic configurations. Semantic Type
BT-Pass@1 (%)
BT-Pass@3 (%)
Code Summary
82.53
89.17
API Comments
62.94
74.26
API Comments + API Test Cases
78.41
88.69
Code Summary + Function Test Cases
93.05
97.82
95.80
Qwen2.5-Coder-7B
50.00
54.67
59.96
62.80
StarCoder2-7B
14.02
21.95
21.95
31.10
StarCoder2-15B
46.95
55.69
60.37
71.34
79.44
63.08
Qwen25-Coder-Instruct-33B
80.49
79.27
77.24
84.15
Qwen-Plus
69.51
79.47
83.13
90.24
GPT-4 Turbo
67.68
77.03
81.50
82.32
DeepSeek-V3
79.88
81.71
83.74
95.73
Vani lla
CoT (a
46.72
Struc Mult t-Sem isage vg) (avg)
30.36
14.00
Figure 7: Comparison of Translation Success Rates under Different Semantic Augmentation Strategies.
Moreover, the gap between BT-Pass@1 and BT-Pass@3 narrows as stronger semantic constraints are introduced, suggesting that richer semantic information reduces reliance on sampling diversity during reconstruction. These results confirm that Multisage generates semantically faithful augmentations that provide effective functional constraints beyond simple executability. Comparative Efficacy. Fig. 7 compares translation success rates under different semantic augmentation strategies. Multisage consistently outperforms CoT prompting across all evaluated models. For example, DeepSeek-V3 improves from 81.71% under CoT to 95.73% with Multisage, while StarCoder2-15B improves from 55.69% to 71.34%. Similar gains are observed for smaller models such as StarCoder2-7B (21.95% vs. 31.10%), indicating that explicit external semantics provide more effective guidance than internal reasoning traces, particularly when model capacity is limited. This trend is also reflected in the CodeBLEU results reported in Table 5. Multisage achieves higher CodeBLEU scores than CoT across all evaluated models, indicating improved alignment in code structure and data-flow semantics. Together, these results demonstrate that Multisage provides more effective semantic guidance than CoT, improving both functional correctness and implementation-level consistency. Generative Quality. Fig. 7 further compares Multisage with a control setting in which HP-LLMs directly generate the same semantic descriptions used in Multisage (denoted as Struct-Sem). Multisage consistently achieves higher translation success rates across model scales. For example, DeepSeek-V3 improves from 83.74% with Struct-Sem to 95.73% with Multisage, while StarCoder2-15B improves from 60.37% to 71.34%. Table 5 provides complementary evidence on code quality. In most cases, Multisage achieves higher CodeBLEU scores than Struct-Sem (e.g., DeepSeek-V3: 52.35 vs. 50.68; Qwen25-Coder-Instruct-33B: 53.60 vs. 52.09), indicating improved structural and data-flow alignment. An exception occurs for GPT-4 Turbo, where Struct-Sem obtains a 17
A PREPRINT - J UNE 11, 2026
Table 5: CodeBLEU scores under different semantic augmentation strategies. Model Vanilla CoT (avg) Struct-Sem (avg) DeepSeek-V3 43.72 47.33 50.68 GPT-4 Turbo 39.23 40.12 49.91 Qwen-Plus 41.90 43.57 47.84 Qwen25-Coder-Instruct-33B 42.17 49.26 52.09 StarCoder2-15B 30.86 28.45 40.77 StarCoder2-7B 15.44 12.15 28.97 Qwen2.5-Coder-7B 28.39 30.62 34.03
Multisage 52.35 47.42 48.19 53.60 42.88 30.24 38.78
Table 6: Overall ablation results of Multisage. Both translation success rate and CodeBLEU are reported in percentage. Values in parentheses indicate absolute percentage-point (pp) changes relative to the full Multisage setting. Model DeepSeek-V3
GPT-4 Turbo
Qwen-Plus
Qwen25-Coder-Instruct-33B
StarCoder2-15B
StarCoder2-7B
Qwen2.5-Coder-7B
Metric
Full
w/o M1
w/o Code Summary
w/o API Info.
w/o Test Cases
w/o Exec. Val.
w/o M3
Successful (%)
95.73
89.02 (-6.71)
90.24 (-5.49)
79.88 (-15.85)
85.98 (-9.75)
84.15 (-11.58)
87.20 (-8.53)
CodeBLEU (%)
52.35
45.92 (-6.43)
47.38 (-4.97)
48.96 (-3.39)
46.84 (-5.51)
51.21 (-1.14)
44.87 (-7.48)
Successful (%)
82.32
76.83 (-5.49)
73.17 (-9.15)
60.37 (-21.95)
70.73 (-11.59)
70.12 (-12.20)
69.51 (-12.81)
CodeBLEU (%)
47.42
41.08 (-6.34)
42.95 (-4.47)
44.61 (-2.81)
43.02 (-4.40)
46.37 (-1.05)
40.26 (-7.16)
Successful (%)
90.24
80.49 (-9.75)
84.15 (-6.09)
70.73 (-19.51)
78.05 (-12.19)
81.10 (-9.14)
73.17 (-17.07)
CodeBLEU (%)
48.19
42.11 (-6.08)
43.76 (-4.43)
45.28 (-2.91)
44.02 (-4.17)
47.02 (-1.17)
41.35 (-6.84)
Successful (%)
84.15
81.71 (-2.44)
76.22 (-7.93)
67.07 (-17.08)
71.34 (-12.81)
74.39 (-9.76)
68.90 (-15.25)
CodeBLEU (%)
53.60
47.83 (-5.77)
49.62 (-3.98)
50.94 (-2.66)
49.18 (-4.42)
52.41 (-1.19)
46.92 (-6.68)
Successful (%)
71.34
69.51 (-1.83)
62.80 (-8.54)
48.78 (-22.56)
55.49 (-15.85)
62.20 (-9.14)
51.83 (-19.51)
CodeBLEU (%)
42.88
36.94 (-5.94)
38.72 (-4.16)
40.05 (-2.83)
39.11 (-3.77)
41.83 (-1.05)
35.87 (-7.01)
Successful (%)
31.10
28.05 (-3.05)
21.34 (-9.76)
6.10 (-25.00)
14.63 (-16.47)
21.34 (-9.76)
8.54 (-22.56)
CodeBLEU (%)
30.24
24.81 (-5.43)
26.03 (-4.21)
27.41 (-2.83)
25.96 (-4.28)
29.37 (-0.87)
23.95 (-6.29)
Successful (%)
69.51
66.46 (-3.05)
60.37 (-9.14)
54.88 (-14.63)
56.71 (-12.80)
61.59 (-7.92)
54.88 (-14.63)
CodeBLEU (%)
38.78
33.02 (-5.76)
34.69 (-4.09)
35.84 (-2.94)
34.21 (-4.57)
37.66 (-1.12)
32.41 (-6.37)
slightly higher CodeBLEU score while Multisage still achieves a higher execution success rate. This suggests that single-stage structural semantics may sometimes improve surface-level similarity, whereas Multisage more reliably translates semantic guidance into execution-grounded correctness. 4.4
RQ4: How do individual components of Multisage contribute to the overall translation performance?
To investigate the contribution of each component in Multisage, we conduct an ablation study by removing individual modules while keeping all other components unchanged. Table 6 reports the overall translation performance in terms of success rate and CodeBLEU, while Table 7 summarizes the corresponding error-type distributions. Across all evaluated models and settings, removing any component leads to a consistent degradation in performance. This observation indicates that Multisage is not a loose combination of independent heuristics, but a tightly coupled framework in which different modules provide complementary capabilities. code representation parsing module (M1). The code representation parsing module (M1) provides the structural foundation of Multisage by reconstructing machine-interpretable semantic representations from source code. As shown in Table 6, removing M1 leads to a noticeable drop in both translation success rate and CodeBLEU. The error distribution in Table 7 further shows an increase in dependency-related and logical errors. Without explicit structural abstractions, models are more likely to generate translations with broken semantic dependencies or inconsistent control logic. This effect is particularly pronounced for smaller and medium-sized models, highlighting the importance of structural guidance when model reasoning capacity is limited. Semantic augmentation signals. The semantic augmentation stage introduces complementary semantic views, including code summaries, API-level semantics, and test-case constraints. These signals jointly provide global and fine-grained semantic guidance during translation. 18
A PREPRINT - J UNE 11, 2026
Table 7: Error-type distribution (%) under different ablation settings. Error types A, B, and C correspond to dependency and logical errors, data parsing errors, and model-specific errors, respectively. Values in parentheses indicate absolute percentage-point (pp) changes relative to the full Multisage setting (positive means more errors). Model
Type
Full
w/o M1
w/o Code Summary
w/o API Info.
w/o Test Cases
w/o Exec. Val.
w/o M3
DeepSeek-V3
A (%) B (%) C (%)
3.05 1.22 0.00
7.93 (+4.88) 2.44 (+1.22) 0.61 (+0.61)
5.49 (+2.44) 3.66 (+2.44) 0.61 (+0.61)
15.24 (+12.19) 4.88 (+3.66) 0.00 (+0.00)
11.59 (+8.54) 2.44 (+1.22) 0.00 (+0.00)
12.20 (+9.15) 3.66 (+2.44) 0.00 (+0.00)
9.76 (+6.71) 2.44 (+1.22) 0.61 (+0.61)
GPT-4 Turbo
A (%) B (%) C (%)
12.80 4.88 0.00
15.85 (+3.05) 6.10 (+1.22) 1.22 (+1.22)
17.68 (+4.88) 8.54 (+3.66) 0.61 (+0.61)
26.83 (+14.03) 10.98 (+6.10) 1.83 (+1.83)
20.73 (+7.93) 7.93 (+3.05) 0.61 (+0.61)
20.12 (+7.32) 9.76 (+4.88) 0.00 (+0.00)
20.12 (+7.32) 9.15 (+4.27) 1.22 (+1.22)
Qwen-Plus
A (%) B (%) C (%)
7.32 2.44 0.00
15.85 (+8.53) 3.05 (+0.61) 0.61 (+0.61)
10.37 (+3.05) 5.49 (+3.05) 0.00 (+0.00)
20.73 (+13.41) 7.32 (+4.88) 1.22 (+1.22)
12.80 (+5.48) 8.54 (+6.10) 0.61 (+0.61)
11.59 (+4.27) 6.71 (+4.27) 0.61 (+0.61)
17.68 (+10.36) 7.93 (+5.49) 1.22 (+1.22)
Qwen25-Coder-Instruct-33B
A (%) B (%) C (%)
10.98 4.88 0.00
12.80 (+1.82) 5.49 (+0.61) 0.00 (+0.00)
15.24 (+4.26) 7.93 (+3.05) 0.61 (+0.61)
21.95 (+10.97) 9.76 (+4.88) 1.22 (+1.22)
17.07 (+6.09) 10.98 (+6.10) 0.61 (+0.61)
15.85 (+4.87) 9.15 (+4.27) 0.61 (+0.61)
19.51 (+8.53) 10.37 (+5.49) 1.22 (+1.22)
StarCoder2-15B
A (%) B (%) C (%)
21.34 3.66 3.66
21.95 (+0.61) 4.88 (+1.22) 3.66 (+0.00)
25.61 (+4.27) 7.32 (+3.66) 4.27 (+0.61)
36.59 (+15.25) 8.54 (+4.88) 6.10 (+2.44)
28.66 (+7.32) 10.98 (+7.32) 4.88 (+1.22)
24.39 (+3.05) 9.15 (+5.49) 4.27 (+0.61)
33.54 (+12.20) 9.15 (+5.49) 5.49 (+1.83)
StarCoder2-7B
A (%) B (%) C (%)
46.34 7.32 15.24
47.56 (+1.22) 8.54 (+1.22) 15.85 (+0.61)
51.83 (+5.49) 9.76 (+2.44) 17.07 (+1.83)
64.02 (+17.68) 10.98 (+3.66) 18.90 (+3.66)
54.88 (+8.54) 12.20 (+4.88) 18.29 (+3.05)
51.22 (+4.88) 10.37 (+3.05) 17.07 (+1.83)
62.20 (+15.86) 11.59 (+4.27) 17.68 (+2.44)
Qwen2.5-Coder-7B
A (%) B (%) C (%)
16.46 11.59 2.44
18.29 (+1.83) 12.20 (+0.61) 3.05 (+0.61)
21.34 (+4.88) 14.63 (+3.04) 3.66 (+1.22)
24.39 (+7.93) 17.07 (+5.48) 3.66 (+1.22)
23.17 (+6.71) 15.85 (+4.26) 4.27 (+1.83)
20.73 (+4.27) 14.02 (+2.43) 3.66 (+1.22)
25.00 (+8.54) 16.46 (+4.87) 3.66 (+1.22)
Removing code summaries results in a moderate but consistent decline in translation success rate, accompanied by more frequent global semantic mismatches such as incorrect algorithmic intent or misplaced control logic. This indicates that summaries serve as global semantic anchors that help maintain coherence throughout the translation. API-level semantic information further contributes to preserving fine-grained dependencies. When API semantics are removed, Table 6 shows substantial degradation in both success rate and CodeBLEU, while Table 7 reveals a sharp increase in dependency-related errors. Without explicit API semantics, models struggle to infer external dependencies and usage contracts correctly. Test-case-based semantic constraints provide direct executable supervision. Removing test cases leads to one of the largest drops in translation success rate, even when CodeBLEU decreases only moderately. The error analysis confirms that the absence of test cases significantly increases data parsing errors and logical inconsistencies, indicating that structural similarity alone cannot guarantee functional correctness. Semantic consistency calibration module (M3). The execution validator and the semantic consistency calibration module jointly ensure the reliability of semantic guidance. The execution validator enforces executability by filtering invalid semantic samples, while M3 performs cross-view consistency calibration to suppress unreliable or contradictory semantics. When these mechanisms are removed, Tables 6 and 7 show consistent performance degradation and a higher proportion of dependency-related and functional errors. This indicates that the main role of semantic calibration is not to increase the amount of semantic information, but to stabilize it by filtering noisy signals and reinforcing semantics that remain consistent across multiple views. Overall, the ablation results demonstrate that Multisage derives its effectiveness from the coordinated interaction between semantic construction and semantic calibration. M1 provides structural grounding, semantic augmentation modules supply complementary semantic constraints, and M3 ensures the reliability of these signals through cross-view consistency verification. 19
A PREPRINT - J UNE 11, 2026
Table 8: Sensitivity of Multisage to the similarity threshold δ. δ 0.5 0.6 0.7 (default) 0.8 0.9
Success Rate (%) 83.24 86.57 90.24 88.73 78.16
CodeBLEU (%) 45.83 46.92 48.19 47.95 46.58
Table 9: Sensitivity of Multisage to the majority-support ratio ρ. ρ 0.3 0.4 0.5 (default) 0.6 0.7 0.8
4.5
Success Rate (%) 81.42 84.65 90.24 88.81 87.13 87.95
CodeBLEU (%) 46.38 47.53 48.19 48.02 47.64 46.91
RQ5: How sensitive is Multisage to the threshold parameters in the semantic consistency calibration module?
Table 8, Table 9, and Table 10 report the sensitivity of Multisage to the three threshold parameters in the semantic consistency calibration module. We use Qwen-Plus as the representative backbone and adopt a one-factor-at-a-time design, sweeping each parameter while keeping the others fixed at their default values. Performance is evaluated using translation success rate and CodeBLEU on HumanEval-X. Similarity threshold δ. As shown in Table 8, increasing δ from 0.5 to 0.7 improves translation performance, with the success rate rising from 83.24% to 90.24% and CodeBLEU increasing from 45.83% to 48.19%. However, when δ becomes overly strict (δ = 0.9), the success rate drops to 78.16%, as many paraphrased but semantically correct units are discarded. Overall, Multisage remains stable within δ ∈ [0.6, 0.8], and the default value δ = 0.7 lies near the center of this stable region. Majority-support ratio ρ. Table 9 shows a similar trend. Increasing ρ from 0.3 to 0.5 raises the success rate from 81.42% to 90.24%, indicating that moderate cross-variant agreement effectively suppresses unreliable semantics. Further increasing ρ leads to gradual performance degradation (87.95% at ρ = 0.8), as overly strict voting thresholds begin to remove useful semantic units. Nevertheless, performance remains relatively stable within ρ ∈ [0.4, 0.7]. Global consistency threshold τ . The sensitivity to τ is comparatively small. As reported in Table 10, the success rate varies only between 88.71% and 90.24% when τ ranges from 0.4 to 0.8, with CodeBLEU following a similar trend. The best performance is observed at τ = 0.6, while other values cause only minor changes. Overall, Multisage maintains stable translation performance across broad parameter intervals: δ ∈ [0.6, 0.8], ρ ∈ [0.4, 0.6], and τ ∈ [0.5, 0.7]. The default configuration used in our main experiments lies near the center of these stable regions, indicating that the semantic consistency mechanism is robust to reasonable threshold variations and does not rely on delicate hyperparameter tuning.
5
Discussion
To further evaluate the generalization of Multisage beyond the primary experimental setting, we conduct additional experiments on Java-to-Python translation. This setting introduces a different challenge profile, where explicit type constraints available in the source language are no longer strictly enforced in the target language, making it easier for semantic inconsistencies to emerge during generation. The results demonstrate that Multisage consistently improves both execution success rate and CodeBLEU across all model scales. Notably, the improvements are more pronounced for lightweight models, where the success rate increases substantially, suggesting that semantic augmentation effectively compensates for limited model capacity. At the same time, even high-performance LLMs benefit from Multisage, indicating that its contribution is not redundant but complementary to existing model capabilities. 20
A PREPRINT - J UNE 11, 2026
Table 10: Sensitivity of Multisage to the global consistency threshold τ . τ 0.4 0.5 0.6 (default) 0.7 0.8
Success Rate (%) 88.71 89.63 90.24 89.92 88.85
CodeBLEU (%) 46.82 47.65 48.19 47.93 46.78
Table 11: Performance comparison across model scales and specialized baselines. Method Succ. (%) CodeBLEU (%) Specialized Translation Models TransCoder 28.05 61.24 DOBF 31.71 64.87 TransCoder-ST 40.24 60.09 TransCoder-IR 45.12 55.63 INTERTRANS 67.07 34.51 LLMs (Average by Scale) HP-LLMs (Baseline) 83.13 47.75 HP-LLMs (+Multisage) 93.29 54.99 MS-LLMs (Baseline) 72.57 42.41 MS-LLMs (+Multisage) 82.01 50.95 ℓLMs (Baseline) 39.64 28.17 ℓLMs (+Multisage) 58.23 37.20 An interesting observation is that the improvements in CodeBLEU are generally smaller than those in execution success rate. This highlights a fundamental distinction between structural similarity and functional correctness. While some approaches may achieve high CodeBLEU scores by preserving surface-level structure, Multisage focuses on improving semantic reliability, leading to more functionally correct programs even when structural similarity does not increase proportionally. Furthermore, the consistent performance gains across diverse model families, including proprietary models such as GPT-4 Turbo and DeepSeek-V3 as well as open-source code models like StarCoder2-7B/15B and QwenCoder2.5Coder-7B, suggest that Multisage is largely model-agnostic. This indicates that its effectiveness primarily stems from the semantic augmentation and consistency calibration mechanisms rather than dependence on specific architectures or training paradigms. Overall, these findings suggest that explicitly modeling semantic consistency across multiple views provides a robust and generalizable strategy for improving code translation, particularly in scenarios where model capacity alone is insufficient to guarantee functional correctness. Detailed per-model results are provided in Appendix F, demonstrating that the observed improvements are consistent across all models rather than driven by a small subset of cases.
6
Threats to Validity
6.1
Internal Validity
The effectiveness of the multi-task fine-tuning module may be influenced by the choice of backbone model. To assess this threat, we instantiated the fine-tuning module with multiple alternative backbones while keeping all other components unchanged. Detailed results are provided in Appendix E. Although absolute performance varies across configurations, the relative improvement trends remain consistent, suggesting that Multisage does not depend on a specific fine-tuning backbone. Another potential threat concerns the sensitivity of the semantic consistency calibration thresholds. If performance gains were observed only under narrowly tuned parameter values, conclusions could be confounded by hyperparameter optimization. We therefore conducted a parameter sensitivity analysis (Section 4.5) by varying the similarity threshold 21
A PREPRINT - J UNE 11, 2026
δ, the majority-support ratio ρ, and the global consistency threshold τ over broad ranges. Multisage maintains stable performance within reasonable intervals, and the default configuration lies within these stable regions. This indicates that the observed improvements are not driven by brittle threshold tuning. 6.2
External Validity
Our experiments focus on function-level code translation, enabling controlled assessment of semantic equivalence and functional correctness. Although real-world software systems may involve project-level dependencies and broader execution contexts, the semantic artifacts employed in Multisage, such as structured summaries, API-level semantics, and executable tests, are not inherently restricted to function-level granularity. Evaluation is conducted on the C++→Java language pair, a widely studied and practically relevant cross-language translation setting. The consistent improvements observed under this representative scenario provide empirical evidence for the applicability of Multisage in cross-language code translation tasks. Finally, we evaluate Multisage across models of different parameter scales and architectural families. The consistent trends observed across these heterogeneous backbones suggest that the framework operates independently of specific model configurations, although continued evaluation on newly emerging architectures would further broaden empirical coverage.
7
Related Work
This section reviews prior work on LLM-based code translation and semantic-enhanced code intelligence. Existing approaches can be broadly grouped based on whether and how additional semantic information is incorporated into the translation process. 7.1
End-to-End LLM Code Translation
Recent advances in code translation are largely driven by LLMs, which treat programs as structured sequences and learn cross-language mappings in an end-to-end manner. Early pretrained models such as CodeBERT [13] demonstrate strong code understanding capabilities through large-scale pretraining objectives, including masked language modeling and replaced token detection. More recent code-oriented LLMs, such as QwenCoder [37], StarCoder [38], and DeepSeekCoder [43], further improve code generation and translation capabilities through scaling and data expansion, providing stronger backbones for downstream code translation methods. Building upon these increasingly powerful models, neural code translation methods have been developed to explicitly model cross-language mapping. A key milestone in neural code translation is TransCoder [4], which enables unsupervised cross-language transfer through denoising autoencoding and back-translation. Subsequent work further improves this paradigm by enhancing data quality and strengthening functional understanding. For example, deobfuscation-based objectives [39] encourage models to recover semantic structure, while approaches such as Function-to-Style [44] and related data augmentation methods improve translation performance through semantically enriched supervision. Beyond improvements in model capacity and training objectives, more recent studies focus on improving the translation process itself. Reasoning-oriented approaches, such as EffiReasonTrans [45], introduce multi-step reasoning processes to enhance logical consistency. Other methods formulate translation as an iterative refinement process, including dialogue-based or multi-agent generation frameworks [46], which progressively improve intermediate outputs. Despite these advances, end-to-end neural translation models largely depend on implicit statistical correlations and lack mechanisms to explicitly represent, verify, and enforce program semantics during generation. As a result, they often produce outputs that are syntactically plausible yet semantically inconsistent, particularly in scenarios involving complex control flow, data dependencies, or API interactions. 7.2
External-Information–Augmented Code Translation
Another line of work attempts to improve code translation by incorporating external semantic or structural information. The key intuition is that exposing latent program semantics through program analysis artifacts or auxiliary supervision can help models better preserve functional intent. Early approaches primarily rely on structured intermediate representations to encode program structure. For example, TreeBERT [16] leverages ASTs to capture syntactic dependencies, while INTERTRANS [41] utilizes graph-based representations to model structural and semantic relationships across programs. Subsequent work further extends 22
A PREPRINT - J UNE 11, 2026
this line by exploring richer representation forms. SynCoBERT [47] combines ASTs with code and comments as multimodal inputs, while other methods [48], [49] incorporate graph-based or representation learning techniques to better model program semantics. Beyond structural representations, recent research introduces more diverse forms of semantic grounding. Some approaches adopt natural language as an intermediate representation. For instance, BabelCoder [50] generates natural language specifications to describe program behavior and guide translation and refinement. Other methods focus on structured decomposition and modular translation. Wang et al. [51] represent programs as high-level templates with placeholders linked to local semantic constraints, while AlphaTrans [18] constructs target-language skeletons and performs compositional translation based on program decomposition and dependency analysis. More recent work incorporates execution-level and system-level signals to further enhance semantic correctness. ExeCoder [52] introduces executability-oriented representations and leverages instruction tuning to improve runtime correctness. EvoC2Rust [53] integrates static analysis, compiler feedback, and staged refinement in a system-level pipeline. Execution-guided methods, such as UniTrans [17] and related approaches, utilize automatically generated test cases or runtime feedback to iteratively repair translation errors. In addition, system-level frameworks incorporating API grounding and external constraints further improve translation reliability in complex real-world scenarios. Despite these advances, existing approaches exhibit two fundamental limitations. First, many methods rely on external resources such as analyzers, documentation, test suites, or compiler feedback, which may be unavailable or costly in practical settings. Second, and more importantly, these approaches typically assume that the introduced semantic signals are reliable, without explicitly modeling their consistency or robustness across different representations. As a result, noisy, partial, or conflicting semantic information may still mislead the translation process. In contrast, Multisage constructs multiple complementary semantic views directly from source code and introduces a cross-view consistency mechanism to explicitly assess and calibrate their reliability. By identifying stable semantic signals across semantically equivalent variants, Multisage enables the model to leverage not only richer semantic information but also more trustworthy and robust guidance for code translation.
8
Conclusion
This paper proposes Multisage, a multi-semantic augmentation and self-calibration framework for LLM-based code translation. The framework integrates three cooperative components: semantic representation parsing, multi-semantic augmentation, and semantic consistency calibration, to systematically construct diverse and complementary semantic information directly from source code without relying on external resources. By providing explicit and reliable semantic guidance, Multisage alleviates the limitations of purely probabilistic translation pipelines and improves the functional correctness and reliability of cross-language code translation. Experimental results demonstrate that Multisage consistently improves translation performance across LLMs with different architectures and parameter scales. On the HumanEval-X benchmark, it achieves up to a 2.22× improvement in translation success rate compared with vanilla models. The framework also exhibits strong cross-model generalization, benefiting both general-purpose and code-specialized LLMs. These improvements arise from the richer and more reliable semantic constraints introduced by multi-semantic augmentation and consistency calibration. Furthermore, back-translation–based evaluations confirm that the semantics generated by Multisage possess high intrinsic validity and can effectively support the reconstruction of functionally equivalent implementations. In future work, we plan to further evaluate the robustness of Multisage in more complex cross-language migration scenarios, such as library substitution, framework migration, and heterogeneous runtime environments. We also aim to more tightly integrate semantic augmentation with the translation process itself to enhance the practical reliability of LLM-based code translation in real-world software engineering environments.
References [1] Maxim Mossienko. Automated cobol to java recycling. In 7th European Conference on Software Maintenance and Reengineering (CSMR 2003), 26-28 March 2003, Benevento, Italy, Proceedings, page 40. IEEE Computer Society, 2003. [2] Kostas Kontogiannis, Johannes Martin, Kenny Wong, Richard Gregory, Hausi A. Müller, and John Mylopoulos. Code migration through transformations: an experience report. In Proceedings of the 1998 conference of the Centre for Advanced Studies on Collaborative Research, November 30 - December 3, 1998, Toronto, Ontario, Canada, page 13. IBM, 1998. 23
A PREPRINT - J UNE 11, 2026
[3] Wasi Uddin Ahmad, Md Golam Rahman Tushar, Saikat Chakraborty, and Kai-Wei Chang. AVATAR: A parallel corpus for java-python program translation. In Anna Rogers, Jordan L. Boyd-Graber, and Naoaki Okazaki, editors, Findings of the Association for Computational Linguistics: ACL 2023, Toronto, Canada, July 9-14, 2023, pages 2268–2281. Association for Computational Linguistics, 2023. [4] Baptiste Rozière, Marie-Anne Lachaux, Lowik Chanussot, and Guillaume Lample. Unsupervised translation of programming languages. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. [5] Ming Zhu, Karthik Suresh, and Chandan K. Reddy. Multilingual code snippets training for program translation. In Thirty-Sixth AAAI Conference on Artificial Intelligence, AAAI 2022, Thirty-Fourth Conference on Innovative Applications of Artificial Intelligence, IAAI 2022, The Twelveth Symposium on Educational Advances in Artificial Intelligence, EAAI 2022 Virtual Event, February 22 - March 1, 2022, pages 11783–11790. AAAI Press, 2022. [6] Fang Liu, Jia Li, and Li Zhang. Syntax and domain aware model for unsupervised program translation. In 45th IEEE/ACM International Conference on Software Engineering, ICSE 2023, Melbourne, Australia, May 14-20, 2023, pages 755–767. IEEE, 2023. [7] Min Xue, Artur Andrzejak, and Marla Leuther. An interpretable error correction method for enhancing codeto-code translation. In The Twelfth International Conference on Learning Representations, ICLR 2024, Vienna, Austria, May 7-11, 2024. OpenReview.net, 2024. [8] Yali Du, Hui Sun, and Ming Li. A joint learning model with variational interaction for multilingual program translation. In Vladimir Filkov, Baishakhi Ray, and Minghui Zhou, editors, Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering, ASE 2024, Sacramento, CA, USA, October 27 November 1, 2024, pages 1907–1918. ACM, 2024. [9] Qiong Feng, Xiaotian Ma, Ziyuan Feng, Marat Akhin, Wei Song, and Peng Liang. Finding compiler bugs through cross-language code generator and differential testing. Proc. ACM Program. Lang., 9(OOPSLA2), October 2025. [10] Kai Huang, Zhengzi Xu, Su Yang, Hongyu Sun, Xuejun Li, Zheng Yan, and Yuqing Zhang. Evolving paradigms in automated program repair: Taxonomy, challenges, and opportunities. ACM Comput. Surv., 57(2), October 2024. [11] Federico Cassano, John Gouwar, Francesca Lucchetti, Claire Schlesinger, Anders Freeman, Carolyn Jane Anderson, Molly Q Feldman, Michael Greenberg, Abhinav Jangda, and Arjun Guha. Knowledge transfer from high-resource to low-resource programming languages for code llms. Proc. ACM Program. Lang., 8(OOPSLA2), October 2024. [12] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 5998–6008, 2017. [13] Zhangyin Feng, Daya Guo, Duyu Tang, Nan Duan, Xiaocheng Feng, Ming Gong, Linjun Shou, Bing Qin, Ting Liu, Daxin Jiang, and Ming Zhou. Codebert: A pre-trained model for programming and natural languages. In Findings of the Association for Computational Linguistics: EMNLP 2020, Online Event, 16-20 November 2020, volume EMNLP 2020 of Findings of ACL, pages 1536–1547. Association for Computational Linguistics, 2020. [14] Rangeet Pan, Ali Reza Ibrahimzada, Rahul Krishna, Divya Sankar, Lambert Pouguem Wassi, Michele Merler, Boris Sobolev, Raju Pavuluri, Saurabh Sinha, and Reyhaneh Jabbarvand. Lost in translation: A study of bugs introduced by large language models while translating code. In Proceedings of the 46th IEEE/ACM International Conference on Software Engineering, ICSE 2024, Lisbon, Portugal, April 14-20, 2024, pages 82:1–82:13. ACM, 2024. [15] Baptiste Rozière, Jie Zhang, François Charton, Mark Harman, Gabriel Synnaeve, and Guillaume Lample. Leveraging automated unit tests for unsupervised code translation. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022. [16] Xinyun Chen, Chang Liu, and Dawn Song. Tree-to-tree neural networks for program translation. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, December 3-8, 2018, Montréal, Canada, pages 2552–2562, 2018. [17] Zhen Yang, Fang Liu, Zhongxing Yu, Jacky Wai Keung, Jia Li, Shuo Liu, Yifan Hong, Xiaoxue Ma, Zhi Jin, and Ge Li. Exploring and unleashing the power of large language models in automated code translation. Proc. ACM Softw. Eng., 1(FSE):1585–1608, 2024. [18] Ali Reza Ibrahimzada, Kaiyao Ke, Mrigank Pawagi, Muhammad Salman Abid, Rangeet Pan, Saurabh Sinha, and Reyhaneh Jabbarvand. Alphatrans: A neuro-symbolic compositional approach for repository-level code translation and validation. Proc. ACM Softw. Eng., 2(FSE):2454–2476, 2025. 24
A PREPRINT - J UNE 11, 2026
[19] Seif Abukhalaf, Mohammad Hamdaqa, and Foutse Khomh. On codex prompt engineering for ocl generation: An empirical study. In 2023 IEEE/ACM 20th International Conference on Mining Software Repositories (MSR), pages 148–157, 2023. [20] Carl A. Gunter. Semantics of programming languages - structures and techniques. Foundations of computing. MIT Press, 1993. [21] Yangruibo Ding, Jinjun Peng, Marcus J. Min, Gail E. Kaiser, Junfeng Yang, and Baishakhi Ray. Semcoder: Training code language models with comprehensive semantics reasoning. In Amir Globersons, Lester Mackey, Danielle Belgrave, Angela Fan, Ulrich Paquet, Jakub M. Tomczak, and Cheng Zhang, editors, Advances in Neural Information Processing Systems 38: Annual Conference on Neural Information Processing Systems 2024, NeurIPS 2024, Vancouver, BC, Canada, December 10 - 15, 2024, 2024. [22] Jiho Shin, Sepehr Hashtroudi, Hadi Hemmati, and Song Wang. Domain adaptation for code model-based unit test case generation. In Maria Christakis and Michael Pradel, editors, Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis, ISSTA 2024, Vienna, Austria, September 16-20, 2024, pages 1211–1222. ACM, 2024. [23] Zhongyang Deng, Ling Xu, Chao Liu, Luwen Huangfu, and Meng Yan. Code semantic enrichment for deep code search. J. Syst. Softw., 207:111856, 2024. [24] Weifeng Sun, Zhenting Guo, Meng Yan, Zhongxin Liu, Yan Lei, and Hongyu Zhang. Method-level test-to-code traceability link construction by semantic correlation learning. IEEE Trans. Software Eng., 50(10):2656–2676, 2024. [25] He Jiang, Yufu Wang, Hao Lin, Peiyu Zou, Zhide Zhou, Ang Jia, Xiaochen Li, and Zhilei Ren. TIT: A treestructured instruction tuning approach for llm-based code translation, 2025. [26] Ming Zhu, Aneesh Jain, Karthik Suresh, Roshan Ravindran, Sindhu Tipirneni, and Chandan K. Reddy. Xlcost: A benchmark dataset for cross-lingual code intelligence. CoRR, abs/2206.08474, 2022. [27] Xuan Li, Shuai Yuan, Xiaodong Gu, Yuting Chen, and Beijun Shen. Few-shot code translation via task-adapted prompt learning. J. Syst. Softw., 212:112002, 2024. [28] Mohammad Abdullah Matin Khan, M. Saiful Bari, Xuan Do Long, Weishi Wang, Md. Rizwan Parvez, and Shafiq Joty. Xcodeeval: An execution-based large scale multilingual multitask benchmark for code understanding, generation, translation and retrieval. In Lun-Wei Ku, Andre Martins, and Vivek Srikumar, editors, Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), ACL 2024, Bangkok, Thailand, August 11-16, 2024, pages 6766–6805. Association for Computational Linguistics, 2024. [29] Bo Liu, Yihao Feng, Peter Stone, and Qiang Liu. FAMO: fast adaptive multitask optimization. In Alice Oh, Tristan Naumann, Amir Globerson, Kate Saenko, Moritz Hardt, and Sergey Levine, editors, Advances in Neural Information Processing Systems 36: Annual Conference on Neural Information Processing Systems 2023, NeurIPS 2023, New Orleans, LA, USA, December 10 - 16, 2023, 2023. [30] Bingchang Liu, Chaoyu Chen, Zi Gong, Cong Liao, Huan Wang, Zhichao Lei, Ming Liang, Dajun Chen, Min Shen, Hailian Zhou, Wei Jiang, Hang Yu, and Jianguo Li. Mftcoder: Boosting code llms with multitask fine-tuning. In Ricardo Baeza-Yates and Francesco Bonchi, editors, Proceedings of the 30th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, KDD 2024, Barcelona, Spain, August 25-29, 2024, pages 5430–5441. ACM, 2024. [31] Erwin Quiring, Alwin Maier, and Konrad Rieck. Misleading authorship attribution of source code using adversarial learning. In Nadia Heninger and Patrick Traynor, editors, 28th USENIX Security Symposium, USENIX Security 2019, Santa Clara, CA, USA, August 14-16, 2019, pages 479–496. USENIX Association, 2019. [32] Paras Jain, Ajay Jain, Tianjun Zhang, Pieter Abbeel, Joseph Gonzalez, and Ion Stoica. Contrastive code representation learning. In Marie-Francine Moens, Xuanjing Huang, Lucia Specia, and Scott Wen-tau Yih, editors, Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, EMNLP 2021, Virtual Event / Punta Cana, Dominican Republic, 7-11 November, 2021, pages 5954–5971. Association for Computational Linguistics, 2021. [33] Qinkai Zheng, Xiao Xia, Xu Zou, Yuxiao Dong, Shan Wang, Yufei Xue, Zihan Wang, Lei Shen, Andi Wang, Yang Li, Teng Su, Zhilin Yang, and Jie Tang. Codegeex: A pre-trained model for code generation with multilingual evaluations on humaneval-x. CoRR, abs/2303.17568, 2023. [34] DeepSeek-AI, Aixin Liu, Bei Feng, Bing Xue, Bingxuan Wang, Bochao Wu, Chengda Lu, Chenggang Zhao, Chengqi Deng, Chenyu Zhang, Chong Ruan, Damai Dai, Daya Guo, Dejian Yang, Deli Chen, Dongjie Ji, Erhang Li, Fangyun Lin, Fucong Dai, Fuli Luo, Guangbo Hao, Guanting Chen, Guowei Li, H. Zhang, Han Bao, Hanwei Xu, Haocheng Wang, Haowei Zhang, Honghui Ding, Huajian Xin, Huazuo Gao, Hui Li, Hui Qu, J. L. Cai, Jian 25
A PREPRINT - J UNE 11, 2026
Liang, Jianzhong Guo, Jiaqi Ni, Jiashi Li, Jiawei Wang, Jin Chen, Jingchang Chen, Jingyang Yuan, Junjie Qiu, Junlong Li, Junxiao Song, Kai Dong, Kai Hu, Kaige Gao, Kang Guan, Kexin Huang, Kuai Yu, Lean Wang, Lecong Zhang, Lei Xu, Leyi Xia, Liang Zhao, Litong Wang, Liyue Zhang, Meng Li, Miaojun Wang, Mingchuan Zhang, Minghua Zhang, Minghui Tang, Mingming Li, Ning Tian, Panpan Huang, Peiyi Wang, Peng Zhang, Qiancheng Wang, Qihao Zhu, Qinyu Chen, Qiushi Du, R. J. Chen, R. L. Jin, Ruiqi Ge, Ruisong Zhang, Ruizhe Pan, Runji Wang, Runxin Xu, Ruoyu Zhang, Ruyi Chen, S. S. Li, Shanghao Lu, Shangyan Zhou, Shanhuang Chen, Shaoqing Wu, Shengfeng Ye, Shirong Ma, Shiyu Wang, Shuang Zhou, Shuiping Yu, Shunfeng Zhou, Shuting Pan, T. Wang, Tao Yun, Tian Pei, Tianyu Sun, W. L. Xiao, and Wangding Zeng. Deepseek-v3 technical report. CoRR, abs/2412.19437, 2024. [35] OpenAI. GPT-4 technical report. CoRR, abs/2303.08774, 2023. [36] Qwen, :, An Yang, Baosong Yang, Beichen Zhang, Binyuan Hui, Bo Zheng, Bowen Yu, Chengyuan Li, Dayiheng Liu, Fei Huang, Haoran Wei, Huan Lin, Jian Yang, Jianhong Tu, Jianwei Zhang, Jianxin Yang, Jiaxi Yang, Jingren Zhou, Junyang Lin, Kai Dang, Keming Lu, Keqin Bao, Kexin Yang, Le Yu, Mei Li, Mingfeng Xue, Pei Zhang, Qin Zhu, Rui Men, Runji Lin, Tianhao Li, Tianyi Tang, Tingyu Xia, Xingzhang Ren, Xuancheng Ren, Yang Fan, Yang Su, Yichang Zhang, Yu Wan, Yuqiong Liu, Zeyu Cui, Zhenru Zhang, and Zihan Qiu. Qwen2.5 technical report, 2025. [37] Binyuan Hui, Jian Yang, Zeyu Cui, Jiaxi Yang, Dayiheng Liu, Lei Zhang, Tianyu Liu, Jiajun Zhang, Bowen Yu, Kai Dang, An Yang, Rui Men, Fei Huang, Xingzhang Ren, Xuancheng Ren, Jingren Zhou, and Junyang Lin. Qwen2.5-coder technical report. CoRR, abs/2409.12186, 2024. [38] Anton Lozhkov, Raymond Li, Loubna Ben Allal, Federico Cassano, Joel Lamy-Poirier, Nouamane Tazi, Ao Tang, Dmytro Pykhtar, Jiawei Liu, Yuxiang Wei, Tianyang Liu, Max Tian, Denis Kocetkov, Arthur Zucker, Younes Belkada, Zijian Wang, Qian Liu, Dmitry Abulkhanov, Indraneil Paul, Zhuang Li, Wen-Ding Li, Megan Risdal, Jia Li, Jian Zhu, Terry Yue Zhuo, Evgenii Zheltonozhskii, Nii Osae Osae Dade, Wenhao Yu, Lucas Krauß, Naman Jain, Yixuan Su, Xuanli He, Manan Dey, Edoardo Abati, Yekun Chai, Niklas Muennighoff, Xiangru Tang, Muhtasham Oblokulov, Christopher Akiki, Marc Marone, Chenghao Mou, Mayank Mishra, Alex Gu, Binyuan Hui, Tri Dao, Armel Zebaze, Olivier Dehaene, Nicolas Patry, Canwen Xu, Julian J. McAuley, Han Hu, Torsten Scholak, Sébastien Paquet, Jennifer Robinson, Carolyn Jane Anderson, Nicolas Chapados, and et al. Starcoder 2 and the stack v2: The next generation. CoRR, abs/2402.19173, 2024. [39] Marie-Anne Lachaux, Baptiste Rozière, Marc Szafraniec, and Guillaume Lample. DOBF: A deobfuscation pre-training objective for programming languages. In Advances in Neural Information Processing Systems 34: Annual Conference on Neural Information Processing Systems 2021, NeurIPS 2021, December 6-14, 2021, virtual, pages 14967–14979, 2021. [40] Marc Szafraniec, Baptiste Rozière, Hugh Leather, Patrick Labatut, François Charton, and Gabriel Synnaeve. Code translation with compiler representations. In The Eleventh International Conference on Learning Representations, ICLR 2023, Kigali, Rwanda, May 1-5, 2023. OpenReview.net, 2023. [41] Marcos Macedo, Yuan Tian, Pengyu Nie, Filipe Roseiro Côgo, and Bram Adams. INTERTRANS: leveraging transitive intermediate translations to enhance llm-based code translation. In 47th IEEE/ACM International Conference on Software Engineering, ICSE 2025, Ottawa, ON, Canada, April 26 - May 6, 2025, pages 1153–1164. IEEE, 2025. [42] Shuo Ren, Daya Guo, Shuai Lu, Long Zhou, Shujie Liu, Duyu Tang, Neel Sundaresan, Ming Zhou, Ambrosio Blanco, and Shuai Ma. Codebleu: a method for automatic evaluation of code synthesis. CoRR, abs/2009.10297, 2020. [43] Qihao Zhu, Daya Guo, Zhihong Shao, Dejian Yang, Peiyi Wang, Runxin Xu, Y Wu, Yukun Li, Huazuo Gao, Shirong Ma, et al. Deepseek-coder-v2: Breaking the barrier of closed-source models in code intelligence. arXiv preprint arXiv:2406.11931, 2024. [44] Longhui Zhang, Bin Wang, Jiahao Wang, Xiaofeng Zhao, Min Zhang, Hao Yang, Meishan Zhang, Yu Li, Jing Li, Jun Yu, and Min Zhang. Function-to-style guidance of LLMs for code translation. In Aarti Singh, Maryam Fazel, Daniel Hsu, Simon Lacoste-Julien, Felix Berkenkamp, Tegan Maharaj, Kiri Wagstaff, and Jerry Zhu, editors, Proceedings of the 42nd International Conference on Machine Learning, volume 267 of Proceedings of Machine Learning Research, pages 76273–76288. PMLR, 13–19 Jul 2025. [45] Yanlin Wang, Rongyi Ou, Yanli Wang, Mingwei Liu, Jiachi Chen, Ensheng Shi, Xilin Liu, Yuchi Ma, and Zibin Zheng. Effireasontrans: Rl-optimized reasoning for code translation, 2025. [46] Le Chen, Nuo Xu, Winson Chen, Bin Lei, Pei-Hung Lin, Dunzhi Zhou, Rajeev Thakur, Caiwen Ding, Ali Jannesari, and Chunhua Liao. Beyond code pairs: Dialogue-based data generation for llm code translation, 2025. 26
A PREPRINT - J UNE 11, 2026
[47] Xin Wang, Yasheng Wang, Fei Mi, Pingyi Zhou, Yao Wan, Xiao Liu, Li Li, Hao Wu, Jin Liu, and Xin Jiang. Syncobert: Syntax-guided multi-modal contrastive pre-training for code representation, 2021. [48] Fang Liu, Jia Li, and Li Zhang. Syntax and domain aware model for unsupervised program translation. In 45th IEEE/ACM International Conference on Software Engineering, ICSE 2023, Melbourne, Australia, May 14-20, 2023, pages 755–767. IEEE, 2023. [49] Yufan Huang, Mengnan Qi, Yongqiang Yao, Maoquan Wang, Bin Gu, Colin B. Clement, and Neel Sundaresan. Program translation via code distillation. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, EMNLP 2023, Singapore, December 6-10, 2023, pages 10903–10914. Association for Computational Linguistics, 2023. [50] Fazle Rabbi, Soumit Kanti Saha, Tri Minh Triet Pham, Song Wang, and Jinqiu Yang. Babelcoder: Agentic code translation with specification alignment. CoRR, abs/2512.06902, 2025. [51] Bo Wang, Tianyu Li, Ruishi Li, Umang Mathur, and Prateek Saxena. Program skeletons for automated program translation. Proc. ACM Program. Lang., 9(PLDI), June 2025. [52] Minghua He, Fangkai Yang, Pu Zhao, Wenjie Yin, Yu Kang, Qingwei Lin, Saravan Rajmohan, Dongmei Zhang, and Qi Zhang. Execoder: Empowering large language models with executability representation for code translation. CoRR, abs/2501.18460, 2025. [53] Chaofan Wang, Tingrui Yu, Jie Wang, Dong Chen, Wenrui Zhang, Yuling Shi, Xiaodong Gu, and Beijun Shen. EVOC2RUST: A skeleton-guided framework for project-level c-to-rust translation. CoRR, abs/2508.04295, 2025. [54] Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin de Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for NLP. In Kamalika Chaudhuri and Ruslan Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pages 2790–2799. PMLR, 2019.
A
Prompt Templates for Multi-Semantic Data Construction
A.1
Semantic Generation Prompt
Semantic Generation Prompt You are an expert [Lang] developer and software engineer. I will provide you with a [Lang] function and any external APIs it uses. Your task is to generate the following outputs: 1. Code Summary 2. Function Test Cases 3. External API Comments and Test Cases [Code] [API List]
A.2
Semantic Refinement Prompt
Semantic Refinement Prompt You are an expert [Lang] developer and software engineer. Based on the validation feedback, adjust the test cases for the function or specified API to resolve the reported issues. [Target Function/API] [Corrective Signal]
27
A PREPRINT - J UNE 11, 2026
B
Multi-Task Optimization Details of the Multi-Semantic Augmentation Model
B.1
Token-Level Normalization Across Semantic Tasks
Due to the heterogeneity of semantic generation tasks, different tasks exhibit substantial variation in dataset size and output sequence length. Directly aggregating task-level losses without normalization may introduce bias toward tasks with longer sequences or larger datasets. To mitigate this issue, we normalize the loss of each task by the number of valid target tokens. For task Ti with dataset (j) (j) i Di = {(xi , yi )}M j=1 , the normalized loss is defined as: PMi PTij Li (θ) =
k=1 − log pθ (tijk ) PMi j=1 Tij
j=1
(10)
where Tij denotes the number of valid tokens in the j-th sample, tijk represents the k-th target token, and pθ (tijk ) is the predicted probability under parameters θ. This normalization ensures that the contribution of each task reflects its intrinsic semantic complexity rather than its sequence length. B.2
Focal Adjustment for Task Difficulty
Different semantic tasks vary in abstraction level and prediction difficulty. To prevent easy samples from dominating optimization, we introduce a focal-style adjustment mechanism that emphasizes relatively hard instances. For task Ti , the focal-adjusted loss is defined as: M
Lfocal (θ) = i
1 Xi αi · (1 − Cij )γ · Qij , Mi j=1
(11)
1 X Qij = − log pθ (tijk ) Tij k
where Cij denotes the mean token-level confidence of sample j, αi is a task-level coefficient, and γ controls the focusing strength. This mechanism reduces the gradient contribution of high-confidence (easy) samples and increases emphasis on more challenging semantic predictions. B.3
Adaptive Task Weighting
To coordinate convergence across heterogeneous semantic objectives, we adopt an adaptive weighting strategy inspired by FAMO. At iteration t, the aggregated gradient is computed as: N X
(t)
(12)
θt+1 = θt − ηgt
(13)
gt =
wi ∇θt Li (θt )
i=1
with parameter update:
Task weights are updated according to the relative improvement: 28
A PREPRINT - J UNE 11, 2026
(t+1)
wi
= PN
ci (η, gt )
j=1 cj (η, gt ) + ε
,
Li (θt ) − Li (θt − ηgt ) ci (η, gt ) = Li (θt ) + ε
(14)
where ε ensures numerical stability. This update reflects the relative convergence speed of each task under the current optimization direction. B.4
Final Multi-Task Objective
The final optimization objective integrates the normalized multi-task loss and the focal-adjusted component:
LMultisage (θ) = λ1 L(θ) + λ2
N X
Lfocal (θ) i
(15)
i=1
where λ1 and λ2 control the relative contribution of the base and focal terms. To improve parameter efficiency, we employ PEFT [54] to fine-tune a small subset of parameters while keeping the backbone largely frozen. B.5
Hyperparameter Settings
Following [30], we set the focusing parameter to γ = 2 and the stability constant to ε = 1 × 10−6 . Unless otherwise specified, λ1 = 1 and λ2 = 1. B.6
Equivalence Mutator: Transformation Rules
This section details the static semantics-preserving transformations used by the equivalence mutator.
C
Equivalence Mutator: Transformation Rules
C.0.1
Expression-Level Transformations
Expression-level rewrites are applied to side-effect-free expressions. Typical transformation patterns include: • Commutative reordering: a + b ↔ b + a • Neutral updates: x = x + 0, x = x × 1 • Boolean equivalence rewrites (e.g., De Morgan’s laws) These transformations are applied only when type consistency and absence of side effects are verified via static analysis. C.0.2
Control-Flow–Preserving Transformations
Control-flow transformations modify the syntactic structure of branching and looping constructs while preserving execution semantics. Representative patterns include: • Negating branch predicates and swapping branch bodies • Refactoring nested conditionals into equivalent cascades • Rewriting conditional expressions into explicit if-else statements All control-flow rewrites are performed under CFG constraints to ensure that reachable execution paths and guard conditions remain semantically equivalent. 29
A PREPRINT - J UNE 11, 2026
10
20
DeepSeek-V3 GPT-4 Turbo Qwen-Plus
10
8
15
Qwen25-Coder-Instruct-33B StarCoder2-15B
8
-2
-9 −10
0 −5
−10
-17
−20
0
−15
-30
-4 −5
-4 -7
−10
-9 -12
-17
−15
-14
−30
−20
-33
−20
-19
−40
-22
−25
A
B
C
A
B
A
C
Error Type
Error Type
(a)
(b)
(c)
DeepSeek-V3 GPT-4 Turbo Qwen-Plus
10
15
Qwen25-Coder-Instruct-33B StarCoder2-15B
6
10
5
10
11
Δ Errors
-1
-8
−5
0
0 -2
−5
-6 −10
-12 −10
−20
-14
-25 −15
A
B
C
-10
A
B
-15 −15
-18
−20
-15
-27
−30
StarCoder2-7B Qwen2.5-Coder-7B 7
0
0
Δ Errors
1
−10
C
5
00
0
B
Error Type
20
Δ Errors
5
0
Δ Errors
Δ Errors
-1
5
0
Δ Errors
0 0
StarCoder2-7B Qwen2.5-Coder-7B
10
5
C
A
B
Error Type
Error Type
Error Type
(d)
(e)
(f)
-20
C
Figure 8: Error distribution shifts under Multisage and Multisage (Repair). Each error type corresponds to a representative category defined in the Motivation section. (a) HP-LLMs with Multisage. (b) MS-LLMs with Multisage. (c) ℓLLMs with Multisage. (d) HP-LLMs with Multisage (Repair). (e) MS-LLMs with Multisage (Repair). (f) ℓLLMs with Multisage (Repair). C.0.3
API-Level Equivalent Substitutions
When multiple standard library functions provide equivalent functionality under identical preconditions, we substitute calls with verified alternatives. These substitutions are restricted to a curated set of API pairs that have been manually validated to preserve parameter and return-type contracts. Mutants that fail compilation or execution checks are discarded during validation.
D
Error Distribution Analysis
To better understand the impact of semantic augmentation on translation failures, we analyze the distribution of error types before and after applying Multisage. The results are shown in Fig. 8. Overall, errors related to dependency reasoning and data interpretation decrease substantially after introducing semantic augmentation, particularly for small and mid-scale models. In contrast, model-specific errors remain relatively stable, suggesting that these failures are primarily determined by model capacity rather than missing semantic information. These observations further support the conclusion that a large portion of translation failures arises from missing or misinterpreted semantic constraints.
E
Backbone Sensitivity Analysis
To evaluate whether the effectiveness of the multi-task fine-tuning module depends on the specific backbone model, we instantiated the module with four alternative backbones: CodeLlama-13B, StarCoder2-15B, CodeLlama-7B, and Qwen2.5-Coder-7B. All other components of Multisage were kept unchanged. Table 12 reports the translation success rates under these configurations. 30
A PREPRINT - J UNE 11, 2026
Table 12: Translation success rates (%) of Multisage under different fine-tuning backbones. Rows denote the evaluated translation models, while columns correspond to the backbone models used to instantiate the multi-task augmentation module. Fine-Tuning Backbone for the Multi-Task Augmentation Module Translation Model CodeLlama-13B StarCoder2-15B CodeLlama-7B Qwen2.5-Coder-7B DeepSeek-V3 95.73 90.24 87.80 89.02 GPT-4 Turbo 82.32 75.61 73.17 74.39 Qwen-Plus 90.24 83.54 81.10 82.32 Qwen25-Coder-Instruct-33B 84.15 78.66 76.22 76.83 StarCoder2-15B 71.34 64.02 60.98 60.98 StarCoder2-7B 31.10 25.61 23.17 24.39 Qwen2.5-Coder-7B 62.80 56.71 54.27 54.88 Table 13: Full results on Java-to-Python translation. Model Succ. (%) Specialized Translation Models TransCoder 28.05 DOBF 31.71 TransCoder-ST 40.24 TransCoder-IR 45.12 INTERTRANS 67.07 Baseline LLMs DeepSeek-V3 90.24 GPT-4 Turbo 78.05 Qwen-Plus 81.10 Qwen2.5-Coder-33B 86.59 StarCoder2-15B 58.54 StarCoder2-7B 23.17 Qwen2.5-Coder-7B 56.10 + Multisage DeepSeek-V3 96.34 GPT-4 Turbo 92.68 Qwen-Plus 90.85 Qwen2.5-Coder-33B 93.29 StarCoder2-15B 70.73 StarCoder2-7B 46.95 Qwen2.5-Coder-7B 69.51
CodeBLEU (%) 61.24 64.87 60.09 55.63 34.51 50.27 45.83 47.15 48.39 36.42 21.76 34.58 57.34 52.16 55.48 56.27 45.63 31.29 43.10
Although absolute performance varies across backbone choices, the relative improvement trends remain consistent, indicating that Multisage does not rely on a specific fine-tuning backbone.
F
Supplementary Analysis on Java-to-Python Translation
To provide a more comprehensive view of model-level performance, we present the detailed results for all evaluated models in Table 13. The table includes both baseline performance and results enhanced by Multisage.
31