Cross-lingual Transfer in Programming Languages: An Extensive Empirical Study

  • 2025-06-10 15:10:33
  • Razan Baltaji, Saurabh Pujar, Louis Mandel, Martin Hirzel, Luca Buratti, Lav Varshney
  • 0

Abstract

Large language models (LLMs) have achieved state-of-the-art performance invarious software engineering tasks, including error detection, clone detection,and code translation, primarily leveraging high-resource programming languageslike Python and Java. However, many critical languages, such as COBOL, as wellas emerging languages, such as Rust and Swift, remain low-resource due tolimited openly available code. This scarcity hampers the training andeffectiveness of LLMs for these languages, increasing software maintenancecosts and stifling innovation. Addressing this gap, we investigate thepotential of transfer learning to enhance LLM performance on low-resourceprogramming languages by leveraging data from high-resource counterparts. Ourextensive empirical study evaluates transferability across 10 to 41 programminglanguages and five key tasks: code generation, clone detection, code repair,solution domain classification, and error detection. Additionally, we develop aperformance prediction model to guess the best source languages for a giventarget and task, and analyze the features that influence transfer performance.We further replicate a representative subset of experiments with a larger modelto test the generalizability of our conclusions to contemporary large-scaleLLMs. Our findings demonstrate that cross-lingual transfer significantlyoutperforms zero-shot learning, with effectiveness varying based on both sourceand target languages. Furthermore, our model reliably predicts successfultransfer sources by considering linguistic and dataset-specific features,offering practical guidance for data acquisition and model training. This workcontributes to the development of LLM-driven tools for low-resource programminglanguages and provides insights into the characteristics that facilitatetransfer across language pairs.

 

Quick Read (beta)

loading the full paper ...