让大模型学会用任意编程语言写代码,只需改个配置文件。
Agnostics: Learning to Code in Any Programming Language via Reinforcement with a Universal Learning Environment
- 用输入输出格式统一测试数据,一套验证器通吃所有语言。
- 在五种低资源语言上,小模型性能媲美更大模型。
- 只需修改YAML配置,即可在任意语言上做强化训练。
大型语言模型在高资源语言(如Python、JavaScript)上表现优异,但在科学与工程中仍重要的低资源语言上却表现不佳。除预训练数据不足外,后训练也成瓶颈:每新增一种语言都需要新数据集、测试框架和强化学习基础设施。本文提出Agnostics,一种语言无关的后训练流程,通过仅根据代码外部行为评判,实现单一验证器支持任意语言。具体包括:(i) 用LLM将现有单元测试重写为I/O格式;(ii) 提供简短配置说明如何编译运行目标语言;(iii) 在稳定执行环境中使用可验证奖励的强化学习(RLVR)。应用于Lua、Julia、R、OCaml和Fortran五种低资源语言,Agnostics使Qwen-3 4B性能达到其他16B–70B开源模型水平;可扩展至更大模型族(Qwen-3 8B、DeepSeek Coder 6.7B Instruct、Phi 4 Mini);对≤16B参数模型,在MultiPL-E及新推出的多语言LiveCodeBench上均取得当前最优的pass@1结果。我们发布了语言无关训练数据集(Ag-MBPP-X、Ag-Codeforces-X、Ag-LiveCodeBench-X)、训练代码与即用配置,使任意语言的强化训练仅需编辑简短YAML文件。
原文摘要 · Abstract (English)
Large language models (LLMs) already excel at writing code in high-resource languages such as Python and JavaScript, yet stumble on low-resource languages that remain essential to science and engineering. Besides the obvious shortage of pre-training data, post-training itself is a bottleneck: every new language seems to require new datasets, test harnesses, and reinforcement-learning (RL) infrastructure. We introduce Agnostics, a language-agnostic post-training pipeline that eliminates this per-language engineering. The key idea is to judge code solely by its externally observable behavior, so a single verifier can test solutions written in any language. Concretely, we (i) use an LLM to rewrite existing unit-test datasets into an I/O format, (ii) supply a short configuration that tells the verifier how to compile and run a target language, and (iii) apply reinforcement learning with verifiable rewards (RLVR) in a robust code execution environment. Applied to five low-resource languages--Lua, Julia, R, OCaml, and Fortran--Agnostics (1) improves Qwen-3 4B to performance that rivals other 16B-70B open-weight models; (2) scales cleanly to larger and diverse model families (Qwen-3 8B, DeepSeek Coder 6.7B Instruct, Phi 4 Mini); and (3) for ${\le} 16$B parameter models, sets new state-of-the-art pass@1 results on MultiPL-E and a new multi-language version of LiveCodeBench that we introduce. We release the language-agnostic training datasets (Ag-MBPP-X, Ag-Codeforces-X, Ag-LiveCodeBench-X), training code, and ready-to-use configurations, making RL post-training in any programming language as simple as editing a short YAML file.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。