TheBloke commited on
Commit
04336e4
1 Parent(s): ad80370

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +438 -0
README.md ADDED
@@ -0,0 +1,438 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: akjindal53244/Arithmo-Mistral-7B
3
+ datasets:
4
+ - akjindal53244/Arithmo-Data
5
+ inference: false
6
+ language:
7
+ - en
8
+ license: apache-2.0
9
+ model_creator: Ashvini Kumar Jindal
10
+ model_name: Arithmo Mistral 7B
11
+ model_type: mistral
12
+ prompt_template: 'Question: {prompt}
13
+
14
+ Answer:
15
+
16
+ '
17
+ quantized_by: TheBloke
18
+ tags:
19
+ - Mathematical Reasoning
20
+ ---
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
+ # Arithmo Mistral 7B - GGUF
40
+ - Model creator: [Ashvini Kumar Jindal](https://huggingface.co/akjindal53244)
41
+ - Original model: [Arithmo Mistral 7B](https://huggingface.co/akjindal53244/Arithmo-Mistral-7B)
42
+
43
+ <!-- description start -->
44
+ ## Description
45
+
46
+ This repo contains GGUF format model files for [Ashvini Kumar Jindal's Arithmo Mistral 7B](https://huggingface.co/akjindal53244/Arithmo-Mistral-7B).
47
+
48
+ <!-- description end -->
49
+ <!-- README_GGUF.md-about-gguf start -->
50
+ ### About GGUF
51
+
52
+ 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.
53
+
54
+ Here is an incomplate list of clients and libraries that are known to support GGUF:
55
+
56
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp). The source project for GGUF. Offers a CLI and a server option.
57
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most widely used web UI, with many features and powerful extensions. Supports GPU acceleration.
58
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), a fully featured web UI, with GPU accel across all platforms and GPU architectures. Especially good for story telling.
59
+ * [LM Studio](https://lmstudio.ai/), an easy-to-use and powerful local GUI for Windows and macOS (Silicon), with GPU acceleration.
60
+ * [LoLLMS Web UI](https://github.com/ParisNeo/lollms-webui), a great web UI with many interesting and unique features, including a full model library for easy model selection.
61
+ * [Faraday.dev](https://faraday.dev/), an attractive and easy to use character-based chat GUI for Windows and macOS (both Silicon and Intel), with GPU acceleration.
62
+ * [ctransformers](https://github.com/marella/ctransformers), a Python library with GPU accel, LangChain support, and OpenAI-compatible AI server.
63
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), a Python library with GPU accel, LangChain support, and OpenAI-compatible API server.
64
+ * [candle](https://github.com/huggingface/candle), a Rust ML framework with a focus on performance, including GPU support, and ease of use.
65
+
66
+ <!-- README_GGUF.md-about-gguf end -->
67
+ <!-- repositories-available start -->
68
+ ## Repositories available
69
+
70
+ * [AWQ model(s) for GPU inference.](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-AWQ)
71
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GPTQ)
72
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GGUF)
73
+ * [Ashvini Kumar Jindal's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/akjindal53244/Arithmo-Mistral-7B)
74
+ <!-- repositories-available end -->
75
+
76
+ <!-- prompt-template start -->
77
+ ## Prompt template: QA
78
+
79
+ ```
80
+ Question: {prompt}
81
+ Answer:
82
+
83
+ ```
84
+
85
+ <!-- prompt-template end -->
86
+
87
+
88
+ <!-- compatibility_gguf start -->
89
+ ## Compatibility
90
+
91
+ These quantised GGUFv2 files are compatible with llama.cpp from August 27th onwards, as of commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221)
92
+
93
+ They are also compatible with many third party UIs and libraries - please see the list at the top of this README.
94
+
95
+ ## Explanation of quantisation methods
96
+ <details>
97
+ <summary>Click to see details</summary>
98
+
99
+ The new methods available are:
100
+ * 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)
101
+ * 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.
102
+ * 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.
103
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
104
+ * 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
105
+
106
+ Refer to the Provided Files table below to see what files use which methods, and how.
107
+ </details>
108
+ <!-- compatibility_gguf end -->
109
+
110
+ <!-- README_GGUF.md-provided-files start -->
111
+ ## Provided files
112
+
113
+ | Name | Quant method | Bits | Size | Max RAM required | Use case |
114
+ | ---- | ---- | ---- | ---- | ---- | ----- |
115
+ | [arithmo-mistral-7b.Q2_K.gguf](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GGUF/blob/main/arithmo-mistral-7b.Q2_K.gguf) | Q2_K | 2 | 3.08 GB| 5.58 GB | smallest, significant quality loss - not recommended for most purposes |
116
+ | [arithmo-mistral-7b.Q3_K_S.gguf](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GGUF/blob/main/arithmo-mistral-7b.Q3_K_S.gguf) | Q3_K_S | 3 | 3.16 GB| 5.66 GB | very small, high quality loss |
117
+ | [arithmo-mistral-7b.Q3_K_M.gguf](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GGUF/blob/main/arithmo-mistral-7b.Q3_K_M.gguf) | Q3_K_M | 3 | 3.52 GB| 6.02 GB | very small, high quality loss |
118
+ | [arithmo-mistral-7b.Q3_K_L.gguf](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GGUF/blob/main/arithmo-mistral-7b.Q3_K_L.gguf) | Q3_K_L | 3 | 3.82 GB| 6.32 GB | small, substantial quality loss |
119
+ | [arithmo-mistral-7b.Q4_0.gguf](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GGUF/blob/main/arithmo-mistral-7b.Q4_0.gguf) | Q4_0 | 4 | 4.11 GB| 6.61 GB | legacy; small, very high quality loss - prefer using Q3_K_M |
120
+ | [arithmo-mistral-7b.Q4_K_S.gguf](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GGUF/blob/main/arithmo-mistral-7b.Q4_K_S.gguf) | Q4_K_S | 4 | 4.14 GB| 6.64 GB | small, greater quality loss |
121
+ | [arithmo-mistral-7b.Q4_K_M.gguf](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GGUF/blob/main/arithmo-mistral-7b.Q4_K_M.gguf) | Q4_K_M | 4 | 4.37 GB| 6.87 GB | medium, balanced quality - recommended |
122
+ | [arithmo-mistral-7b.Q5_0.gguf](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GGUF/blob/main/arithmo-mistral-7b.Q5_0.gguf) | Q5_0 | 5 | 5.00 GB| 7.50 GB | legacy; medium, balanced quality - prefer using Q4_K_M |
123
+ | [arithmo-mistral-7b.Q5_K_S.gguf](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GGUF/blob/main/arithmo-mistral-7b.Q5_K_S.gguf) | Q5_K_S | 5 | 5.00 GB| 7.50 GB | large, low quality loss - recommended |
124
+ | [arithmo-mistral-7b.Q5_K_M.gguf](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GGUF/blob/main/arithmo-mistral-7b.Q5_K_M.gguf) | Q5_K_M | 5 | 5.13 GB| 7.63 GB | large, very low quality loss - recommended |
125
+ | [arithmo-mistral-7b.Q6_K.gguf](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GGUF/blob/main/arithmo-mistral-7b.Q6_K.gguf) | Q6_K | 6 | 5.94 GB| 8.44 GB | very large, extremely low quality loss |
126
+ | [arithmo-mistral-7b.Q8_0.gguf](https://huggingface.co/TheBloke/Arithmo-Mistral-7B-GGUF/blob/main/arithmo-mistral-7b.Q8_0.gguf) | Q8_0 | 8 | 7.70 GB| 10.20 GB | very large, extremely low quality loss - not recommended |
127
+
128
+ **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.
129
+
130
+
131
+
132
+ <!-- README_GGUF.md-provided-files end -->
133
+
134
+ <!-- README_GGUF.md-how-to-download start -->
135
+ ## How to download GGUF files
136
+
137
+ **Note for manual downloaders:** You almost never want to clone the entire repo! Multiple different quantisation formats are provided, and most users only want to pick and download a single file.
138
+
139
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
140
+ - LM Studio
141
+ - LoLLMS Web UI
142
+ - Faraday.dev
143
+
144
+ ### In `text-generation-webui`
145
+
146
+ Under Download Model, you can enter the model repo: TheBloke/Arithmo-Mistral-7B-GGUF and below it, a specific filename to download, such as: arithmo-mistral-7b.Q4_K_M.gguf.
147
+
148
+ Then click Download.
149
+
150
+ ### On the command line, including multiple files at once
151
+
152
+ I recommend using the `huggingface-hub` Python library:
153
+
154
+ ```shell
155
+ pip3 install huggingface-hub
156
+ ```
157
+
158
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
159
+
160
+ ```shell
161
+ huggingface-cli download TheBloke/Arithmo-Mistral-7B-GGUF arithmo-mistral-7b.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
162
+ ```
163
+
164
+ <details>
165
+ <summary>More advanced huggingface-cli download usage</summary>
166
+
167
+ You can also download multiple files at once with a pattern:
168
+
169
+ ```shell
170
+ huggingface-cli download TheBloke/Arithmo-Mistral-7B-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
171
+ ```
172
+
173
+ 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).
174
+
175
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
176
+
177
+ ```shell
178
+ pip3 install hf_transfer
179
+ ```
180
+
181
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
182
+
183
+ ```shell
184
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Arithmo-Mistral-7B-GGUF arithmo-mistral-7b.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
185
+ ```
186
+
187
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
188
+ </details>
189
+ <!-- README_GGUF.md-how-to-download end -->
190
+
191
+ <!-- README_GGUF.md-how-to-run start -->
192
+ ## Example `llama.cpp` command
193
+
194
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
195
+
196
+ ```shell
197
+ ./main -ngl 32 -m arithmo-mistral-7b.Q4_K_M.gguf --color -c 2048 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "Question: {prompt}\nAnswer:"
198
+ ```
199
+
200
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
201
+
202
+ Change `-c 2048` to the desired sequence length. 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.
203
+
204
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
205
+
206
+ 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)
207
+
208
+ ## How to run in `text-generation-webui`
209
+
210
+ Further instructions here: [text-generation-webui/docs/llama.cpp.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp.md).
211
+
212
+ ## How to run from Python code
213
+
214
+ 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.
215
+
216
+ ### How to load this model in Python code, using ctransformers
217
+
218
+ #### First install the package
219
+
220
+ Run one of the following commands, according to your system:
221
+
222
+ ```shell
223
+ # Base ctransformers with no GPU acceleration
224
+ pip install ctransformers
225
+ # Or with CUDA GPU acceleration
226
+ pip install ctransformers[cuda]
227
+ # Or with AMD ROCm GPU acceleration (Linux only)
228
+ CT_HIPBLAS=1 pip install ctransformers --no-binary ctransformers
229
+ # Or with Metal GPU acceleration for macOS systems only
230
+ CT_METAL=1 pip install ctransformers --no-binary ctransformers
231
+ ```
232
+
233
+ #### Simple ctransformers example code
234
+
235
+ ```python
236
+ from ctransformers import AutoModelForCausalLM
237
+
238
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
239
+ llm = AutoModelForCausalLM.from_pretrained("TheBloke/Arithmo-Mistral-7B-GGUF", model_file="arithmo-mistral-7b.Q4_K_M.gguf", model_type="mistral", gpu_layers=50)
240
+
241
+ print(llm("AI is going to"))
242
+ ```
243
+
244
+ ## How to use with LangChain
245
+
246
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
247
+
248
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
249
+ * [LangChain + ctransformers](https://python.langchain.com/docs/integrations/providers/ctransformers)
250
+
251
+ <!-- README_GGUF.md-how-to-run end -->
252
+
253
+ <!-- footer start -->
254
+ <!-- 200823 -->
255
+ ## Discord
256
+
257
+ For further support, and discussions on these models and AI in general, join us at:
258
+
259
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
260
+
261
+ ## Thanks, and how to contribute
262
+
263
+ Thanks to the [chirper.ai](https://chirper.ai) team!
264
+
265
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
266
+
267
+ 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.
268
+
269
+ 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.
270
+
271
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
272
+
273
+ * Patreon: https://patreon.com/TheBlokeAI
274
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
275
+
276
+ **Special thanks to**: Aemon Algiz.
277
+
278
+ **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
279
+
280
+
281
+ Thank you to all my generous patrons and donaters!
282
+
283
+ And thank you again to a16z for their generous grant.
284
+
285
+ <!-- footer end -->
286
+
287
+ <!-- original-model-card start -->
288
+ # Original model card: Ashvini Kumar Jindal's Arithmo Mistral 7B
289
+
290
+ # Model Card for Model ID
291
+
292
+ [![Code License](https://img.shields.io/badge/Code%20License-Apache_2.0-green.svg)](CODE_LICENSE)
293
+ [![Model Weight License](https://img.shields.io/badge/Model%20Weights%20License-Apache_2.0-green.svg)](LICENSE)
294
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/release/python-390/)
295
+
296
+ **P.S.:** Please reach out to [Ashvini Jindal](https://www.linkedin.com/in/ashvini-jindal-26653262/) if you would be interested in supporting compute need. We are looking for small-scale support so we'd appreciate any kind of help! :)
297
+
298
+ ## Model Details
299
+
300
+ Arithmo-Mistral-7B is trained to reason and answer mathematical problems and is also capable of writing a Python program that upon execution prints answer to the question. We used [Mistral-7B](https://huggingface.co/mistralai/Mistral-7B-v0.1) as a base model and used QLoRA to fine-tune it on a single RTX 4090 GPU.
301
+
302
+ ### Model Description
303
+
304
+ - **Project GitHub Page:** https://github.com/akjindal53244/Arithmo-Mistral-7B
305
+ - **Developed by:** [Ashvini Kumar Jindal](https://www.linkedin.com/in/ashvini-jindal-26653262/)
306
+ - **Funded by:** self-work
307
+ - **Model type:** fine-tuned
308
+ - **Language(s) (NLP):** English
309
+ - **Finetuned from model:** mistralai/Mistral-7B-v0.1
310
+
311
+ ## Results
312
+
313
+ Arithmo-Mistral-7B outperforms existing 7B and 13B state-of-the-art Mathematical Reasoning models. Refer to [Comparing Arithmo-Mistral-7B with other LLM models](https://github.com/akjindal53244/Arithmo-Mistral-7B/tree/master#comparing-arithmo-mistral-7b-with-other-llm-models) section for more details.
314
+
315
+ <table>
316
+ <thead>
317
+ <tr>
318
+ <th>Prompt Approach</th>
319
+ <th>GSM8k</th>
320
+ <th>MATH</th>
321
+ </tr>
322
+ </thead>
323
+ <tbody>
324
+ <tr>
325
+ <td>Zero-Shot CoT</td>
326
+ <td><b>74.7</b></td>
327
+ <td><b>25.3</b></td>
328
+ </tr>
329
+ <tr>
330
+ <td>Zero-Shot PoT</td>
331
+ <td><b>71.2</b></td>
332
+ <td>-</td>
333
+ </tr>
334
+ </tbody>
335
+ </table>
336
+
337
+ - **Zero-Shot CoT**: On providing a question as prompt, model generates reasoning steps to solve the question along with answer. We check if answer matches with ground-truth.
338
+ - **Zero-Shot PoT**: We prompt the model to generate a Python program for the given question. During inference, we execute the Python program generated by the model and check if the program output matches with ground-truth answer.
339
+
340
+
341
+ ## Installation
342
+
343
+ ```
344
+ pip install transformers >=4.34.0
345
+ pip install accelerate
346
+ pip install sentencepiece
347
+ pip install protobuf
348
+
349
+ # If you are GPU poor like me
350
+ pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
351
+
352
+ # If you have a GPU.
353
+ pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu118
354
+ pip install scipy
355
+ pip install bitsandbytes
356
+ ```
357
+
358
+
359
+ ## How to query the model
360
+
361
+ ```
362
+ # Set `run_model_on_gpu` to `False` if you are running on CPU. Model will generate reasoning steps with answer for your question. If you want to generate Python program, uncomment line-69 that adds a Python prompt.
363
+ # This script automatically does formatting for you, so you just need to type question (eg: `What is 2+2?`) without any prefix like `Question:`, etc.**
364
+
365
+ $ python query_model.py
366
+ ```
367
+ **Note:** Above script automatically does formatting for you, so you just need to type question (eg: `What is 2+2?`) without any prefix like `Question:`, etc. Checkout [query_model.py](https://github.com/akjindal53244/Arithmo-Mistral-7B/blob/master/query_model.py) for more details. <br><br>
368
+
369
+ ##### Sample Input:
370
+ ```
371
+ Question: There are total 10 children. I have to give 1 apple to first child, 2 apples to second child, 3 apples to third child, and so on. How many apples do I need?
372
+ ```
373
+ ##### Model Output:
374
+ ```
375
+ Answer: The total number of apples needed is the sum of the first 10 positive integers.
376
+ This can be calculated using the formula for the sum of an arithmetic series:
377
+ \[S = \frac{n}{2}(a_1 + a_n),\]
378
+ where $S$ is the sum, $n$ is the number of terms, $a_1$ is the first term, and $a_n$ is the last term.
379
+ In this case, $n = 10$, $a_1 = 1$, and $a_n = 10$.
380
+ Plugging these values into the formula, we get:
381
+ \[S = \frac{10}{2}(1 + 10) = 5(11) = \boxed{55}.\]
382
+ The answer is: 55
383
+ ```
384
+
385
+ Arithmo-Mistral-7B is trained with the following format:
386
+ #### CoT Format (generate reasoning steps with answer):
387
+ ```
388
+ Question: <question>
389
+
390
+ Answer:
391
+ ```
392
+
393
+ #### PoT Format (generate a python program):
394
+ ```
395
+ Question: <question> <python_prompt>
396
+
397
+ Answer:
398
+ ```
399
+ It will perform best if queried in this way with your own script.
400
+
401
+ ## Comparing Arithmo-Mistral-7B with other LLM models.
402
+ Results for all models except `Arithmo-Mistral-7B` are taken from [MetaMath](https://github.com/meta-math/MetaMath/blob/main/README.MD) repository.
403
+
404
+ | Model | GSM8k Pass@1 | MATH Pass@1 |
405
+ |---------------------|--------------|-------------|
406
+ | MPT-7B | 6.8 | 3.0 |
407
+ | Falcon-7B | 6.8 | 2.3 |
408
+ | LLaMA-1-7B | 11.0 | 2.9 |
409
+ | LLaMA-2-7B | 14.6 | 2.5 |
410
+ | MPT-30B | 15.2 | 3.1 |
411
+ | LLaMA-1-13B | 17.8 | 3.9 |
412
+ | GPT-Neo-2.7B | 19.5 | -- |
413
+ | Falcon-40B | 19.6 | 2.5 |
414
+ | Baichuan-chat-13B | 23.9 | -- |
415
+ | Vicuna-v1.3-13B | 27.6 | -- |
416
+ | LLaMA-2-13B | 28.7 | 3.9 |
417
+ | InternLM-7B | 31.2 | -- |
418
+ | ChatGLM-2-6B | 32.4 | -- |
419
+ | GPT-J-6B | 34.9 | -- |
420
+ | LLaMA-1-33B | 35.6 | 3.9 |
421
+ | LLaMA-2-34B | 42.2 | 6.24 |
422
+ | RFT-7B | 50.3 | -- |
423
+ | LLaMA-1-65B | 50.9 | 10.6 |
424
+ | Qwen-7B | 51.6 | -- |
425
+ | WizardMath-7B | 54.9 | 10.7 |
426
+ | LLaMA-2-70B | 56.8 | 13.5 |
427
+ | WizardMath-13B | 63.9 | 14.0 |
428
+ | MetaMath-7B | 66.5 | 19.8 |
429
+ | MetaMath-13B | 72.3 | 22.4 |
430
+ | 🔥 **Arithmo-Mistral-7B Zero-Shot PoT** | **71.2** | -- |
431
+ | 🔥 **Arithmo-Mistral-7B Zero-Shot CoT** | **74.7** | **25.3** |
432
+ | WizardMath-70B | **81.6** | 22.7 |
433
+ | MetaMath-70B | **82.3** | **26.6** |
434
+
435
+
436
+ If you are interested in reproducing the resullts, visit https://github.com/akjindal53244/Arithmo-Mistral-7B#reproducing-results section.
437
+
438
+ <!-- original-model-card end -->