arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2310.16937cs.CL
收藏

编程语言中的跨语言迁移:一项广泛的实证研究

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

Department of Electrical and Computer Engineering(电气与计算机工程系);University of Illinois at Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校);IBM Research(IBM研究院)

Razan Baltaji, Saurabh Pujar, Louis Mandel, Martin Hirzel, Luca Buratti, Lav Varshney

AI总结:

本文通过覆盖10至41种语言和五项代码任务的大规模实证研究,评估高资源到低资源编程语言的迁移学习,并构建模型预测最佳源语言。

摘要:

大语言模型(LLM)已在错误检测、克隆检测和代码翻译等各种软件工程任务中取得最先进性能,这些任务主要利用 Python 和 Java 等高资源编程语言。然而,许多关键语言(如 COBOL)以及新兴语言(如 Rust 和 Swift)由于公开可用代码有限,仍属于低资源语言。这种稀缺性阻碍了 LLM 在这些语言上的训练和有效性,增加了软件维护成本并抑制了创新。为弥补这一差距,我们研究了迁移学习的潜力,即通过利用来自高资源对应语言的数据来提升 LLM 在低资源编程语言上的性能。我们的广泛实证研究评估了跨 10 至 41 种编程语言以及五项关键任务的可迁移性:代码生成、克隆检测、代码修复、解决方案领域分类和错误检测。此外,我们开发了一个性能预测模型,用于针对给定目标语言和任务推测最佳源语言,并分析影响迁移性能的特征。我们还使用一个更大的模型复现了具有代表性的实验子集,以检验我们的结论对当代大规模 LLM 的普适性。研究结果表明,跨语言迁移显著优于零样本学习,其有效性因源语言和目标语言而异。此外,我们的模型通过考虑语言特征和数据集特定特征,能够可靠地预测成功的迁移来源,从而为数据获取和模型训练提供实用指导。本工作有助于开发面向低资源编程语言的 LLM 驱动工具,并为促进跨语言对迁移的特征提供洞见。

英文摘要:

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

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