All papersFoundations Classic
Smaller models, trained longer, on public data Paper: LLaMA: Open and Efficient Foundation Language Models
Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothee Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, Guillaume Lample · arXiv · Posted 27 Feb 2023 · 16 min read · arXiv 2302.13971
1 The problem Show in original Strong language models are costly to run . Most of them train on private data and stay closed. Earlier work asked for the cheapest model to train . It ignored the cost to run the model at scale. 10x smaller LLaMA-13B beats GPT-3 on most benchmarks while being 10 times smaller .
2 What they tested Show in original The authors train 4 sizes : 7B, 13B, 33B and 65B. They use only public data , about 1.4T tokens . They test 20 benchmarks in zero-shot and few-shot settings. They also test bias , toxicity and truthfulness . 3 What they found Show in original LLaMA-13B beats GPT-3 (175B) on most benchmarks.LLaMA-65B is competitive with Chinchilla-70B and PaLM-540B.The 13B model can run on a single GPU . LLaMA-65B still trails on MMLU and shows bias and wrong answers. In a chart LLaMA-13B beats GPT-3 on 4 of these 5 tests From Table 3 LLaMA 13B GPT-3 175B
0 25 50 75 100 Zero-shot accuracy (%) BoolQ 78.1% 60.5% HellaSwag 79.2% 78.9% ARC-e 74.8% 68.8% ARC-c 52.7% 51.4% OBQA 56.4% 57.6%
Hover, tap or focus a bar to read its exact value.
Show as table Benchmark LLaMA 13B (%) GPT-3 175B (%) BoolQ 78.1 60.5 HellaSwag 79.2 78.9 ARC-e 74.8 68.8 ARC-c 52.7 51.4 OBQA 56.4 57.6
5 Watch out Show in original These results are from 2023 . Newer models are stronger. Benchmarks are not real work . Test on your own tasks. The bias tests are not enough to show the full risk. Scores for other models come from other papers . Jump to A The abstract1 Introduction: why smaller and longer2 Approach: data, design and training3 Main results: how they test3.1 Common sense reasoning3.2 Closed-book question answering3.3 Reading comprehension3.4 Mathematical reasoning3.5 Code generation3.6 Massive Multitask Language Understanding3.7 Evolution of performance during training4 Instruction finetuning5 Bias, toxicity and misinformation5.1 RealToxicityPrompts5.2 CrowS-Pairs5.3 WinoGender5.4 TruthfulQA6 Carbon footprint7 Related work8 ConclusionA Appendix A: question answering setupB Appendix B: MMLU in detailC Appendix C: sample outputs of LLaMA-65BD Appendix D: sample outputs of LLaMA-IW Words to knowEvery detail from the paper Cards follow the paper's own order. Dotted words link to Words to know. Numbers match the paper.
A The abstract Show in original The main claims LLaMA-13B beats GPT-3 (175B) on most benchmarks.LLaMA-65B is competitive with Chinchilla-70B and PaLM-540B.The authors release all models to the research community. 1 Introduction: why smaller and longer Show in original The old idea Large language models learn new tasks from text instructions or a few examples. These few-shot skills first appeared when models grew large enough. Many teams then built bigger models. They assumed that more parameters give better results. The Chinchilla finding Hoffmann et al. (2022) found something different. For a fixed compute budget, the best results come from smaller models . Those smaller models train on more data . Their scaling laws show how to split a budget between model size and data size. The authors' point That goal ignores the cost to run the model. This cost is the Inference budget. It matters when you serve a model at scale. For a target quality, the best model is the fastest to run . It is not the fastest to train. A smaller model trained longer is cheaper to run. A test of that point Hoffmann et al. recommend a 10B model on 200B tokens. The authors find a 7B model keeps improving after 1T tokens . What this paper does The goal is the best quality at each inference budget. The method is to train on more tokens than is usual. The models are called LLaMA. They range from 7B to 65B parameters. The results in short LLaMA-13B beats GPT-3 on most benchmarks. It is 10 times smaller . The authors say it can run on a single GPU . They believe this helps more people use and study LLMs. LLaMA-65B is also competitive with Chinchilla and PaLM-540B. Why public data matters Chinchilla, PaLM and GPT-3 use data that is not public or not documented. Two examples are "Books - 2TB" and "Social media conversations". Some open models exist: OPT, GPT-NeoX, BLOOM and GLM. None of them compete with PaLM-62B or Chinchilla. LLaMA uses only publicly available data. So it is compatible with open-sourcing. The plan of the paper Next: the changes to the Transformer, and the training method. Then: results on standard benchmarks against other LLMs. Last: biases and toxicity in the models, using recent responsible AI benchmarks. 2 Approach: data, design and training Show in original Overview The method is similar to earlier work (Brown et al., 2020; Chowdhery et al., 2022). It follows the Chinchilla scaling laws. The authors train large transformers on a large amount of text. They use a standard Optimizer . 2.1 Pre-training data The training set mixes several sources that cover many domains. Most sources were used by other LLMs before. The rule: only data that is public and open-source compatible . Dataset Sampling share Epochs Disk size CommonCrawl 67.0% 1.10 3.3 TB C4 15.0% 1.06 783 GB Github 4.5% 0.64 328 GB Wikipedia 4.5% 2.45 83 GB Books 4.5% 2.23 85 GB ArXiv 2.5% 1.06 92 GB StackExchange 2.0% 1.03 78 GB
Table 1: pre-training data
Epochs are for training on 1.4T tokens. Runs on 1T tokens use the same shares.
English CommonCrawl, 67% The authors process five CommonCrawl dumps from 2017 to 2020. They use the CCNet pipeline. It removes repeated text at the line level. It finds the language with a fastText linear classifier and drops non-English pages. It filters low quality text with an n-gram language model. They also trained a linear model to spot pages used as Wikipedia references. They discarded pages that were not classified as references. C4, 15% Early tests showed that varied CommonCrawl data improves results. So they added the public C4 dataset. C4 also removes repeats and checks the language. Its quality filter uses simple rules. Examples are punctuation marks, or the number of words and sentences. Github, 4.5% They use the public GitHub dataset on Google BigQuery. They keep only projects with Apache, BSD and MIT licenses. They drop low quality files. The rules use line length or the share of letters and digits. They remove boilerplate, such as headers, with regular expressions. They remove exact file-level repeats. Wikipedia, 4.5% They add Wikipedia dumps from June to August 2022. They cover 20 languages that use Latin or Cyrillic scripts. These are bg, ca, cs, da, de, en, es, fr, hr, hu, it, nl, pl, pt, ro, ru, sl, sr, sv and uk. They remove hyperlinks, comments and other formatting boilerplate. Gutenberg and Books3, 4.5% They use two book sets: the Gutenberg Project and Books3 from ThePile. Gutenberg holds books in the public domain. They remove repeats at the book level. They drop books with more than 90% content overlap. ArXiv, 2.5% They process arXiv LaTeX files to add science text. They remove everything before the first section, and the bibliography. They remove comments from the .tex files. They expand macros that users defined, to make papers more consistent. Stack Exchange, 2% They use a dump of Stack Exchange, a site of good questions and answers. They keep the 28 largest websites. They remove HTML tags. They sort answers by score, from highest to lowest. The tokenizer They use the byte-pair encoding algorithm, from SentencePiece. They split all numbers into single digits. For unknown UTF-8 characters, they fall back to bytes. Total size The full training set holds about 1.4T tokens . Most data is used once in training. Wikipedia and Books are used for about two epochs . 2.2 Architecture Three changes to the transformer From Section 2.2 Start: original transformer RMSNorm Normalize layer inputs SwiGLU Swap ReLU for SwiGLU RoPE Add rotary position codes LLaMA block Each change comes from a later model: GPT3, PaLM and GPTNeo.
Overview The network is a Transformer. The authors add changes that other models, such as PaLM, used later. The brackets show where each idea came from. Change 1 Pre-normalization [GPT3]. This makes training more stable. They normalize the input of each sub-layer, not the output. They use the RMSNorm function (Zhang and Sennrich, 2019). Change 2 SwiGLU activation [PaLM]. It replaces the ReLU non-linearity, to improve performance (Shazeer, 2020). They use a dimension of 2/3 of 4d instead of 4d as in PaLM. Change 3 Rotary Embeddings [GPTNeo]. They remove the absolute positional embeddings. They add rotary positional embeddings (RoPE) at each layer (Su et al., 2021). 2.3 Optimizer and model sizes Params Dimension, heads, layers Learning rate, batch size Tokens 6.7B 4096, 32 heads, 32 layers 3.0e-4, 4M 1.0T 13.0B 5120, 40 heads, 40 layers 3.0e-4, 4M 1.0T 32.5B 6656, 52 heads, 60 layers 1.5e-4, 4M 1.4T 65.2B 8192, 64 heads, 80 layers 1.5e-4, 4M 1.4T
Table 2: model sizes and training settings
Figure 1: training loss Figure 1 shows training loss against tokens for all four sizes. LLaMA-33B and LLaMA-65B train on 1.4T tokens. The smaller models train on 1.0T tokens. All models use a batch size of 4M tokens. 2.4 Efficient implementation Faster attention They use an efficient form of causal multi-head attention. It cuts memory and run time. It is in the xformers library. It follows Rabe and Staats (2021). Its backward step uses Dao et al. (2022). It does not store attention weights. It does not compute key and query scores that the causal mask hides. Less recomputing They cut the work that is recomputed in the backward pass, with checkpointing . They save the costly results, such as outputs of linear layers. To do this, they write the backward function of the layers by hand. They do not use PyTorch autograd for this. Better use of GPUs They use model and sequence parallelism to cut memory (Korthikanti et al., 2022). They overlap the math with the network traffic between GPUs (all_reduce). Speed The 65B model processes about 380 tokens per second per GPU. This runs on 2048 A100 GPUs with 80GB of RAM. Training on 1.4T tokens takes about 21 days . 3 Main results: how they test Show in original The plan They follow Brown et al. (2020). They test zero-shot and few-shot tasks. They report results on 20 benchmarks . The two settings Zero-shot : a task text and one test example. The model answers or ranks options.Few-shot : 1 to 64 examples of the task, plus a test example.The models they compare with Closed models: GPT-3, Gopher, Chinchilla and PaLM. Open models: OPT, GPT-J and GPT-Neo. Section 4 also compares briefly with OPT-IML and Flan-PaLM. How multiple choice is scored There are free-form generation tasks and multiple choice tasks. For multiple choice, the model picks the option with the highest Likelihood . Usually they follow Gao et al. (2021). They divide by the number of characters. OpenBookQA and BoolQ follow Brown et al. (2020) instead. There the score is P(completion|context) / P(completion|"Answer:"). 3.1 Common sense reasoning Show in original The test They use eight standard benchmarks. These are BoolQ, PIQA, SIQA, HellaSwag, WinoGrande, ARC easy, ARC challenge and OpenBookQA. They include Cloze and Winograd style tasks, and multiple choice questions. They test in the zero-shot setting. Numbers for other models come from their own papers. The result LLaMA-65B beats Chinchilla-70B on all reported benchmarks but BoolQ. It beats PaLM-540B everywhere but BoolQ and WinoGrande. LLaMA-13B beats GPT-3 on most benchmarks, though it is 10 times smaller. LLaMA-13B beats GPT-3 on 4 of these 5 tests From Table 3 LLaMA 13B GPT-3 175B
0 25 50 75 100 Zero-shot accuracy (%) BoolQ 78.1% 60.5% HellaSwag 79.2% 78.9% ARC-e 74.8% 68.8% ARC-c 52.7% 51.4% OBQA 56.4% 57.6%
Hover, tap or focus a bar to read its exact value.
Show as table Benchmark LLaMA 13B (%) GPT-3 175B (%) BoolQ 78.1 60.5 HellaSwag 79.2 78.9 ARC-e 74.8 68.8 ARC-c 52.7 51.4 OBQA 56.4 57.6
The chart shows 5 of the 8 benchmarks. The tables below have all of them. Table 3 in full: zero-shot common sense reasoning Model BoolQ PIQA SIQA GPT-3 175B 60.5 81.0 - Gopher 280B 79.3 81.8 50.6 Chinchilla 70B 83.7 81.8 51.3 PaLM 62B 84.8 80.5 - PaLM-cont 62B 83.9 81.4 - PaLM 540B 88.0 82.3 - LLaMA 7B 76.5 79.8 48.9 LLaMA 13B 78.1 80.1 50.4 LLaMA 33B 83.1 82.3 50.4 LLaMA 65B 85.3 82.8 52.3
Table 3: zero-shot accuracy on common sense reasoning (part 1 of 3)
A dash means the paper has no number.
Model HellaSwag WinoGrande ARC-e GPT-3 175B 78.9 70.2 68.8 Gopher 280B 79.2 70.1 - Chinchilla 70B 80.8 74.9 - PaLM 62B 79.7 77.0 75.2 PaLM-cont 62B 80.6 77.0 - PaLM 540B 83.4 81.1 76.6 LLaMA 7B 76.1 70.1 72.8 LLaMA 13B 79.2 73.0 74.8 LLaMA 33B 82.8 76.0 80.0 LLaMA 65B 84.2 77.0 78.9
Table 3: zero-shot accuracy on common sense reasoning (part 2 of 3)
A dash means the paper has no number.
Model ARC-c OBQA GPT-3 175B 51.4 57.6 Gopher 280B - - Chinchilla 70B - - PaLM 62B 52.5 50.4 PaLM-cont 62B - - PaLM 540B 53.0 53.4 LLaMA 7B 47.6 57.2 LLaMA 13B 52.7 56.4 LLaMA 33B 57.8 58.6 LLaMA 65B 56.0 60.2
Table 3: zero-shot accuracy on common sense reasoning (part 3 of 3)
A dash means the paper has no number.
3.2 Closed-book question answering Show in original The test They test on Natural Questions and TriviaQA. They report exact match in a closed-book setting. The models get no documents that hold the evidence. The result LLaMA-65B reaches state-of-the-art in zero-shot and few-shot settings. LLaMA-13B is competitive with GPT-3 and Chinchilla, though 5 to 10 times smaller. LLaMA-13B runs on a single V100 GPU for inference. Table 4 and Table 5 in full Model 0-shot, 1-shot 5-shot, 64-shot GPT-3 175B 14.6, 23.0 -, 29.9 Gopher 280B 10.1, - 24.5, 28.2 Chinchilla 70B 16.6, - 31.5, 35.5 PaLM 8B 8.4, 10.6 -, 14.6 PaLM 62B 18.1, 26.5 -, 27.6 PaLM 540B 21.2, 29.3 -, 39.6 LLaMA 7B 16.8, 18.7 22.0, 26.1 LLaMA 13B 20.1, 23.4 28.1, 31.9 LLaMA 33B 24.9, 28.3 32.9, 36.0 LLaMA 65B 23.8, 31.0 35.0, 39.9
Table 4: NaturalQuestions exact match (0-shot and 1-shot, then 5-shot and 64-shot)
A dash means the paper has no number.
Model 0-shot, 1-shot 5-shot, 64-shot Gopher 280B 43.5, - 57.0, 57.2 Chinchilla 70B 55.4, - 64.1, 64.6 LLaMA 7B 50.0, 53.4 56.3, 57.6 LLaMA 13B 56.6, 60.5 63.1, 64.0 LLaMA 33B 65.1, 67.9 69.9, 70.4 LLaMA 65B 68.2, 71.6 72.6, 73.0
Table 5: TriviaQA exact match on the filtered dev set (same column pairs)
A dash means the paper has no number.
3.3 Reading comprehension Show in original They use the RACE reading comprehension set. It comes from English exams for middle and high school students in China. The setup follows Brown et al. (2020). LLaMA-65B is competitive with PaLM-540B. LLaMA-13B beats GPT-3 by a few percent. Model RACE-middle RACE-high GPT-3 175B 58.4 45.5 PaLM 8B 57.9 42.3 PaLM 62B 64.3 47.5 PaLM 540B 68.1 49.1 LLaMA 7B 61.1 46.9 LLaMA 13B 61.6 47.2 LLaMA 33B 64.1 48.3 LLaMA 65B 67.9 51.6
Table 6: reading comprehension, zero-shot accuracy
3.4 Mathematical reasoning Show in original The test MATH has 12K middle and high school problems written in LaTeX. GSM8k is a set of middle school math problems. They compare with PaLM and Minerva. Minerva is PaLM fine-tuned on 38.5B tokens from ArXiv and Math Web Pages. Neither PaLM nor LLaMA is fine-tuned on math data. How majority voting is set Numbers for PaLM and Minerva come from Lewkowycz et al. (2022). maj1@k means: make k samples per problem, then take a majority vote.LLaMA and Minerva 62B use k = 256 for MATH. They use k = 100 for GSM8k. Minerva 540B uses k = 64 for MATH and k = 40 for GSM8k. The result On GSM8k, LLaMA-65B beats Minerva-62B. It does so without any fine-tuning on math data. Table 7 in full Model MATH MATH +maj1@k PaLM 8B 1.5 - PaLM 62B 4.4 - PaLM 540B 8.8 - Minerva 8B 14.1 25.4 Minerva 62B 27.6 43.4 Minerva 540B 33.6 50.3 LLaMA 7B 2.9 6.9 LLaMA 13B 3.9 8.8 LLaMA 33B 7.1 15.2 LLaMA 65B 10.6 20.5
Table 7: quantitative reasoning (part 1 of 2)
A dash means the paper has no number.
Model GSM8k GSM8k +maj1@k PaLM 8B 4.1 - PaLM 62B 33.0 - PaLM 540B 56.5 - Minerva 8B 16.2 28.4 Minerva 62B 52.4 68.5 Minerva 540B 68.5 78.5 LLaMA 7B 11.0 18.1 LLaMA 13B 17.8 29.3 LLaMA 33B 35.6 53.1 LLaMA 65B 50.9 69.7
Table 7: quantitative reasoning (part 2 of 2)
A dash means the paper has no number.
3.5 Code generation Show in original The test They test on HumanEval and MBPP. The model gets a short description of a program and a few input-output examples. In HumanEval it also gets a function signature. The prompt looks like code, with the description and tests in a docstring. The model must write a Python program that meets the description and passes the tests. The result They compare with models that are not fine-tuned on code: PaLM and LaMDA. PaLM and LLaMA trained on a similar number of code tokens. For similar size, LLaMA beats LaMDA and PaLM. LLaMA-13B and larger beat LaMDA 137B on both tests. LLaMA-65B beats PaLM 62B, even though PaLM trained longer. How scores are made pass@1 uses Temperature 0.1. pass@100 and pass@80 use temperature 0.8. They use the method of Chen et al. (2021) for unbiased pass@k estimates. HumanEval runs zero-shot. MBPP uses 3-shot prompts like Austin et al. (2021). Fine-tuning on code Fine-tuning on code can raise scores. PaLM-Coder raises PaLM pass@1 on HumanEval from 26.2% to 36%. Other code-specific models also beat general models. Fine-tuning on code is out of scope for this paper. Table 8 in full Model HumanEval @1 HumanEval @100 LaMDA 137B 14.0 47.3 PaLM 8B 3.6* 18.7* PaLM 62B 15.9 46.3* PaLM-cont 62B 23.7 - PaLM 540B 26.2 76.2 LLaMA 7B 10.5 36.5 LLaMA 13B 15.8 52.5 LLaMA 33B 21.7 70.7 LLaMA 65B 23.7 79.3
Table 8: code generation, pass@ score (part 1 of 2)
A star marks values read from figures in Chowdhery et al. (2022).
Model MBPP @1 MBPP @80 LaMDA 137B 14.8 62.4 PaLM 8B 5.0* 35.7* PaLM 62B 21.4 63.2* PaLM-cont 62B 31.2 - PaLM 540B 36.8 75.0 LLaMA 7B 17.7 56.2 LLaMA 13B 22.0 64.0 LLaMA 33B 30.2 73.4 LLaMA 65B 37.7 76.8
Table 8: code generation, pass@ score (part 2 of 2)
A star marks values read from figures in Chowdhery et al. (2022).
3.6 Massive Multitask Language Understanding Show in original The test MMLU (Hendrycks et al., 2020) has multiple choice questions.They cover humanities, STEM and social sciences. They test in the 5-shot setting, with the examples the benchmark gives. The result On average, LLaMA-65B is behind Chinchilla-70B and PaLM-540B by a few percent. This holds across most domains. LLaMA-65B trails the biggest models on MMLU From Table 9 0 20 40 60 80 Average five-shot accuracy (%) GPT-3 175B 43.9% Gopher 280B 60.0% Chinchilla 70B 67.5% PaLM 540B 69.3% LLaMA 7B 35.1% LLaMA 13B 46.9% LLaMA 33B 57.8% LLaMA 65B 63.4%
Hover, tap or focus a bar to read its exact value.
Show as table Model Average (%) GPT-3 175B 43.9 Gopher 280B 60.0 Chinchilla 70B 67.5 PaLM 540B 69.3 LLaMA 7B 35.1 LLaMA 13B 46.9 LLaMA 33B 57.8 LLaMA 65B 63.4
Why it may lag A possible reason: LLaMA used few books and academic papers. ArXiv, Gutenberg and Books3 add up to only 177GB. Gopher, Chinchilla and PaLM trained on up to 2TB of books. That large amount of books may also explain why Gopher beats GPT-3 here. Table 9 in full Model Humanities STEM GPT-NeoX 20B 29.8 34.9 GPT-3 175B 40.8 36.7 Gopher 280B 56.2 47.4 Chinchilla 70B 63.6 54.9 PaLM 8B 25.6 23.8 PaLM 62B 59.5 41.9 PaLM 540B 77.0 55.6 LLaMA 7B 34.0 30.5 LLaMA 13B 45.0 35.8 LLaMA 33B 55.8 46.0 LLaMA 65B 61.8 51.7
Table 9: MMLU five-shot accuracy (part 1 of 2)
Model Social Sciences Other Average GPT-NeoX 20B 33.7 37.7 33.6 GPT-3 175B 50.4 48.8 43.9 Gopher 280B 71.9 66.1 60.0 Chinchilla 70B 79.3 73.9 67.5 PaLM 8B 24.1 27.8 25.4 PaLM 62B 62.7 55.8 53.7 PaLM 540B 81.0 69.6 69.3 LLaMA 7B 38.3 38.1 35.1 LLaMA 13B 53.8 53.3 46.9 LLaMA 33B 66.7 63.4 57.8 LLaMA 65B 72.9 67.4 63.4
Table 9: MMLU five-shot accuracy (part 2 of 2)
3.7 Evolution of performance during training Show in original What they saw They tracked scores on a few question answering and common sense tests during training. Figure 2 shows the results. On most tests, scores improve steadily. They track the training Perplexity (see Figure 1). The exceptions are SIQA and WinoGrande. The two exceptions On SIQA, scores vary a lot. The authors say this may show the benchmark is not reliable. On WinoGrande, scores do not follow training perplexity well. LLaMA-33B and LLaMA-65B score about the same during training. 4 Instruction finetuning Show in original What they did A short instruction fine-tuning step quickly raises MMLU scores. The plain LLaMA-65B can already follow basic instructions. A very small amount of fine-tuning improves MMLU and instruction following. This is not the focus of the paper. They ran one experiment with the protocol of Chung et al. (2022). The result is the instruct model LLaMA-I . The result LLaMA-I (65B) reaches 68.9% on MMLU. It beats other instruction fine-tuned models of moderate size. It is still far from the state of the art: 77.4 for GPT code-davinci-002. Numbers for other models come from their papers (Iyer et al., 2022). Scores for all 57 tasks are in Table 16 of the appendix. Model Size MMLU OPT 30B 26.1 GLM 120B 44.8 PaLM 62B 55.1 PaLM-cont 62B 62.8 Chinchilla 70B 67.5 LLaMA 65B 63.4 OPT-IML-Max 30B 43.2 Flan-T5-XXL 11B 55.1 Flan-PaLM 62B 59.6 Flan-PaLM-cont 62B 66.1 LLaMA-I 65B 68.9
Table 10: instruction finetuning, MMLU 5-shot
The first six rows have no instruction fine-tuning. The last five do.
5 Bias, toxicity and misinformation Show in original Why they test LLMs can repeat and increase the biases in their training data. They can also write toxic or offensive text. LLaMA trains on a large share of web data. So the authors test how likely it is to write such content. They test LLaMA-65B on benchmarks for toxic text and stereotype detection. A limit The authors say these tests are not enough to fully understand the risks. 5.1 RealToxicityPrompts Show in original The test Models can write insults, hate speech or threats. The range of toxic text is very wide, so a full test is hard. RealToxicityPrompts has about 100k prompts that the model must complete. PerspectiveAPI gives each text a toxicity score. The authors do not control the third-party API pipeline. This makes comparison with earlier models hard. The method They generate greedily for each of the 100k prompts. The score per prompt goes from 0 (not toxic) to 1 (toxic). "Respectful" prompts start with: "Complete the following sentence in a polite, respectful, and unbiased manner:". "Basic" prompts do not have this start. LLaMA size Basic Respectful 7B 0.106 0.081 13B 0.104 0.095 33B 0.107 0.087 65B 0.128 0.141
Table 11: RealToxicityPrompts, average toxicity score (higher is more toxic)
What they found These scores are comparable with the literature, for example 0.087 for Chinchilla. But the methods differ: sampling, number of prompts and time of the API. Toxicity rises with model size , mostly for Respectful prompts. OPT work saw the same (Zhang et al., 2022). Hoffmann et al. (2022) saw no difference between Chinchilla and Gopher. Gopher is larger but performs worse than Chinchilla. So the link between toxicity and size may hold only within one model family. 5.2 CrowS-Pairs Show in original The test CrowS-Pairs (Nangia et al., 2020) measures bias in 9 categories. The categories are gender, religion, race/color, sexual orientation, age, nationality, disability, physical appearance and socioeconomic status. Each example has a stereotype sentence and an anti-stereotype sentence. They test zero-shot, using the Perplexity of both sentences. A higher score means more bias. They compare LLaMA-65B with GPT-3 and OPT-175B. Category LLaMA GPT3 OPT Gender 70.6 62.6 65.7 Religion 79.0 73.3 68.6 Race/Color 57.0 64.7 68.6 Sexual orientation 81.0 76.2 78.6 Age 70.1 64.4 67.8 Nationality 64.2 61.6 62.9 Disability 66.7 76.7 76.7 Physical appearance 77.8 74.6 76.2 Socioeconomic status 71.5 73.8 76.2 Average 66.6 67.2 69.5
Table 12: CrowS-Pairs (higher means more bias)
What they found LLaMA is slightly better than both models on average. It is most biased in religion: +10% against OPT-175B. Age and gender come next. The authors expect the bias comes from CommonCrawl, despite many filters. 5.3 WinoGender Show in original The test WinoGender (Rudinger et al., 2018) is a co-reference task. It checks if the pronoun's gender changes the model's co-reference accuracy. Each sentence has three mentions: an occupation, a participant and a pronoun. The pronoun refers to either the occupation or the participant. The goal is to see if the model learned social biases about occupations. How it works Example: "The nurse notified the patient that his shift would be ending in an hour." Then 'His' refers to. They compare the perplexity of "the nurse" and "the patient". They test 3 pronoun sets: "her/her/she", "his/him/he" and "their/them/someone". What they found LLaMA-65B is much better with "their/them/someone". It is weaker with "her/her/she" and "his/him/he". Earlier work saw the same. It likely shows gender bias . With gendered pronouns, the model probably uses the majority gender of the job. It does not use the evidence in the sentence. The gotcha test "Gotcha" cases: the pronoun does not match the majority gender of the occupation. In these cases the occupation is the correct answer. LLaMA-65B makes more errors on gotcha cases. This shows it captures social bias about gender and occupation. The drop exists for both "her/her/she" and "his/him/he". Table 13 in full Pronouns 7B 13B All 66.0 64.7 her/her/she 65.0 66.7 his/him/he 60.8 62.5 their/them/someone 72.1 65.0 her/her/she (gotcha) 64.2 65.8 his/him/he (gotcha) 55.0 55.8
Table 13: WinoGender co-reference accuracy (part 1 of 2)
Pronouns 33B 65B All 69.0 77.5 her/her/she 66.7 78.8 his/him/he 62.1 72.1 their/them/someone 78.3 81.7 her/her/she (gotcha) 61.7 75.0 his/him/he (gotcha) 55.8 63.3
Table 13: WinoGender co-reference accuracy (part 2 of 2)
5.4 TruthfulQA Show in original The test TruthfulQA (Lin et al., 2021) measures truthfulness. That means the ability to tell when a claim is true. "True" means literal truth about the real world. It does not mean claims that are true only inside a belief system. It tests the risk of false claims and misinformation. The questions use diverse styles, cover 38 categories and are adversarial. Model Size Truthful Truthful*Inf GPT-3 1.3B 0.31 0.19 GPT-3 6B 0.22 0.19 GPT-3 175B 0.28 0.25 LLaMA 7B 0.33 0.29 LLaMA 13B 0.47 0.41 LLaMA 33B 0.52 0.48 LLaMA 65B 0.57 0.53
Table 14: TruthfulQA, fraction of answers
Specially trained models score the answers through the OpenAI API. The prompt style follows Ouyang et al. (2022). GPT-3 numbers come from the same paper.
What they found LLaMA scores higher than GPT-3 in both columns. But the rate of correct answers is still low. So the model is likely to hallucinate wrong answers. 6 Carbon footprint Show in original The method Training used a huge amount of energy and emitted carbon dioxide. They follow Wu et al. (2022) to estimate energy and carbon. Energy in Wh = GPU hours x GPU power use x PUE . They set PUE to 1.1. A fair comparison Carbon depends on where the data center is. BLOOM uses a grid with 0.057 kg CO2 eq/KWh. That gives 27 tCO2 eq. OPT uses a grid with 0.231 kg CO2 eq/KWh. That gives 82 tCO2 eq. To compare fairly, they assume the same data center for all models. They use the US national average of 0.385 kg CO2 eq/KWh. So: tCO2 eq = MWh x 0.385. The totals They apply the same formula to OPT and BLOOM. For OPT they assume 34 days on 992 A100-80B GPUs. They used about 2048 A100-80GB GPUs for about 5 months to develop the models. The total is around 2,638 MWh and 1,015 tCO2 eq. They hope the release cuts future carbon, since training is done. Some models are small and run on a single GPU. The smaller LLaMA models emit far less carbon than OPT-175B From Table 15 0 50 100 150 200 Carbon emitted in training (tCO2 eq) OPT-175B 137 tCO2 eq BLOOM-175B 183 tCO2 eq LLaMA-7B 14 tCO2 eq LLaMA-13B 23 tCO2 eq LLaMA-33B 90 tCO2 eq LLaMA-65B 173 tCO2 eq
Hover, tap or focus a bar to read its exact value.
Show as table Model Carbon (tCO2 eq) OPT-175B 137 BLOOM-175B 183 LLaMA-7B 14 LLaMA-13B 23 LLaMA-33B 90 LLaMA-65B 173
Model GPU hours Total power Carbon (tCO2 eq) OPT-175B 809,472 356 MWh 137 BLOOM-175B 1,082,880 475 MWh 183 LLaMA-7B 82,432 36 MWh 14 LLaMA-13B 135,168 59 MWh 23 LLaMA-33B 530,432 233 MWh 90 LLaMA-65B 1,022,362 449 MWh 173
Table 15: carbon footprint of training in the same data center
All use A100-80GB GPUs at 400W (thermal design power for NVLink systems), PUE 1.1 and 0.385 kg CO2 e per KWh.
8 Conclusion Show in original What they showed The authors present a series of openly released language models. They are competitive with state-of-the-art foundation models. LLaMA-13B beats GPT-3 and is more than 10 times smaller. LLaMA-65B is competitive with Chinchilla-70B and PaLM-540B. Unlike earlier work, they reach this using public data only . Hopes and plans They hope the release speeds up LLM development. They hope it helps efforts to improve robustness and cut toxicity and bias. Like Chung et al. (2022), they saw that instruction fine-tuning gives promising results. They plan to study this further. They plan to release larger models trained on larger corpora. They saw steady gains as they scaled. A Appendix A: question answering setup Show in original The data Natural Questions: they use the test split for open-domain QA. It has 3610 questions. TriviaQA: they use the dev set of the filtered set. GPT-3 and PaLM use the test set of the unfiltered set instead. Its online evaluation server is not available any more. Scoring and prompts They answer with greedy decoding . They stop at the first line break, final dot or comma to get the answer. An answer is correct if it matches any listed answer after normalization. Normalization lowercases the text and removes articles, punctuation and repeated spaces. In every setting, they start the prompt with "Answer these questions:". Figure 3 shows 1-shot examples for both datasets. B Appendix B: MMLU in detail Show in original What the table holds Table 16 lists 5-shot MMLU scores for each of the 57 tasks. It covers GPT-3, Gopher, Chinchilla, LLaMA 7B to 65B and LLaMA-I. This card shows the group totals. The task rows are in the original. Table 16: group totals Group GPT-3 175B Gopher 280B Chinchilla 70B Humanities 40.6 56.2 63.6 STEM 36.7 47.4 54.9 Social Science 50.5 71.9 79.3 Others 49.0 66.1 73.9 All 43.9 60.0 67.6
Table 16: MMLU group totals (part 1 of 3)
Group LLaMA 7B LLaMA 13B LLaMA 33B Humanities 34.0 45.0 55.8 STEM 30.5 35.8 46.0 Social Science 38.3 53.8 66.7 Others 38.1 53.3 63.4 All 35.1 46.9 57.8
Table 16: MMLU group totals (part 2 of 3)
Group LLaMA 65B LLaMA-I 65B Humanities 61.8 67.4 STEM 51.7 56.6 Social Science 72.9 79.2 Others 67.4 72.6 All 63.4 68.9
Table 16: MMLU group totals (part 3 of 3)
C Appendix C: sample outputs of LLaMA-65B Show in original This appendix shows text that plain LLaMA-65B wrote. The model had no instruction fine-tuning. The prompts are in bold in the paper. The samples include a note on the Fibonacci sequence and a funny recommendation letter. They also include a short Python function and a made-up review of a rap album. They are examples only. They are not scored. D Appendix D: sample outputs of LLaMA-I Show in original This appendix shows text from LLaMA-I. LLaMA-I is LLaMA-65B fine-tuned with the protocol and data of Chung et al. (2022). The samples include a short chat between the sun and Pluto. They also include code for an HTTP request in Javascript, and regular expressions in Python. They are examples only. They are not scored. Words to know AdamW: A common optimizer for training large models.Batch size: The amount of text used for each update.Bias: Unfair patterns about people that a model learns from data.Byte-pair encoding: A method that splits text into common pieces.Causal attention: Each token looks only at earlier tokens.Checkpointing: Save some results and recompute the rest, to save memory.Closed-book: The model answers with no access to documents.CommonCrawl: A public archive of web pages.Cosine schedule: A learning rate that falls along a smooth curve.Deduplication: Removing repeated copies of the same text.Exact match: An answer counts only if it equals a right answer.Few-shot: The prompt holds a few worked examples of the task.Foundation model: A big model trained on broad text that people adapt to many tasks.GPU: A chip that does the math for training and running models.Gradient clipping: A cap on the size of each update.Greedy decoding: Always pick the most likely next token.Hallucination: A confident answer that is false.Inference: Running a trained model to get answers.Instruction fine-tuning: Extra training on instructions paired with good answers.Large language model: A model trained on huge text that predicts the next token.Learning rate: The size of each update step during training.Likelihood: How probable the model finds a piece of text.maj1@k: Make k answers, then pick the most common one.MMLU: A multiple choice test that spans 57 subjects.Model parallelism: Splitting one model across many GPUs.MWh: Megawatt hour. A unit of energy.Optimizer: The method that updates the model numbers during training.Parameter: A number inside the model that training adjusts. 7B means 7 billion.pass@k: The chance that at least one of k code samples passes the tests.Perplexity: How surprised the model is by text. Lower is better.PUE: Power usage effectiveness. It counts the extra power a data center uses.RMSNorm: A way to rescale numbers in the network to keep training stable.Rotary embeddings: A way to tell the model where each token sits in the text.Scaling laws: Rules that predict model quality from model size and data size.tCO2 eq: Tons of carbon dioxide equivalent. A unit of climate impact.Temperature: A setting for randomness. Low values give safer text.Token: A small piece of text, such as a word part or a digit.Toxicity: Text that is rude, hateful or threatening.Transformer: The standard network design for language models.Warmup: Early steps where the learning rate rises slowly.Weight decay: A penalty that keeps model numbers small.Zero-shot: The prompt describes the task but gives no examples.Ask AI about this paper Stuck on a word or an idea? Ask in plain words. The answer comes from the write-up on this page.
Ask AI about this paper Explain it like I am new to AI How would a finance team use this? What are the limits?
Jump to