[Paper Review] Sheared LLaMA: Accelerating Language Model Pre-training via Structured Pruning
The paper introduces LLM-shearing, a method for producing smaller, competitive language models by targeted structured pruning of a pre-trained larger model followed by continued pre-training, aided by dynamic batch loading to balance data across domains.
The popularity of LLaMA (Touvron et al., 2023a;b) and other recently emerged moderate-sized large language models (LLMs) highlights the potential of building smaller yet powerful LLMs. Regardless, the cost of training such models from scratch on trillions of tokens remains high. In this work, we study structured pruning as an effective means to develop smaller LLMs from pre-trained, larger models. Our approach employs two key techniques: (1) targeted structured pruning, which prunes a larger model to a specified target shape by removing layers, heads, and intermediate and hidden dimensions in an end-to-end manner, and (2) dynamic batch loading, which dynamically updates the composition of sampled data in each training batch based on varying losses across different domains. We demonstrate the efficacy of our approach by presenting the Sheared-LLaMA series, pruning the LLaMA2-7B model down to 1.3B and 2.7B parameters. Sheared-LLaMA models outperform state-of-the-art open-source models of equivalent sizes, such as Pythia, INCITE, OpenLLaMA and the concurrent TinyLlama models, on a wide range of downstream and instruction tuning evaluations, while requiring only 3% of compute compared to training such models from scratch. This work provides compelling evidence that leveraging existing LLMs with structured pruning is a far more cost-effective approach for building competitive small-scale LLMs
Motivation & Objective
- Motivate cost-effective creation of strong moderate-sized LLMs from existing large pre-trained models.
- Develop a pruning method that yields target architectures aligned with proven pre-trained configurations.
- Address imbalanced knowledge retention across data domains during continued pre-training.
- Introduce dynamic batch loading to allocate data by domain based on loss reduction rates.
Proposed method
- Propose targeted structured pruning to morph a source model into a specified target architecture using pruning masks at layer, hidden dimension, head, and intermediate dimensions.
- Learn pruning masks via a constrained optimization with hard-concrete distributions and a min-max objective to meet target shapes.
- Perform continued pre-training on the pruned model to recover or exceed performance.
- Introduce dynamic batch loading to adjust domain data proportions during training based on domain-specific loss reductions.
- Use a two-stage process: pruning followed by continued pre-training, guided by a domain-aware data strategy.
Experimental results
Research questions
- RQ1Can pruning a large pre-trained LLM into a specified target architecture yield competitive small LLMs with less compute?
- RQ2Does continued pre-training after pruning recover performance better than pruning alone?
- RQ3Can dynamic batch loading balance domain-wise loss reductions to improve overall downstream performance?
Key findings
- Sheared-LLaMA models (1.3B and 2.7B) outperform state-of-the-art open-source models of similar size on 11 downstream tasks and instruction tuning benchmarks.
- Pruning from LLaMA2-7B to 1.3B/2.7B used only about 50B tokens for pruning and continued pre-training, achieving competitive results with roughly 3% of the compute required for training from scratch.
- Dynamic batch loading aligns loss reduction across domains and increases data usage for more challenging domains, improving downstream performance.
- Pruned models offer better initialization for continued pre-training than simply starting from a similarly sized existing model in some comparisons.
- Targeted structured pruning yields higher inference throughput than non-uniform pruning approaches at equivalent sparsity.
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.