LLaMA Pro

LLaMA Pro introduces block expansion as a recipe for adding new knowledge to a pretrained LLM without catastrophic forgetting.
Ask this paper
Block expansion: Additional identity-initialized transformer blocks are inserted into a frozen base model; only these new blocks are trained on the new corpus while inherited blocks stay frozen.
Math + code training: LLaMA Pro-8.3B is initialized from Llama 2-7B and post-pretrained on a mix of math and code data, yielding a domain-specialized yet general-purpose model.
Preserves general capability: Because inherited blocks stay frozen, the model retains its original general skills - a stark contrast with continual full fine-tuning which typically degrades general performance.
Strong benchmark performance: Matches or beats Llama 2 7B on general benchmarks while significantly outperforming it on math and code tasks, validating the block-expansion recipe.
Abstract
Humans generally acquire new skills without compromising the old; however, the opposite holds for Large Language Models (LLMs), e.g., from LLaMA to CodeLLaMA. To this end, we propose a new post-pretraining method for LLMs with an expansion of Transformer blocks. We tune the expanded blocks using only new corpus, efficiently and effectively improving the model's knowledge without catastrophic forgetting. In this paper, we experiment on the corpus of code and math, yielding LLaMA Pro-8.3B, a versatile foundation model initialized from LLaMA2-7B, excelling in general tasks, programming, and mathematics. LLaMA Pro and its instruction-following counterpart (LLaMA Pro-Instruct) achieve advanced performance among various benchmarks, demonstrating superiority over existing open models in the LLaMA family and the immense potential of reasoning and addressing diverse tasks as an intelligent agent. Our findings provide valuable insights into integrating natural and programming languages, laying a solid foundation for developing advanced language agents that operate effectively in various environments.