Bridge-Coder: Transferring Model Capabilities from High-Resource to Low-Resource Programming Language (2025)

Abstract: Most LLMs universally excel at generating code for high-resource programming languages (HRPLs) like Python, a capability that has become standard due to the abundance of training data. However, they struggle significantly with low-resource programming languages (LRPLs) such as D, exacerbating the digital divide. This gap limits developers using LRPLs from equally benefiting and hinders innovation within underrepresented programming communities. To make matters worse, manually generating data for LRPLs is highly labor intensive and requires expensive expert effort. In this work, we begin by analyzing the NL-PL Gap, where LLMs’ direct-generated LRPL data often suffers from subpar quality due to the misalignment between natural language (NL) instructions and programming language (PL) outputs. To address this issue, we introduce Bridge-Assist Generation, a method to generate LRPL data utilizing LLM’s general knowledge, HRPL proficiency, and in-context learning capabilities. To further maximize the utility of the generated data, we propose Bridged Alignment to obtain Bridge-Coder. To thoroughly evaluate our approach, we select four relatively LRPLs: R, D, Racket, and Bash. Experimental results reveal that Bridge-Coder achieves significant improvements over the original model, with average gains of 18.71 and 10.81 on two comprehensive benchmarks, M-HumanEval and M-MBPP.

## introduction large language models (llms) have shown remarkable capabilities @xcite in assisting with coding tasks such as code generation @xcite , debugging @xcite , code explanation @xcite . with the introduction of tools like github copilot @xcite when responding to such tasks, models' response involves both natural language (nl) and programming language (pl). however, due to the lack of training data in lrpls, the nl-pl gap makes it challenging for models to generate accurate responses directly. in contrast, code-bridge mitigates this gap by leveraging the model's proficiency in hrpls to generate an intermediate nl-pl aligned process. this intermediate step serves as a bridge, guiding the model to produce more accurate and coherent responses in lrpls. models like openai codex @xcite have greatly enhanced the efficiency of developers by automating repetitive tasks, providing real-time code suggestions, and offering in-depth explanations of code functionality. however, when it comes to low-resource programming languages (lrpls), the instructionfollowing abilities of llms are significantly diminished @xcite . this limits llms' ability to effectively support developers working with lrpls @xcite , preventing these developers from fully benefiting from the advanced capabilities that llms provide for high-resource programming languages (hrpls). this uneven distribution of benefits exacerbates digital inequality, further widening the gap between developers in different programming ecosystems. while research has been conducted on lowresource natural languages (lrnls) @xcite @xcite @xcite , lrpls remain relatively underexplored and present distinct challenges. first, unlike nls, where one language can address a broad range of tasks, specific pls are often designed for specialized domains, limiting their versatility. second, programming demands greater attention to the logical structure and coherence of pl. finally, programming tasks require generating responses that seamlessly combine both nl (e.g., instructions or comments) and pl (the actual code), adding a significant layer of complexity to lrpls. as illustrated in figure 1 , this interplay between nl and pl introduces what we refer to as the nl-pl gap-a disconnect arising from the need to align nl instructions with outputs in both nl and pl. while llms exhibit some proficiency in lr-pls derived from indirect sources, this gap limits their fully ability and often results in suboptimal outputs. however, by first leveraging llms' capabilities in hrpls to generate an intermediate code-bridge, the model can produce more accurate responses. the code-bridge, which contains both the hrpl solution and nl-formatted comments explaining it, replaces purely nl-based instructions. this approach offers two key benefits: (1) enhancing task comprehension by incorporating both nl and pl information, and (2) leveraging pl's logical structure to guide the generation of more accurate and coherent outputs in lrpls. in light of this, we propose a two-stage approach to develop an enhanced model, bridge-coder, for improving performance in lrpls. the first stage, bridge-assisted generation, begins by leveraging llms' general knowledge for task screening to ensure that the selected tasks are answerable within the lrpl context. we then synthesize the code-bridge and let llms use in-context learning abilities to reference this bridge when responding to instructions in lrpls, enabling it to generate more accurate and coherent results. given the existence of the nl-pl gap, it is critical to effectively utilize this data to help llms better address lrpl tasks. to this end, the second stage, bridged alignment, begins with assisted alignment, where intermediate guidance is provided to help the llm gradually bridge the nl-pl gap, avoiding an abrupt learning leap. this is followed by direct alignment, which focuses on enhancing the model's ability to independently respond to nl instructions in lrpls. to thoroughly evaluate our approach, we select four functionally diverse yet relatively low-resource programming languages (lrpls): r, d, racket, and bash. we conduct experiments on two comprehensive benchmarks, m-humaneval and n-mbpp, each featuring hundreds of tasks per language that require passing numerous test cases to ensure correctness. the results demonstrate that our method significantly enhances the model's performance in lrpls. additionally, we perform extensive experiments to validate the technical choices within our approach, which may offer valuable insights into the underexplored domain of low-resource programming languages. in summary, our contributions are: ## nl-pl gap the nl-pl gap refers to the disparity that arises when llms are tasked with following natural language (nl) instructions in programming language (pl). this gap is particularly pronounced in lowresource programming languages (lrpls). the nl-pl gap stems from the following key factors: data imbalance. the statistics in complexity of mapping nl to pl. unlike purely natural language tasks, coding tasks require models to first understand nl instructions and then generate executable pl code, often together with nl comments to explain the code. in hrpls, models excel due to the abundance of nl-pl aligned data. however, for lrpls, this mapping is more difficult due to limited data. as shown in our experiments, directly generating code for lrpls leads to lower-quality outputs, whereas using a code-bridge as a transitional step improves code quality by mitigating the nl-pl gap. ## methodology in this section, we present the details of our approach to obtain bridge-coder, including two phases: bridge-assisted generation (section 4.1) and bridged alignment (section 4.2). the key idea of bridge-assisted generation is fully leveraging llms' intrinsic capabilities to generate instruction following data for low-resouce programming languages (lrpls). afterward, bridged alignment gradually helps the model overcome the nl-pl gap, improving its performance on lrpls. an illustration of bridge-coder is shown in figure 2 . ## conclusion this paper tackles the challenge of generating highquality programs in low-resource languages. by leveraging llms' intrinsic abilities and expertise in high-resource programming languages, we create a new, high-quality dataset for low-resource languages. we also propose a progressive alignment to mitigate the gap. experimental results show our methods significantly outperform the baseline.