Introduction

Llama 2 is a series of pretrained and fine-tuned generative text models developed by Meta, ranging from 7 billion to 70 billion parameters. These models are designed for both commercial and research uses, particularly in English text generation tasks. The fine-tuned versions, known as Llama-2-Chat, are optimized for dialogue.

Architecture

Llama 2 employs an auto-regressive language model structure using an optimized transformer architecture. The fine-tuned models leverage supervised fine-tuning (SFT) and reinforcement learning with human feedback (RLHF) to align with human preferences for helpfulness and safety. The models are trained on publicly available data and are designed to generate text based on input prompts.

Training

The Llama 2 models were pretrained on 2 trillion tokens and fine-tuned using publicly available instruction datasets along with over one million human-annotated examples. The training involved significant computational resources, utilizing Meta's Research Super Cluster and third-party cloud compute resources, with an emphasis on sustainability by offsetting carbon emissions. Training metrics are available for each model size, demonstrating their performance across various benchmarks.

Guide: Running Locally

  1. Model Access: To access the model, visit Meta's resource page and accept the license terms.
  2. Environment Setup: Ensure you have Python and PyTorch installed. Clone the repository and set up a virtual environment.
  3. Dependencies: Install necessary dependencies using a package manager.
  4. Download Weights: Use the provided links to download model weights after accepting the licensing agreement.
  5. Model Invocation: Run the model using your preferred text generation script or adapt the reference code provided by Meta.
  6. GPU Recommendation: For optimal performance, use cloud GPU services such as AWS, Google Cloud, or Azure, which offer powerful GPU instances.

License

Llama 2 is released under the LLAMA 2 Community License. This custom commercial license allows for the use, reproduction, and distribution of the Llama Materials under specific conditions. Redistribution requires adherence to the license terms and compliance with applicable laws and the Acceptable Use Policy. The license details and conditions, including prohibited uses and liabilities, are available on Meta's website.

More Related APIs in Text Generation