alokabhishek commited on
Commit
eb7a952
1 Parent(s): 4e13590

Updated Readme

Browse files
Files changed (1) hide show
  1. README.md +621 -101
README.md CHANGED
@@ -1,201 +1,721 @@
1
  ---
2
  library_name: transformers
3
- tags: []
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  ---
5
 
6
- # Model Card for Model ID
7
 
8
  <!-- Provide a quick summary of what the model is/does. -->
9
 
10
-
11
 
12
  ## Model Details
13
 
14
- ### Model Description
 
15
 
16
- <!-- Provide a longer summary of what this model is. -->
17
 
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
 
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
 
28
- ### Model Sources [optional]
29
 
30
- <!-- Provide the basic links for the model. -->
31
 
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
 
36
- ## Uses
37
 
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
 
40
- ### Direct Use
41
 
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
 
44
- [More Information Needed]
45
 
46
- ### Downstream Use [optional]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
 
 
 
49
 
50
- [More Information Needed]
 
 
 
 
51
 
52
- ### Out-of-Scope Use
 
 
 
53
 
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
 
 
 
 
 
 
 
 
 
 
55
 
56
- [More Information Needed]
57
 
58
- ## Bias, Risks, and Limitations
59
 
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
 
62
- [More Information Needed]
63
 
64
- ### Recommendations
65
 
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
 
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
 
70
- ## How to Get Started with the Model
71
 
72
- Use the code below to get started with the model.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
- [More Information Needed]
75
 
76
- ## Training Details
77
 
78
- ### Training Data
79
 
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
 
82
- [More Information Needed]
83
 
84
- ### Training Procedure
 
 
85
 
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
 
88
- #### Preprocessing [optional]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
- [More Information Needed]
 
 
 
 
91
 
 
 
 
 
92
 
93
- #### Training Hyperparameters
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
 
97
- #### Speeds, Sizes, Times [optional]
98
 
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
 
101
- [More Information Needed]
102
 
103
- ## Evaluation
104
 
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
 
107
- ### Testing Data, Factors & Metrics
108
 
109
- #### Testing Data
110
 
111
- <!-- This should link to a Dataset Card if possible. -->
112
 
113
- [More Information Needed]
114
 
115
- #### Factors
116
 
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
 
119
- [More Information Needed]
120
 
121
- #### Metrics
122
 
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
124
 
125
- [More Information Needed]
126
 
127
- ### Results
128
 
129
- [More Information Needed]
130
 
131
- #### Summary
132
 
 
133
 
 
134
 
135
- ## Model Examination [optional]
136
 
137
- <!-- Relevant interpretability work for the model goes here -->
138
 
139
- [More Information Needed]
140
 
141
- ## Environmental Impact
142
 
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
 
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
146
 
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
 
153
- ## Technical Specifications [optional]
154
 
155
- ### Model Architecture and Objective
156
 
157
- [More Information Needed]
158
 
159
- ### Compute Infrastructure
160
 
161
- [More Information Needed]
162
 
163
- #### Hardware
164
 
165
- [More Information Needed]
166
 
167
- #### Software
168
 
169
- [More Information Needed]
170
 
171
- ## Citation [optional]
172
 
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
 
175
- **BibTeX:**
176
 
177
- [More Information Needed]
178
 
179
- **APA:**
180
 
181
- [More Information Needed]
182
 
183
- ## Glossary [optional]
184
 
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
 
187
- [More Information Needed]
188
 
189
- ## More Information [optional]
190
 
191
- [More Information Needed]
192
 
193
- ## Model Card Authors [optional]
194
 
195
- [More Information Needed]
196
 
197
- ## Model Card Contact
198
 
199
- [More Information Needed]
200
 
 
201
 
 
1
  ---
2
  library_name: transformers
3
+ tags:
4
+ - 8bit
5
+ - bnb
6
+ - bitsandbytes
7
+ - llama
8
+ - llama-3
9
+ - facebook
10
+ - meta
11
+ - 8b
12
+ - quantized
13
+ license: other
14
+ license_name: llama3
15
+ license_link: LICENSE
16
+ pipeline_tag: text-generation
17
  ---
18
 
19
+ # Model Card for alokabhishek/Meta-Llama-3-8B-Instruct-bnb-8bit
20
 
21
  <!-- Provide a quick summary of what the model is/does. -->
22
 
23
+ This repo contains 8-bit quantized (using bitsandbytes) model of Meta's Meta-Llama-3-8B-Instruct
24
 
25
  ## Model Details
26
 
