TL;DR
Meta AI introduces LLaMA, a family of open-source foundation language models ranging from 7B to 65B parameters. These models achieve state-of-the-art performance by training on trillions of tokens using publicly available data, demonstrating that proprietary datasets are not a prerequisite for top-tier LLM capabilities. LLaMA-13B outperforms GPT-3, while LLaMA-65B is competitive with models like Chinchilla and PaLM, making powerful LLMs more accessible for research.
What Problem Does This Paper Address?
The pursuit of ever-larger language models has been a dominant trend, driven by the assumption that more parameters directly translate to better performance. However, recent research has highlighted the crucial role of training data size and quality, suggesting that optimal performance for a given compute budget might be achieved by training smaller models on more data. This paper addresses the challenge of developing high-performing foundation language models that are also efficient for inference and can be trained using only publicly available datasets, thereby democratizing access and research in the field. The authors aim to find a balance between model size, training data, and inference efficiency to achieve competitive results.
Methods
The LLaMA models are based on the standard transformer architecture, incorporating several improvements:
- Pre-normalization: Similar to GPT-3, inputs to each transformer sub-layer are normalized using RMSNorm for improved training stability.
- SwiGLU Activation: The ReLU non-linearity is replaced with the SwiGLU activation function, inspired by PaLM, to enhance performance.
- Rotary Embeddings (RoPE): Absolute positional embeddings are replaced with rotary positional embeddings (RoPE), as introduced by Su et al. (2021), at each layer.
The models are trained using the AdamW optimizer with a cosine learning rate schedule, weight decay, and gradient clipping. For efficient implementation, they leverage the xformers library for optimized attention mechanisms and employ checkpointing to reduce activation recomputation during the backward pass.
Datasets
LLaMA models are trained on a diverse mixture of publicly available datasets, totaling approximately 1.4 trillion tokens. Key components include:
- English CommonCrawl (67%): Preprocessed using the CCNet pipeline, including deduplication, language identification, and quality filtering.
- C4 (15%): The publicly available C4 dataset is included, with similar preprocessing steps.
- GitHub (4.5%): Public GitHub data, filtered for Apache, BSD, and MIT licenses, with quality heuristics applied.
- Wikipedia (4.5%): Dumps from June-August 2022, covering various languages.
- Books (4.5%): Includes the Gutenberg Project and the Books3 section of The Pile.
- ArXiv (2.5%): Processed arXiv LaTeX files to incorporate scientific data.
- Stack Exchange (2%): A dump of Stack Exchange data, filtered for the 28 largest websites.
For evaluation, LLaMA models are tested on a wide range of benchmarks, including Common Sense Reasoning (BoolQ, PIQA, SIQA, HellaSwag, WinoGrande, ARC-e, ARC-c, OBQA), Closed-book Question Answering (NaturalQuestions, TriviaQA), Reading Comprehension (RACE), Mathematical Reasoning (MATH, GSM8k), Code Generation (HumanEval, MBPP), Massive Multitask Language Understanding (MMLU), and bias/toxicity benchmarks (RealToxicityPrompts, CrowS-Pairs, WinoGender, TruthfulQA).
Key Insights and Ideas
- Public Data is Sufficient for State-of-the-Art: A major takeaway is that achieving competitive, state-of-the-art performance is possible using only publicly available datasets, challenging the notion that proprietary data is essential for cutting-edge LLMs.
- LLaMA-13B's Efficiency: The LLaMA-13B model significantly outperforms GPT-3 (175B) on many benchmarks while being 10x smaller, highlighting the benefits of efficient scaling and training on more data. This smaller model can even run on a single GPU, democratizing access.
- Scaling Laws and Inference Budgets: The paper emphasizes that while scaling laws often focus on training compute, inference budgets are critical for real-world deployment. Training smaller models for longer can be more cost-effective at inference time.
- Competitive Performance at Scale: The LLaMA-65B model demonstrates strong performance, rivaling larger models like Chinchilla-70B and PaLM-540B, showcasing the effectiveness of their training methodology.
- Bias Mitigation Efforts: The authors acknowledge the inherent biases in large language models and present evaluations on bias and toxicity benchmarks, indicating that while LLaMA shows comparable or slightly better performance than other models, biases still exist and require further attention.
Key Results
- LLaMA-13B vs. GPT-3: LLaMA-13B outperforms GPT-3 (175B) on most benchmarks, despite being significantly smaller.
- LLaMA-65B Performance: LLaMA-65B is competitive with Chinchilla-70B and PaLM-540B across various tasks, including Common Sense Reasoning, Question Answering, and Reading Comprehension.
- Code Generation: LLaMA models show strong performance in code generation tasks, outperforming general-purpose models like LaMDA and PaLM when not specifically fine-tuned for code.
- MMLU Performance: LLaMA-65B achieves a 63.4% accuracy on the MMLU benchmark, competitive with other large models, though slightly behind Chinchilla and PaLM, potentially due to differences in the amount of book data used in pre-training.
- Carbon Footprint: The paper provides a detailed analysis of the carbon footprint for training LLaMA models, estimating 1,015 tCO2eq for the entire suite, which is presented as a significant effort towards more sustainable AI development.
Limitations and Future Work
- Bias and Toxicity: The authors acknowledge that LLaMA models, like other LLMs, exhibit biases and can generate toxic content. While they evaluate these aspects, they note that these evaluations are not exhaustive and further work is needed to fully understand and mitigate these risks.
- Instruction Finetuning: While the paper briefly explores instruction finetuning (LLaMA-I), demonstrating improved performance on MMLU, this was not the primary focus. The authors plan to further investigate this area.
- Model Size and Data Scaling: The paper suggests that performance continues to improve with larger models and more training data, indicating a path for future work to release even larger models trained on larger corpora.
- Inference Efficiency: While LLaMA models are designed with inference efficiency in mind, further optimizations and exploration of deployment strategies are implied.
- Limited Book Data Impact: The authors hypothesize that the slightly lower performance on MMLU compared to Chinchilla and PaLM might be due to the smaller proportion of book data in their training set.
Summary updated