Skip to main content
Browse Models

Meta

Llama 2 7B

Released

2023-07-18

Family

Llama 2

Type

Foundation Model

Downloads

External Download

You are about to open a link to an external source. Verify the URL before continuing.

Download

Chat model, 4-bit GGUF (Q4_K_M)

GGUF · llama-2-7b-chat.Q4_K_M.gguf

Chat model, 5-bit GGUF (Q5_K_M)

GGUF · llama-2-7b-chat.Q5_K_M.gguf

Chat model, 6-bit GGUF (Q6_K)

GGUF · llama-2-7b-chat.Q6_K.gguf

Chat model, 8-bit GGUF (Q8_0)

GGUF · llama-2-7b-chat.Q8_0.gguf

4-bit GGUF (Q4_K_M)

GGUF · llama-2-7b.Q4_K_M.gguf

5-bit GGUF (Q5_K_M)

GGUF · llama-2-7b.Q5_K_M.gguf

6-bit GGUF (Q6_K)

GGUF · llama-2-7b.Q6_K.gguf

8-bit GGUF (Q8_0)

GGUF · llama-2-7b.Q8_0.gguf

Ollama Model (q4_K_M)

Ollama

Model Report

Overview

Llama 2 7B is a large language model developed by Meta, forming part of the Llama 2 family of generative text models. Llama 2 7B has 7 billion parameters and is part of the Llama 2 series, which also includes 13B and 70B parameter variants. Released for both research and commercial purposes, Llama 2 models facilitate access to language generation capabilities. The Llama 2-Chat variants have been fine-tuned for dialogue and exhibit performance on standard benchmarks consistent with human preferences for useful and safe outputs, as described in the Llama 2 research paper.

Llama 2 model graphic

Figure 1. Stylized graphic highlighting Llama 2 and its model variants, including the 7B, 13B, and 70B parameter options.

Model Architecture and Training

Llama 2 7B belongs to the class of transformer-based language models using an auto-regressive architecture. The model is pretrained with 7 billion parameters on a corpus comprising two trillion tokens of publicly available online data. The training data represents a 40% increase compared to its predecessor, Llama 1, and the context length is extended to 4,096 tokens, twice that of previous versions. The fine-tuned "Llama-2-Chat" variants utilize supervised fine-tuning and reinforcement learning from human feedback (RLHF) to further optimize for dialogue quality, safety, and helpfulness, employing methods such as rejection sampling and proximal policy optimization, as detailed in the official model documentation.

Llama 2 technical table

Figure 2. Infographic showing the scale of Llama 2's training data, context length, and supervised fine-tuning process across model sizes.

Llama 2 7B, like the larger variants, does not use Meta user data for training or fine-tuning. Data for pretraining has a cutoff of September 2022, while supervised and preference-aligned data for fine-tuning includes examples curated up to July 2023. The training pipeline incorporates Meta’s large-scale infrastructure and custom libraries, leveraging both proprietary and third-party computing resources.

Fine-Tuning and Human Feedback

Alignment with human intent and safety has been prioritized in the development of Llama-2-Chat models. After pretraining, the model undergoes supervised fine-tuning using instructional datasets and a substantial set of human-annotated examples. The RLHF procedure integrates human preference data to build reward models for helpfulness and safety, which then guide further optimization.

Diagram of RLHF training for Llama-2-Chat

Figure 3. Flow chart illustrating how Reinforcement Learning from Human Feedback (RLHF) is applied to produce Llama-2-Chat models focused on safety and helpfulness.

Supervised fine-tuning (SFT) is used as an initial phase, followed by iterative reinforcement learning steps that refine outputs in light of human judgement using techniques such as rejection sampling and proximal policy optimization. This alignment methodology is documented in the Llama 2 paper.

Performance and Benchmarking

Llama 2 7B exhibits enhanced performance compared to previous models across a variety of academic benchmarks. When evaluated, Llama 2 7B achieves higher scores in areas such as code generation, commonsense reasoning, and reading comprehension relative to comparable open models. For instance, the Llama 2 7B model reaches 45.3 in MMLU, 14.6 in math, and 16.8 in code evaluations, surpassing Llama 1 7B in each category. The fine-tuned Llama-2-Chat variant outperforms both open-source and select proprietary models in specific helpfulness and truthfulness tests, as reflected in side-by-side academic comparisons benchmark results.

