Bridge-Coder: Unlocking LLMs' Potential to Overcome Language Gaps in Low-Resource Code

Jipeng Zhang, Jianshu Zhang, Yuanzhe Li, Renjie Pi, Rui Pan, Runtao Liu, Ziqiang Zheng, Tong ZhangarXiv 2024 · DOI

Introduction

Large Language Models (LLMs) have revolutionized software development, demonstrating remarkable proficiency in high-resource programming languages (HRPLs) like Python, Java, and C++. However, this progress is unevenly distributed. For developers working with low-resource programming languages (LRPLs)—such as R, Racket, D, or Bash—the performance of even state-of-the-art models often degrades significantly. This disparity stems from the NL-PL Gap: the difficulty of mapping Natural Language (NL) instructions to Programming Language (PL) syntax when aligned instruction-code data is scarce.

The Bridge-Coder Framework

To address this gap, the authors introduce Bridge-Coder, a two-stage framework that leverages high-resource languages as a logical "bridge" to synthesize high-quality training data and perform progressive alignment.

1. Bridge-Assisted Generation

The first stage focuses on generating high-quality synthetic data through a three-step pipeline:

  • Task Screening: An LLM filters tasks to ensure they are solvable in the target LRPL, preventing dataset pollution.
  • Code-Bridge Synthesis: The model generates a solution in Python (an HRPL) with detailed comments. This "code-bridge" provides a logical blueprint for the task.
  • Guided Code Transfer: Using In-Context Learning (ICL), the model translates the logic from the Python bridge into the target LRPL.

2. Bridged Alignment

The model then undergoes a curriculum-based training process:

  • Assist Alignment: The model learns to generate LRPL code given both the NL instruction and the Python code-bridge.
  • Direct Alignment: The model is fine-tuned to generate LRPL code directly from the NL instruction, removing the intermediate bridge.
Overview of the Bridge-Coder framework, including the data generation pipeline and the two-stage alignment process.

Experimental Results

The researchers evaluated Bridge-Coder using M-HumanEval and M-MBPP, multilingual adaptations of standard benchmarks. The results across R, D, Bash, and Racket demonstrate substantial improvements over baseline models.

Performance comparison on M-HumanEval and M-MBPP benchmarks across four low-resource languages.

As shown in the results table, the Bridge-Coder version of DeepSeek-Coder-Base (DeepSeek-Coder-BC) achieved an average score of 42.30 on M-HumanEval, an improvement of +18.71 points over the base model. Notably, it outperformed specialized models like Magicoder-S-DS across all tested languages, showing significant gains even in challenging environments like Racket (+21.73 points).

Key Insights

  • Python as a Logical Lingua Franca: By using Python as an intermediate step, the framework reduces the cognitive load of generating code in unfamiliar syntax, leveraging the model's deep understanding of Python logic.
  • The Power of Comments: Natural language comments within the code-bridge are crucial for mapping abstract intent to concrete implementation.
  • Curriculum Learning: The transition from assisted to direct alignment is vital for stability and generalization, ensuring the model can eventually perform without the "training wheels" of the bridge.

Conclusion and Future Work

Bridge-Coder effectively unlocks the potential of LLMs for low-resource languages by bridging the data gap with high-resource logic. While the current focus is on snippet-level generation, future work will aim to extend this approach to repository-level code generation and multi-turn debugging scenarios.

Summary updated

BibTeX
@misc{zhang2024bridge,
  author = {Jipeng Zhang and Jianshu Zhang and Yuanzhe Li and Renjie Pi and Rui Pan and Runtao Liu and Ziqiang Zheng and Tong Zhang},
  title = {{Bridge-Coder: Unlocking LLMs' Potential to Overcome Language Gaps in Low-Resource Code}},
  year = {2024},
  eprint = {2410.18957},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.18957},
}
Figure