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

CodeChemist:通过测试时扩展实现低资源代码生成的功能知识迁移

CodeChemist: Test-Time Scaling for Low-Resource Code Generation via Functional Knowledge Transfer

School of Computer Science and Technology, Xi’an Jiaotong University(西安交通大学计算机科学与技术学院);Beihang University(北京航空航天大学);Nanyang Technological University(南洋理工大学);Ant Group(蚂蚁集团);National Engineering Research Center for Visual Information and Applications(视觉信息与应用国家工程研究中心)

Kaixin Wang, Tianlin Li, Xiaoyu Zhang, Aishan Liu, Xianglong Liu, Ziqi Liu, Zhiqiang Zhang, Jun Zhou, and Bin Shi

AI总结:

提出CodeChemist框架,通过合成测试用例将模型功能知识从高资源语言迁移到低资源语言,无需训练,显著提升低资源语言代码生成性能。

摘要:

代码大语言模型(CodeLLMs)已被广泛用于自然语言到编程语言的代码生成,支撑着拥有大量用户的应用。然而,它们的性能在不同编程语言(PLs)之间差异很大,特别是在低资源PLs上由于数据稀缺而表现不佳,限制了其整体可用性。在这项工作中,我们引入了CodeChemist,一个简单而有效、无需训练的测试时扩展框架,通过合成的测试用例将模型的功能知识从高资源PLs迁移到低资源PLs,无需依赖外部模型。具体来说,CodeChemist首先应用多温度对冲采样生成低资源PL中的候选解决方案池,并合成一组测试输入。然后它估计不确定性:当不确定性低时,通过语言内多数投票选择输出;否则,通过执行高资源参考程序构建跨语言I/O测试预言,并选择通过率最高的候选方案。大量实验表明,CodeChemist显著优于现有的测试时扩展方法,无需重新训练即可改进低资源PLs(如Lua)和复杂语法PLs(如C++、Java)的代码生成。

英文摘要:

Code Large Language Models (CodeLLMs) have been widely adopted for Natural Language to Programming Language code generation, powering applications with large user bases. Their performance, however, varies sharply across programming languages (PLs) and is particularly suboptimal for low-resource PLs due to data scarcity, limiting their overall usability. In this work, we introduce CodeChemist, a simple yet effective, training-free test-time scaling framework that transfers the model's functional knowledge from high-resource to low-resource PLs via synthesized test cases, without relying on external models. Specifically, CodeChemist first applies multi-temperature hedged sampling to generate a pool of candidate solutions in the low-resource PL and synthesizes a set of test inputs. It then estimates uncertainty: when uncertainty is low, it selects the output via in-language majority voting; otherwise, it constructs cross-lingual I/O test oracles by executing high-resource reference programs and selects the candidate with the highest pass rate. Extensive experiments demonstrate that CodeChemist significantly outperforms existing test-time scaling methods, improving code generation for both low-resource PLs (e.g., Lua) and complex-syntax PLs (e.g., C++, Java) without retraining.

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

↑