[论文解读] Multi-lingual Evaluation of Code Generation Models
本论文提出 MBXP、Multilingual HumanEval 和 MathQA-X 基准,用于跨 10 种以上语言的基于执行的代码生成,并分析多语言模型与单语言模型的性能、少样本提示、零样本翻译、鲁棒性,以及代码插入/摘要等任务,同时发布数据集和代码。
We present new benchmarks on evaluation code generation models: MBXP and Multilingual HumanEval, and MathQA-X. These datasets cover over 10 programming languages and are generated using a scalable conversion framework that transpiles prompts and test cases from the original Python datasets into the corresponding data in the target language. Using these benchmarks, we are able to assess the performance of code generation models in a multi-lingual fashion, and discovered generalization ability of language models on out-of-domain languages, advantages of multi-lingual models over mono-lingual, the ability of few-shot prompting to teach the model new languages, and zero-shot translation abilities even on mono-lingual settings. Furthermore, we use our code generation model to perform large-scale bootstrapping to obtain synthetic canonical solutions in several languages, which can be used for other code-related evaluations such as code insertion, robustness, or summarization tasks. Overall, our benchmarks represents a significant step towards a deeper understanding of language models' code generation abilities. We publicly release our code and datasets at https://github.com/amazon-research/mxeval.
研究动机与目标
- 开发超越 Python 的可扩展多语言执行型代码生成基准(MBXP、Multilingual HumanEval、MathQA-X)。
- 评估多语言模型在域外语言上的泛化能力,以及从少样本提示和翻译中获益的情况。
- 使得使用合成的规范解来分析鲁棒性、代码插入、摘要以及其他与代码相关的任务成为可能。
- 提供公共工具和数据集,以支持对多语言代码生成模型的广泛评估。
提出的方法
- 通过基于规则的转译器将 Python 为基础的执行数据集转换为多种目标语言,同时保留提示和测试用例。
- 使用 125M、672M、2.7B 和 13B 参数规模,在多语言与单语言设置下训练解码器模型,单语言每种语言 210B 个标记,或多语言每语言 210B,总计 630B(多语言模式)。
- 使用无偏估计的 pass@k 进行评估,生成完整的函数体并根据语言特定的测试用例进行正确性检查。
- 通过大规模自举来合成多语言的规范解,以支持额外的评估(插入、鲁棒性或摘要)。
- 通过在源语言中前置参考解来对目标语言提示进行零-shot 翻译并分析翻译驱动的性能。
实验结果
研究问题
- RQ1多语言代码生成模型在域外语言上的表现是否相对于资源等量的单语言模型更优?
- RQ2当模型规模足够大时,在多语言训练上是否相对于单语言训练具有优势?
- RQ3少样本提示和零样本翻译是否能提升此前未见语言中的代码生成?
- RQ4多语言数据的溢出对跨语言代码生成和翻译有何影响?
- RQ5多语言模型在鲁棒性、代码插入和代码摘要等任务在各语言中的表现如何?
主要发现
- 在足够大的规模下,多语言模型通常优于资源等价的最佳单语言模型。
- 由于训练数据中的跨语言溢出,模型在域外语言上也表现出非零的成功率。
- 少样本提示能提升域外执行的准确性并降低非断言错误。
- 模型表现出零-shot 翻译能力;翻译可以使此前难以解决的任务变得可解,有时甚至对单语言模型也有帮助。
- 多语言模型通常在鲁棒性和代码摘要方面优于单语言模型,且在域外场景有显著提升。
- 在代码插入方面,右上下文信息在各语言中的 Pass@1 上有显著提升。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。