Paper notes

LLaMA: Train Smaller Models for Longer, on Public Data Only

LLaMA is a family of 7B to 65B foundation models from Meta (2023), trained on public data only. The paper reports LLaMA-13B beating GPT-3 175B on most benchmarks. This post covers the inference-budget argument, data, architecture, training cost and evidence, and which claims need a discount.

Published Updated 26 min read

On this page
  1. Why this paper matters
  2. What the paper contributes
  3. Background: the training budget and the inference budget
  4. Data: seven public sources
  5. Method: three architecture changes and a training setup
  6. Architecture
  7. Model sizes and hyperparameters
  8. Training efficiency
  9. Checking the numbers yourself
  10. Experiments: numbers first, then the setup
  11. Common-sense reasoning
  12. Closed-book QA and reading comprehension
  13. Math and code
  14. MMLU and instruction tuning
  15. Performance during training
  16. Bias, toxicity and truthfulness
  17. Limitations and cautions
  18. What came after
  19. What to take away from this paper
  20. Further reading
  21. FAQ

Why this paper matters

LLaMA comes from Meta, and version 1 of the paper appeared on arXiv on 27 February 2023. It is a family of base language models with 6.7B, 13.0B, 32.5B and 65.2B parameters according to Table 2 (the text calls them 7B, 13B, 33B and 65B), trained on 1.0T to 1.4T tokens drawn entirely from public sources. Two results stand out: LLaMA-13B outperforms GPT-3 (175B) on most benchmarks with about 1/13 of its parameters, and LLaMA-65B is competitive with the best models of the time, Chinchilla-70B and PaLM-540B. The authors say the models are released to the research community, and that the 13B model can run inference on a single V100 GPU.

A word about what kind of paper this is: it proposes no new architecture and has no ablation study. Its weight comes from three things. First, it makes the difference between the training budget and the inference budget explicit, which gives a reason to train small models for longer. Second, it shows that public data alone is enough for a competitive base model, and it writes the recipe down in unusual detail: data mix, preprocessing, hyperparameters, throughput and energy use are all in the paper. Third, its models became the foundation for a great deal of later fine-tuning and quantization work. The way to read it is as a recipe plus an evaluation report: the recipe can be checked, while the reasons it works have to come from other papers and your own judgment.

What the paper contributes

  1. Models. Four sizes (6.7B, 13.0B, 32.5B, 65.2B): the 7B and 13B models are trained on 1.0T tokens, the 33B and 65B models on 1.4T tokens.
  2. Data. A mixture of seven public sources, deduplicated, language-filtered and quality-filtered, about 1.4T tokens.
  3. Architecture. Three changes to the decoder-only Transformer: Pre-Norm with RMSNorm, SwiGLU and RoPE.
  4. Training. AdamW, a cosine learning-rate schedule and 4M tokens per batch; a memory-efficient attention implementation and a hand-written backward pass to cut recomputation; about 380 tokens/s/GPU for the 65B model on 2048 A100-80GB GPUs, so 1.4T tokens take about 21 days.
  5. Evaluation. Zero-shot and few-shot common-sense reasoning, question answering, reading comprehension, math, code and MMLU; one instruction-tuning experiment (LLaMA-I); bias, toxicity, truthfulness and carbon footprint.

Background: the training budget and the inference budget

Kaplan et al. (2020) found that bigger models are better, and the work that followed (GPT-3, Gopher, PaLM and others) went a long way down the road of adding parameters; see the Scaling Laws paper breakdown for the details. Hoffmann et al. (2022, Chinchilla) corrected this: for a given training compute budget, the best choice is not the largest model but one where parameters and training tokens grow in proportion, empirically about 20 tokens per parameter (see scaling laws).

The LLaMA paper points out that this objective only cares about training and ignores the inference budget, which becomes critical once a model is served at scale. Its argument is that, for a target level of performance, the preferred model is not the fastest to train but the fastest at inference: training a large model to reach some performance may be cheaper, but a smaller model trained for longer ends up cheaper to serve. The paper’s example is that Hoffmann et al. recommend training a 10B model on 200B tokens, while the authors found that a 7B model keeps improving even after 1T tokens.

Dividing each model’s training tokens by its parameter count makes the difference plain:

