Skip to main content
Back

Meta Releases Llama-2-13b-Chat to Run Powerful AI on a Single GPU

Meta shipped the 13B chat variant of Llama 2 on Hugging Face, a dialogue-tuned open model trained with SFT and RLHF for assistant use.

Pro

Model, Full Access
  • Meta released Llama-2-13b-chat-hf, the 13B dialogue-tuned Llama 2 variant in Hugging Face format.
  • Architecture: auto-regressive transformer, 4k context, pretrained on 2T tokens, no GQA.
  • Alignment stack: supervised fine-tuning plus RLHF with rejection sampling and PPO, distilled from the 70B run.
  • Introduces Ghost Attention (GAtt) so system prompts persist across multi-turn dialogue.
  • Chat tuning drives TruthfulQA to 62.18 and Toxigen to 0.00, up sharply from the base 13B.
  • Free for commercial use unless the licensee had over 700M MAUs before release; English-only scope.

Meta publicly released Llama-2-13b-chat-hf, the 13-billion-parameter dialogue-tuned variant of Llama 2, packaged in Hugging Face Transformers format. It sits between the 7B and 70B siblings in the Llama 2 family, and it is the size most teams reach for when they want more capability than a 7B model but still cheap enough to serve on a single GPU.

What Meta put on the table

Llama 2 spans pretrained and fine-tuned generative text models from 7 billion to 70 billion parameters. This repository holds the 13B fine-tuned model optimized for dialogue and converted for Hugging Face Transformers. The tuned versions use supervised fine-tuning (SFT) and reinforcement learning with human feedback (RLHF) to align with human preferences for helpfulness and safety.

Access is gated behind a license acceptance step on Hugging Face, and usage is governed by the Llama 2 Community License. Additional commercial terms kick in only if the licensee's products had more than 700 million monthly active users in the calendar month before the Llama 2 release date, so for most teams the weights are free to use commercially.

Under the hood

Llama 2 is an auto-regressive language model built on an optimized transformer architecture. The 13B chat model has a 4k token context window, does not use Grouped-Query Attention (that was reserved for the 70B tier), and was pretrained on 2 trillion tokens with a global batch size of 4M tokens and a learning rate of 3.0e-4.

The heavier lift was the alignment stack. Self-supervised learning on pretraining data produced base LLaMa 2, then supervised fine-tuning gave an initial LLaMa-2-chat, which was iteratively refined through RLHF using rejection sampling with PPO and human feedback for safety and reward models. All the smaller chat variants are trained on the largest model's data through distillation, so the 13B chat weights inherit a lot of behavior shaped by the 70B run.

One of the more interesting tricks in the paper is Ghost Attention (GAtt), aimed at multi-turn instruction stickiness. Initial RLHF models tended to forget the initial instruction after a few turns of dialogue, so the authors propose a technique similar to context distillation: concatenate the first-turn instruction to all the user messages of the conversation using hidden tokens. In practice this makes system-prompt personas hold up better across longer chats.

Compute footprint and training data

The compute footprint is public. Pretraining consumed a cumulative 3.3M GPU hours on A100-80GB hardware with a TDP of 350-400W, and estimated total emissions were 539 tCO2eq, all offset by Meta's sustainability program. The 13B run alone accounted for 368,640 A100 hours.

On data, Llama 2 was pretrained on 2 trillion tokens from publicly available sources. The fine-tuning corpus includes publicly available instruction datasets plus over one million new human-annotated examples, with no Meta user data in either stage. The pretraining data has a September 2022 cutoff, with some tuning data as recent as July 2023.

Where the 13B lands on benchmarks

Meta's own numbers put the 13B pretrained base at 54.8 on MMLU, 24.5 on Code (HumanEval and MBPP average), 28.7 on math, and 66.9 on commonsense reasoning. Those beat Llama 1 13B across the board and, on several tasks, edge out Llama 1 33B despite having far fewer parameters.

Chat tuning also swings the safety numbers hard in the right direction. Llama-2-Chat 13B scores 62.18 on TruthfulQA and 0.00 on Toxigen, versus 41.86 and 26.10 for the untuned 13B base. One paper review flagged a caveat: the 13B and 70B base models exhibited increased toxicity relative to the 7B, potentially due to larger pretraining data or different dataset mixes.

Running it

Because the weights ship in Hugging Face format, the fastest path is the Transformers pipeline:

from transformers import pipeline
pipe = pipeline("text-generation", model="meta-llama/Llama-2-13b-chat-hf")
messages = [{"role": "user", "content": "Who are you?"}]
pipe(messages)

For serving, the model card documents drop-in commands for vLLM (vllm serve "meta-llama/Llama-2-13b-chat-hf"), SGLang, and Docker Model Runner, all exposing an OpenAI-compatible chat completions endpoint. One prompt-formatting caveat is worth knowing: to get the expected quality from the chat versions, prompts need the INST and system tags, BOS and EOS tokens, and correct whitespaces and breaklines. Meta recommends calling strip() on inputs to avoid double-spaces. The Transformers chat template handles this automatically, but hand-rolled prompt strings are a common source of quality regressions.

Where it fits, and where it does not

Meta is explicit about the scope. Llama 2 is intended for commercial and research use in English, with tuned models aimed at assistant-like chat and pretrained models adaptable to a variety of natural language generation tasks. Out-of-scope uses include anything that violates applicable laws, and use in languages other than English.

Practical fits for the 13B chat model include:

  • English-language chat assistants where a 70B is too expensive to serve but a 7B is too weak
  • A base for domain fine-tunes and LoRA adapters, with quantization to fit consumer GPUs
  • RAG backends where the model handles synthesis over retrieved chunks rather than raw world-knowledge recall
  • Reward-model or judge experiments, where its RLHF-tuned behavior is a useful starting point

Weaknesses to plan around: no native multilingual support, a 4k context window that is short by current standards, weaker code and math than dedicated coder or reasoning models, and the usual RLHF quirks. One analysis of the training procedure noted that re-introducing top samples from past versions is a form of overfitting to the reward model common in RLHF pipelines, so behavior can feel over-hedged in certain domains.

Why this checkpoint stuck

The reason this checkpoint became a default in so many stacks is simple: it was the first commercially licensed open chat model at 13B scale that was actually competitive with hosted APIs on assistant tasks. It anchored an ecosystem of adapters, quantizations, and derivative fine-tunes, and it set the template Meta would keep iterating on with Llama 3 and beyond, including a paper that documented the RLHF recipe in detail. If you are picking a mid-size open model today, the 13B chat weights are still a reasonable baseline to benchmark newer options against.