Abstract
Large Language Models (LLMs) exhibit a significant performance disparity between high-resource programming languages like Python and low-resource languages such as Haskell or Go. This paper introduces OORL (On-policy and Off-policy Reinforcement Learning), a framework designed to bridge this "capability gap" by treating coding logic as a universal property independent of syntax. OORL combines on-policy rewards derived from unit tests with a novel Group Equivalent Preference Optimization (GEPO) method. GEPO leverages compiler Intermediate Representations (IRs) to recognize functional equivalence across diverse implementations, effectively teaching models to prioritize logical consistency over syntactic patterns. Experimental results on the MultiPL-E and the newly introduced CrossPLEval benchmarks demonstrate that OORL significantly enhances the cross-language transfer of programming intelligence, with the Qwen3-8B-OORL model outperforming substantially larger counterparts.
Introduction
While modern LLMs have achieved remarkable proficiency in popular programming ecosystems, their utility diminishes sharply when applied to less common languages. This discrepancy stems from the skewed distribution of training data, where Python and C++ dominate the corpus. The fundamental challenge in multi-language understanding is not necessarily a lack of logical reasoning, but a barrier in syntax mapping.
Existing preference optimization techniques, such as Direct Preference Optimization (DPO), often struggle with the "coarse-grained" nature of code. In programming, a single logical objective can be achieved through numerous distinct but functionally identical implementations. Standard binary preference models (comparing one "winner" to one "loser") fail to account for this equivalence, often leading to over-fitting on specific coding styles rather than the underlying logic. To address this, we propose OORL and its core component, GEPO, to treat functional equivalence as a group property.
Methodology
The OORL framework utilizes a dual-signal approach to refine the model’s programming capabilities:
1. On-Policy Reinforcement Learning
To ensure basic correctness, the model generates code and receives immediate, rule-based feedback. This on-policy signal is binary: the code either compiles and passes unit tests, or it does not. This stage anchors the model in the practical reality of execution, ensuring that the generated syntax is valid and functionally sound within the target language's environment.
2. Group Equivalent Preference Optimization (GEPO)
GEPO represents the primary innovation of this work. It shifts the focus from surface-level syntax to deep logic by utilizing Compiler Intermediate Representations (IRs). IRs serve as a "universal language" for logic, stripping away syntactic sugar to reveal the raw computational flow.
- IR Translation: The model is trained to translate high-level code into LLVM IRs. Because different syntactic approaches often compile to the same or similar IRs, the IR acts as a ground truth for logical intent.
- Variance Constraint: Unlike standard DPO, GEPO operates on groups of equivalent responses. The framework explicitly penalizes the model if it assigns significantly different reward scores to different IRs that are functionally equivalent. By minimizing this variance, the model learns that multiple paths can lead to the same logical destination, fostering a more robust understanding of code equivalence.
Experimental Setup
Datasets
The training pipeline utilized 2,400 translation problems from SYNTHETIC-1 and APPS for on-policy RL, alongside 9,600 C-to-IR groups from the SLTrans dataset for GEPO.
For evaluation, the study employed:
- MultiPL-E: A standard benchmark for cross-language code generation.
- CrossPLEval: A new, rigorous benchmark introduced by the authors. It consists of 119 core problems from the TACO dataset, manually translated into Java, Go, C++, and Python, resulting in 3,920 independent coding tasks with extensive unit test coverage.
Results and Discussion
The application of OORL to the Qwen3-8B base model yielded substantial performance gains across all tested languages.
Benchmark Performance
Qwen3-8B-OORL achieved an average score of 76.31 on MultiPL-E, a marked improvement over the base model's 65.07. Notably, it outperformed larger models such as Qwen2.5-Coder-7B-Inst (68.71), suggesting that the OORL framework is highly efficient at extracting capability from smaller parameter counts.
Low-Resource Language Gains
The impact was most pronounced in low-resource scenarios. On the CrossPLEval benchmark, the model's ability to translate from Python to Haskell nearly doubled compared to the base model. This confirms that by focusing on IR-based logic, the model successfully transfers its "intelligence" from high-resource languages to those with sparse training data.
Ablation Studies
Ablation tests confirmed that GEPO is the critical driver of these improvements. Replacing GEPO with standard pairwise DPO resulted in significantly lower performance, validating the hypothesis that modeling functional equivalence as a group property is essential for complex structured tasks like programming.
Conclusion and Future Work
OORL and GEPO provide a scalable pathway for improving LLM performance in specialized or low-resource programming domains. By utilizing IRs as a bridge for logic and enforcing variance constraints on equivalent code groups, the framework moves beyond simple pattern matching toward true logical understanding.
Future research will focus on reducing the computational overhead associated with processing large groups of responses and exploring the application of group equivalence to other structured reasoning tasks, such as formal mathematical proofs.
Summary updated