Training tokens per parameter: LLaMA and several contemporaries A log-scale dot plot listing ten models, with training tokens per parameter on the horizontal axis. LLaMA 7B is about 148, 13B about 77, 33B about 43 and 65B about 21, close to Chinchilla at 20; GPT-3, Jurassic, LaMDA, Gopher and MT-NLG all sit between 0.5 and 1.7. Training tokens per parameter (log scale) 1 10 100 20: Chinchilla's ratio LLaMA 7B 1.0T tokens 148 LLaMA 13B 1.0T tokens 77 LLaMA 33B 1.4T tokens 43 LLaMA 65B 1.4T tokens 21 Chinchilla 70B 1.4T tokens 20 GPT-3 175B 300B tokens 1.71 Jurassic 178B 300B tokens 1.69 LaMDA 137B 168B tokens 1.23 Gopher 280B 300B tokens 1.07 MT-NLG 530B 270B tokens 0.51
Training tokens per parameter. LLaMA's parameter counts are computed from the configurations in Table 2 (code above) and its token counts come from the same table; the other models come from Table 1 of the Chinchilla paper. The axis is logarithmic, so the plot uses dots rather than bars; the dashed line at 20 is Chinchilla's ratio (70B, 1.4T tokens), often used as a rule of thumb for compute-optimal training.
  • GPT-3, Gopher and Jurassic were each trained on only about 300B tokens, which is 1.1 to 1.7 tokens per parameter; MT-NLG is at 0.51. They represent the “add parameters” route.
  • LLaMA-65B sits almost exactly where Chinchilla does (21 vs 20) and saw the same number of tokens (1.4T). The largest LLaMA is essentially trained at the Chinchilla ratio.
  • The small sizes are what is special about LLaMA. LLaMA-7B saw 148 tokens per parameter, about 7 times the Chinchilla ratio. These models are deliberately overtrained, spending extra training compute to get cheaper inference.

In terms of compute, training costs about Ctrain≈6NDC_{\text{train}}\approx 6ND floating-point operations and each token served costs about 2N2N, so when the number of tokens served, TT, is large, the second term of 6ND+2NT6ND+2NT overtakes the first, and shrinking NN pays off more. The paper gives only the argument. It does not measure inference cost and does not plot quality against total cost, which is the missing step the reader has to supply.

Data: seven public sources

The paper describes each source and its processing in detail. “Tokens at 1.4T” in the table is the sampling share times 1.4T:

SourceSampling shareEpochsDisk sizeTokens at 1.4TProcessing
English CommonCrawl67.0%1.103.3 TB938BFive 2017 to 2020 dumps through the CCNet pipeline: line-level deduplication, fastText language identification to drop non-English pages, an n-gram language model to filter low-quality text; plus a linear classifier that discards pages that do not look like pages cited by Wikipedia
C415.0%1.06783 GB210BAlso deduplicated and language-identified; quality filtering is heuristic (punctuation, word and sentence counts)
GitHub4.5%0.64328 GB63BPublic dataset on Google BigQuery, only projects under Apache, BSD and MIT licenses; heuristic filters on line length and the share of alphanumeric characters, regular expressions to remove boilerplate such as file headers, exact file-level deduplication
Wikipedia4.5%2.4583 GB63BDumps from June to August 2022 in 20 languages that use Latin or Cyrillic scripts; hyperlinks, comments and other formatting boilerplate removed
Books4.5%2.2385 GB63BProject Gutenberg and the Books3 section of The Pile; book-level deduplication, dropping books with more than 90% content overlap
ArXiv2.5%1.0692 GB35BLaTeX sources: everything before the first section and the bibliography removed, comments removed, user-defined macros expanded inline
Stack Exchange2.0%1.0378 GB28BThe 28 largest sites, HTML tags removed, answers sorted by score from highest to lowest
  • Tokenization. BPE through SentencePiece, with numbers split into individual digits and unknown UTF-8 characters falling back to bytes; see tokenizers and embeddings. The paper does not state the vocabulary size in its text. The released implementation uses 32,000, which the check below relies on, and the parameter counts it produces match Table 2.
  • Epochs. Most data is used once; Wikipedia and books are used for about two epochs (2.45 and 2.23).
  • Mostly English. Only English pages are kept from CommonCrawl, and although Wikipedia covers 20 languages it is only 4.5% of the mix.
  • Data choices show up in the scores. The paper’s own explanation is that books and papers (ArXiv, Gutenberg, Books3) add up to only 177 GB, while Gopher, Chinchilla and PaLM used up to 2 TB of books, which may be why LLaMA trails on MMLU. This is the authors’ conjecture; the paper runs no controlled experiment to test it.

