Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,336 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
inference: false
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
license: other
|
6 |
+
model_creator: Meta Llama 2
|
7 |
+
model_link: https://huggingface.co/meta-llama/Llama-2-70b-chat-hf
|
8 |
+
model_name: Llama 2 70B Chat
|
9 |
+
model_type: llama
|
10 |
+
pipeline_tag: text-generation
|
11 |
+
quantized_by: TheBloke
|
12 |
+
tags:
|
13 |
+
- facebook
|
14 |
+
- meta
|
15 |
+
- pytorch
|
16 |
+
- llama
|
17 |
+
- llama-2
|
18 |
+
---
|
19 |
+
|
20 |
+
<!-- header start -->
|
21 |
+
<!-- 200823 -->
|
22 |
+
<div style="width: auto; margin-left: auto; margin-right: auto">
|
23 |
+
<img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
|
24 |
+
</div>
|
25 |
+
<div style="display: flex; justify-content: space-between; width: 100%;">
|
26 |
+
<div style="display: flex; flex-direction: column; align-items: flex-start;">
|
27 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
|
28 |
+
</div>
|
29 |
+
<div style="display: flex; flex-direction: column; align-items: flex-end;">
|
30 |
+
<p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
|
31 |
+
</div>
|
32 |
+
</div>
|
33 |
+
<div style="text-align:center; margin-top: 0em; margin-bottom: 0em"><p style="margin-top: 0.25em; margin-bottom: 0em;">TheBloke's LLM work is generously supported by a grant from <a href="https://a16z.com">andreessen horowitz (a16z)</a></p></div>
|
34 |
+
<hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
|
35 |
+
<!-- header end -->
|
36 |
+
|
37 |
+
# Llama 2 70B Chat - GGUF
|
38 |
+
- Model creator: [Meta Llama 2](https://huggingface.co/meta-llama)
|
39 |
+
- Original model: [Llama 2 70B Chat](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf)
|
40 |
+
|
41 |
+
## Description
|
42 |
+
|
43 |
+
This repo contains GGUF format model files for [Meta Llama 2's Llama 2 70B Chat](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf).
|
44 |
+
|
45 |
+
<!-- README_GGUF.md-about-gguf start -->
|
46 |
+
### About GGUF
|
47 |
+
|
48 |
+
GGUF is a new format introduced by the llama.cpp team on August 21st 2023. It is a replacement for GGML, which is no longer supported by llama.cpp.
|
49 |
+
|
50 |
+
The key benefit of GGUF is that it is a extensible, future-proof format which stores more information about the model as metadata. It also includes significantly improved tokenization code, including for the first time full support for special tokens. This should improve performance, especially with models that use new special tokens and implement custom prompt templates.
|
51 |
+
|
52 |
+
Here are a list of clients and libraries that are known to support GGUF:
|
53 |
+
* [llama.cpp](https://github.com/ggerganov/llama.cpp).
|
54 |
+
* [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most widely used web UI. Supports GGUF with GPU acceleration via the ctransformers backend - llama-cpp-python backend should work soon too.
|
55 |
+
* [KoboldCpp](https://github.com/LostRuins/koboldcpp), now supports GGUF as of release 1.41! A powerful GGML web UI, with full GPU accel. Especially good for story telling.
|
56 |
+
* [LM Studio](https://lmstudio.ai/), version 0.2.2 and later support GGUF. A fully featured local GUI with GPU acceleration on both Windows (NVidia and AMD), and macOS.
|
57 |
+
* [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), should now work, choose the `c_transformers` backend. A great web UI with many interesting features. Supports CUDA GPU acceleration.
|
58 |
+
* [ctransformers](https://github.com/marella/ctransformers), now supports GGUF as of version 0.2.24! A Python library with GPU accel, LangChain support, and OpenAI-compatible AI server.
|
59 |
+
* [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), supports GGUF as of version 0.1.79. A Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
|
60 |
+
* [candle](https://github.com/huggingface/candle), added GGUF support on August 22nd. Candle is a Rust ML framework with a focus on performance, including GPU support, and ease of use.
|
61 |
+
|
62 |
+
<!-- README_GGUF.md-about-gguf end -->
|
63 |
+
<!-- repositories-available start -->
|
64 |
+
## Repositories available
|
65 |
+
|
66 |
+
* [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Llama-2-70B-chat-GPTQ)
|
67 |
+
* [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Llama-2-70B-chat-GGUF)
|
68 |
+
* [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference (deprecated)](https://huggingface.co/TheBloke/Llama-2-70B-chat-GGML)
|
69 |
+
* [Meta Llama 2's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/meta-llama/Llama-2-70b-chat-hf)
|
70 |
+
<!-- repositories-available end -->
|
71 |
+
|
72 |
+
<!-- prompt-template start -->
|
73 |
+
## Prompt template: Llama-2-Chat
|
74 |
+
|
75 |
+
```
|
76 |
+
[INST] <<SYS>>
|
77 |
+
You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.
|
78 |
+
<</SYS>>
|
79 |
+
{prompt}[/INST]
|
80 |
+
|
81 |
+
```
|
82 |
+
|
83 |
+
<!-- prompt-template end -->
|
84 |
+
<!-- compatibility_gguf start -->
|
85 |
+
## Compatibility
|
86 |
+
|
87 |
+
These quantised GGUF files are compatible with llama.cpp from August 21st 2023 onwards, as of commit [6381d4e110bd0ec02843a60bbeb8b6fc37a9ace9](https://github.com/ggerganov/llama.cpp/commit/6381d4e110bd0ec02843a60bbeb8b6fc37a9ace9)
|
88 |
+
|
89 |
+
They are now also compatible with many third party UIs and libraries - please see the list at the top of the README.
|
90 |
+
|
91 |
+
## Explanation of quantisation methods
|
92 |
+
<details>
|
93 |
+
<summary>Click to see details</summary>
|
94 |
+
|
95 |
+
The new methods available are:
|
96 |
+
* GGML_TYPE_Q2_K - "type-1" 2-bit quantization in super-blocks containing 16 blocks, each block having 16 weight. Block scales and mins are quantized with 4 bits. This ends up effectively using 2.5625 bits per weight (bpw)
|
97 |
+
* GGML_TYPE_Q3_K - "type-0" 3-bit quantization in super-blocks containing 16 blocks, each block having 16 weights. Scales are quantized with 6 bits. This end up using 3.4375 bpw.
|
98 |
+
* GGML_TYPE_Q4_K - "type-1" 4-bit quantization in super-blocks containing 8 blocks, each block having 32 weights. Scales and mins are quantized with 6 bits. This ends up using 4.5 bpw.
|
99 |
+
* GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
|
100 |
+
* GGML_TYPE_Q6_K - "type-0" 6-bit quantization. Super-blocks with 16 blocks, each block having 16 weights. Scales are quantized with 8 bits. This ends up using 6.5625 bpw
|
101 |
+
|
102 |
+
Refer to the Provided Files table below to see what files use which methods, and how.
|
103 |
+
</details>
|
104 |
+
<!-- compatibility_gguf end -->
|
105 |
+
|
106 |
+
<!-- README_GGUF.md-provided-files start -->
|
107 |
+
## Provided files
|
108 |
+
|
109 |
+
| Name | Quant method | Bits | Size | Max RAM required | Use case |
|
110 |
+
| ---- | ---- | ---- | ---- | ---- | ----- |
|
111 |
+
| [llama-2-70b-chat.Q2_K.gguf](https://huggingface.co/TheBloke/Llama-2-70B-chat-GGUF/blob/main/llama-2-70b-chat.Q2_K.gguf) | Q2_K | 2 | 29.28 GB| 31.78 GB | smallest, significant quality loss - not recommended for most purposes |
|
112 |
+
| [llama-2-70b-chat.Q3_K_S.gguf](https://huggingface.co/TheBloke/Llama-2-70B-chat-GGUF/blob/main/llama-2-70b-chat.Q3_K_S.gguf) | Q3_K_S | 3 | 29.92 GB| 32.42 GB | very small, high quality loss |
|
113 |
+
| [llama-2-70b-chat.Q5_K_S.gguf](https://huggingface.co/TheBloke/Llama-2-70B-chat-GGUF/blob/main/llama-2-70b-chat.Q5_K_S.gguf) | Q5_K_S | 5 | 30.57 GB| 33.07 GB | large, low quality loss - recommended |
|
114 |
+
| [llama-2-70b-chat.Q3_K_M.gguf](https://huggingface.co/TheBloke/Llama-2-70B-chat-GGUF/blob/main/llama-2-70b-chat.Q3_K_M.gguf) | Q3_K_M | 3 | 33.19 GB| 35.69 GB | very small, high quality loss |
|
115 |
+
| [llama-2-70b-chat.Q3_K_L.gguf](https://huggingface.co/TheBloke/Llama-2-70B-chat-GGUF/blob/main/llama-2-70b-chat.Q3_K_L.gguf) | Q3_K_L | 3 | 36.15 GB| 38.65 GB | small, substantial quality loss |
|
116 |
+
| [llama-2-70b-chat.Q4_0.gguf](https://huggingface.co/TheBloke/Llama-2-70B-chat-GGUF/blob/main/llama-2-70b-chat.Q4_0.gguf) | Q4_0 | 4 | 38.87 GB| 41.37 GB | legacy; small, very high quality loss - prefer using Q3_K_M |
|
117 |
+
| [llama-2-70b-chat.Q4_K_S.gguf](https://huggingface.co/TheBloke/Llama-2-70B-chat-GGUF/blob/main/llama-2-70b-chat.Q4_K_S.gguf) | Q4_K_S | 4 | 39.07 GB| 41.57 GB | small, greater quality loss |
|
118 |
+
| [llama-2-70b-chat.Q4_K_M.gguf](https://huggingface.co/TheBloke/Llama-2-70B-chat-GGUF/blob/main/llama-2-70b-chat.Q4_K_M.gguf) | Q4_K_M | 4 | 41.42 GB| 43.92 GB | medium, balanced quality - recommended |
|
119 |
+
| [llama-2-70b-chat.Q5_0.gguf](https://huggingface.co/TheBloke/Llama-2-70B-chat-GGUF/blob/main/llama-2-70b-chat.Q5_0.gguf) | Q5_0 | 5 | 47.46 GB| 49.96 GB | legacy; medium, balanced quality - prefer using Q4_K_M |
|
120 |
+
|
121 |
+
**Note**: the above RAM figures assume no GPU offloading. If layers are offloaded to the GPU, this will reduce RAM usage and use VRAM instead.
|
122 |
+
<!-- README_GGUF.md-provided-files end -->
|
123 |
+
|
124 |
+
<!-- README_GGUF.md-how-to-run start -->
|
125 |
+
## Example `llama.cpp` command
|
126 |
+
|
127 |
+
Make sure you are using `llama.cpp` from commit [6381d4e110bd0ec02843a60bbeb8b6fc37a9ace9](https://github.com/ggerganov/llama.cpp/commit/6381d4e110bd0ec02843a60bbeb8b6fc37a9ace9) or later.
|
128 |
+
|
129 |
+
For compatibility with older versions of llama.cpp, or for any third-party libraries or clients that haven't yet updated for GGUF, please use GGML files instead.
|
130 |
+
|
131 |
+
```
|
132 |
+
./main -t 10 -ngl 32 -m llama-2-70b-chat.q4_K_M.gguf --color -c 4096 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "[INST] <<SYS>>\nYou are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.\n<</SYS>>\nWrite a story about llamas[/INST]"
|
133 |
+
```
|
134 |
+
Change `-t 10` to the number of physical CPU cores you have. For example if your system has 8 cores/16 threads, use `-t 8`. If offloading all layers to GPU, set `-t 1`.
|
135 |
+
|
136 |
+
Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
|
137 |
+
|
138 |
+
Change `-c 4096` to the desired sequence length for this model. For extended sequence models - eg 8K, 16K, 32K - the necessary RoPE scaling parameters are read from the GGUF file and set by llama.cpp automatically.
|
139 |
+
|
140 |
+
If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
|
141 |
+
|
142 |
+
For other parameters and how to use them, please refer to [the llama.cpp documentation](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/README.md)
|
143 |
+
|
144 |
+
## How to run in `text-generation-webui`
|
145 |
+
|
146 |
+
Further instructions here: [text-generation-webui/docs/llama.cpp.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp.md).
|
147 |
+
|
148 |
+
## How to run from Python code
|
149 |
+
|
150 |
+
You can use GGUF models from Python using the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python) or [ctransformers](https://github.com/marella/ctransformers) libraries.
|
151 |
+
|
152 |
+
### How to load this model from Python using ctransformers
|
153 |
+
|
154 |
+
#### First install the package
|
155 |
+
|
156 |
+
```bash
|
157 |
+
# Base ctransformers with no GPU acceleration
|
158 |
+
pip install ctransformers>=0.2.24
|
159 |
+
# Or with CUDA GPU acceleration
|
160 |
+
pip install ctransformers[cuda]>=0.2.24
|
161 |
+
# Or with ROCm GPU acceleration
|
162 |
+
CT_HIPBLAS=1 pip install ctransformers>=0.2.24 --no-binary ctransformers
|
163 |
+
# Or with Metal GPU acceleration for macOS systems
|
164 |
+
CT_METAL=1 pip install ctransformers>=0.2.24 --no-binary ctransformers
|
165 |
+
```
|
166 |
+
|
167 |
+
#### Simple example code to load one of these GGUF models
|
168 |
+
|
169 |
+
```python
|
170 |
+
from ctransformers import AutoModelForCausalLM
|
171 |
+
|
172 |
+
# Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
|
173 |
+
llm = AutoModelForCausalLM.from_pretrained("TheBloke/Llama-2-70B-chat-GGML", model_file="llama-2-70b-chat.q4_K_M.gguf", model_type="llama", gpu_layers=50)
|
174 |
+
|
175 |
+
print(llm("AI is going to"))
|
176 |
+
```
|
177 |
+
|
178 |
+
## How to use with LangChain
|
179 |
+
|
180 |
+
Here's guides on using llama-cpp-python or ctransformers with LangChain:
|
181 |
+
|
182 |
+
* [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
|
183 |
+
* [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
|
184 |
+
|
185 |
+
<!-- README_GGUF.md-how-to-run end -->
|
186 |
+
|
187 |
+
<!-- footer start -->
|
188 |
+
<!-- 200823 -->
|
189 |
+
## Discord
|
190 |
+
|
191 |
+
For further support, and discussions on these models and AI in general, join us at:
|
192 |
+
|
193 |
+
[TheBloke AI's Discord server](https://discord.gg/theblokeai)
|
194 |
+
|
195 |
+
## Thanks, and how to contribute.
|
196 |
+
|
197 |
+
Thanks to the [chirper.ai](https://chirper.ai) team!
|
198 |
+
|
199 |
+
I've had a lot of people ask if they can contribute. I enjoy providing models and helping people, and would love to be able to spend even more time doing it, as well as expanding into new projects like fine tuning/training.
|
200 |
+
|
201 |
+
If you're able and willing to contribute it will be most gratefully received and will help me to keep providing more models, and to start work on new AI projects.
|
202 |
+
|
203 |
+
Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
|
204 |
+
|
205 |
+
* Patreon: https://patreon.com/TheBlokeAI
|
206 |
+
* Ko-Fi: https://ko-fi.com/TheBlokeAI
|
207 |
+
|
208 |
+
**Special thanks to**: Aemon Algiz.
|
209 |
+
|
210 |
+
**Patreon special mentions**: Russ Johnson, J, alfie_i, Alex, NimbleBox.ai, Chadd, Mandus, Nikolai Manek, Ken Nordquist, ya boyyy, Illia Dulskyi, Viktor Bowallius, vamX, Iucharbius, zynix, Magnesian, Clay Pascal, Pierre Kircher, Enrico Ros, Tony Hughes, Elle, Andrey, knownsqashed, Deep Realms, Jerry Meng, Lone Striker, Derek Yates, Pyrater, Mesiah Bishop, James Bentley, Femi Adebogun, Brandon Frisco, SuperWojo, Alps Aficionado, Michael Dempsey, Vitor Caleffi, Will Dee, Edmond Seymore, usrbinkat, LangChain4j, Kacper Wikieł, Luke Pendergrass, John Detwiler, theTransient, Nathan LeClaire, Tiffany J. Kim, biorpg, Eugene Pentland, Stanislav Ovsiannikov, Fred von Graf, terasurfer, Kalila, Dan Guido, Nitin Borwankar, 阿明, Ai Maven, John Villwock, Gabriel Puliatti, Stephen Murray, Asp the Wyvern, danny, Chris Smitley, ReadyPlayerEmma, S_X, Daniel P. Andersen, Olakabola, Jeffrey Morgan, Imad Khwaja, Caitlyn Gatomon, webtim, Alicia Loh, Trenton Dambrowitz, Swaroop Kallakuri, Erik Bjäreholt, Leonard Tan, Spiking Neurons AB, Luke @flexchar, Ajan Kanaga, Thomas Belote, Deo Leter, RoA, Willem Michiel, transmissions 11, subjectnull, Matthew Berman, Joseph William Delisle, David Ziegler, Michael Davis, Johann-Peter Hartmann, Talal Aujan, senxiiz, Artur Olbinski, Rainer Wilmers, Spencer Kim, Fen Risland, Cap'n Zoog, Rishabh Srivastava, Michael Levine, Geoffrey Montalvo, Sean Connelly, Alexandros Triantafyllidis, Pieter, Gabriel Tamborski, Sam, Subspace Studios, Junyu Yang, Pedro Madruga, Vadim, Cory Kujawski, K, Raven Klaugh, Randy H, Mano Prime, Sebastain Graf, Space Cruiser
|
211 |
+
|
212 |
+
|
213 |
+
Thank you to all my generous patrons and donaters!
|
214 |
+
|
215 |
+
And thank you again to a16z for their generous grant.
|
216 |
+
|
217 |
+
<!-- footer end -->
|
218 |
+
|
219 |
+
<!-- original-model-card start -->
|
220 |
+
# Original model card: Meta Llama 2's Llama 2 70B Chat
|
221 |
+
|
222 |
+
# **Llama 2**
|
223 |
+
Llama 2 is a collection of pretrained and fine-tuned generative text models ranging in scale from 7 billion to 70 billion parameters. This is the repository for the 70B fine-tuned model, optimized for dialogue use cases and converted for the Hugging Face Transformers format. Links to other models can be found in the index at the bottom.
|
224 |
+
|
225 |
+
## Model Details
|
226 |
+
*Note: Use of this model is governed by the Meta license. In order to download the model weights and tokenizer, please visit the [website](https://ai.meta.com/resources/models-and-libraries/llama-downloads/) and accept our License before requesting access here.*
|
227 |
+
|
228 |
+
Meta developed and publicly released the Llama 2 family of large language models (LLMs), a collection of pretrained and fine-tuned generative text models ranging in scale from 7 billion to 70 billion parameters. Our fine-tuned LLMs, called Llama-2-Chat, are optimized for dialogue use cases. Llama-2-Chat models outperform open-source chat models on most benchmarks we tested, and in our human evaluations for helpfulness and safety, are on par with some popular closed-source models like ChatGPT and PaLM.
|
229 |
+
|
230 |
+
**Model Developers** Meta
|
231 |
+
|
232 |
+
**Variations** Llama 2 comes in a range of parameter sizes — 7B, 13B, and 70B — as well as pretrained and fine-tuned variations.
|
233 |
+
|
234 |
+
**Input** Models input text only.
|
235 |
+
|
236 |
+
**Output** Models generate text only.
|
237 |
+
|
238 |
+
**Model Architecture** Llama 2 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 to human preferences for helpfulness and safety.
|
239 |
+
|
240 |
+
|
241 |
+
||Training Data|Params|Content Length|GQA|Tokens|LR|
|
242 |
+
|---|---|---|---|---|---|---|
|
243 |
+
|Llama 2|*A new mix of publicly available online data*|7B|4k|✗|2.0T|3.0 x 10<sup>-4</sup>|
|
244 |
+
|Llama 2|*A new mix of publicly available online data*|13B|4k|✗|2.0T|3.0 x 10<sup>-4</sup>|
|
245 |
+
|Llama 2|*A new mix of publicly available online data*|70B|4k|✔|2.0T|1.5 x 10<sup>-4</sup>|
|
246 |
+
|
247 |
+
*Llama 2 family of models.* Token counts refer to pretraining data only. All models are trained with a global batch-size of 4M tokens. Bigger models - 70B -- use Grouped-Query Attention (GQA) for improved inference scalability.
|
248 |
+
|
249 |
+
**Model Dates** Llama 2 was trained between January 2023 and July 2023.
|
250 |
+
|
251 |
+
**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.
|
252 |
+
|
253 |
+
**License** A custom commercial license is available at: [https://ai.meta.com/resources/models-and-libraries/llama-downloads/](https://ai.meta.com/resources/models-and-libraries/llama-downloads/)
|
254 |
+
|
255 |
+
**Research Paper** ["Llama-2: Open Foundation and Fine-tuned Chat Models"](arxiv.org/abs/2307.09288)
|
256 |
+
|
257 |
+
## Intended Use
|
258 |
+
**Intended Use Cases** Llama 2 is intended for commercial and research use in English. Tuned models are intended for assistant-like chat, whereas pretrained models can be adapted for a variety of natural language generation tasks.
|
259 |
+
|
260 |
+
**Out-of-scope Uses** Use in any manner that violates applicable laws or regulations (including trade compliance laws).Use in languages other than English. Use in any other way that is prohibited by the Acceptable Use Policy and Licensing Agreement for Llama 2.
|
261 |
+
|
262 |
+
## Hardware and Software
|
263 |
+
**Training Factors** We used custom training libraries, Meta's Research Super Cluster, and production clusters for pretraining. Fine-tuning, annotation, and evaluation were also performed on third-party cloud compute.
|
264 |
+
|
265 |
+
**Carbon Footprint** Pretraining utilized a cumulative 3.3M GPU hours of computation on hardware of type A100-80GB (TDP of 350-400W). Estimated total emissions were 539 tCO2eq, 100% of which were offset by Meta’s sustainability program.
|
266 |
+
|
267 |
+
||Time (GPU hours)|Power Consumption (W)|Carbon Emitted(tCO<sub>2</sub>eq)|
|
268 |
+
|---|---|---|---|
|
269 |
+
|Llama 2 7B|184320|400|31.22|
|
270 |
+
|Llama 2 13B|368640|400|62.44|
|
271 |
+
|Llama 2 70B|1720320|400|291.42|
|
272 |
+
|Total|3311616||539.00|
|
273 |
+
|
274 |
+
**CO<sub>2</sub> emissions during pretraining.** 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.
|
275 |
+
|
276 |
+
## Training Data
|
277 |
+
**Overview** Llama 2 was pretrained on 2 trillion tokens of data from publicly available sources. The fine-tuning data includes publicly available instruction datasets, as well as over one million new human-annotated examples. Neither the pretraining nor the fine-tuning datasets include Meta user data.
|
278 |
+
|
279 |
+
**Data Freshness** The pretraining data has a cutoff of September 2022, but some tuning data is more recent, up to July 2023.
|
280 |
+
|
281 |
+
## Evaluation Results
|
282 |
+
|
283 |
+
In this section, we report the results for the Llama 1 and Llama 2 models on standard academic benchmarks.For all the evaluations, we use our internal evaluations library.
|
284 |
+
|
285 |
+
|Model|Size|Code|Commonsense Reasoning|World Knowledge|Reading Comprehension|Math|MMLU|BBH|AGI Eval|
|
286 |
+
|---|---|---|---|---|---|---|---|---|---|
|
287 |
+
|Llama 1|7B|14.1|60.8|46.2|58.5|6.95|35.1|30.3|23.9|
|
288 |
+
|Llama 1|13B|18.9|66.1|52.6|62.3|10.9|46.9|37.0|33.9|
|
289 |
+
|Llama 1|33B|26.0|70.0|58.4|67.6|21.4|57.8|39.8|41.7|
|
290 |
+
|Llama 1|65B|30.7|70.7|60.5|68.6|30.8|63.4|43.5|47.6|
|
291 |
+
|Llama 2|7B|16.8|63.9|48.9|61.3|14.6|45.3|32.6|29.3|
|
292 |
+
|Llama 2|13B|24.5|66.9|55.4|65.8|28.7|54.8|39.4|39.1|
|
293 |
+
|Llama 2|70B|**37.5**|**71.9**|**63.6**|**69.4**|**35.2**|**68.9**|**51.2**|**54.2**|
|
294 |
+
|
295 |
+
**Overall performance on grouped academic benchmarks.** *Code:* We report the average pass@1 scores of our models on HumanEval and MBPP. *Commonsense Reasoning:* We report the average of PIQA, SIQA, HellaSwag, WinoGrande, ARC easy and challenge, OpenBookQA, and CommonsenseQA. We report 7-shot results for CommonSenseQA and 0-shot results for all other benchmarks. *World Knowledge:* We evaluate the 5-shot performance on NaturalQuestions and TriviaQA and report the average. *Reading Comprehension:* For reading comprehension, we report the 0-shot average on SQuAD, QuAC, and BoolQ. *MATH:* We report the average of the GSM8K (8 shot) and MATH (4 shot) benchmarks at top 1.
|
296 |
+
|
297 |
+
|||TruthfulQA|Toxigen|
|
298 |
+
|---|---|---|---|
|
299 |
+
|Llama 1|7B|27.42|23.00|
|
300 |
+
|Llama 1|13B|41.74|23.08|
|
301 |
+
|Llama 1|33B|44.19|22.57|
|
302 |
+
|Llama 1|65B|48.71|21.77|
|
303 |
+
|Llama 2|7B|33.29|**21.25**|
|
304 |
+
|Llama 2|13B|41.86|26.10|
|
305 |
+
|Llama 2|70B|**50.18**|24.60|
|
306 |
+
|
307 |
+
**Evaluation of pretrained LLMs on automatic safety benchmarks.** For TruthfulQA, we present the percentage of generations that are both truthful and informative (the higher the better). For ToxiGen, we present the percentage of toxic generations (the smaller the better).
|
308 |
+
|
309 |
+
|
310 |
+
|||TruthfulQA|Toxigen|
|
311 |
+
|---|---|---|---|
|
312 |
+
|Llama-2-Chat|7B|57.04|**0.00**|
|
313 |
+
|Llama-2-Chat|13B|62.18|**0.00**|
|
314 |
+
|Llama-2-Chat|70B|**64.14**|0.01|
|
315 |
+
|
316 |
+
**Evaluation of fine-tuned LLMs on different safety datasets.** Same metric definitions as above.
|
317 |
+
|
318 |
+
## Ethical Considerations and Limitations
|
319 |
+
Llama 2 is a new technology that carries risks with 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 2’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 2, developers should perform safety testing and tuning tailored to their specific applications of the model.
|
320 |
+
|
321 |
+
Please see the Responsible Use Guide available at [https://ai.meta.com/llama/responsible-use-guide/](https://ai.meta.com/llama/responsible-use-guide)
|
322 |
+
|
323 |
+
## Reporting Issues
|
324 |
+
Please report any software “bug,” or other problems with the models through one of the following means:
|
325 |
+
- Reporting issues with the model: [github.com/facebookresearch/llama](http://github.com/facebookresearch/llama)
|
326 |
+
- Reporting problematic content generated by the model: [developers.facebook.com/llama_output_feedback](http://developers.facebook.com/llama_output_feedback)
|
327 |
+
- Reporting bugs and security concerns: [facebook.com/whitehat/info](http://facebook.com/whitehat/info)
|
328 |
+
|
329 |
+
## Llama Model Index
|
330 |
+
|Model|Llama2|Llama2-hf|Llama2-chat|Llama2-chat-hf|
|
331 |
+
|---|---|---|---|---|
|
332 |
+
|7B| [Link](https://huggingface.co/llamaste/Llama-2-7b) | [Link](https://huggingface.co/llamaste/Llama-2-7b-hf) | [Link](https://huggingface.co/llamaste/Llama-2-7b-chat) | [Link](https://huggingface.co/llamaste/Llama-2-7b-chat-hf)|
|
333 |
+
|13B| [Link](https://huggingface.co/llamaste/Llama-2-13b) | [Link](https://huggingface.co/llamaste/Llama-2-13b-hf) | [Link](https://huggingface.co/llamaste/Llama-2-13b-chat) | [Link](https://huggingface.co/llamaste/Llama-2-13b-hf)|
|
334 |
+
|70B| [Link](https://huggingface.co/llamaste/Llama-2-70b) | [Link](https://huggingface.co/llamaste/Llama-2-70b-hf) | [Link](https://huggingface.co/llamaste/Llama-2-70b-chat) | [Link](https://huggingface.co/llamaste/Llama-2-70b-hf)|
|
335 |
+
|
336 |
+
<!-- original-model-card end -->
|