atlas

Research map / Large language models / Language, safety and interpretability

To Code or Not To Code? Exploring Impact of Code in Pre-training

ICLR 2025 · Large language models › Language, safety and interpretability · approach: LLM unlearning and benchmarks · 3 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Systematic controlled pre-training study (470M and 2.8B models) showing that including code in pre-training, in initialization, proportion, synthetic code quality, and cooldown, improves non-code tasks such as NL reasoning, world knowledge, and LLM-judged win-rates.

Problem

Code is routinely included in LLM pre-training even for non-code models, but its precise impact on general non-code performance has not been systematically studied.

Approach

Runs 64 controlled pre-training experiments varying where code enters training (initialization, continued pre-training, cooldown), code proportion, code quality and properties (markup, code-adjacent, synthetic verified Python), and model scale, measuring NL reasoning, world knowledge, code, and LLM-judged win-rates.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use Balanced→Text initialization and continued pre-training instead of text-only pre-trainingPre-training recipe · Natural language reasoningrelative performance: +8.2%Helped
Use Balanced→Text initialization and continued pre-training instead of text-only pre-trainingPre-training recipe · World knowledgerelative performance: +4.2%Helped
Use Balanced→Text initialization and continued pre-training instead of text-only pre-trainingPre-training recipe · Dolly-200 Englishwin-rate difference: +6.6%Helped
Use Balanced→Text initialization and continued pre-training instead of text-only pre-trainingPre-training recipe · Code benchmarksrelative performance: 12xHelped
Increase code proportion from 0% to 25% (ablation)Pre-training from scratch · Natural language reasoningrelative performance: +3.4%Helped
Increase code proportion from 0% to 25% (ablation)Pre-training from scratch · World knowledgerelative performance: 3.4%Hurt
Increase code proportion from 25% to 100% (ablation)Pre-training from scratch · Code benchmarksrelative performance: 2.6xHelped
Use 100% code rather than 0% code (ablation)Pre-training from scratch · Natural language reasoningrelative performance: 18.3%Hurt
Replace 20% of web code with markup-style data (ablation)Code-only pre-training · Natural language reasoningrelative performance: +2.8%Helped
Replace 20% of web code with markup-style data (ablation)Code-only pre-training · Code benchmarksrelative performance: 15.7%Hurt
Replace 15% of web code with code-adjacent data (ablation)Code-only pre-training · Natural language reasoningrelative performance: +6.3%Helped
Replace 15% of web code with code-adjacent data (ablation)Code-only pre-training · Code benchmarksrelative performance: 9.4%Hurt

Surprising findings

Limitations

Experimental setup

Datasets: SlimPajama The Stack RedPajama Dolly-15K Dolly-200 English Natural Questions Open TriviaQA BoolQ PiQA SciQ SocialIQA QUAC

Benchmarks: TriviaQA NaturalQuestionsOpen BoolQ PiQA SciQ SocialIQA QUAC SuperGLUE-CB SuperGLUE-COPA StoryCloze HellaSwag Winogrande

Metrics: accuracy exact match pass@1 win-rate

Baselines: text-only pre-training balanced-only code-only pre-training (web-code-only)

Builds on: SlimPajama The Stack StarCoder RedPajama

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy