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最好的免费在线电子书
程序猿
56+阅读 · 2018年5月17日
福利 | 当Python遇上大数据与机器学习,入门so easy!
国家自然科学基金
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日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
VIP会员
最新内容
综述 | 从问答到任务完成:Agent系统与Harness设计
Agentic RL:框架、实践与长程智能体训练
专知会员服务
2+阅读 · 6月24日
重新思考无人机时代的生存能力
专知会员服务
5+阅读 · 6月24日
装甲突击旅:现代战争思考、战斗与组织
专知会员服务
4+阅读 · 6月24日
在人工智能加速决策环境中拓展OODA循环
专知会员服务
4+阅读 · 6月24日
军事欺骗:供作战战术指挥官使用的工具
专知会员服务
4+阅读 · 6月24日
综述 | 世界动作模型:少做梦,多行动
专知会员服务
6+阅读 · 6月23日
美以伊冲突:无人机与人工智能的运用
专知会员服务
10+阅读 · 6月23日
《特种部队在透明战场中的生存力》最新报告
专知会员服务
5+阅读 · 6月23日
相关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日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
8+阅读 · 2014年12月31日
国家自然科学基金
4+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员