Method: three architecture changes and a training setup

Architecture

LLaMA is a decoder-only Transformer, and the paper lists three changes, with the authors’ sources of inspiration in brackets:

ChangeWhat it doesDeeper coverage
Pre-Norm and RMSNorm (GPT-3)Normalize the input of each sublayer instead of the output; the normalization function is RMSNormThe Transformer block
SwiGLU (PaLM)Replace ReLU with SwiGLU, with a hidden size of 23⋅4d\frac{2}{3}\cdot 4d instead of PaLM’s 4d4dModern LLM architecture
RoPE (GPTNeo)Remove absolute position embeddings and add rotary position embeddings to the queries and keys in every layerPositional encoding

RMSNorm (Zhang and Sennrich, 2019) divides by the root mean square of the features and does not subtract the mean:

RMSNorm(x)=x1d∑i=1dxi2+ϵ⊙g\mathrm{RMSNorm}(\mathbf{x})=\frac{\mathbf{x}}{\sqrt{\frac{1}{d}\sum_{i=1}^{d}x_i^{2}+\epsilon}}\odot\mathbf{g}

The SwiGLU feed-forward network (Shazeer, 2020) has three matrices, with W1W_1 and W3W_3 of shape d×hd\times h and W2W_2 of shape h×dh\times d:

FFN(x)=(SiLU(xW1)⊙xW3)W2\mathrm{FFN}(\mathbf{x})=\bigl(\mathrm{SiLU}(\mathbf{x}W_1)\odot \mathbf{x}W_3\bigr)W_2

The hidden size h=23⋅4dh=\frac{2}{3}\cdot 4d is chosen to keep the parameter count unchanged: three matrices hold 3dh=8d23dh=8d^{2} parameters, the same as the two matrices of a plain FFN, 2⋅d⋅4d=8d22\cdot d\cdot 4d=8d^{2}. The official implementation also rounds hh up to a multiple of 256, so d=4096d=4096 gives 11008 rather than 10922.

The paper runs no ablation, so it does not say what each of the three changes buys. It is more accurate to read them as “a sound configuration for the time” than as “these three things make the model stronger”.

Model sizes and hyperparameters

ModelParameters (Table 2)ddHeadsLayersFFN hidden sizeLearning rateBatchTraining tokens
7B6.7B40963232110083.0e-44M1.0T
13B13.0B51204040138243.0e-44M1.0T
33B32.5B66565260179201.5e-44M1.4T
65B65.2B81926480220161.5e-44M1.4T

Everything else is shared by all sizes: AdamW with β1=0.9\beta_1=0.9 and β2=0.95\beta_2=0.95; cosine learning-rate decay to 10% of the peak; weight decay 0.1; gradient clipping at 1.0; 2,000 warmup steps. The FFN hidden sizes in the table follow the rule above; the paper does not list them.

Training efficiency

The paper uses several engineering optimizations to reach about 380 tokens/s/GPU for the 65B model on 2048 A100-80GB GPUs:

  • Memory-efficient causal attention. The implementation in xformers (inspired by Rabe and Staats, 2021, with a backward pass from FlashAttention) does not store the attention weights and does not compute the query-key scores that the causal mask would hide. See the FlashAttention paper breakdown for the idea.
  • Less recomputation. Expensive activations, such as the outputs of linear layers, are saved, which required writing the backward pass of the Transformer layers by hand instead of relying on PyTorch autograd.
  • Parallelism and overlap. Model and sequence parallelism as in Korthikanti et al. (2022), with the computation of activations overlapped with the all_reduce communication between GPUs as far as possible. For background see compute and memory and distributed training.

Checking the numbers yourself

Tables 2 and 15 give enough information to check the parameter counts, the training compute and the energy use, and to estimate model FLOPs utilization (MFU) with fewer than 40 lines of code. It runs on a CPU with Python 3.14 and has no randomness.

