[论文解读] To Code, or Not To Code? Exploring Impact of Code in Pre-training
本文研究了在大规模语言模型的预训练数据中包含代码的影响,表明代码显著提升了非代码任务的性能。通过在参数量从470M到2.8B的模型上进行受控的消融实验,作者发现添加代码可使自然语言推理性能提升最多8.2%,世界知识能力提升4.2%,代码生成性能提升12倍,且代码质量和训练过程中的冷却阶段进一步增强了性能增益。
Including code in the pre-training data mixture, even for models not specifically designed for code, has become a common practice in LLMs pre-training. While there has been anecdotal consensus among practitioners that code data plays a vital role in general LLMs' performance, there is only limited work analyzing the precise impact of code on non-code tasks. In this work, we systematically investigate the impact of code data on general performance. We ask "what is the impact of code data used in pre-training on a large variety of downstream tasks beyond code generation". We conduct extensive ablations and evaluate across a broad range of natural language reasoning tasks, world knowledge tasks, code benchmarks, and LLM-as-a-judge win-rates for models with sizes ranging from 470M to 2.8B parameters. Across settings, we find a consistent results that code is a critical building block for generalization far beyond coding tasks and improvements to code quality have an outsized impact across all tasks. In particular, compared to text-only pre-training, the addition of code results in up to relative increase of 8.2% in natural language (NL) reasoning, 4.2% in world knowledge, 6.6% improvement in generative win-rates, and a 12x boost in code performance respectively. Our work suggests investments in code quality and preserving code during pre-training have positive impacts.
研究动机与目标
- 系统评估代码数据对大规模语言模型在非代码下游任务中影响的目的。
- 确定代码数据是否能提升模型在代码特定能力之外的泛化能力。
- 分析代码质量、比例以及训练阶段(包括冷却阶段)对模型性能的影响。
- 评估在包括推理、知识和大语言模型作为裁判的胜率等多样化基准上,代码包含是否带来可测量的性能增益。
提出的方法
- 在参数量从470M到2.8B的模型上开展大规模、受控的预训练实验。
- 将仅使用文本的预训练与包含来自多样化来源的代码数据比例逐步增加的变体进行对比。
- 引入高质量的合成代码及代码相关数据(如GitHub提交记录),以评估数据质量的影响。
- 在初始预训练和后续冷却阶段均对代码包含情况进行消融研究。
- 在基准测试中采用标准化评估:自然语言推理(如HellaSwag)、世界知识(如MMLU)、代码生成(HumanEval)以及大语言模型作为裁判的胜率。
- 对代码数据应用质量过滤,移除低质量或格式错误的条目(如过多数字、0x字符串、顶级域名列表等)。
实验结果
研究问题
- RQ1在预训练中包含代码对非代码自然语言任务(如推理和世界知识)的性能有何影响?
- RQ2代码数据质量(特别是合成代码与基于网络的代码)对下游模型性能的影响是什么?
- RQ3在预训练的冷却阶段引入代码是否能在多种任务类型上带来额外增益?
- RQ4预训练混合数据中代码比例的变化如何影响模型的泛化能力和性能?
主要发现
- 与仅使用文本的预训练相比,在预训练中包含代码数据可使自然语言推理任务的性能相对提升8.2%。
- 在MMLU等世界知识基准测试中,代码包含使性能相对提升4.2%。
- 在大语言模型作为裁判的评估中,生成任务的胜率相比未包含代码的训练提升了6.6%。
- 在HumanEval基准测试中,代码性能在包含代码的预训练下提升了12倍。
- 使用高质量合成代码数据相比基于网络的代码,使自然语言推理性能相对提升9%,代码性能相对提升44%。
- 在冷却阶段也包含代码可进一步提升性能,相比非代码冷却阶段,自然语言推理性能相对提升3.7%,世界知识能力提升6.8%,代码性能提升20%。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。