用测试时计算生成真实代码数据,提升低资源编程语言的模型性能
Selective Left-Shift: Turning Test-Time Compute and Difficulty-based Curation into Training Data for Low-Resource Code Generation

- 将推理时计算转为离线数据生成,用编译和测试反馈自动合成验证过的代码
- 在Julia上使Qwen3-8B模型通过率提升14.2点,仅需1/6成本
- 适合低资源语言代码生成,尤其对无预训练基础的语言也有效
大型语言模型在高资源语言(如Python、Java)上表现优异,但在低资源编程语言(如Julia)上性能急剧下降。提升小模型在这些语言上的表现面临三难困境:监督微调受数据稀缺限制,推理时扩展成本过高,从零开始强化学习几乎无收益。本文提出三阶段流程,将语法学习与算法推理解耦。首先,通过离线数据生成引擎,利用迭代编译与测试反馈生成已验证的训练样本;其次,用这些合成数据微调小模型,嵌入强语法先验;最后,采用基于可验证奖励的强化学习(RLVR),以语言无关的输入输出测试为约束,防止探索偏离语法正确性。应用于Qwen3-8B模型,在MultiPL-E和Agnostics LiveCodeBench上,对Julia的pass@1分别提升7.6点和14.2点,且仅使用1/3数据和1/6成本。该方法还可推广至近无预训练表示的Ballerina语言,达到49.7% MultiPL-E Pass@1。消融实验表明,微调阶段与执行驱动的奖励均对稳定训练至关重要。
原文摘要 · Abstract (English)
Large Language Models achieve strong code generation for high resource languages like Python and Java but suffer sharp performance drops on Low-Resource Programming Languages~(LRPLs) such as Julia. Improving Small Language Models~(SLMs) for these languages faces a trilemma: Supervised Fine-Tuning~(SFT) is bottlenecked by data scarcity, inference-time scaling is too expensive for deployment, and Reinforcement Learning from scratch yields near zero advantages. We propose a three-phase pipeline that resolves this trilemma by decoupling syntax acquisition from algorithmic reasoning. First, we \emph{left-shift} inference-time compute to an offline data synthesis engine that uses iterative compiler and test feedback to generate verified training examples. Second, we fine-tune an SLM on this synthetic, verified data to embed strong syntactic priors. Third, we apply Reinforcement Learning with Verifiable Reward~(RLVR) grounded by language-agnostic Input/Output tests, where the SFT prior constrains exploration away from syntax errors. Applied to Qwen3-8B, our pipeline improves pass@1 by up to +7.6 points on MultiPL-E and +14.2 points on the Agnostics LiveCodeBench for Julia compared to SOTA results. Furthermore, the pipeline only used $\frac{1}{3}$ data and $\frac{1}{6}$ cost over the previous state-of-the-art. We further demonstrate that the pipeline generalizes to Ballerina achieving 49.7\% MultiPL-E Pass@1, a language with near-zero pretraining representation. Ablations confirm that both the SFT phase and execution-grounded rewards are necessary for stable training.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。