27
+ - Model creator: [Meta](https://huggingface.co/meta-llama)
28
+ - Original model: [Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)
29
 
 
30
 
31
+ ### About 8 bit quantization using bitsandbytes
32
 
 
 
 
 
 
 
 
33
 
34
+ - QLoRA: Efficient Finetuning of Quantized LLMs: [arXiv - QLoRA: Efficient Finetuning of Quantized LLMs](https://arxiv.org/abs/2305.14314)
35
 
36
+ - Hugging Face Blog post on 8-bit quantization using bitsandbytes: [A Gentle Introduction to 8-bit Matrix Multiplication for transformers at scale using Hugging Face Transformers, Accelerate and bitsandbytes](https://huggingface.co/blog/hf-bitsandbytes-integration)
37
 
38
+ - bitsandbytes github repo: [bitsandbytes github repo](https://github.com/TimDettmers/bitsandbytes)
 
 
39
 
40
+ # How to Get Started with the Model
41
 
42
+ Use the code below to get started with the model.
43
 
44
+ ## How to run from Python code
45
 
 
46
 
47
+ #### Use a pipeline as a high-level helper
48
 
49
+ ```python
50
+
51
+ import transformers
52
+ import torch
53
+
54
+ model_id = "alokabhishek/Meta-Llama-3-8B-Instruct-bnb-8bit"
55
+
56
+ pipeline = transformers.pipeline(
57
+ "text-generation",
58
+ model=model_id,
59
+ model_kwargs={"torch_dtype": torch.bfloat16},
60
+ device_map="auto",
61
+ )
62
+
63
+ prompt_instruction = "You are a virtual assistant with advanced expertise in a broad spectrum of topics, equipped to utilize high-level critical thinking, cognitive skills, creativity, and innovation. Here’s how you should approach user queries: "
64
+ user_prompt = "Why is Hulk always angry?"
65
 
66
+ chat_messages = [
67
+ {"role": "system", "content": str(prompt_instruction)},
68
+ {"role": "user", "content": str(user_prompt)},
69
+ ]
70
 
71
+ prompt = pipeline.tokenizer.apply_chat_template(
72
+ chat_messages,
73
+ tokenize=False,
74
+ add_generation_prompt=True
75
+ )
76
 
77
+ terminators = [
78
+ pipeline.tokenizer.eos_token_id,
79
+ pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
80
+ ]
81
 
82
+ output = pipeline(
83
+ prompt,
84
+ do_sample=True,
85
+ max_new_tokens=1024,
86
+ temperature=1,
87
+ top_k=50,
88
+ top_p=1,
89
+ num_return_sequences=1,
90
+ pad_token_id=text_generation_pipeline.tokenizer.pad_token_id,
91
+ eos_token_id=terminators,
92
+ )
93
 
 
94
 
95
+ print(outputs[0]["generated_text"][len(prompt):])
96
 
 
97
 
98
+ ```
99
 
 
100
 
101
+ ## Meta Llama 3 Original Model Card:
102
 
103
+ Meta developed and released the Meta Llama 3 family of large language models (LLMs), a collection of pretrained and instruction tuned generative text models in 8 and 70B sizes. The Llama 3 instruction tuned models are optimized for dialogue use cases and outperform many of the available open source chat models on common industry benchmarks. Further, in developing these models, we took great care to optimize helpfulness and safety.
104
 
105
+ **Model developers** Meta
106
 
107
+ **Variations** Llama 3 comes in two sizes 8B and 70B parameters — in pre-trained and instruction tuned variants.
108
+
109
+ **Input** Models input text only.
110
+
111
+ **Output** Models generate text and code only.
112
+
113
+ **Model Architecture** Llama 3 is an auto-regressive language model that uses an optimized transformer architecture. The tuned versions use supervised fine-tuning (SFT) and reinforcement learning with human feedback (RLHF) to align with human preferences for helpfulness and safety.
114
+
115
+
116
+ <table>
117
+ <tr>
118
+ <td>
119
+ </td>
120
+ <td><strong>Training Data</strong>
121
+ </td>
122
+ <td><strong>Params</strong>
123
+ </td>
124
+ <td><strong>Context length</strong>
125
+ </td>
126
+ <td><strong>GQA</strong>
127
+ </td>
128
+ <td><strong>Token count</strong>
129
+ </td>
130
+ <td><strong>Knowledge cutoff</strong>
131
+ </td>
132
+ </tr>
133
+ <tr>
134
+ <td rowspan="2" >Llama 3
135
+ </td>
136
+ <td rowspan="2" >A new mix of publicly available online data.
137
+ </td>
138
+ <td>8B
139
+ </td>
140
+ <td>8k
141
+ </td>
142
+ <td>Yes
143
+ </td>
144
+ <td rowspan="2" >15T+
145
+ </td>
146
+ <td>March, 2023
147
+ </td>
148
+ </tr>
149
+ <tr>
150
+ <td>70B
151
+ </td>
152
+ <td>8k
153
+ </td>
154
+ <td>Yes
155
+ </td>
156
+ <td>December, 2023
157
+ </td>
158
+ </tr>
159
+ </table>
160
+
161
+
162
+ **Llama 3 family of models**. Token counts refer to pretraining data only. Both the 8 and 70B versions use Grouped-Query Attention (GQA) for improved inference scalability.
163
+
164
+ **Model Release Date** April 18, 2024.
165
+
166
+ **Status** This is a static model trained on an offline dataset. Future versions of the tuned models will be released as we improve model safety with community feedback.
167
+
168
+ **License** A custom commercial license is available at: [https://llama.meta.com/llama3/license](https://llama.meta.com/llama3/license)
169
+
170
+ Where to send questions or comments about the model Instructions on how to provide feedback or comments on the model can be found in the model [README](https://github.com/meta-llama/llama3). For more technical information about generation parameters and recipes for how to use Llama 3 in applications, please go [here](https://github.com/meta-llama/llama-recipes).
171
+
172
+
173
+ ## Intended Use
174
+
175
+ **Intended Use Cases** Llama 3 is intended for commercial and research use in English. Instruction tuned models are intended for assistant-like chat, whereas pretrained models can be adapted for a variety of natural language generation tasks.
176
+
177
+ **Out-of-scope** Use in any manner that violates applicable laws or regulations (including trade compliance laws). Use in any other way that is prohibited by the Acceptable Use Policy and Llama 3 Community License. Use in languages other than English**.
178
+
179
+ **Note: Developers may fine-tune Llama 3 models for languages beyond English provided they comply with the Llama 3 Community License and the Acceptable Use Policy.
180
 
181
+ ## How to use
182
 
183
+ This repository contains two versions of Meta-Llama-3-8B-Instruct, for use with transformers and with the original `llama3` codebase.
184
 
185
+ ### Use with transformers
186
 
187
+ You can run conversational inference using the Transformers pipeline abstraction, or by leveraging the Auto classes with the `generate()` function. Let's see examples of both.
188
 
189
+ #### Transformers pipeline
190
 
191
+ ```python
192
+ import transformers
193
+ import torch
194
 
195
+ model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
196
 
197
+ pipeline = transformers.pipeline(
198
+ "text-generation",
199
+ model=model_id,
200
+ model_kwargs={"torch_dtype": torch.bfloat16},
201
+ device_map="auto",
202
+ )
203
+
204
+ messages = [
205
+ {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
206
+ {"role": "user", "content": "Who are you?"},
207
+ ]
208
+
209
+ prompt = pipeline.tokenizer.apply_chat_template(
210
+ messages,
211
+ tokenize=False,
212
+ add_generation_prompt=True
213
+ )
214
+
215
+ terminators = [
216
+ pipeline.tokenizer.eos_token_id,
217
+ pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
218
+ ]
219
+
220
+ outputs = pipeline(
221
+ prompt,
222
+ max_new_tokens=256,
223
+ eos_token_id=terminators,
224
+ do_sample=True,
225
+ temperature=0.6,
226
+ top_p=0.9,
227
+ )
228
+ print(outputs[0]["generated_text"][len(prompt):])
229
+ ```
230
+
231
+ #### Transformers AutoModelForCausalLM
232
+
233
+ ```python
234
+ from transformers import AutoTokenizer, AutoModelForCausalLM
235
+ import torch
236
+
237
+ model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
238
+
239
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
240
+ model = AutoModelForCausalLM.from_pretrained(
241
+ model_id,
242
+ torch_dtype=torch.bfloat16,
243
+ device_map="auto",
244
+ )
245
+
246
+ messages = [
247
+ {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
248
+ {"role": "user", "content": "Who are you?"},
249
+ ]
250
 
251
+ input_ids = tokenizer.apply_chat_template(
252
+ messages,
253
+ add_generation_prompt=True,
254
+ return_tensors="pt"
255
+ ).to(model.device)
256
 
257
+ terminators = [
258
+ tokenizer.eos_token_id,
259
+ tokenizer.convert_tokens_to_ids("<|eot_id|>")
260
+ ]
261
 
262
+ outputs = model.generate(
263
+ input_ids,
264
+ max_new_tokens=256,
265
+ eos_token_id=terminators,
266
+ do_sample=True,
267
+ temperature=0.6,
268
+ top_p=0.9,
269
+ )
270
+ response = outputs[0][input_ids.shape[-1]:]
271
+ print(tokenizer.decode(response, skip_special_tokens=True))
272
+ ```
273
+
274
+
275
+ ### Use with `llama3`
276
+
277
+ Please, follow the instructions in the [repository](https://github.com/meta-llama/llama3)
278
+
279
+ To download Original checkpoints, see the example command below leveraging `huggingface-cli`:
280
+
281
+ ```
282
+ huggingface-cli download meta-llama/Meta-Llama-3-8B-Instruct --include "original/*" --local-dir Meta-Llama-3-8B-Instruct
283
+ ```
284
+
285
+ For Hugging Face support, we recommend using transformers or TGI, but a similar command works.
286
+
287
+ ## Hardware and Software
288
+
289
+ **Training Factors** We used custom training libraries, Meta's Research SuperCluster, and production clusters for pretraining. Fine-tuning, annotation, and evaluation were also performed on third-party cloud compute.
290
+
291
+ **Carbon Footprint Pretraining utilized a cumulative** 7.7M GPU hours of computation on hardware of type H100-80GB (TDP of 700W). Estimated total emissions were 2290 tCO2eq, 100% of which were offset by Meta’s sustainability program.
292
+
293
+
294
+ <table>
295
+ <tr>
296
+ <td>
297
+ </td>
298
+ <td><strong>Time (GPU hours)</strong>
299
+ </td>
300
+ <td><strong>Power Consumption (W)</strong>
301
+ </td>
302
+ <td><strong>Carbon Emitted(tCO2eq)</strong>
303
+ </td>
304
+ </tr>
305
+ <tr>
306
+ <td>Llama 3 8B
307
+ </td>
308
+ <td>1.3M
309
+ </td>
310
+ <td>700
311
+ </td>
312
+ <td>390
313
+ </td>
314
+ </tr>
315
+ <tr>
316
+ <td>Llama 3 70B
317
+ </td>
318
+ <td>6.4M
319
+ </td>
320
+ <td>700
321
+ </td>
322
+ <td>1900
323
+ </td>
324
+ </tr>
325
+ <tr>
326
+ <td>Total
327
+ </td>
328
+ <td>7.7M
329
+ </td>
330
+ <td>
331
+ </td>
332
+ <td>2290
333
+ </td>
334
+ </tr>
335
+ </table>
336
+
337
+
338
+
339
+ **CO2 emissions during pre-training**. Time: total GPU time required for training each model. Power Consumption: peak power capacity per GPU device for the GPUs used adjusted for power usage efficiency. 100% of the emissions are directly offset by Meta's sustainability program, and because we are openly releasing these models, the pretraining costs do not need to be incurred by others.
340
+
341
+
342
+ ## Training Data
343
+
344
+ **Overview** Llama 3 was pretrained on over 15 trillion tokens of data from publicly available sources. The fine-tuning data includes publicly available instruction datasets, as well as over 10M human-annotated examples. Neither the pretraining nor the fine-tuning datasets include Meta user data.
345
+
346
+ **Data Freshness** The pretraining data has a cutoff of March 2023 for the 7B and December 2023 for the 70B models respectively.
347
+
348
+
349
+ ## Benchmarks
350
+
351
+ In this section, we report the results for Llama 3 models on standard automatic benchmarks. For all the evaluations, we use our internal evaluations library. For details on the methodology see [here](https://github.com/meta-llama/llama3/blob/main/eval_methodology.md).
352
+
353
+
354
+ ### Base pretrained models
355
+
356
+
357
+ <table>
358
+ <tr>
359
+ <td><strong>Category</strong>
360
+ </td>
361
+ <td><strong>Benchmark</strong>
362
+ </td>
363
+ <td><strong>Llama 3 8B</strong>
364
+ </td>
365
+ <td><strong>Llama2 7B</strong>
366
+ </td>
367
+ <td><strong>Llama2 13B</strong>
368
+ </td>
369
+ <td><strong>Llama 3 70B</strong>
370
+ </td>
371
+ <td><strong>Llama2 70B</strong>
372
+ </td>
373
+ </tr>
374
+ <tr>
375
+ <td rowspan="6" >General
376
+ </td>
377
+ <td>MMLU (5-shot)
378
+ </td>
379
+ <td>66.6
380
+ </td>
381
+ <td>45.7
382
+ </td>
383
+ <td>53.8
384
+ </td>
385
+ <td>79.5
386
+ </td>
387
+ <td>69.7
388
+ </td>
389
+ </tr>
390
+ <tr>
391
+ <td>AGIEval English (3-5 shot)
392
+ </td>
393
+ <td>45.9
394
+ </td>
395
+ <td>28.8
396
+ </td>
397
+ <td>38.7
398
+ </td>
399
+ <td>63.0
400
+ </td>
401
+ <td>54.8
402
+ </td>
403
+ </tr>
404
+ <tr>
405
+ <td>CommonSenseQA (7-shot)
406
+ </td>
407
+ <td>72.6
408
+ </td>
409
+ <td>57.6
410
+ </td>
411
+ <td>67.6
412
+ </td>
413
+ <td>83.8
414
+ </td>
415
+ <td>78.7
416
+ </td>
417
+ </tr>
418
+ <tr>
419
+ <td>Winogrande (5-shot)
420
+ </td>
421
+ <td>76.1
422
+ </td>
423
+ <td>73.3
424
+ </td>
425
+ <td>75.4
426
+ </td>
427
+ <td>83.1
428
+ </td>
429
+ <td>81.8
430
+ </td>
431
+ </tr>
432
+ <tr>
433
+ <td>BIG-Bench Hard (3-shot, CoT)
434
+ </td>
435
+ <td>61.1
436
+ </td>
437
+ <td>38.1
438
+ </td>
439
+ <td>47.0
440
+ </td>
441
+ <td>81.3
442
+ </td>
443
+ <td>65.7
444
+ </td>
445
+ </tr>
446
+ <tr>
447
+ <td>ARC-Challenge (25-shot)
448
+ </td>
449
+ <td>78.6
450
+ </td>
451
+ <td>53.7
452
+ </td>
453
+ <td>67.6
454
+ </td>
455
+ <td>93.0
456
+ </td>
457
+ <td>85.3
458
+ </td>
459
+ </tr>
460
+ <tr>
461
+ <td>Knowledge reasoning
462
+ </td>
463
+ <td>TriviaQA-Wiki (5-shot)
464
+ </td>
465
+ <td>78.5
466
+ </td>
467
+ <td>72.1
468
+ </td>
469
+ <td>79.6
470
+ </td>
471
+ <td>89.7
472
+ </td>
473
+ <td>87.5
474
+ </td>
475
+ </tr>
476
+ <tr>
477
+ <td rowspan="4" >Reading comprehension
478
+ </td>
479
+ <td>SQuAD (1-shot)
480
+ </td>
481
+ <td>76.4
482
+ </td>
483
+ <td>72.2
484
+ </td>
485
+ <td>72.1
486
+ </td>
487
+ <td>85.6
488
+ </td>
489
+ <td>82.6
490
+ </td>
491
+ </tr>
492
+ <tr>
493
+ <td>QuAC (1-shot, F1)
494
+ </td>
495
+ <td>44.4
496
+ </td>
497
+ <td>39.6
498
+ </td>
499
+ <td>44.9
500
+ </td>
501
+ <td>51.1
502
+ </td>
503
+ <td>49.4
504
+ </td>
505
+ </tr>
506
+ <tr>
507
+ <td>BoolQ (0-shot)
508
+ </td>
509
+ <td>75.7
510
+ </td>
511
+ <td>65.5
512
+ </td>
513
+ <td>66.9
514
+ </td>
515
+ <td>79.0
516
+ </td>
517
+ <td>73.1
518
+ </td>
519
+ </tr>
520
+ <tr>
521
+ <td>DROP (3-shot, F1)
522
+ </td>
523
+ <td>58.4
524
+ </td>
525
+ <td>37.9
526
+ </td>
527
+ <td>49.8
528
+ </td>
529
+ <td>79.7
530
+ </td>
531
+ <td>70.2
532
+ </td>
533
+ </tr>
534
+ </table>
535
+
536
+
537
+
538
+ ### Instruction tuned models
539
+
540
+
541
+ <table>
542
+ <tr>
543
+ <td><strong>Benchmark</strong>
544
+ </td>
545
+ <td><strong>Llama 3 8B</strong>
546
+ </td>
547
+ <td><strong>Llama 2 7B</strong>
548
+ </td>
549
+ <td><strong>Llama 2 13B</strong>
550
+ </td>
551
+ <td><strong>Llama 3 70B</strong>
552
+ </td>
553
+ <td><strong>Llama 2 70B</strong>
554
+ </td>
555
+ </tr>
556
+ <tr>
557
+ <td>MMLU (5-shot)
558
+ </td>
559
+ <td>68.4
560
+ </td>
561
+ <td>34.1
562
+ </td>
563
+ <td>47.8
564
+ </td>
565
+ <td>82.0
566
+ </td>
567
+ <td>52.9
568
+ </td>
569
+ </tr>
570
+ <tr>
571
+ <td>GPQA (0-shot)
572
+ </td>
573
+ <td>34.2
574
+ </td>
575
+ <td>21.7
576
+ </td>
577
+ <td>22.3
578
+ </td>
579
+ <td>39.5
580
+ </td>
581
+ <td>21.0
582
+ </td>
583
+ </tr>
584
+ <tr>
585
+ <td>HumanEval (0-shot)
586
+ </td>
587
+ <td>62.2
588
+ </td>
589
+ <td>7.9
590
+ </td>
591
+ <td>14.0
592
+ </td>
593
+ <td>81.7
594
+ </td>
595
+ <td>25.6
596
+ </td>
597
+ </tr>
598
+ <tr>
599
+ <td>GSM-8K (8-shot, CoT)
600
+ </td>
601
+ <td>79.6
602
+ </td>
603
+ <td>25.7
604
+ </td>
605
+ <td>77.4
606
+ </td>
607
+ <td>93.0
608
+ </td>
609
+ <td>57.5
610
+ </td>
611
+ </tr>
612
+ <tr>
613
+ <td>MATH (4-shot, CoT)
614
+ </td>
615
+ <td>30.0
616
+ </td>
617
+ <td>3.8
618
+ </td>
619
+ <td>6.7
620
+ </td>
621
+ <td>50.4
622
+ </td>
623
+ <td>11.6
624
+ </td>
625
+ </tr>
626
+ </table>
627
 
 
628
 
 
629
 
630
+ ### Responsibility & Safety
631
 
632
+ We believe that an open approach to AI leads to better, safer products, faster innovation, and a bigger overall market. We are committed to Responsible AI development and took a series of steps to limit misuse and harm and support the open source community.
633
 
634
+ Foundation models are widely capable technologies that are built to be used for a diverse range of applications. They are not designed to meet every developer preference on safety levels for all use cases, out-of-the-box, as those by their nature will differ across different applications.
635
 
636
+ Rather, responsible LLM-application deployment is achieved by implementing a series of safety best practices throughout the development of such applications, from the model pre-training, fine-tuning and the deployment of systems composed of safeguards to tailor the safety needs specifically to the use case and audience.
637
 
 
638
 
639
+ As part of the Llama 3 release, we updated our [Responsible Use Guide](https://llama.meta.com/responsible-use-guide/) to outline the steps and best practices for developers to implement model and system level safety for their application. We also provide a set of resources including [Meta Llama Guard 2](https://llama.meta.com/purple-llama/) and [Code Shield](https://llama.meta.com/purple-llama/) safeguards. These tools have proven to drastically reduce residual risks of LLM Systems, while maintaining a high level of helpfulness. We encourage developers to tune and deploy these safeguards according to their needs and we provide a [reference implementation](https://github.com/meta-llama/llama-recipes/tree/main/recipes/responsible_ai) to get you started.
640
 
 
641
 
642
+ #### Llama 3-Instruct
643
 
644
+ As outlined in the Responsible Use Guide, some trade-off between model helpfulness and model alignment is likely unavoidable. Developers should exercise discretion about how to weigh the benefits of alignment and helpfulness for their specific use case and audience. Developers should be mindful of residual risks when using Llama models and leverage additional safety tools as needed to reach the right safety bar for their use case.
645
 
646
+ <span style="text-decoration:underline;">Safety</span>
647
 
648
+ For our instruction tuned model, we conducted extensive red teaming exercises, performed adversarial evaluations and implemented safety mitigations techniques to lower residual risks. As with any Large Language Model, residual risks will likely remain and we recommend that developers assess these risks in the context of their use case. In parallel, we are working with the community to make AI safety benchmark standards transparent, rigorous and interpretable.
649
 
650
+ <span style="text-decoration:underline;">Refusals</span>
651
 
652
+ In addition to residual risks, we put a great emphasis on model refusals to benign prompts. Over-refusing not only can impact the user experience but could even be harmful in certain contexts as well. We’ve heard the feedback from the developer community and improved our fine tuning to ensure that Llama 3 is significantly less likely to falsely refuse to answer prompts than Llama 2.
653
 
654
+ We built internal benchmarks and developed mitigations to limit false refusals making Llama 3 our most helpful model to date.
655
 
 
656
 
657
+ #### Responsible release
658
 
659
+ In addition to responsible use considerations outlined above, we followed a rigorous process that requires us to take extra measures against misuse and critical risks before we make our release decision.
660
 
661
+ Misuse
662
 
663
+ If you access or use Llama 3, you agree to the Acceptable Use Policy. The most recent copy of this policy can be found at [https://llama.meta.com/llama3/use-policy/](https://llama.meta.com/llama3/use-policy/).
664
 
 
665
 
666
+ #### Critical risks
667
 
668
+ <span style="text-decoration:underline;">CBRNE</span> (Chemical, Biological, Radiological, Nuclear, and high yield Explosives)
669
 
670
+ We have conducted a two fold assessment of the safety of the model in this area:
671
 
 
672
 
 
673
 
674
+ * Iterative testing during model training to assess the safety of responses related to CBRNE threats and other adversarial risks.
675
+ * Involving external CBRNE experts to conduct an uplift test assessing the ability of the model to accurately provide expert knowledge and reduce barriers to potential CBRNE misuse, by reference to what can be achieved using web search (without the model).
 
 
 
676
 
 
677
 
678
+ ### <span style="text-decoration:underline;">Cyber Security </span>
679
 
680
+ We have evaluated Llama 3 with CyberSecEval, Meta’s cybersecurity safety eval suite, measuring Llama 3’s propensity to suggest insecure code when used as a coding assistant, and Llama 3’s propensity to comply with requests to help carry out cyber attacks, where attacks are defined by the industry standard MITRE ATT&CK cyber attack ontology. On our insecure coding and cyber attacker helpfulness tests, Llama 3 behaved in the same range or safer than models of [equivalent coding capability](https://huggingface.co/spaces/facebook/CyberSecEval).
681
 
 
682
 
683
+ ### <span style="text-decoration:underline;">Child Safety</span>
684
 
685
+ Child Safety risk assessments were conducted using a team of experts, to assess the model’s capability to produce outputs that could result in Child Safety risks and inform on any necessary and appropriate risk mitigations via fine tuning. We leveraged those expert red teaming sessions to expand the coverage of our evaluation benchmarks through Llama 3 model development. For Llama 3, we conducted new in-depth sessions using objective based methodologies to assess the model risks along multiple attack vectors. We also partnered with content specialists to perform red teaming exercises assessing potentially violating content while taking account of market specific nuances or experiences.
686
 
 
687
 
688
+ ### Community
689
 
690
+ Generative AI safety requires expertise and tooling, and we believe in the strength of the open community to accelerate its progress. We are active members of open consortiums, including the AI Alliance, Partnership in AI and MLCommons, actively contributing to safety standardization and transparency. We encourage the community to adopt taxonomies like the MLCommons Proof of Concept evaluation to facilitate collaboration and transparency on safety and content evaluations. Our Purple Llama tools are open sourced for the community to use and widely distributed across ecosystem partners including cloud service providers. We encourage community contributions to our [Github repository](https://github.com/meta-llama/PurpleLlama).
691
 
692
+ Finally, we put in place a set of resources including an [output reporting mechanism](https://developers.facebook.com/llama_output_feedback) and [bug bounty program](https://www.facebook.com/whitehat) to continuously improve the Llama technology with the help of the community.
693
 
 
694
 
695
+ ## Ethical Considerations and Limitations
696
 
697
+ The core values of Llama 3 are openness, inclusivity and helpfulness. It is meant to serve everyone, and to work for a wide range of use cases. It is thus designed to be accessible to people across many different backgrounds, experiences and perspectives. Llama 3 addresses users and their needs as they are, without insertion unnecessary judgment or normativity, while reflecting the understanding that even content that may appear problematic in some cases can serve valuable purposes in others. It respects the dignity and autonomy of all users, especially in terms of the values of free thought and expression that power innovation and progress.
698
 
699
+ But Llama 3 is a new technology, and like any new technology, there are risks associated with its use. Testing conducted to date has been in English, and has not covered, nor could it cover, all scenarios. For these reasons, as with all LLMs, Llama 3’s potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses to user prompts. Therefore, before deploying any applications of Llama 3 models, developers should perform safety testing and tuning tailored to their specific applications of the model. As outlined in the Responsible Use Guide, we recommend incorporating [Purple Llama](https://github.com/facebookresearch/PurpleLlama) solutions into your workflows and specifically [Llama Guard](https://ai.meta.com/research/publications/llama-guard-llm-based-input-output-safeguard-for-human-ai-conversations/) which provides a base model to filter input and output prompts to layer system-level safety on top of model-level safety.
700
 
701
+ Please see the Responsible Use Guide available at [http://llama.meta.com/responsible-use-guide](http://llama.meta.com/responsible-use-guide)
702
 
 
703
 
704
+ ## Citation instructions
705
 
706
+ @article{llama3modelcard,
707
 
708
+ title={Llama 3 Model Card},
709
 
710
+ author={AI@Meta},
711
 
712
+ year={2024},
713
 
714
+ url = {https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md}
715
 
716
+ }
717
 
718
+ ## Contributors
719
 
720
+ Aaditya Singh; Aaron Grattafiori; Abhimanyu Dubey; Abhinav Jauhri; Abhinav Pandey; Abhishek Kadian; Adam Kelsey; Adi Gangidi; Ahmad Al-Dahle; Ahuva Goldstand; Aiesha Letman; Ajay Menon; Akhil Mathur; Alan Schelten; Alex Vaughan; Amy Yang; Andrei Lupu; Andres Alvarado; Andrew Gallagher; Andrew Gu; Andrew Ho; Andrew Poulton; Andrew Ryan; Angela Fan; Ankit Ramchandani; Anthony Hartshorn; Archi Mitra; Archie Sravankumar; Artem Korenev; Arun Rao; Ashley Gabriel; Ashwin Bharambe; Assaf Eisenman; Aston Zhang; Aurelien Rodriguez; Austen Gregerson; Ava Spataru; Baptiste Roziere; Ben Maurer; Benjamin Leonhardi; Bernie Huang; Bhargavi Paranjape; Bing Liu; Binh Tang; Bobbie Chern; Brani Stojkovic; Brian Fuller; Catalina Mejia Arenas; Chao Zhou; Charlotte Caucheteux; Chaya Nayak; Ching-Hsiang Chu; Chloe Bi; Chris Cai; Chris Cox; Chris Marra; Chris McConnell; Christian Keller; Christoph Feichtenhofer; Christophe Touret; Chunyang Wu; Corinne Wong; Cristian Canton Ferrer; Damien Allonsius; Daniel Kreymer; Daniel Haziza; Daniel Li; Danielle Pintz; Danny Livshits; Danny Wyatt; David Adkins; David Esiobu; David Xu; Davide Testuggine; Delia David; Devi Parikh; Dhruv Choudhary; Dhruv Mahajan; Diana Liskovich; Diego Garcia-Olano; Diego Perino; Dieuwke Hupkes; Dingkang Wang; Dustin Holland; Egor Lakomkin; Elina Lobanova; Xiaoqing Ellen Tan; Emily Dinan; Eric Smith; Erik Brinkman; Esteban Arcaute; Filip Radenovic; Firat Ozgenel; Francesco Caggioni; Frank Seide; Frank Zhang; Gabriel Synnaeve; Gabriella Schwarz; Gabrielle Lee; Gada Badeer; Georgia Anderson; Graeme Nail; Gregoire Mialon; Guan Pang; Guillem Cucurell; Hailey Nguyen; Hannah Korevaar; Hannah Wang; Haroun Habeeb; Harrison Rudolph; Henry Aspegren; Hu Xu; Hugo Touvron; Iga Kozlowska; Igor Molybog; Igor Tufanov; Iliyan Zarov; Imanol Arrieta Ibarra; Irina-Elena Veliche; Isabel Kloumann; Ishan Misra; Ivan Evtimov; Jacob Xu; Jade Copet; Jake Weissman; Jan Geffert; Jana Vranes; Japhet Asher; Jason Park; Jay Mahadeokar; Jean-Baptiste Gaya; Jeet Shah; Jelmer van der Linde; Jennifer Chan; Jenny Hong; Jenya Lee; Jeremy Fu; Jeremy Teboul; Jianfeng Chi; Jianyu Huang; Jie Wang; Jiecao Yu; Joanna Bitton; Joe Spisak; Joelle Pineau; Jon Carvill; Jongsoo Park; Joseph Rocca; Joshua Johnstun; Junteng Jia; Kalyan Vasuden Alwala; Kam Hou U; Kate Plawiak; Kartikeya Upasani; Kaushik Veeraraghavan; Ke Li; Kenneth Heafield; Kevin Stone; Khalid El-Arini; Krithika Iyer; Kshitiz Malik; Kuenley Chiu; Kunal Bhalla; Kyle Huang; Lakshya Garg; Lauren Rantala-Yeary; Laurens van der Maaten; Lawrence Chen; Leandro Silva; Lee Bell; Lei Zhang; Liang Tan; Louis Martin; Lovish Madaan; Luca Wehrstedt; Lukas Blecher; Luke de Oliveira; Madeline Muzzi; Madian Khabsa; Manav Avlani; Mannat Singh; Manohar Paluri; Mark Zuckerberg; Marcin Kardas; Martynas Mankus; Mathew Oldham; Mathieu Rita; Matthew Lennie; Maya Pavlova; Meghan Keneally; Melanie Kambadur; Mihir Patel; Mikayel Samvelyan; Mike Clark; Mike Lewis; Min Si; Mitesh Kumar Singh; Mo Metanat; Mona Hassan; Naman Goyal; Narjes Torabi; Nicolas Usunier; Nikolay Bashlykov; Nikolay Bogoychev; Niladri Chatterji; Ning Dong; Oliver Aobo Yang; Olivier Duchenne; Onur Celebi; Parth Parekh; Patrick Alrassy; Paul Saab; Pavan Balaji; Pedro Rittner; Pengchuan Zhang; Pengwei Li; Petar Vasic; Peter Weng; Polina Zvyagina; Prajjwal Bhargava; Pratik Dubal; Praveen Krishnan; Punit Singh Koura; Qing He; Rachel Rodriguez; Ragavan Srinivasan; Rahul Mitra; Ramon Calderer; Raymond Li; Robert Stojnic; Roberta Raileanu; Robin Battey; Rocky Wang; Rohit Girdhar; Rohit Patel; Romain Sauvestre; Ronnie Polidoro; Roshan Sumbaly; Ross Taylor; Ruan Silva; Rui Hou; Rui Wang; Russ Howes; Ruty Rinott; Saghar Hosseini; Sai Jayesh Bondu; Samyak Datta; Sanjay Singh; Sara Chugh; Sargun Dhillon; Satadru Pan; Sean Bell; Sergey Edunov; Shaoliang Nie; Sharan Narang; Sharath Raparthy; Shaun Lindsay; Sheng Feng; Sheng Shen; Shenghao Lin; Shiva Shankar; Shruti Bhosale; Shun Zhang; Simon Vandenhende; Sinong Wang; Seohyun Sonia Kim; Soumya Batra; Sten Sootla; Steve Kehoe; Suchin Gururangan; Sumit Gupta; Sunny Virk; Sydney Borodinsky; Tamar Glaser; Tamar Herman; Tamara Best; Tara Fowler; Thomas Georgiou; Thomas Scialom; Tianhe Li; Todor Mihaylov; Tong Xiao; Ujjwal Karn; Vedanuj Goswami; Vibhor Gupta; Vignesh Ramanathan; Viktor Kerkez; Vinay Satish Kumar; Vincent Gonguet; Vish Vogeti; Vlad Poenaru; Vlad Tiberiu Mihailescu; Vladan Petrovic; Vladimir Ivanov; Wei Li; Weiwei Chu; Wenhan Xiong; Wenyin Fu; Wes Bouaziz; Whitney Meers; Will Constable; Xavier Martinet; Xiaojian Wu; Xinbo Gao; Xinfeng Xie; Xuchao Jia; Yaelle Goldschlag; Yann LeCun; Yashesh Gaur; Yasmine Babaei; Ye Qi; Yenda Li; Yi Wen; Yiwen Song; Youngjin Nam; Yuchen Hao; Yuchen Zhang; Yun Wang; Yuning Mao; Yuzi He; Zacharie Delpierre Coudert; Zachary DeVito; Zahra Hankir; Zhaoduo Wen; Zheng Yan; Zhengxing Chen; Zhenyu Yang; Zoe Papakipos
721