alokabhishek commited on
Commit
39bf09f
1 Parent(s): 28900ae

Updated Readme

Browse files
Files changed (1) hide show
  1. README.md +622 -101
README.md CHANGED
@@ -1,201 +1,722 @@
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
+ - 4bit
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-4bit
20
 
21
  <!-- Provide a quick summary of what the model is/does. -->
22
 
23
+ This repo contains 4-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 4 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 4-bit quantization using bitsandbytes: [Making LLMs even more accessible with bitsandbytes, 4-bit quantization and QLoRA](https://huggingface.co/blog/4bit-transformers-bitsandbytes)
37
 
38
+ bitsandbytes github repo: [bitsandbytes github repo](https://github.com/TimDettmers/bitsandbytes)
 
 
39
 
 
40
 
41
+ # How to Get Started with the Model
42
 
43
+ Use the code below to get started with the model.
44
 
45
+ ## How to run from Python code
46
 
 
47
 
48
+ #### Use a pipeline as a high-level helper
49
 
50
+ ```python
51
+
52
+ import transformers
53
+ import torch
54
+
55
+ model_id = "alokabhishek/Meta-Llama-3-8B-Instruct-bnb-4bit"
56
+
57
+ pipeline = transformers.pipeline(
58
+ "text-generation",
59
+ model=model_id,
60
+ model_kwargs={"torch_dtype": torch.bfloat16},
61
+ device_map="auto",
62
+ )
63
+
64
+ 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: "
65
+ user_prompt = "Why is Hulk always angry?"
66
 
67
+ chat_messages = [
68
+ {"role": "system", "content": str(prompt_instruction)},
69
+ {"role": "user", "content": str(user_prompt)},
70
+ ]
71
 
72
+ prompt = pipeline.tokenizer.apply_chat_template(
73
+ chat_messages,
74
+ tokenize=False,
75
+ add_generation_prompt=True
76
+ )
77
 
78
+ terminators = [
79
+ pipeline.tokenizer.eos_token_id,
80
+ pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
81
+ ]
82
 
83
+ output = pipeline(
84
+ prompt,
85
+ do_sample=True,
86
+ max_new_tokens=1024,
87
+ temperature=1,
88
+ top_k=50,
89
+ top_p=1,
90
+ num_return_sequences=1,
91
+ pad_token_id=text_generation_pipeline.tokenizer.pad_token_id,
92
+ eos_token_id=terminators,
93
+ )
94
 
 
95
 
96
+ print(outputs[0]["generated_text"][len(prompt):])
97
 
 
98
 
99
+ ```
100
 
 
101
 
102
+ ## Meta Llama 3 Original Model Card:
103
 
104
+ 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.
105
 
106
+ **Model developers** Meta
107
+
108
+ **Variations** Llama 3 comes in two sizes — 8B and 70B parameters — in pre-trained and instruction tuned variants.
109
+
110
+ **Input** Models input text only.
111
+
112
+ **Output** Models generate text and code only.
113
+
114
+ **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.
115
+
116
+
117
+ <table>
118
+ <tr>
119
+ <td>
120
+ </td>
121
+ <td><strong>Training Data</strong>
122
+ </td>
123
+ <td><strong>Params</strong>
124
+ </td>
125
+ <td><strong>Context length</strong>
126
+ </td>
127
+ <td><strong>GQA</strong>
128
+ </td>
129
+ <td><strong>Token count</strong>
130
+ </td>
131
+ <td><strong>Knowledge cutoff</strong>
132
+ </td>
133
+ </tr>
134
+ <tr>
135
+ <td rowspan="2" >Llama 3
136
+ </td>
137
+ <td rowspan="2" >A new mix of publicly available online data.
138
+ </td>
139
+ <td>8B
140
+ </td>
141
+ <td>8k
142
+ </td>
143
+ <td>Yes
144
+ </td>
145
+ <td rowspan="2" >15T+
146
+ </td>
147
+ <td>March, 2023
148
+ </td>
149
+ </tr>
150
+ <tr>
151
+ <td>70B
152
+ </td>
153
+ <td>8k
154
+ </td>
155
+ <td>Yes
156
+ </td>
157
+ <td>December, 2023
158
+ </td>
159
+ </tr>
160
+ </table>
161
+
162
+
163
+ **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.
164
+
165
+ **Model Release Date** April 18, 2024.
166
+
167
+ **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.
168
+
169
+ **License** A custom commercial license is available at: [https://llama.meta.com/llama3/license](https://llama.meta.com/llama3/license)
170
+
171
+ 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).
172
+
173
+
174
+ ## Intended Use
175
+
176
+ **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.
177
+
178
+ **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**.
179
+
180
+ **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.
181
 
182
+ ## How to use
183
 
184
+ This repository contains two versions of Meta-Llama-3-8B-Instruct, for use with transformers and with the original `llama3` codebase.
185
 
186
+ ### Use with transformers
187
 
188
+ 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.
189
 
190
+ #### Transformers pipeline
191
 
192
+ ```python
193
+ import transformers
194
+ import torch
195
 
196
+ model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
197
 
198
+ pipeline = transformers.pipeline(
199
+ "text-generation",
200
+ model=model_id,
201
+ model_kwargs={"torch_dtype": torch.bfloat16},
202
+ device_map="auto",
203
+ )
204
+
205
+ messages = [
206
+ {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
207
+ {"role": "user", "content": "Who are you?"},
208
+ ]
209
+
210
+ prompt = pipeline.tokenizer.apply_chat_template(
211
+ messages,
212
+ tokenize=False,
213
+ add_generation_prompt=True
214
+ )
215
+
216
+ terminators = [
217
+ pipeline.tokenizer.eos_token_id,
218
+ pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
219
+ ]
220
+
221
+ outputs = pipeline(
222
+ prompt,
223
+ max_new_tokens=256,
224
+ eos_token_id=terminators,
225
+ do_sample=True,
226
+ temperature=0.6,
227
+ top_p=0.9,
228
+ )
229
+ print(outputs[0]["generated_text"][len(prompt):])
230
+ ```
231
+
232
+ #### Transformers AutoModelForCausalLM
233
+
234
+ ```python
235
+ from transformers import AutoTokenizer, AutoModelForCausalLM
236
+ import torch
237
+
238
+ model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
239
+
240
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
241
+ model = AutoModelForCausalLM.from_pretrained(
242
+ model_id,
243
+ torch_dtype=torch.bfloat16,
244
+ device_map="auto",
245
+ )
246
+
247
+ messages = [
248
+ {"role": "system", "content": "You are a pirate chatbot who always responds in pirate speak!"},
249
+ {"role": "user", "content": "Who are you?"},
250
+ ]
251
 
252
+ input_ids = tokenizer.apply_chat_template(
253
+ messages,
254
+ add_generation_prompt=True,
255
+ return_tensors="pt"
256
+ ).to(model.device)
257
 
258
+ terminators = [
259
+ tokenizer.eos_token_id,
260
+ tokenizer.convert_tokens_to_ids("<|eot_id|>")
261
+ ]
262
 
263
+ outputs = model.generate(
264
+ input_ids,
265
+ max_new_tokens=256,
266
+ eos_token_id=terminators,
267
+ do_sample=True,
268
+ temperature=0.6,
269
+ top_p=0.9,
270
+ )
271
+ response = outputs[0][input_ids.shape[-1]:]
272
+ print(tokenizer.decode(response, skip_special_tokens=True))
273
+ ```
274
+
275
+
276
+ ### Use with `llama3`
277
+
278
+ Please, follow the instructions in the [repository](https://github.com/meta-llama/llama3)
279
+
280
+ To download Original checkpoints, see the example command below leveraging `huggingface-cli`:
281
+
282
+ ```
283
+ huggingface-cli download meta-llama/Meta-Llama-3-8B-Instruct --include "original/*" --local-dir Meta-Llama-3-8B-Instruct
284
+ ```
285
+
286
+ For Hugging Face support, we recommend using transformers or TGI, but a similar command works.
287
+
288
+ ## Hardware and Software
289
+
290
+ **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.
291
+
292
+ **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.
293
+
294
+
295
+ <table>
296
+ <tr>
297
+ <td>
298
+ </td>
299
+ <td><strong>Time (GPU hours)</strong>
300
+ </td>
301
+ <td><strong>Power Consumption (W)</strong>
302
+ </td>
303
+ <td><strong>Carbon Emitted(tCO2eq)</strong>
304
+ </td>
305
+ </tr>
306
+ <tr>
307
+ <td>Llama 3 8B
308
+ </td>
309
+ <td>1.3M
310
+ </td>
311
+ <td>700
312
+ </td>
313
+ <td>390
314
+ </td>
315
+ </tr>
316
+ <tr>
317
+ <td>Llama 3 70B
318
+ </td>
319
+ <td>6.4M
320
+ </td>
321
+ <td>700
322
+ </td>
323
+ <td>1900
324
+ </td>
325
+ </tr>
326
+ <tr>
327
+ <td>Total
328
+ </td>
329
+ <td>7.7M
330
+ </td>
331
+ <td>
332
+ </td>
333
+ <td>2290
334
+ </td>
335
+ </tr>
336
+ </table>
337
+
338
+
339
+
340
+ **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.
341
+
342
+
343
+ ## Training Data
344
+
345
+ **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.
346
+
347
+ **Data Freshness** The pretraining data has a cutoff of March 2023 for the 7B and December 2023 for the 70B models respectively.
348
+
349
+
350
+ ## Benchmarks
351
+
352
+ 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).
353
+
354
+
355
+ ### Base pretrained models
356
+
357
+
358
+ <table>
359
+ <tr>
360
+ <td><strong>Category</strong>
361
+ </td>
362
+ <td><strong>Benchmark</strong>
363
+ </td>
364
+ <td><strong>Llama 3 8B</strong>
365
+ </td>
366
+ <td><strong>Llama2 7B</strong>
367
+ </td>
368
+ <td><strong>Llama2 13B</strong>
369
+ </td>
370
+ <td><strong>Llama 3 70B</strong>
371
+ </td>
372
+ <td><strong>Llama2 70B</strong>
373
+ </td>
374
+ </tr>
375
+ <tr>
376
+ <td rowspan="6" >General
377
+ </td>
378
+ <td>MMLU (5-shot)
379
+ </td>
380
+ <td>66.6
381
+ </td>
382
+ <td>45.7
383
+ </td>
384
+ <td>53.8
385
+ </td>
386
+ <td>79.5
387
+ </td>
388
+ <td>69.7
389
+ </td>
390
+ </tr>
391
+ <tr>
392
+ <td>AGIEval English (3-5 shot)
393
+ </td>
394
+ <td>45.9
395
+ </td>
396
+ <td>28.8
397
+ </td>
398
+ <td>38.7
399
+ </td>
400
+ <td>63.0
401
+ </td>
402
+ <td>54.8
403
+ </td>
404
+ </tr>
405
+ <tr>
406
+ <td>CommonSenseQA (7-shot)
407
+ </td>
408
+ <td>72.6
409
+ </td>
410
+ <td>57.6
411
+ </td>
412
+ <td>67.6
413
+ </td>
414
+ <td>83.8
415
+ </td>
416
+ <td>78.7
417
+ </td>
418
+ </tr>
419
+ <tr>
420
+ <td>Winogrande (5-shot)
421
+ </td>
422
+ <td>76.1
423
+ </td>
424
+ <td>73.3
425
+ </td>
426
+ <td>75.4
427
+ </td>
428
+ <td>83.1
429
+ </td>
430
+ <td>81.8
431
+ </td>
432
+ </tr>
433
+ <tr>
434
+ <td>BIG-Bench Hard (3-shot, CoT)
435
+ </td>
436
+ <td>61.1
437
+ </td>
438
+ <td>38.1
439
+ </td>
440
+ <td>47.0
441
+ </td>
442
+ <td>81.3
443
+ </td>
444
+ <td>65.7
445
+ </td>
446
+ </tr>
447
+ <tr>
448
+ <td>ARC-Challenge (25-shot)
449
+ </td>
450
+ <td>78.6
451
+ </td>
452
+ <td>53.7
453
+ </td>
454
+ <td>67.6
455
+ </td>
456
+ <td>93.0
457
+ </td>
458
+ <td>85.3
459
+ </td>
460
+ </tr>
461
+ <tr>
462
+ <td>Knowledge reasoning
463
+ </td>
464
+ <td>TriviaQA-Wiki (5-shot)
465
+ </td>
466
+ <td>78.5
467
+ </td>
468
+ <td>72.1
469
+ </td>
470
+ <td>79.6
471
+ </td>
472
+ <td>89.7
473
+ </td>
474
+ <td>87.5
475
+ </td>
476
+ </tr>
477
+ <tr>
478
+ <td rowspan="4" >Reading comprehension
479
+ </td>
480
+ <td>SQuAD (1-shot)
481
+ </td>
482
+ <td>76.4
483
+ </td>
484
+ <td>72.2
485
+ </td>
486
+ <td>72.1
487
+ </td>
488
+ <td>85.6
489
+ </td>
490
+ <td>82.6
491
+ </td>
492
+ </tr>
493
+ <tr>
494
+ <td>QuAC (1-shot, F1)
495
+ </td>
496
+ <td>44.4
497
+ </td>
498
+ <td>39.6
499
+ </td>
500
+ <td>44.9
501
+ </td>
502
+ <td>51.1
503
+ </td>
504
+ <td>49.4
505
+ </td>
506
+ </tr>
507
+ <tr>
508
+ <td>BoolQ (0-shot)
509
+ </td>
510
+ <td>75.7
511
+ </td>
512
+ <td>65.5
513
+ </td>
514
+ <td>66.9
515
+ </td>
516
+ <td>79.0
517
+ </td>
518
+ <td>73.1
519
+ </td>
520
+ </tr>
521
+ <tr>
522
+ <td>DROP (3-shot, F1)
523
+ </td>
524
+ <td>58.4
525
+ </td>
526
+ <td>37.9
527
+ </td>
528
+ <td>49.8
529
+ </td>
530
+ <td>79.7
531
+ </td>
532
+ <td>70.2
533
+ </td>
534
+ </tr>
535
+ </table>
536
+
537
+
538
+
539
+ ### Instruction tuned models
540
+
541
+
542
+ <table>
543
+ <tr>
544
+ <td><strong>Benchmark</strong>
545
+ </td>
546
+ <td><strong>Llama 3 8B</strong>
547
+ </td>
548
+ <td><strong>Llama 2 7B</strong>
549
+ </td>
550
+ <td><strong>Llama 2 13B</strong>
551
+ </td>
552
+ <td><strong>Llama 3 70B</strong>
553
+ </td>
554
+ <td><strong>Llama 2 70B</strong>
555
+ </td>
556
+ </tr>
557
+ <tr>
558
+ <td>MMLU (5-shot)
559
+ </td>
560
+ <td>68.4
561
+ </td>
562
+ <td>34.1
563
+ </td>
564
+ <td>47.8
565
+ </td>
566
+ <td>82.0
567
+ </td>
568
+ <td>52.9
569
+ </td>
570
+ </tr>
571
+ <tr>
572
+ <td>GPQA (0-shot)
573
+ </td>
574
+ <td>34.2
575
+ </td>
576
+ <td>21.7
577
+ </td>
578
+ <td>22.3
579
+ </td>
580
+ <td>39.5
581
+ </td>
582
+ <td>21.0
583
+ </td>
584
+ </tr>
585
+ <tr>
586
+ <td>HumanEval (0-shot)
587
+ </td>
588
+ <td>62.2
589
+ </td>
590
+ <td>7.9
591
+ </td>
592
+ <td>14.0
593
+ </td>
594
+ <td>81.7
595
+ </td>
596
+ <td>25.6
597
+ </td>
598
+ </tr>
599
+ <tr>
600
+ <td>GSM-8K (8-shot, CoT)
601
+ </td>
602
+ <td>79.6
603
+ </td>
604
+ <td>25.7
605
+ </td>
606
+ <td>77.4
607
+ </td>
608
+ <td>93.0
609
+ </td>
610
+ <td>57.5
611
+ </td>
612
+ </tr>
613
+ <tr>
614
+ <td>MATH (4-shot, CoT)
615
+ </td>
616
+ <td>30.0
617
+ </td>
618
+ <td>3.8
619
+ </td>
620
+ <td>6.7
621
+ </td>
622
+ <td>50.4
623
+ </td>
624
+ <td>11.6
625
+ </td>
626
+ </tr>
627
+ </table>
628
 
 
629
 
 
630
 
631
+ ### Responsibility & Safety
632
 
633
+ 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.
634
 
635
+ 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.
636
 
637
+ 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.
638
 
 
639
 
640
+ 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.
641
 
 
642
 
643
+ #### Llama 3-Instruct
644
 
645
+ 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.
646
 
647
+ <span style="text-decoration:underline;">Safety</span>
648
 
649
+ 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.
650
 
651
+ <span style="text-decoration:underline;">Refusals</span>
652
 
653
+ 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.
654
 
655
+ We built internal benchmarks and developed mitigations to limit false refusals making Llama 3 our most helpful model to date.
656
 
 
657
 
658
+ #### Responsible release
659
 
660
+ 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.
661
 
662
+ Misuse
663
 
664
+ 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/).
665
 
 
666
 
667
+ #### Critical risks
668
 
669
+ <span style="text-decoration:underline;">CBRNE</span> (Chemical, Biological, Radiological, Nuclear, and high yield Explosives)
670
 
671
+ We have conducted a two fold assessment of the safety of the model in this area:
672
 
 
673
 
 
674
 
675
+ * Iterative testing during model training to assess the safety of responses related to CBRNE threats and other adversarial risks.
676
+ * 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).
 
 
 
677
 
 
678
 
679
+ ### <span style="text-decoration:underline;">Cyber Security </span>
680
 
681
+ 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).
682
 
 
683
 
684
+ ### <span style="text-decoration:underline;">Child Safety</span>
685
 
686
+ 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.
687
 
 
688
 
689
+ ### Community
690
 
691
+ 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).
692
 
693
+ 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.
694
 
 
695
 
696
+ ## Ethical Considerations and Limitations
697
 
698
+ 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.
699
 
700
+ 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.
701
 
702
+ Please see the Responsible Use Guide available at [http://llama.meta.com/responsible-use-guide](http://llama.meta.com/responsible-use-guide)
703
 
 
704
 
705
+ ## Citation instructions
706
 
707
+ @article{llama3modelcard,
708
 
709
+ title={Llama 3 Model Card},
710
 
711
+ author={AI@Meta},
712
 
713
+ year={2024},
714
 
715
+ url = {https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md}
716
 
717
+ }
718
 
719
+ ## Contributors
720
 
721
+ 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
722