Modern language models demonstrate impressive coding capabilities in common programming languages (PLs), such as C++ and Python, but their performance in lower-resource PLs is often limited by training data availability. In principle, however, most programming skills are universal across PLs, so the capability acquired in one PL should transfer to others. In this work, we propose the task of zero-shot cross-programming-language transfer for code RL. We find that, for Llama-3.1, RL training for code generation in a source PL fails to improve, and sometimes even degrades, the performance on other target PLs. To address this, we hypothesize that effective RL transfer requires a generalizable SFT initialization before RL. We thus propose **Parallel-SFT**, an SFT strategy that incorporates "parallel programs" -- functionally equivalent code implemented in multiple PLs -- into the data mixture. We demonstrate that this improves transferability: when we subsequently perform RL on our Parallel-SFT model, we observe better generalization to unseen PLs. Analysis of the model internal representations reveals that Parallel-SFT leads to a more functionality-centric latent space, where equivalent programs across PLs are more tightly clustered, which we hypothesize to contribute to the improved transferability.


翻译:现代语言模型在常见编程语言(如C++和Python)中展现出令人瞩目的编码能力,但在低资源编程语言上的表现常受限于训练数据的可用性。然而,从原理上看,大多数编程技能在不同编程语言间具有通用性,因此在一个语言中获取的能力应能迁移至其他语言。本文提出了代码强化学习的零样本跨编程语言迁移任务。我们发现,对于Llama-3.1而言,针对源编程语言的代码生成进行强化学习训练,不仅未能提升目标语言的性能,有时甚至会导致性能下降。为解决此问题,我们假设有效的强化学习迁移需要在进行强化学习之前具备可泛化的SFT初始化。为此,我们提出**Parallel-SFT**,一种将"并行程序"——即用多种编程语言实现的功能等价代码——纳入数据混合的SFT策略。实验证明,该策略能提升迁移能力:当我们在Parallel-SFT模型上执行强化学习时,可观察到对未见编程语言更好的泛化效果。模型内部表示分析表明,Parallel-SFT能够构建更以功能为中心的潜在空间,在该空间中不同编程语言的等价程序聚类更紧密,我们推测这是迁移能力提升的关键因素。

0
下载
关闭预览

相关内容

人们为了让计算机解决各种棘手的问题,使用编程语言 编写程序代码并通过计算机运算得到最终结果的过程。
通过强化学习增强代码生成中的代码大语言模型:综述
专知会员服务
29+阅读 · 2025年1月1日
【Google】高效Transformer综述,Efficient Transformers: A Survey
专知会员服务
66+阅读 · 2022年3月17日
绝对干货!NLP预训练模型:从transformer到albert
新智元
13+阅读 · 2019年11月10日
福利 | 当Python遇上大数据与机器学习,入门so easy!
关于强化学习(附代码,练习和解答)
深度学习
38+阅读 · 2018年1月30日
国家自然科学基金
40+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
31+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2015年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
23+阅读 · 2009年12月31日
VIP会员
最新内容
网状网络及其在军事领域的运用
专知会员服务
1+阅读 · 今天6:18
无美国参与的欧洲战争方式(万字长文)
专知会员服务
2+阅读 · 今天5:54
《国防领域敏感性分析白皮书》
专知会员服务
2+阅读 · 今天3:42
综述 | 从问答到任务完成:Agent系统与Harness设计
Agentic RL:框架、实践与长程智能体训练
专知会员服务
3+阅读 · 6月24日
重新思考无人机时代的生存能力
专知会员服务
7+阅读 · 6月24日
装甲突击旅:现代战争思考、战斗与组织
专知会员服务
5+阅读 · 6月24日
在人工智能加速决策环境中拓展OODA循环
专知会员服务
7+阅读 · 6月24日
军事欺骗:供作战战术指挥官使用的工具
专知会员服务
5+阅读 · 6月24日
相关VIP内容
通过强化学习增强代码生成中的代码大语言模型:综述
专知会员服务
29+阅读 · 2025年1月1日
【Google】高效Transformer综述,Efficient Transformers: A Survey
专知会员服务
66+阅读 · 2022年3月17日
相关基金
国家自然科学基金
40+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
5+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
31+阅读 · 2015年12月31日
国家自然科学基金
12+阅读 · 2015年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
23+阅读 · 2009年12月31日
Top
微信扫码咨询专知VIP会员