TheBloke commited on
Commit
6d5e7fa
1 Parent(s): 7dba975

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +406 -0
README.md ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: EleutherAI/llemma_7b
3
+ datasets:
4
+ - EleutherAI/proof-pile-2
5
+ inference: false
6
+ language:
7
+ - en
8
+ license: llama2
9
+ model_creator: EleutherAI
10
+ model_name: Llemma 7B
11
+ model_type: llama
12
+ prompt_template: '{prompt}
13
+
14
+ '
15
+ quantized_by: TheBloke
16
+ tags:
17
+ - math
18
+ - reasoning
19
+ ---
20
+ <!-- markdownlint-disable MD041 -->
21
+
22
+ <!-- header start -->
23
+ <!-- 200823 -->
24
+ <div style="width: auto; margin-left: auto; margin-right: auto">
25
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
26
+ </div>
27
+ <div style="display: flex; justify-content: space-between; width: 100%;">
28
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
29
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
30
+ </div>
31
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
32
+ <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>
33
+ </div>
34
+ </div>
35
+ <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>
36
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
37
+ <!-- header end -->
38
+
39
+ # Llemma 7B - GPTQ
40
+ - Model creator: [EleutherAI](https://huggingface.co/EleutherAI)
41
+ - Original model: [Llemma 7B](https://huggingface.co/EleutherAI/llemma_7b)
42
+
43
+ <!-- description start -->
44
+ ## Description
45
+
46
+ This repo contains GPTQ model files for [EleutherAI's Llemma 7B](https://huggingface.co/EleutherAI/llemma_7b).
47
+
48
+ Multiple GPTQ parameter permutations are provided; see Provided Files below for details of the options provided, their parameters, and the software used to create them.
49
+
50
+ <!-- description end -->
51
+ <!-- repositories-available start -->
52
+ ## Repositories available
53
+
54
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/llemma_7b-AWQ)
55
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/llemma_7b-GPTQ)
56
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/llemma_7b-GGUF)
57
+ * [EleutherAI's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/EleutherAI/llemma_7b)
58
+ <!-- repositories-available end -->
59
+
60
+ <!-- prompt-template start -->
61
+ ## Prompt template: Unknown
62
+
63
+ ```
64
+ {prompt}
65
+
66
+ ```
67
+
68
+ <!-- prompt-template end -->
69
+
70
+
71
+ <!-- README_GPTQ.md-provided-files start -->
72
+ ## Provided files, and GPTQ parameters
73
+
74
+ Multiple quantisation parameters are provided, to allow you to choose the best one for your hardware and requirements.
75
+
76
+ Each separate quant is in a different branch. See below for instructions on fetching from different branches.
77
+
78
+ Most GPTQ files are made with AutoGPTQ. Mistral models are currently made with Transformers.
79
+
80
+ <details>
81
+ <summary>Explanation of GPTQ parameters</summary>
82
+
83
+ - Bits: The bit size of the quantised model.
84
+ - GS: GPTQ group size. Higher numbers use less VRAM, but have lower quantisation accuracy. "None" is the lowest possible value.
85
+ - Act Order: True or False. Also known as `desc_act`. True results in better quantisation accuracy. Some GPTQ clients have had issues with models that use Act Order plus Group Size, but this is generally resolved now.
86
+ - Damp %: A GPTQ parameter that affects how samples are processed for quantisation. 0.01 is default, but 0.1 results in slightly better accuracy.
87
+ - GPTQ dataset: The calibration dataset used during quantisation. Using a dataset more appropriate to the model's training can improve quantisation accuracy. Note that the GPTQ calibration dataset is not the same as the dataset used to train the model - please refer to the original model repo for details of the training dataset(s).
88
+ - Sequence Length: The length of the dataset sequences used for quantisation. Ideally this is the same as the model sequence length. For some very long sequence models (16+K), a lower sequence length may have to be used. Note that a lower sequence length does not limit the sequence length of the quantised model. It only impacts the quantisation accuracy on longer inference sequences.
89
+ - ExLlama Compatibility: Whether this file can be loaded with ExLlama, which currently only supports Llama models in 4-bit.
90
+
91
+ </details>
92
+
93
+ | Branch | Bits | GS | Act Order | Damp % | GPTQ Dataset | Seq Len | Size | ExLlama | Desc |
94
+ | ------ | ---- | -- | --------- | ------ | ------------ | ------- | ---- | ------- | ---- |
95
+ | [main](https://huggingface.co/TheBloke/llemma_7b-GPTQ/tree/main) | 4 | 128 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 3.90 GB | Yes | 4-bit, with Act Order and group size 128g. Uses even less VRAM than 64g, but with slightly lower accuracy. |
96
+ | [gptq-4bit-32g-actorder_True](https://huggingface.co/TheBloke/llemma_7b-GPTQ/tree/gptq-4bit-32g-actorder_True) | 4 | 32 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 4.28 GB | Yes | 4-bit, with Act Order and group size 32g. Gives highest possible inference quality, with maximum VRAM usage. |
97
+ | [gptq-8bit--1g-actorder_True](https://huggingface.co/TheBloke/llemma_7b-GPTQ/tree/gptq-8bit--1g-actorder_True) | 8 | None | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 7.01 GB | No | 8-bit, with Act Order. No group size, to lower VRAM requirements. |
98
+ | [gptq-8bit-128g-actorder_True](https://huggingface.co/TheBloke/llemma_7b-GPTQ/tree/gptq-8bit-128g-actorder_True) | 8 | 128 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 7.16 GB | No | 8-bit, with group size 128g for higher inference quality and with Act Order for even higher accuracy. |
99
+ | [gptq-8bit-32g-actorder_True](https://huggingface.co/TheBloke/llemma_7b-GPTQ/tree/gptq-8bit-32g-actorder_True) | 8 | 32 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 7.62 GB | No | 8-bit, with group size 32g and Act Order for maximum inference quality. |
100
+ | [gptq-4bit-64g-actorder_True](https://huggingface.co/TheBloke/llemma_7b-GPTQ/tree/gptq-4bit-64g-actorder_True) | 4 | 64 | Yes | 0.1 | [CamelAI Math](https://huggingface.co/datasets/andersonbcdefg/math) | 4096 | 4.02 GB | Yes | 4-bit, with Act Order and group size 64g. Uses less VRAM than 32g, but with slightly lower accuracy. |
101
+
102
+ <!-- README_GPTQ.md-provided-files end -->
103
+
104
+ <!-- README_GPTQ.md-download-from-branches start -->
105
+ ## How to download, including from branches
106
+
107
+ ### In text-generation-webui
108
+
109
+ To download from the `main` branch, enter `TheBloke/llemma_7b-GPTQ` in the "Download model" box.
110
+
111
+ To download from another branch, add `:branchname` to the end of the download name, eg `TheBloke/llemma_7b-GPTQ:gptq-4bit-32g-actorder_True`
112
+
113
+ ### From the command line
114
+
115
+ I recommend using the `huggingface-hub` Python library:
116
+
117
+ ```shell
118
+ pip3 install huggingface-hub
119
+ ```
120
+
121
+ To download the `main` branch to a folder called `llemma_7b-GPTQ`:
122
+
123
+ ```shell
124
+ mkdir llemma_7b-GPTQ
125
+ huggingface-cli download TheBloke/llemma_7b-GPTQ --local-dir llemma_7b-GPTQ --local-dir-use-symlinks False
126
+ ```
127
+
128
+ To download from a different branch, add the `--revision` parameter:
129
+
130
+ ```shell
131
+ mkdir llemma_7b-GPTQ
132
+ huggingface-cli download TheBloke/llemma_7b-GPTQ --revision gptq-4bit-32g-actorder_True --local-dir llemma_7b-GPTQ --local-dir-use-symlinks False
133
+ ```
134
+
135
+ <details>
136
+ <summary>More advanced huggingface-cli download usage</summary>
137
+
138
+ If you remove the `--local-dir-use-symlinks False` parameter, the files will instead be stored in the central Huggingface cache directory (default location on Linux is: `~/.cache/huggingface`), and symlinks will be added to the specified `--local-dir`, pointing to their real location in the cache. This allows for interrupted downloads to be resumed, and allows you to quickly clone the repo to multiple places on disk without triggering a download again. The downside, and the reason why I don't list that as the default option, is that the files are then hidden away in a cache folder and it's harder to know where your disk space is being used, and to clear it up if/when you want to remove a download model.
139
+
140
+ The cache location can be changed with the `HF_HOME` environment variable, and/or the `--cache-dir` parameter to `huggingface-cli`.
141
+
142
+ For more documentation on downloading with `huggingface-cli`, please see: [HF -> Hub Python Library -> Download files -> Download from the CLI](https://huggingface.co/docs/huggingface_hub/guides/download#download-from-the-cli).
143
+
144
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
145
+
146
+ ```shell
147
+ pip3 install hf_transfer
148
+ ```
149
+
150
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
151
+
152
+ ```shell
153
+ mkdir llemma_7b-GPTQ
154
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/llemma_7b-GPTQ --local-dir llemma_7b-GPTQ --local-dir-use-symlinks False
155
+ ```
156
+
157
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
158
+ </details>
159
+
160
+ ### With `git` (**not** recommended)
161
+
162
+ To clone a specific branch with `git`, use a command like this:
163
+
164
+ ```shell
165
+ git clone --single-branch --branch gptq-4bit-32g-actorder_True https://huggingface.co/TheBloke/llemma_7b-GPTQ
166
+ ```
167
+
168
+ Note that using Git with HF repos is strongly discouraged. It will be much slower than using `huggingface-hub`, and will use twice as much disk space as it has to store the model files twice (it stores every byte both in the intended target folder, and again in the `.git` folder as a blob.)
169
+
170
+ <!-- README_GPTQ.md-download-from-branches end -->
171
+ <!-- README_GPTQ.md-text-generation-webui start -->
172
+ ## How to easily download and use this model in [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
173
+
174
+ Please make sure you're using the latest version of [text-generation-webui](https://github.com/oobabooga/text-generation-webui).
175
+
176
+ It is strongly recommended to use the text-generation-webui one-click-installers unless you're sure you know how to make a manual install.
177
+
178
+ 1. Click the **Model tab**.
179
+ 2. Under **Download custom model or LoRA**, enter `TheBloke/llemma_7b-GPTQ`.
180
+
181
+ - To download from a specific branch, enter for example `TheBloke/llemma_7b-GPTQ:gptq-4bit-32g-actorder_True`
182
+ - see Provided Files above for the list of branches for each option.
183
+
184
+ 3. Click **Download**.
185
+ 4. The model will start downloading. Once it's finished it will say "Done".
186
+ 5. In the top left, click the refresh icon next to **Model**.
187
+ 6. In the **Model** dropdown, choose the model you just downloaded: `llemma_7b-GPTQ`
188
+ 7. The model will automatically load, and is now ready for use!
189
+ 8. If you want any custom settings, set them and then click **Save settings for this model** followed by **Reload the Model** in the top right.
190
+
191
+ - Note that you do not need to and should not set manual GPTQ parameters any more. These are set automatically from the file `quantize_config.json`.
192
+
193
+ 9. Once you're ready, click the **Text Generation** tab and enter a prompt to get started!
194
+
195
+ <!-- README_GPTQ.md-text-generation-webui end -->
196
+
197
+ <!-- README_GPTQ.md-use-from-tgi start -->
198
+ ## Serving this model from Text Generation Inference (TGI)
199
+
200
+ It's recommended to use TGI version 1.1.0 or later. The official Docker container is: `ghcr.io/huggingface/text-generation-inference:1.1.0`
201
+
202
+ Example Docker parameters:
203
+
204
+ ```shell
205
+ --model-id TheBloke/llemma_7b-GPTQ --port 3000 --quantize gptq --max-input-length 3696 --max-total-tokens 4096 --max-batch-prefill-tokens 4096
206
+ ```
207
+
208
+ Example Python code for interfacing with TGI (requires huggingface-hub 0.17.0 or later):
209
+
210
+ ```shell
211
+ pip3 install huggingface-hub
212
+ ```
213
+
214
+ ```python
215
+ from huggingface_hub import InferenceClient
216
+
217
+ endpoint_url = "https://your-endpoint-url-here"
218
+
219
+ prompt = "Tell me about AI"
220
+ prompt_template=f'''{prompt}
221
+ '''
222
+
223
+ client = InferenceClient(endpoint_url)
224
+ response = client.text_generation(prompt,
225
+ max_new_tokens=128,
226
+ do_sample=True,
227
+ temperature=0.7,
228
+ top_p=0.95,
229
+ top_k=40,
230
+ repetition_penalty=1.1)
231
+
232
+ print(f"Model output: {response}")
233
+ ```
234
+ <!-- README_GPTQ.md-use-from-tgi end -->
235
+ <!-- README_GPTQ.md-use-from-python start -->
236
+ ## How to use this GPTQ model from Python code
237
+
238
+ ### Install the necessary packages
239
+
240
+ Requires: Transformers 4.33.0 or later, Optimum 1.12.0 or later, and AutoGPTQ 0.4.2 or later.
241
+
242
+ ```shell
243
+ pip3 install transformers optimum
244
+ pip3 install auto-gptq --extra-index-url https://huggingface.github.io/autogptq-index/whl/cu118/ # Use cu117 if on CUDA 11.7
245
+ ```
246
+
247
+ If you have problems installing AutoGPTQ using the pre-built wheels, install it from source instead:
248
+
249
+ ```shell
250
+ pip3 uninstall -y auto-gptq
251
+ git clone https://github.com/PanQiWei/AutoGPTQ
252
+ cd AutoGPTQ
253
+ git checkout v0.4.2
254
+ pip3 install .
255
+ ```
256
+
257
+ ### You can then use the following code
258
+
259
+ ```python
260
+ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
261
+
262
+ model_name_or_path = "TheBloke/llemma_7b-GPTQ"
263
+ # To use a different branch, change revision
264
+ # For example: revision="gptq-4bit-32g-actorder_True"
265
+ model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
266
+ device_map="auto",
267
+ trust_remote_code=False,
268
+ revision="main")
269
+
270
+ tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
271
+
272
+ prompt = "Tell me about AI"
273
+ prompt_template=f'''{prompt}
274
+ '''
275
+
276
+ print("\n\n*** Generate:")
277
+
278
+ input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
279
+ output = model.generate(inputs=input_ids, temperature=0.7, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)
280
+ print(tokenizer.decode(output[0]))
281
+
282
+ # Inference can also be done using transformers' pipeline
283
+
284
+ print("*** Pipeline:")
285
+ pipe = pipeline(
286
+ "text-generation",
287
+ model=model,
288
+ tokenizer=tokenizer,
289
+ max_new_tokens=512,
290
+ do_sample=True,
291
+ temperature=0.7,
292
+ top_p=0.95,
293
+ top_k=40,
294
+ repetition_penalty=1.1
295
+ )
296
+
297
+ print(pipe(prompt_template)[0]['generated_text'])
298
+ ```
299
+ <!-- README_GPTQ.md-use-from-python end -->
300
+
301
+ <!-- README_GPTQ.md-compatibility start -->
302
+ ## Compatibility
303
+
304
+ The files provided are tested to work with AutoGPTQ, both via Transformers and using AutoGPTQ directly. They should also work with [Occ4m's GPTQ-for-LLaMa fork](https://github.com/0cc4m/KoboldAI).
305
+
306
+ [ExLlama](https://github.com/turboderp/exllama) is compatible with Llama and Mistral models in 4-bit. Please see the Provided Files table above for per-file compatibility.
307
+
308
+ [Huggingface Text Generation Inference (TGI)](https://github.com/huggingface/text-generation-inference) is compatible with all GPTQ models.
309
+ <!-- README_GPTQ.md-compatibility end -->
310
+
311
+ <!-- footer start -->
312
+ <!-- 200823 -->
313
+ ## Discord
314
+
315
+ For further support, and discussions on these models and AI in general, join us at:
316
+
317
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
318
+
319
+ ## Thanks, and how to contribute
320
+
321
+ Thanks to the [chirper.ai](https://chirper.ai) team!
322
+
323
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
324
+
325
+ 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.
326
+
327
+ 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.
328
+
329
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
330
+
331
+ * Patreon: https://patreon.com/TheBlokeAI
332
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
333
+
334
+ **Special thanks to**: Aemon Algiz.
335
+
336
+ **Patreon special mentions**: Pierre Kircher, Stanislav Ovsiannikov, Michael Levine, Eugene Pentland, Andrey, 준교 김, Randy H, Fred von Graf, Artur Olbinski, Caitlyn Gatomon, terasurfer, Jeff Scroggin, James Bentley, Vadim, Gabriel Puliatti, Harry Royden McLaughlin, Sean Connelly, Dan Guido, Edmond Seymore, Alicia Loh, subjectnull, AzureBlack, Manuel Alberto Morcote, Thomas Belote, Lone Striker, Chris Smitley, Vitor Caleffi, Johann-Peter Hartmann, Clay Pascal, biorpg, Brandon Frisco, sidney chen, transmissions 11, Pedro Madruga, jinyuan sun, Ajan Kanaga, Emad Mostaque, Trenton Dambrowitz, Jonathan Leane, Iucharbius, usrbinkat, vamX, George Stoitzev, Luke Pendergrass, theTransient, Olakabola, Swaroop Kallakuri, Cap'n Zoog, Brandon Phillips, Michael Dempsey, Nikolai Manek, danny, Matthew Berman, Gabriel Tamborski, alfie_i, Raymond Fosdick, Tom X Nguyen, Raven Klaugh, LangChain4j, Magnesian, Illia Dulskyi, David Ziegler, Mano Prime, Luis Javier Navarrete Lozano, Erik Bjäreholt, 阿明, Nathan Dryer, Alex, Rainer Wilmers, zynix, TL, Joseph William Delisle, John Villwock, Nathan LeClaire, Willem Michiel, Joguhyik, GodLy, OG, Alps Aficionado, Jeffrey Morgan, ReadyPlayerEmma, Tiffany J. Kim, Sebastain Graf, Spencer Kim, Michael Davis, webtim, Talal Aujan, knownsqashed, John Detwiler, Imad Khwaja, Deo Leter, Jerry Meng, Elijah Stavena, Rooh Singh, Pieter, SuperWojo, Alexandros Triantafyllidis, Stephen Murray, Ai Maven, ya boyyy, Enrico Ros, Ken Nordquist, Deep Realms, Nicholas, Spiking Neurons AB, Elle, Will Dee, Jack West, RoA, Luke @flexchar, Viktor Bowallius, Derek Yates, Subspace Studios, jjj, Toran Billups, Asp the Wyvern, Fen Risland, Ilya, NimbleBox.ai, Chadd, Nitin Borwankar, Emre, Mandus, Leonard Tan, Kalila, K, Trailburnt, S_X, Cory Kujawski
337
+
338
+
339
+ Thank you to all my generous patrons and donaters!
340
+
341
+ And thank you again to a16z for their generous grant.
342
+
343
+ <!-- footer end -->
344
+
345
+ # Original model card: EleutherAI's Llemma 7B
346
+
347
+ <img src="llemma.png" width="400">
348
+
349
+ [ArXiv](http://arxiv.org/abs/2310.10631) | [Models](https://huggingface.co/EleutherAI/llemma_34b) | [Data](https://huggingface.co/datasets/EleutherAI/proof-pile-2) | [Code](https://github.com/EleutherAI/math-lm) | [Blog](https://blog.eleuther.ai/llemma/) | [Sample Explorer](https://llemma-demo.github.io/)
350
+
351
+ [Zhangir Azerbayev](https://zhangir-azerbayev.github.io/), [Hailey Schoelkopf](https://github.com/haileyschoelkopf), [Keiran Paster](https://keirp.com), [Marco Dos Santos](https://github.com/dsantosmarco), [Stephen McAleer](https://www.andrew.cmu.edu/user/smcaleer/), [Albert Q. Jiang](https://albertqjiang.github.io/), [Jia Deng](https://www.cs.princeton.edu/~jiadeng/), [Stella Biderman](https://www.stellabiderman.com/), [Sean Welleck](https://wellecks.com/)
352
+
353
+ **Llemma 7B** is a language model for mathematics. It was initialized with [Code Llama 7B](https://github.com/facebookresearch/codellama) weights, and trained on the [Proof-Pile-2](https://huggingface.co/datasets/EleutherAI/proof-pile-2) for 200B tokens.
354
+
355
+ This model also comes in a 34B parameter version: [Llemma 34B](https://huggingface.co/EleutherAI/llemma_34b).
356
+
357
+ ## Evaluations
358
+
359
+ Llemma models are particularly strong at chain-of-thought mathematical reasoning and using computational tools for mathematics, such as Python and formal theorem provers.
360
+
361
+
362
+ ### Chain-of-thought Math
363
+ On chain-of-thought mathematics tasks, Llemma models outperform Llama-2, Code Llama, and when controlled for model size, outperform Minerva.
364
+
365
+ | Model | Size | GSM8k | [OCW](https://openreview.net/forum?id=IFXTZERXdM7) | MMLU-STEM | [SAT](https://huggingface.co/datasets/mcaleste/sat_multiple_choice_math_may_23) | MATH |
366
+ |------------|------|--------|-------|-----------|-------|-------|
367
+ | Llama 2 | 7B | 11.8% | 3.7% | 29.9% | 25% | 3.2% |
368
+ | Code Llama | 7B | 10.5% | 4.4% | 25.1% | 9.4% | 4.5% |
369
+ | LLEMMA | 7B | **36.4%** | **7.7%** | **37.7%** | **53.1%** | **18.0%** |
370
+ | Minerva | 8B | 16.2% | **7.7%** | 35.6% | - | 14.1% |
371
+ |------------|------|--------|-------|-----------|-------|-------|
372
+ | Code Llama | 34B | 29.6% | 7.0% | 40.5% | 40.6% | 12.2% |
373
+ | LLEMMA | 34B | **51.5%** | **11.8%** | **49.0%** | **71.9%** | **25.0%** |
374
+ |------------|------|--------|-------|-----------|-------|-------|
375
+ | Minerva | 62B | 52.4% | 12.0% | 53.9% | - | 27.6% |
376
+ | Minerva | 540B | 58.8% | 17.6% | 63.9% | - | 33.6% |
377
+
378
+
379
+ Further performance can be extracted by using majority voting:
380
+
381
+ | Model | Size | GSM8k maj@100 | OCW maj@100 | MMLU-STEM maj@16 | SAT maj@16 | MATH maj@256 |
382
+ |---------|------|-------------|-----------|-----------------|-----------|------------|
383
+ | LLEMMA | 7B | 54.0% | 14.3% | 49.9% | 78.1% | **33.5** |
384
+ | Minerva | 8B | 28.4% | 12.5% | 43.4% | - | 25.4% |
385
+ |---------|------|-------------|-----------|-----------------|-----------|------------|
386
+ | LLEMMA | 34B | 69.3% | 18.4% | 59.7% | 81.3% | **43.1%** |
387
+ |---------|------|-------------|-----------|-----------------|-----------|------------|
388
+ | Minerva | 62B | 68.5% | 23.5% | 63.5% | - | 43.4% |
389
+ | Minerva | 540B | 78.5% | 30.8% | 75.0% | - | 50.3% |
390
+
391
+ ### Tool Use and Theorem Proving
392
+ In addition to chain-of-thought reasoning, Llemma has strong capabilities in computational mathematics tasks. For tool use and formal theorem proving evaluations, see [our paper](http://arxiv.org/abs/2310.10631).
393
+
394
+ ### Citation
395
+ ```
396
+ @misc{azerbayev2023llemma,
397
+ title={Llemma: An Open Language Model For Mathematics},
398
+ author={Zhangir Azerbayev and Hailey Schoelkopf and Keiran Paster and Marco Dos Santos and Stephen McAleer and Albert Q. Jiang and Jia Deng and Stella Biderman and Sean Welleck},
399
+ year={2023},
400
+ eprint={2310.10631},
401
+ archivePrefix={arXiv},
402
+ primaryClass={cs.CL}
403
+ }
404
+ ```
405
+
406
+