Llama 2 benchmark comparison chart

Figure 4. Benchmark table comparing Llama 2 with other language models across key tasks, emphasizing performance gains in MMLU, world knowledge, code, and more.

Improvements over earlier iterations include increased scores on TruthfulQA and a reduction in toxicity as measured by ToxiGen. These results contribute to model deployments that exhibit lower toxicity and higher truthfulness in practical applications.

Capabilities and Use Cases

Llama 2 7B is designed primarily for text generation in English, with additional exposure to data from 27 other languages. The model can be adapted for a broad array of tasks that require natural language understanding and generation, including conversational agents, document summarization, question answering, and code completion. The chat-optimized versions, Llama-2-Chat, are tailored for interactive dialogue applications and virtual assistants, incorporating extensive supervised and RLHF fine-tuning.

While non-English capabilities are present, output quality is generally higher in English, and performance may vary across other languages. Meta provides guidance for safe and responsible application development to assist users in developing applications based on Llama 2.

Responsible Use Guide banner

Figure 5. Visual cover for Meta's Responsible Use Guide, outlining best practices for developers working with Llama 2 models.

Limitations and Licensing

Llama 2 7B, consistent with other large language models, is subject to inherent unpredictability in its outputs and may occasionally generate inaccurate, biased, or objectionable content. The model's safety evaluations focus mainly on English, and thorough application-specific risk assessments are recommended prior to deployment. Use cases must comply with local laws, Meta’s Acceptable Use Policy, and licensing agreements.

The model is distributed under the custom LLAMA 2 Community License, which allows use, modification, and distribution under defined conditions. Terms include mandatory attribution, adherence to an acceptable use policy, restrictions against leveraging Llama 2 outputs to improve other large language models, and special provisions for entities with over 700 million monthly active users, who must seek a separate license.

Timeline and Ecosystem

Llama 2 models were trained from January to July 2023 and publicly announced with the release of the foundational Llama 2 research paper on July 18, 2023. The open availability of Llama 2 has led to an ecosystem of collaborators, partners, and research initiatives focused on expanding the use and assessment of large language models.

Partner and supporter logos for Llama 2

Figure 6. Collage of partner logos, representing global collaborators and supporters in the Llama 2 ecosystem.

Further Reading and External Resources

These resources provide technical documentation, responsible usage guidelines, community developments, and detailed instructions for working with the Llama 2 7B model.

About Llama 2: The Llama 2 family, developed by Meta, comprises large language models ranging from 7 billion to 70 billion parameters, trained on 40% more data than their predecessors and featuring a doubled context length of 4,096 tokens.

More in the Llama 2 Family

codellama /

CodeLlama 7B

Fine-tuned version of Llama 7b, with training data optimized for code generation and completion tasks.
lmsys /

Vicuna 7B

Llama 7B fine-tuned on 125k GPT-4 conversations, with strong performance in chatbot and instruction following use-cases.
PygmalionAI /

Pygmalion 2 7B

Llama 7B fine-tuned for conversation, roleplaying, and storywriting.
openchat /

OpenChat 3.5 7B

Llama 2 7B fine-tuned using the C-RLFT strategy, with performance surpassing GPT 3.5 on some benchmarks.
Xwin-LM /

Xwin LM 7B

Llama 2 7B fine-tune using numerous emerging techniques including SFT, RM, and RLHF, achieving top results on AlpacaEval.
Meta /

Llama 2 13B

13 billion parameter version of the 2nd iteration in Meta's Llama series of open source models.
Meta /

CodeLlama 13B

Fine-tuned version of Llama 13b, with training data optimized for code generation and completion tasks.
NousResearch /

Nous Hermes 13b

Llama 13b fine-tuned on over 300k curated GPT-4 outputs, known long high-quality outputs.
lmsys /

Vicuna 13B

Llama 13B fine-tuned on 125k GPT-4 conversations, with strong performance in chatbot and instruction following use-cases.
Gryphe /

MythoMax L2