# Table 2 configs (hidden size d, layers, training tokens), Table 15 GPU hours
CONFIG = {
    "7B": (4096, 32, 1.0e12, 82_432),
    "13B": (5120, 40, 1.0e12, 135_168),
    "33B": (6656, 60, 1.4e12, 530_432),
    "65B": (8192, 80, 1.4e12, 1_022_362),
}
V = 32_000          # SentencePiece vocabulary size
A100_PEAK = 312e12  # A100 dense BF16 peak, FLOP/s


def ffn_dim(d):
    """SwiGLU hidden size: 2/3 of 4d, rounded up to a multiple of 256."""
    return 256 * -(-(8 * d // 3) // 256)


def n_params(d, layers):
    attn = 4 * d * d                # Wq, Wk, Wv, Wo, no biases
    ffn = 3 * d * ffn_dim(d)        # SwiGLU has three matrices
    per_layer = attn + ffn + 2 * d  # plus two RMSNorm scale vectors
    return layers * per_layer + 2 * V * d + d  # input and output embeddings


print("size  params  tok/param     6ND   MFU   MWh  tCO2")
total_mwh = 0
for name, (d, layers, tokens, gpu_h) in CONFIG.items():
    n = n_params(d, layers)
    flops = 6 * n * tokens
    mfu = flops / (gpu_h * 3600 * A100_PEAK)
    mwh = gpu_h * 400 * 1.1 / 1e6   # 400 W per GPU, PUE 1.1
    total_mwh += mwh
    print(f"{name:>4} {n / 1e9:6.2f}B {tokens / n:9.0f} {flops:9.2e} "
          f"{mfu:5.0%} {mwh:5.0f} {mwh * 0.385:5.0f}")

days = 1.4e12 / (380 * 2048) / 86400   # 380 tokens/s/GPU on 2048 GPUs
print(f"65B needs about {days:.1f} days for 1.4T tokens")
print(f"Four final runs: {total_mwh:.0f} MWh, "
      f"{total_mwh / 2638:.0%} of the paper's 2,638 MWh")

Output:

size  params  tok/param     6ND   MFU   MWh  tCO2
  7B   6.74B       148  4.04e+22   44%    36    14
 13B  13.02B        77  7.81e+22   51%    59    23
 33B  32.53B        43  2.73e+23   46%   233    90
 65B  65.29B        21  5.48e+23   48%   450   173
65B needs about 20.8 days for 1.4T tokens
Four final runs: 779 MWh, 30% of the paper's 2,638 MWh

Compared with the paper, line by line:

  • The parameter counts match Table 2. 6.74B, 13.02B, 32.53B and 65.29B against 6.7B, 13.0B, 32.5B and 65.2B (65.29B is written as 65.2B in the table). It also confirms that a 32,000-token vocabulary with separate input and output embeddings is the right assumption.
  • Tokens per parameter. 148, 77, 43 and 21, as in the figure above.
  • MFU lands between 44% and 51%. Compute is estimated as 6ND6ND, the denominator is the A100’s dense BF16 peak (312 TFLOP/s), and the GPU hours come from Table 15. 6ND6ND leaves out the attention-score computation, so the true utilization is a little higher. The range is in the same ballpark as the 46.2% reported for PaLM 540B. The paper does not say whether the GPU hours include restarts after failures.
  • Training time. At 380 tokens/s/GPU on 2048 GPUs, 1.4T tokens take 20.8 days, matching the paper’s “approximately 21 days”.
  • Energy and emissions. With the paper’s assumptions (400 W per GPU, a PUE of 1.1, 0.385 kg CO2e per kWh), the computed 36, 59, 233 and 450 MWh agree with Table 15 (for 65B the table says 449; the exact value, 449.8, rounds to 450), which is 14, 23, 90 and 173 tonnes of CO2 equivalent. For comparison, Table 15 lists OPT-175B at 356 MWh and 137 tonnes and BLOOM-175B at 475 MWh and 183 tonnes.
  • The final runs are only about 30% of the project’s electricity. The four final runs total 779 MWh, while the paper says developing the models took about 2048 A100-80GB GPUs for about 5 months, around 2,638 MWh and 1,015 tonnes of CO2 equivalent. The rest went to experiments, failed attempts and evaluation. Reporting only the final run understates the cost of a model.

Experiments: numbers first, then the setup

The paper evaluates on 20 benchmarks in the zero-shot and few-shot settings. Multiple-choice questions are answered by picking the option with the highest likelihood given the context, normalized by the number of characters in the option (OpenBookQA and BoolQ are the exceptions, normalized by the option’s likelihood after “Answer:”). The numbers for the other models (GPT-3, Gopher, Chinchilla, PaLM) are copied from their own papers and were not re-run under one prompt.

Common-sense reasoning

Table 3 is zero-shot, and each cell is accuracy in percent:

ModelBoolQPIQASIQAHellaSwagWinoGrandeARC-eARC-cOBQA
GPT-3 175B60.581.0–78.970.268.851.457.6
Chinchilla 70B83.781.851.380.874.9–––
PaLM 540B88.082.3–83.481.176.653.053.4
LLaMA 7B76.579.848.976.170.172.847.657.2
LLaMA 13B78.180.150.479.273.074.852.756.4
LLaMA 33B83.182.350.482.876.080.057.858.6
LLaMA 65B85.382.852.384.277.078.956.060.2

The paper’s text has three sentences summarizing this table, and the math section has one more about GSM8k. Here they are checked by typing the numbers into code:

# Table 3: zero-shot common-sense reasoning (None: not reported in the paper)
TASKS = ["BoolQ", "PIQA", "SIQA", "HellaSwag", "WinoGrande",
         "ARC-e", "ARC-c", "OBQA"]
T3 = {
    "GPT-3 175B": [60.5, 81.0, None, 78.9, 70.2, 68.8, 51.4, 57.6],
    "Chinchilla 70B": [83.7, 81.8, 51.3, 80.8, 74.9, None, None, None],
    "PaLM 540B": [88.0, 82.3, None, 83.4, 81.1, 76.6, 53.0, 53.4],
    "LLaMA 13B": [78.1, 80.1, 50.4, 79.2, 73.0, 74.8, 52.7, 56.4],
    "LLaMA 65B": [85.3, 82.8, 52.3, 84.2, 77.0, 78.9, 56.0, 60.2],
}


def compare(a, b):
    pairs = [(t, x, y) for t, x, y in zip(TASKS, T3[a], T3[b])
             if x is not None and y is not None]
    lost = [t for t, x, y in pairs if x <= y]
    print(f"{a} vs {b}: {len(pairs)} comparable, "
          f"wins {len(pairs) - len(lost)}, no win: {lost or 'none'}")


compare("LLaMA 13B", "GPT-3 175B")
compare("LLaMA 65B", "Chinchilla 70B")
compare("LLaMA 65B", "PaLM 540B")

# Table 7: GSM8k accuracy (single decode, majority vote)
GSM8K = {"LLaMA 65B": (50.9, 69.7), "Minerva 62B": (52.4, 68.5)}
for i, mode in enumerate(["single decode", "majority vote"]):
    a, b = GSM8K["LLaMA 65B"][i], GSM8K["Minerva 62B"][i]
    print(f"GSM8k, {mode}: LLaMA 65B {a}, Minerva 62B {b}, "
          f"{'ahead' if a > b else 'behind'}")

Output:

LLaMA 13B vs GPT-3 175B: 7 comparable, wins 5, no win: ['PIQA', 'OBQA']
LLaMA 65B vs Chinchilla 70B: 5 comparable, wins 5, no win: none
LLaMA 65B vs PaLM 540B: 7 comparable, wins 5, no win: ['BoolQ', 'WinoGrande']
GSM8k, single decode: LLaMA 65B 50.9, Minerva 62B 52.4, behind
GSM8k, majority vote: LLaMA 65B 69.7, Minerva 62B 68.5, ahead
  • “LLaMA-13B outperforms GPT-3 on most benchmarks” holds, but not on all. It wins 5 of the 7 comparable tasks and is slightly behind on PIQA and OpenBookQA.
  • “LLaMA-65B outperforms Chinchilla-70B on all reported benchmarks but BoolQ” does not match the table. That is what the text says, but the 85.3 for BoolQ in Table 3 is also higher than Chinchilla’s 83.7, so LLaMA-65B is ahead on all 5 comparable tasks. The table is what counts, and the exception in the text looks like a slip.
  • “LLaMA-65B surpasses PaLM-540B everywhere except BoolQ and WinoGrande” holds. It wins 5 of 7.
  • “Outperforms Minerva-62B on GSM8k” holds only with majority voting. With a single decode it is 50.9 against 52.4, behind; with majority voting it is 69.7 against 68.5, ahead. Minerva is PaLM further trained on 38.5B tokens of math and ArXiv web pages, while LLaMA was not trained specially on math data, so this comparison is not unfair to LLaMA, but check which column a claim refers to.

Closed-book QA and reading comprehension

NaturalQuestions and TriviaQA are closed-book question answering (the model gets no documents), scored by exact match in percent. Tables 4 and 5 have 0-, 1-, 5- and 64-shot columns; only the 0-shot and 64-shot columns are shown here:

ModelNaturalQuestions 0-shotNaturalQuestions 64-shotTriviaQA 0-shotTriviaQA 64-shot
GPT-3 175B14.629.9––
Gopher 280B10.128.243.557.2
Chinchilla 70B16.635.555.464.6
PaLM 540B21.239.6––
LLaMA 7B16.826.150.057.6
LLaMA 13B20.131.956.664.0
LLaMA 33B24.936.065.170.4
LLaMA 65B23.839.968.273.0
  • LLaMA-65B is the highest in the table on both TriviaQA columns and on NaturalQuestions 64-shot. Its 39.9 on NaturalQuestions 64-shot is only 0.3 above PaLM-540B’s 39.6, and at zero-shot LLaMA-33B (24.9) beats the 65B model (23.8), so do not treat a single-cell gap as a stable pattern.
  • On TriviaQA, LLaMA-13B is already close to Chinchilla. 56.6 against 55.4 at zero-shot and 64.0 against 64.6 at 64-shot. The authors say it runs on a single V100: at 2 bytes per parameter in fp16, 13.02B parameters take 26.0 GB, which fits a 32 GB V100 but not a 16 GB one.
  • Reading comprehension (RACE, zero-shot). In Table 6 LLaMA-65B scores 67.9 on the middle-school questions and 51.6 on the high-school ones, against 68.1 and 49.1 for PaLM-540B and 58.4 and 45.5 for GPT-3. The paper says 65B is competitive with PaLM-540B, and LLaMA-13B is 3.2 and 1.7 points above GPT-3.

Math and code

Math uses MATH and GSM8k, and code uses HumanEval and MBPP (pass@1, sampling temperature 0.1). Tables 7 and 8 are excerpted below, in percent:

ModelMATHMATH, majority voteGSM8kGSM8k, majority voteHumanEval pass@1MBPP pass@1
PaLM 62B4.4–33.0–15.921.4
PaLM 540B8.8–56.5–26.236.8
Minerva 62B27.643.452.468.5––
LaMDA 137B––––14.014.8
LLaMA 7B2.96.911.018.110.517.7
LLaMA 13B3.98.817.829.315.822.0
LLaMA 33B7.115.235.653.121.730.2
LLaMA 65B10.620.550.969.723.737.7
  • On math, a model trained specifically for it is far ahead. On MATH, Minerva 62B scores 27.6 and LLaMA-65B only 10.6; majority voting samples k=256k=256 times on MATH and k=100k=100 times on GSM8k.
  • On code, LLaMA is near the top among general-purpose models of similar size. LLaMA-13B gets 15.8 on HumanEval and 22.0 on MBPP, both above the 137B LaMDA (14.0 and 14.8); LLaMA-65B is above PaLM-62B (HumanEval 23.7 vs 15.9, MBPP 37.7 vs 21.4) and close to PaLM-540B (HumanEval 23.7 vs 26.2, MBPP 37.7 vs 36.8). The paper notes that fine-tuning on code helps further (PaLM-Coder raises PaLM’s HumanEval pass@1 from 26.2% to 36%), which is out of scope here.

MMLU and instruction tuning

MMLU is a multiple-choice benchmark covering the humanities, STEM, social sciences and other fields, evaluated five-shot (Table 9, percent):

ModelHumanitiesSTEMSocial sciencesOtherAverage
GPT-3 175B40.836.750.448.843.9
Chinchilla 70B63.654.979.373.967.5
PaLM 540B77.055.681.069.669.3
LLaMA 7B34.030.538.338.135.1
LLaMA 13B45.035.853.853.346.9
LLaMA 33B55.846.066.763.457.8
LLaMA 65B61.851.772.967.463.4

This is where LLaMA does not lead: 65B averages 63.4, about 4 points behind Chinchilla-70B and about 6 behind PaLM-540B. The paper attributes this to the small amount of book and paper data (see above), and suggests that the large amount of books may also explain why Gopher is so much stronger than GPT-3 on this benchmark.

Section 4 of the paper runs one instruction-tuning experiment (a single experiment, following the Flan protocol of Chung et al., 2022) and calls the result LLaMA-I. In Table 10, LLaMA-65B’s MMLU rises from 63.4 to 68.9 for LLaMA-I, above Flan-PaLM-cont 62B at 66.1 and OPT-IML-Max 30B at 43.2, but still well below GPT code-davinci-002 at 77.4 (a number taken from the OPT-IML paper). So a small amount of instruction data clearly helps on MMLU, which the LLaMA paper treats only as a preview of future work.

Performance during training

Figure 2 of the paper tracks question-answering and common-sense benchmarks during training: on most benchmarks the scores rise steadily and correlate with training perplexity, with SIQA and WinoGrande as the exceptions. SIQA shows large variance, which the authors take as a sign that the benchmark may be unreliable, and on WinoGrande the 33B and 65B models perform similarly and do not track training perplexity. Using a single small benchmark as the only evidence of capability is risky.

Bias, toxicity and truthfulness

The paper checks LLaMA-65B (and some smaller sizes) on four benchmarks. The authors stress that these evaluations are not enough to fully understand the risks.

BenchmarkResultHow to read it
RealToxicityPrompts (higher is more toxic)“Basic” prompts: 7B 0.106, 13B 0.104, 33B 0.107, 65B 0.128; “respectful” prompts: 0.081, 0.095, 0.087, 0.141Toxicity rises with size, and the respectful prompt does not help at 65B (0.141 is higher than the basic prompt’s 0.128); scores come from a third-party API, so they are not strictly comparable with other papers
CrowS-Pairs (higher is more biased)Average 66.6, against 67.2 for GPT-3 and 69.5 for OPT-175B; religion 79.0, about 10 points above OPT-175B’s 68.6Slightly better overall, but bias is clear for religion, age and gender; the authors expect it to come from CommonCrawl
WinoGender (coreference accuracy, 65B)All 77.5; their/them/someone 81.7, her/her/she 78.8, his/him/he 72.1; on “gotcha” cases her 75.0 and his 63.3More accurate with the neutral pronoun, and more errors where the pronoun does not match the majority gender of the occupation, which suggests the model uses occupational stereotypes
TruthfulQA (truthful / truthful and informative)65B 0.57 / 0.53, GPT-3 175B 0.28 / 0.25Higher than GPT-3, but the rate of correct answers is still low, so the model is likely to make up wrong answers

Limitations and cautions

  • No ablation studies. The paper does not test the individual contributions of RMSNorm, SwiGLU, RoPE or the data mix, so “LLaMA is strong because of these changes” is not a conclusion of the paper.
  • Comparison numbers are copied from other papers. The results for GPT-3, Gopher, Chinchilla and PaLM come from their own papers, with different prompts, shot counts and evaluation details, so gaps within a point or two should not be read as wins. The text also contains a statement that disagrees with the table (the BoolQ item above).
  • Inference cost is not measured. “A smaller model trained for longer is cheaper to serve” is an argument, not a measured result; the paper gives no speed or cost comparison.
  • Limited reproducibility. The paper lists the data sources and processing steps but does not release the processed dataset. The models were released to the research community, and the terms of use are those of the license at release, which is not the same as an open license that allows commercial use.
  • The MMLU explanation is a conjecture. The idea that too little book data is the reason was not tested by a controlled experiment.
  • One instruction-tuning experiment. The LLaMA-I result is only a directional signal.
  • Limited safety evaluation. The bias and toxicity checks cover a handful of benchmarks, and the authors admit they are not sufficient to fully understand the risks.

What came after

  • The fine-tuning and quantization ecosystem. Many projects built directly on LLaMA: Alpaca fine-tuned LLaMA 7B on 52K instructions generated by text-davinci-003 (see SFT data construction and quality control for the problems with that data), and QLoRA (Dettmers et al., 2023) notes that ordinary 16-bit fine-tuning of LLaMA 65B needs more than 780 GB of GPU memory while QLoRA brings it under 48 GB; see LoRA fine-tuning in practice for how.
  • “Train for longer” was pushed further. The Llama 3 paper (2024) says that its scaling laws suggest the flagship model (405B parameters, 15.6T tokens) is approximately compute-optimal in size for its training budget, but that the smaller models are trained for much longer than is compute-optimal and perform better than compute-optimal models at the same inference budget. That is the idea LLaMA introduced; see scaling laws for more.
  • The recipe was reused. Pre-Norm, RMSNorm, SwiGLU and RoPE became common settings for open models (see modern LLM architecture), and later models such as Mixtral and DeepSeek-V3 keep modifying that base configuration.

What to take away from this paper

  1. Choose model size by the total cost of training plus inference. The optimum for training compute alone gives a model that is too large; LLaMA’s small models spend more tokens to get cheaper inference.
  2. Tokens per parameter is a useful diagnostic. 148, 77, 43 and 21 against about 1.7 for GPT-3 shows the difference in training route at a glance.
  3. Public data plus careful preprocessing is enough. Deduplication, language identification, quality filtering and license filtering each have a concrete recipe, and data quality matters more than whether the source is exotic.
  4. The three architecture changes are sound rather than novel. Pre-Norm with RMSNorm, SwiGLU and RoPE all come from earlier work and the paper has no ablation, so be careful about attributing the gains.
  5. Read conclusions against the tables. The text has a claim that disagrees with a table, the comparison numbers are copied from elsewhere, and small gaps on a single benchmark are unstable; checking the numbers yourself is more reliable than trusting one sentence.

Further reading

FAQ

What is the core idea of LLaMA?
The paper puts the inference budget into the choice of model size. For a target level of quality, the best model is not the one that is fastest to train but the one that is fastest to serve, so a smaller model should be trained for longer. LLaMA's 7B and 13B models saw 1.0T tokens and the 33B and 65B models saw 1.4T tokens, which works out to 148, 77, 43 and 21 tokens per parameter, against about 1.7 for GPT-3. Two other traits are that it uses only public data and that it makes three changes to the Transformer, namely Pre-Norm with RMSNorm, SwiGLU and RoPE.
Is LLaMA-13B really better than GPT-3 175B?
On most of the paper's benchmarks, yes, but not on all of them. Table 3 has 7 zero-shot common-sense tasks where both models report a score, and LLaMA-13B wins 5, falling slightly behind on PIQA (80.1 vs 81.0) and OpenBookQA (56.4 vs 57.6). On NaturalQuestions zero-shot it scores 20.1 against 14.6, and on five-shot MMLU 46.9 against 43.9. The GPT-3 numbers are copied from its own paper, with different prompts and evaluation protocols, so small gaps should not be over-read.
What data was LLaMA trained on, and can it be reproduced?
Seven public sources. English CommonCrawl is 67%, C4 is 15%, GitHub, Wikipedia and books are 4.5% each, ArXiv is 2.5% and Stack Exchange is 2%, about 1.4T tokens in total. The paper describes the preprocessing of every source (deduplication, language identification, quality filtering, license filtering) but does not release the processed dataset, so you can rebuild a similar corpus by following the steps, but not a token-identical one.
How does LLaMA differ from the original Transformer?
The paper lists three changes. Normalization moves to the input of each sublayer and uses RMSNorm. SwiGLU replaces ReLU, with a hidden size of two thirds of 4d so that three matrices have the same parameter count as the original two. Absolute position embeddings are removed, and rotary position embeddings (RoPE) are added to the queries and keys in every layer. The paper has no ablation study, so it does not say how much each change contributes.
How much compute and electricity did training LLaMA-65B take?
The paper reports about 380 tokens per second per GPU on 2048 A100-80GB GPUs, so 1.4T tokens take about 21 days; Table 15 lists 1,022,362 GPU hours, which under the paper's assumptions is about 449 MWh and 173 tonnes of CO2 equivalent. By the $6ND$ approximation the total is about 5.5×10²³ FLOPs, which corresponds to a model FLOPs utilization of about 48% (our estimate, not a number from the paper).