[Paper Review] CodeGen2: Lessons for Training LLMs on Programming and Natural Languages
CodeGen2 experiments unifying architecture, learning objectives, infill sampling, and data distributions to train LLMs for code and natural language; finds prefix-LM benefits unclear, infill not free, mixed data promising, and multi-epoch training effective, with open-source recipes.
Large language models (LLMs) have demonstrated remarkable abilities in representation learning for program synthesis and understanding tasks. The quality of the learned representations appears to be dictated by the neural scaling laws as a function of the number of model parameters and observations, while imposing upper bounds on the model performance by the amount of available data and compute, which is costly. In this study, we attempt to render the training of LLMs for program synthesis more efficient by unifying four key components: (1) model architectures, (2) learning methods, (3) infill sampling, and, (4) data distributions. Specifically, for the model architecture, we attempt to unify encoder and decoder-based models into a single prefix-LM. For learning methods, (i) causal language modeling, (ii) span corruption, (iii) infilling are unified into a simple learning algorithm. For infill sampling, we explore the claim of a "free lunch" hypothesis. For data distributions, the effect of a mixture distribution and multi-epoch training of programming and natural languages on model performance is explored. We conduct a comprehensive series of empirical experiments on 1B LLMs, for which failures and successes of this exploration are distilled into five lessons. We will provide a final recipe for training and release CodeGen2 models in size 1B, 3.7B, 7B, and, 16B parameters, along with the training framework as open-source: https://github.com/salesforce/CodeGen.
Motivation & Objective
- Motivate reducing the cost of training LLMs for programming and natural language tasks via unification of design choices.
- Evaluate whether a Prefix-LM architecture can unify encoder-like and decoder-like capabilities without sacrificing performance.
- Assess whether infill sampling provides zero or negligible extra compute cost (“free lunch”).
- Investigate the impact of mixing natural and programming language data and of multi-epoch training on model performance.
- Provide an open-source, practical training recipe and released CodeGen2 models across multiple sizes.
Proposed method
- Unify architecture, learning objectives, left-to-right and infill sampling, and data distributions into a single recipe.
- Study Prefix-LM as a potential encoder-decoder unification and evaluate on programming and language benchmarks.
- Use a mixture of causal language modeling and span corruption as the learning objective.
- Experiment with infill sampling and test the ‘free lunch’ hypothesis.
- Experiment with mixed-domain data (natural+programming) and multi-epoch training to assess performance gains.
Experimental results
Research questions
- RQ1Does Prefix-LM provide measurable benefits over causal decoders for code and language tasks across evaluation settings?
- RQ2Is infill sampling truly costless in terms of compute and performance (the “free lunch” hypothesis)?
- RQ3Can a simple mixture of causal language modeling and span corruption perform well for both generation and understanding tasks?
- RQ4What is the impact of mixing natural and programming languages and of multi-epoch training on cross-domain performance?
Key findings
- Prefix-LM benefits are not clearly demonstrated across tasks; performance is task-dependent and not consistently superior to causal decoders.
- Infill sampling did not yield a clear free-lunch advantage; a slight decline in HumanEval pass@1 was observed in some settings when infill was added.
- A simple mixed objective (causal language modeling plus span corruption) can be competitive for left-to-right and infill sampling, though UL2-style objectives did not outperform causal baselines in this study.
- Mixing natural and programming language data shows promising results and multi-epoch training yields strong improvements, especially evident in CodeGen2.5.
- The authors provide open-source training code and plan to release CodeGen2 models (1B, 3.7B, 7B, 16B) as training converges.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.