An improved variant of MythoMix (MythoLogic-L2 and Huginn merge) using an experimental tensor-type merge technique. Originally a merge of multiple popular Llama 2 fine-tunes, including Hermes, Chronos, and Airoboros. Very popular for rich descriptions, storywriting, and roleplay.
WizardLM /

WizardLM 13B

Llama 2 13B model fine-tuned to follow complex instructions using the WizardLM training methodology.
PygmalionAI /

Pygmalion 2 13B

Llama 13B fine-tuned for conversation, roleplaying, and storywriting.
PygmalionAI /

Mythalion 13B

Merge of two popular fine-tunes: Pygmalion and Mythomax L2, resulting in a model that is good at roleplaying and instruction-following.
Xwin-LM /

Xwin LM 13B

Llama 2 13B fine-tune using numerous emerging techniques including SFT, RM, and RLHF, achieving top results on AlpacaEval.
Meta /

CodeLlama 34B

Fine-tuned version of unreleased Llama 2 34b, with training data optimized for code generation and completion tasks.
Meta /

Llama 2 70B

70 billion parameter version of the 2nd iteration in Meta's Llama series of open source models.
Meta /

CodeLlama 70B

Fine-tuned version of Llama 70b, with training data optimized for code generation and completion tasks.
Xwin-LM /

Xwin 70B

Llama 2 70B fine-tune using numerous emerging techniques including SFT, RM, and RLHF, achieving top results on AlpacaEval.
WizardLM /

WizardLM 70B

Llama 2 70B model fine-tuned to follow complex instructions using the WizardLM training methodology.
NousResearch /

Nous Hermes Llama 2 70B

Llama 2 70B fine-tuned on over 300k curated GPT-4 outputs.

More from Meta

Meta /

LLaMA 7B

A 7-billion parameter transformer language model trained on one trillion tokens from publicly available datasets for natural language processing research.
Meta /

LLaMA 13B

A 13-billion parameter transformer-based language model trained on 1.4 trillion tokens from publicly available datasets, demonstrating competitive performance on various benchmarks.
Meta /

LLaMA 33B

A 32.5 billion parameter transformer-based language model trained on 1.4 trillion tokens of publicly available data with competitive benchmark performance.
Meta /

LLaMA 65B

A 65.2-billion parameter transformer language model trained on 1.4 trillion tokens from publicly available datasets for research applications.
Meta /

Llama 4 Scout (17Bx16E)

A natively multimodal transformer with mixture-of-experts architecture supporting 10 million token context and multilingual text-image understanding capabilities.
Meta /

Llama 4 Maverick (17Bx128E)

Multimodal instruction-tuned model with 17 billion active parameters from 400 billion total, trained on 22 trillion tokens across 200 languages.
Meta /

Llama 3 8B

Large language model with 8 billion parameters featuring transformer architecture, trained on 15 trillion tokens for text generation and coding tasks.
Meta /

Llama 3 70B

State-of-the-art 70B foundation model from Meta, trained on over 15 trillion tokens.
Meta /

Llama 3.1 8B

Llama 3.1 is a new state-of-the-art large language model from Meta.
Meta /

Llama 3.1 70B

The Llama 3.1 series of open models rivals top closed models in performance. It was trained on over 15 trillion tokens using over 16K H100 GPUs. These models display state-of-the-art capabilities in general knowledge, steerability, math, tool use, and translation.
Meta /

Llama 3.2 3B

The next iteration in the Llama series of open models. This lightweight model was designed to run on edge devices, even mobile.
Meta /

Llama 3.3 70B

Llama 3.3 is a text-only 70B instruction-tuned model that provides enhanced performance relative to Llama 3.1 70B and to Llama 3.2 90B when used for text-only applications. For some applications, Llama 3.3 70B approaches the performance of Llama 3.1 405B.
Meta /

MusicGen

MusicGen is a text-to-music autoregressive transformer model capable of generating music samples conditioned on text descriptions or audio prompts.
Meta /

Magnet

Magnet is a single-stage, non-autoregressive transformer model for text-to-music and text-to-audio generation, with faster generation that MusicGen.
Meta /

Seamless

Seamless is a MMMMT (Massively Multilingual and Multimodal Machine Translation) model that can translate and generate audio in over 100 languages.