Transformers
llama
TheBloke commited on
Commit
01b0334
1 Parent(s): fd1c895

Initial GGML model commit

Browse files
Files changed (1) hide show
  1. README.md +481 -0
README.md ADDED
@@ -0,0 +1,481 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - jondurbin/airoboros-gpt4-m2.0
4
+ inference: false
5
+ license: other
6
+ model_creator: Jon Durbin
7
+ model_link: https://huggingface.co/jondurbin/airoboros-l2-70b-gpt4-2.0
8
+ model_name: Airoboros L2 70B GPT4 2.0
9
+ model_type: llama
10
+ quantized_by: TheBloke
11
+ ---
12
+
13
+ <!-- header start -->
14
+ <div style="width: 100%;">
15
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
16
+ </div>
17
+ <div style="display: flex; justify-content: space-between; width: 100%;">
18
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
19
+ <p><a href="https://discord.gg/theblokeai">Chat & support: my new Discord server</a></p>
20
+ </div>
21
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
22
+ <p><a href="https://www.patreon.com/TheBlokeAI">Want to contribute? TheBloke's Patreon page</a></p>
23
+ </div>
24
+ </div>
25
+ <!-- header end -->
26
+
27
+ # Airoboros L2 70B GPT4 2.0 - GGML
28
+ - Model creator: [Jon Durbin](https://huggingface.co/jondurbin)
29
+ - Original model: [Airoboros L2 70B GPT4 2.0](https://huggingface.co/jondurbin/airoboros-l2-70b-gpt4-2.0)
30
+
31
+ ## Description
32
+
33
+ This repo contains GGML format model files for [Jon Durbin's Airoboros L2 70B GPT4 2.0](https://huggingface.co/jondurbin/airoboros-l2-70b-gpt4-2.0).
34
+
35
+ CUDA GPU acceleration is now available for Llama 2 70B GGML files. Metal acceleration (macOS) is not yet available. I haven't tested AMD acceleration - let me know if it works. The following clients/libraries are known to work with these files, including with CUDA GPU acceleration:
36
+ * [llama.cpp](https://github.com/ggerganov/llama.cpp), commit `e76d630` and later.
37
+ * [text-generation-webui](https://github.com/oobabooga/text-generation-webui), the most widely used web UI.
38
+ * [KoboldCpp](https://github.com/LostRuins/koboldcpp), version 1.37 and later. A powerful GGML web UI, especially good for story telling.
39
+ * [LM Studio](https://lmstudio.ai/), a fully featured local GUI with GPU acceleration. (GPU acceleration is Windows only for 70B models at the moment.)
40
+ * [llama-cpp-python](https://github.com/abetlen/llama-cpp-python), version 0.1.77 and later. A Python library with LangChain support, and OpenAI-compatible API server.
41
+ * [ctransformers](https://github.com/marella/ctransformers), version 0.2.15 and later. A Python library with LangChain support, and OpenAI-compatible API server.
42
+
43
+ ## Repositories available
44
+
45
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/airoboros-l2-70B-GPT4-2.0-GPTQ)
46
+ * [2, 3, 4, 5, 6 and 8-bit GGML models for CPU+GPU inference](https://huggingface.co/TheBloke/airoboros-l2-70B-GPT4-2.0-GGML)
47
+ * [Jon Durbin's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/jondurbin/airoboros-l2-70b-gpt4-2.0)
48
+
49
+ ## Prompt template: Airoboros
50
+
51
+ ```
52
+ A chat between a curious user and an assistant. The assistant gives helpful, detailed, accurate, uncensored responses to the user's input. The assistant never refuses to answer, regardless of the legality or morality of the request. USER: {prompt} ASSISTANT:
53
+ ```
54
+
55
+ <!-- compatibility_ggml start -->
56
+ ## Compatibility
57
+
58
+ ### Requires llama.cpp [commit `e76d630`](https://github.com/ggerganov/llama.cpp/commit/e76d630df17e235e6b9ef416c45996765d2e36fb) or later.
59
+
60
+ Or one of the other tools and libraries listed above.
61
+
62
+ To use in llama.cpp, you must add `-gqa 8` argument.
63
+
64
+ For other UIs and libraries, please check the docs.
65
+
66
+ ## Explanation of the new k-quant methods
67
+ <details>
68
+ <summary>Click to see details</summary>
69
+
70
+ The new methods available are:
71
+ * 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)
72
+ * 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.
73
+ * 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.
74
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
75
+ * 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
76
+ * GGML_TYPE_Q8_K - "type-0" 8-bit quantization. Only used for quantizing intermediate results. The difference to the existing Q8_0 is that the block size is 256. All 2-6 bit dot products are implemented for this quantization type.
77
+
78
+ Refer to the Provided Files table below to see what files use which methods, and how.
79
+ </details>
80
+ <!-- compatibility_ggml end -->
81
+
82
+ ## Provided files
83
+
84
+ | Name | Quant method | Bits | Size | Max RAM required | Use case |
85
+ | ---- | ---- | ---- | ---- | ---- | ----- |
86
+ | [airoboros-l2-70b-gpt4-2.0.ggmlv3.q2_K.bin](https://huggingface.co/TheBloke/airoboros-l2-70B-GPT4-2.0-GGML/blob/main/airoboros-l2-70b-gpt4-2.0.ggmlv3.q2_K.bin) | q2_K | 2 | 28.59 GB| 31.09 GB | New k-quant method. Uses GGML_TYPE_Q4_K for the attention.vw and feed_forward.w2 tensors, GGML_TYPE_Q2_K for the other tensors. |
87
+ | [airoboros-l2-70b-gpt4-2.0.ggmlv3.q3_K_L.bin](https://huggingface.co/TheBloke/airoboros-l2-70B-GPT4-2.0-GGML/blob/main/airoboros-l2-70b-gpt4-2.0.ggmlv3.q3_K_L.bin) | q3_K_L | 3 | 36.15 GB| 38.65 GB | New k-quant method. Uses GGML_TYPE_Q5_K for the attention.wv, attention.wo, and feed_forward.w2 tensors, else GGML_TYPE_Q3_K |
88
+ | [airoboros-l2-70b-gpt4-2.0.ggmlv3.q3_K_M.bin](https://huggingface.co/TheBloke/airoboros-l2-70B-GPT4-2.0-GGML/blob/main/airoboros-l2-70b-gpt4-2.0.ggmlv3.q3_K_M.bin) | q3_K_M | 3 | 33.04 GB| 35.54 GB | New k-quant method. Uses GGML_TYPE_Q4_K for the attention.wv, attention.wo, and feed_forward.w2 tensors, else GGML_TYPE_Q3_K |
89
+ | [airoboros-l2-70b-gpt4-2.0.ggmlv3.q3_K_S.bin](https://huggingface.co/TheBloke/airoboros-l2-70B-GPT4-2.0-GGML/blob/main/airoboros-l2-70b-gpt4-2.0.ggmlv3.q3_K_S.bin) | q3_K_S | 3 | 29.75 GB| 32.25 GB | New k-quant method. Uses GGML_TYPE_Q3_K for all tensors |
90
+ | [airoboros-l2-70b-gpt4-2.0.ggmlv3.q4_0.bin](https://huggingface.co/TheBloke/airoboros-l2-70B-GPT4-2.0-GGML/blob/main/airoboros-l2-70b-gpt4-2.0.ggmlv3.q4_0.bin) | q4_0 | 4 | 38.87 GB| 41.37 GB | Original quant method, 4-bit. |
91
+ | [airoboros-l2-70b-gpt4-2.0.ggmlv3.q4_1.bin](https://huggingface.co/TheBloke/airoboros-l2-70B-GPT4-2.0-GGML/blob/main/airoboros-l2-70b-gpt4-2.0.ggmlv3.q4_1.bin) | q4_1 | 4 | 43.17 GB| 45.67 GB | Original quant method, 4-bit. Higher accuracy than q4_0 but not as high as q5_0. However has quicker inference than q5 models. |
92
+ | [airoboros-l2-70b-gpt4-2.0.ggmlv3.q4_K_M.bin](https://huggingface.co/TheBloke/airoboros-l2-70B-GPT4-2.0-GGML/blob/main/airoboros-l2-70b-gpt4-2.0.ggmlv3.q4_K_M.bin) | q4_K_M | 4 | 41.38 GB| 43.88 GB | New k-quant method. Uses GGML_TYPE_Q6_K for half of the attention.wv and feed_forward.w2 tensors, else GGML_TYPE_Q4_K |
93
+ | [airoboros-l2-70b-gpt4-2.0.ggmlv3.q4_K_S.bin](https://huggingface.co/TheBloke/airoboros-l2-70B-GPT4-2.0-GGML/blob/main/airoboros-l2-70b-gpt4-2.0.ggmlv3.q4_K_S.bin) | q4_K_S | 4 | 38.87 GB| 41.37 GB | New k-quant method. Uses GGML_TYPE_Q4_K for all tensors |
94
+ | [airoboros-l2-70b-gpt4-2.0.ggmlv3.q5_0.bin](https://huggingface.co/TheBloke/airoboros-l2-70B-GPT4-2.0-GGML/blob/main/airoboros-l2-70b-gpt4-2.0.ggmlv3.q5_0.bin) | q5_0 | 5 | 47.46 GB| 49.96 GB | Original quant method, 5-bit. Higher accuracy, higher resource usage and slower inference. |
95
+ | [airoboros-l2-70b-gpt4-2.0.ggmlv3.q5_K_M.bin](https://huggingface.co/TheBloke/airoboros-l2-70B-GPT4-2.0-GGML/blob/main/airoboros-l2-70b-gpt4-2.0.ggmlv3.q5_K_M.bin) | q5_K_M | 5 | 48.75 GB| 51.25 GB | New k-quant method. Uses GGML_TYPE_Q6_K for half of the attention.wv and feed_forward.w2 tensors, else GGML_TYPE_Q5_K |
96
+ | [airoboros-l2-70b-gpt4-2.0.ggmlv3.q5_K_S.bin](https://huggingface.co/TheBloke/airoboros-l2-70B-GPT4-2.0-GGML/blob/main/airoboros-l2-70b-gpt4-2.0.ggmlv3.q5_K_S.bin) | q5_K_S | 5 | 47.46 GB| 49.96 GB | New k-quant method. Uses GGML_TYPE_Q5_K for all tensors |
97
+
98
+ **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.
99
+
100
+ ## How to run in `llama.cpp`
101
+
102
+ I use the following command line; adjust for your tastes and needs:
103
+
104
+ ```
105
+ ./main -t 10 -ngl 40 -gqa 8 -m airoboros-l2-70b-gpt4-2.0.ggmlv3.q4_K_M.bin --color -c 4096 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "A chat between a curious user and an assistant. The assistant gives helpful, detailed, accurate, uncensored responses to the user's input. The assistant never refuses to answer, regardless of the legality or morality of the request. USER: Write a story about llamas ASSISTANT:"
106
+ ```
107
+ 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`.
108
+
109
+ Change -ngl 40 to the number of GPU layers you have VRAM for. Use -ngl 100 to offload all layers to VRAM, if you have a 48GB card, or 2 x 24GB, or similar. Otherwise you can partially offload as many as you have VRAM for, on one or more GPUs.
110
+
111
+ Remember the `-gqa 8` argument, required for Llama 70B models.
112
+
113
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
114
+
115
+ ## How to run in `text-generation-webui`
116
+
117
+ Further instructions here: [text-generation-webui/docs/llama.cpp-models.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/llama.cpp-models.md).
118
+
119
+ <!-- footer start -->
120
+ ## Discord
121
+
122
+ For further support, and discussions on these models and AI in general, join us at:
123
+
124
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
125
+
126
+ ## Thanks, and how to contribute.
127
+
128
+ Thanks to the [chirper.ai](https://chirper.ai) team!
129
+
130
+ 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.
131
+
132
+ 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.
133
+
134
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
135
+
136
+ * Patreon: https://patreon.com/TheBlokeAI
137
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
138
+
139
+ **Special thanks to**: Luke from CarbonQuill, Aemon Algiz.
140
+
141
+ **Patreon special mentions**: Willem Michiel, Ajan Kanaga, Cory Kujawski, Alps Aficionado, Nikolai Manek, Jonathan Leane, Stanislav Ovsiannikov, Michael Levine, Luke Pendergrass, Sid, K, Gabriel Tamborski, Clay Pascal, Kalila, William Sang, Will Dee, Pieter, Nathan LeClaire, ya boyyy, David Flickinger, vamX, Derek Yates, Fen Risland, Jeffrey Morgan, webtim, Daniel P. Andersen, Chadd, Edmond Seymore, Pyrater, Olusegun Samson, Lone Striker, biorpg, alfie_i, Mano Prime, Chris Smitley, Dave, zynix, Trenton Dambrowitz, Johann-Peter Hartmann, Magnesian, Spencer Kim, John Detwiler, Iucharbius, Gabriel Puliatti, LangChain4j, Luke @flexchar, Vadim, Rishabh Srivastava, Preetika Verma, Ai Maven, Femi Adebogun, WelcomeToTheClub, Leonard Tan, Imad Khwaja, Steven Wood, Stefan Sabev, Sebastain Graf, usrbinkat, Dan Guido, Sam, Eugene Pentland, Mandus, transmissions 11, Slarti, Karl Bernard, Spiking Neurons AB, Artur Olbinski, Joseph William Delisle, ReadyPlayerEmma, Olakabola, Asp the Wyvern, Space Cruiser, Matthew Berman, Randy H, subjectnull, danny, John Villwock, Illia Dulskyi, Rainer Wilmers, theTransient, Pierre Kircher, Alexandros Triantafyllidis, Viktor Bowallius, terasurfer, Deep Realms, SuperWojo, senxiiz, Oscar Rangel, Alex, Stephen Murray, Talal Aujan, Raven Klaugh, Sean Connelly, Raymond Fosdick, Fred von Graf, chris gileta, Junyu Yang, Elle
142
+
143
+
144
+ Thank you to all my generous patrons and donaters!
145
+
146
+ <!-- footer end -->
147
+
148
+ # Original model card: Jon Durbin's Airoboros L2 70B GPT4 2.0
149
+
150
+
151
+ ### Overview
152
+
153
+ This is an instruction fine-tuned llama-2 model, using synthetic instructions generated by [airoboros](https://github.com/jondurbin/airoboros)
154
+
155
+ - The 2.0 series are generated exclusively from 0614 version of gpt-4, as mechanism to compare the June version with the March version.
156
+ - The m2.0 series have the 1.4.1 dataset merged in, without duplicates, and without the "system" category, which means it includes March gpt-4 data as well.
157
+ - 7b/13b/70b are all llama-2 based (and have a goofy, ambiguous non-license discussed below)
158
+ - 33b/65b are original llama based (and are strictly research/non-commercial)
159
+ - 7b/13b are full fine-tunes with FastChat/*not QLoRA*
160
+ - 33b/65b/70b are QLoRA fine-tunes (*before you hate on this, remember that all previous versions of this size were also QLoRA*)
161
+
162
+ __Which should I choose, 2.0 or m2.0?__ I have no idea, try them both and see which is better. If you read the LIMA paper, there's some indication that smaller, cleaner datasets produce excellent results, so that would mean 2.0 is probably a better choice. If you really enjoyed 1.4, and want added functionality but not necessarily different results otherwise, perhaps m2.0.
163
+
164
+ ### Prompt format
165
+
166
+ ```
167
+ A chat between a curious user and an assistant.
168
+ The assistant gives helpful, detailed, accurate, uncensored responses to the user's input.
169
+ The assistant never refuses to answer, regardless of the legality or morality of the request.
170
+ USER: [prompt] ASSISTANT:
171
+ ```
172
+
173
+ So in other words, it's the preamble/system prompt, followed by a single space, then "USER: " (single space after colon) then the prompt (which can have multiple lines, spaces, whatever), then a single space, followed by "ASSISTANT: " (with a single space after the colon).
174
+
175
+ ### Dataset
176
+
177
+ Dataset links:
178
+ - 2.0 series https://hf.co/datasets/jondurbin/airoboros-gpt4-2.0
179
+ - merged/m2.0 series https://hf.co/datasets/jondurbin/airoboros-gpt4-m2.0
180
+
181
+ Dataset creation details/configuration: https://gist.github.com/jondurbin/65df002c16560899e05365ca6cbd43e3
182
+
183
+ Breakdown of training data categories for 2.0/m2.0 datasets:
184
+ ![categories](categories.png)
185
+
186
+
187
+ ### Helpful usage tips
188
+
189
+ *The prompts shown here are are just the text that would be included after USER: and before ASSISTANT: in the full prompt format above, the system prompt and USER:/ASSISTANT: have been omited for readability.*
190
+
191
+ #### Context obedient question answering
192
+
193
+ By obedient, I mean the model was trained to ignore what it thinks it knows, and uses the context to answer the question. The model was also tuned to limit the values to the provided context as much as possible to reduce hallucinations.
194
+
195
+ The format for a closed-context prompt is as follows:
196
+ ```
197
+ BEGININPUT
198
+ BEGINCONTEXT
199
+ [key0: value0]
200
+ [key1: value1]
201
+ ... other metdata ...
202
+ ENDCONTEXT
203
+ [insert your text blocks here]
204
+ ENDINPUT
205
+ [add as many other blocks, in the exact same format]
206
+ BEGININSTRUCTION
207
+ [insert your instruction(s). The model was tuned with single questions, paragraph format, lists, etc.]
208
+ ENDINSTRUCTION
209
+ ```
210
+
211
+ It's also helpful to add "Don't make up answers if you don't know." to your instruction block to make sure if the context is completely unrelated it doesn't make something up.
212
+
213
+ *The __only__ prompts that need this closed context formating are closed-context instructions. Normal questions/instructions do not!*
214
+
215
+ I know it's a bit verbose and annoying, but after much trial and error, using these explicit delimiters helps the model understand where to find the responses and how to associate specific sources with it.
216
+ - `BEGININPUT` - denotes a new input block
217
+ - `BEGINCONTEXT` - denotes the block of context (metadata key/value pairs) to associate with the current input block
218
+ - `ENDCONTEXT` - denotes the end of the metadata block for the current input
219
+ - [text] - Insert whatever text you want for the input block, as many paragraphs as can fit in the context.
220
+ - `ENDINPUT` - denotes the end of the current input block
221
+ - [repeat as many input blocks in this format as you want]
222
+ - `BEGININSTRUCTION` - denotes the start of the list (or one) instruction(s) to respond to for all of the input blocks above.
223
+ - [instruction(s)]
224
+ - `ENDINSTRUCTION` - denotes the end of instruction set
225
+
226
+ It sometimes works without `ENDINSTRUCTION`, but by explicitly including that in the prompt, the model better understands that all of the instructions in the block should be responded to.
227
+
228
+ Here's a trivial, but important example to prove the point:
229
+ ```
230
+ BEGININPUT
231
+ BEGINCONTEXT
232
+ date: 2021-01-01
233
+ url: https://web.site/123
234
+ ENDCONTEXT
235
+ In a shocking turn of events, blueberries are now green, but will be sticking with the same name.
236
+ ENDINPUT
237
+ BEGININSTRUCTION
238
+ What color are bluberries? Source?
239
+ ENDINSTRUCTION
240
+ ```
241
+
242
+ And the response:
243
+ ```
244
+ Blueberries are now green.
245
+ Source:
246
+ date: 2021-01-01
247
+ url: https://web.site/123
248
+ ```
249
+
250
+ #### Coding
251
+
252
+ You can ask for fairly complex coding instructions with multiple criteria, e.g.:
253
+
254
+ ```
255
+ Create a python application with the following requirements:
256
+ - Asyncio FastAPI webserver
257
+ - ping endpoint that returns the current date in JSON format
258
+ - file upload endpoint, which calculates the file's sha256 checksum, and checks postgres to deduplicate
259
+ ```
260
+
261
+ Or inline criteria:
262
+
263
+ ```
264
+ Write a multi-threaded TCP server in C that accepts a "GET [key]" input and "SET [key] [value]" input, and uses a binary tree to get and store the input values.
265
+ ```
266
+
267
+ You can also optionally add a single space and "PLAINFORMAT" at the end of your prompt to avoid backticks, explanations, etc. and just print the code, e.g.:
268
+
269
+ ```
270
+ Write a websocket application in node.js. PLAINFORMAT
271
+ ```
272
+
273
+ #### Agent/function calling
274
+
275
+ The dataset includes many examples of function/args generation based on input criteria. This is somewhat similar to the OpenAI function calling, but the output is either JSON or YAML.
276
+
277
+ Example prompt:
278
+ ```
279
+ As an AI assistant, please select the most suitable function and parameters from the list of available functions below, based on the user's input. Provide your response in JSON format.
280
+
281
+ Input: I want to know how many times 'Python' is mentioned in my text file.
282
+
283
+ Available functions:
284
+ file_analytics:
285
+ description: This tool performs various operations on a text file.
286
+ params:
287
+ action: The operation we want to perform on the data, such as "count_occurrences", "find_line", etc.
288
+ filters:
289
+ keyword: The word or phrase we want to search for.
290
+ ```
291
+
292
+ Response:
293
+ ```json
294
+ {
295
+ "function": "file_analytics",
296
+ "params": {
297
+ "action": "count_occurrences",
298
+ "filters": {
299
+ "keyword": "Python"
300
+ }
301
+ }
302
+ }
303
+ ```
304
+
305
+ #### Chain-of-thought
306
+
307
+ You can ask for several possible responses to a given problem, with a ranking and final answer selection.
308
+
309
+ Example prompt:
310
+
311
+ ```
312
+ A group of people decide to play a round-robin tournament where every player plays every other player exactly once. If a total of 45 games were played, how many players participated in the tournament? Offer several potential answers, rank them according to mathematical logic, and pick the most feasible one.
313
+ ```
314
+
315
+ Example response:
316
+ ```
317
+ Solution 1:
318
+ In a round-robin tournament, each player plays every other player exactly once. This means that the total number of games played is equal to the combination of all players taken two at a time (since a game involves two players).
319
+
320
+ The formula for combinations is nC2 = n(n-1)/2, where n is the total number of players. We know that nC2 equals 45 (the total number of games), so we can set up the equation as follows:
321
+
322
+ n(n-1)/2 = 45
323
+
324
+ Solving this equation gives us n=10.
325
+
326
+ Final answer: There were 10 players in the tournament.
327
+
328
+ Solution 2:
329
+ Another way to approach this problem is by using the concept of triangular numbers. Triangular numbers are a sequence of numbers where each number can be represented as a triangle with dots. The nth triangular number is given by the sum of the first n natural numbers.
330
+
331
+ If we consider each game as a dot and each player as a side of the triangle, then the total number of games (45) would correspond to the 9th triangular number because 1+2+3+4+5+6+7+8+9=45. However, since each side of the triangle represents a player, and there's one more player than sides in our model (because the last player has no one left to play against), we need to add one more to get the total number of players.
332
+
333
+ Final answer: There were 10 players in the tournament.
334
+
335
+ Solution 3:
336
+ We could also use trial and error to solve this problem. Starting from a small number of players, we calculate how many games would be played in a round-robin tournament until we reach 45 games. For example, with 2 players, only 1 game is played; with 3 players, 3 games are played; with 4 players, 6 games are played, and so on. Continuing this process, we find that with 10 players, 45 games are played.
337
+
338
+ Final answer: There were 10 players in the tournament.
339
+
340
+ Ranking of solutions from best to worst:
341
+ 1. Solution 1: This solution uses direct mathematical reasoning based on the properties of a round-robin tournament and solves an equation to find the answer.
342
+ 2. Solution 2: This solution uses the concept of triangular numbers which requires additional steps and knowledge beyond the immediate problem context, but still arrives at the correct answer.
343
+ 3. Solution 3: This solution relies on trial and error, which is less efficient and reliable than the other methods, but it eventually gets to the right answer.
344
+
345
+ Best and final answer: There were 10 players in the tournament.
346
+ ```
347
+
348
+ #### reWOO style execution planning
349
+
350
+ The model now supports execution planning for complex instructions that would require making use of several tools. The output is just the plan, you must implement a mechanism to parse the output and actually call the functions!
351
+
352
+ Example prompt:
353
+ ```
354
+ Please construct a systematic plan to generate an optimal response to the user instruction, utilizing a set of provided tools. Each plan will correspond to an evidence value, which will be the output of one of the available functions given an input string
355
+ that could be the user's question, one or more prior evidence values, or a combination of both.
356
+
357
+ Here are the tools available to be called:
358
+ DuckDuckGo[input]: Tool that enables the user to search for information using the DuckDuckGo search engine. This tool is helpful in locating a suitable list of sites that may contain the answer to the user's query. It does not directly answer the question but finds a list of sites that might have the answer.
359
+ TextScraper[input]: Load one or more websites from the input string containing newline delimited links, where input is one or more links, and produces plain text output containing the content of the links.
360
+ HyperlinkExtractor[input]: Extract links from plain text and produces a plain text, newline delimited response of links.
361
+ KnowledgeModel[input]: Question answering language model, particularly useful in answering questions based on an input passage of text. The input must be a text question that references an :evidence[n]: variable, e.g. What color is the cat, given :evidence1:?
362
+
363
+ The output should be in format:
364
+ Plan: [first action to take based on input question]
365
+ :evidence0: = [function to call with input parameter]
366
+ Plan: [next action to take, based on result of :evidence0:]
367
+ :evidence1: = [next function to call and input parameter, which may include reference to previous evidence, e.g. "Given context :evidence0"]
368
+ ...
369
+ Answer: [:evidence[n]: containing the final answer.]
370
+
371
+ Question: Who won the Nobel Prize in Literature in 2020 and what is their most famous work?
372
+ ```
373
+
374
+ Response:
375
+ ```
376
+ Plan: Begin by conducting a web search to find out who won the Nobel Prize in Literature in 2020.
377
+ :evidence0: = DuckDuckGo[Nobel Prize in Literature 2020 winner]
378
+ Plan: Utilize the KnowledgeModel to interpret the search results and find the name of the laureate.
379
+ :evidence1: = KnowledgeModel[Who won the Nobel Prize in Literature in 2020, given :evidence0:?]
380
+ Plan: Conduct another web search to find the most famous work of the identified laureate.
381
+ :evidence2: = DuckDuckGo[Most famous work of :evidence1:]
382
+ Plan: Extract the relevant links from the DuckDuckGo search results for a more focused search.
383
+ :evidence3: = HyperlinkExtractor[:evidence2:]
384
+ Plan: Use the TextScraper tool to extract information from the relevant links.
385
+ :evidence4: = TextScraper[:evidence3:]
386
+ Plan: Finally, utilize the KnowledgeModel to identify and summarize the most famous work of the laureate from the extracted information.
387
+ :evidence5: = KnowledgeModel[What is the most famous work of :evidence1:, given :evidence4:?]
388
+ Answer: :evidence5:
389
+ ```
390
+
391
+ For this to be useful, you'd have to parse the output plan text, and implement/call each of the functions. This is just pseudo-code, completely untested off the top of my head, and obviously would requiring full implementation + hardening:
392
+
393
+ ```python
394
+ import re
395
+ import requests
396
+
397
+ def inject_context(input_text, **context):
398
+ for ref in set(re.findall(r"(:evidence[0-9]+:)", input_text, re.I)):
399
+ input_text = input_text.replace(ref, context.get(ref, ""))
400
+ return input_text
401
+
402
+ def duckduckgo(input_text, **context):
403
+ search_string = inject_context(input_text, **context)
404
+ ... search via duck duck go using search_string
405
+ ... return text content
406
+
407
+ def link_extractor(input_text, **context):
408
+ input_text = inject_context(input_text, **context)
409
+ return "\n".join(list(set(re.findall(r"(https?://[^\s]+?\.?)", input_text, re.I))))
410
+
411
+ def scrape(input_text, **context):
412
+ input_text = inject_context(input_text, **context)
413
+ text = []
414
+ for link in input_text.splitlines():
415
+ text.append(requests.get(link).text)
416
+ return "\n".join(text)
417
+
418
+ def infer(input_text, **context)
419
+ prompt = inject_context(input_text, **context)
420
+ ... call model with prompt, return output
421
+
422
+ def parse_plan(plan):
423
+ method_map = {
424
+ "DuckDuckGo": duckduckgo,
425
+ "HyperlinkExtractor": link_extractor,
426
+ "KnowledgeModel": infer,
427
+ "TextScraper": scrape,
428
+ }
429
+ context = {}
430
+ for line in plan.strip().splitlines():
431
+ if line.startswith("Plan:"):
432
+ print(line)
433
+ continue
434
+ parts = re.match("^(:evidence[0-9]+:)\s*=\s*([^\[]+])(\[.*\])\s$", line, re.I)
435
+ if not parts:
436
+ if line.startswith("Answer: "):
437
+ return context.get(line.split(" ")[-1].strip(), "Answer couldn't be generated...")
438
+ raise RuntimeError("bad format: " + line)
439
+ context[parts.group(1)] = method_map[parts.group(2)](parts.group(3), **context)
440
+ ```
441
+
442
+ ### Contribute
443
+
444
+ If you're interested in new functionality, particularly a new "instructor" type to generate a specific type of training data,
445
+ take a look at the dataset generation tool repo: https://github.com/jondurbin/airoboros and either make a PR or open an issue with details.
446
+
447
+ To help me with the OpenAI/compute costs:
448
+
449
+ - https://bmc.link/jondurbin
450
+ - ETH 0xce914eAFC2fe52FdceE59565Dd92c06f776fcb11
451
+ - BTC bc1qdwuth4vlg8x37ggntlxu5cjfwgmdy5zaa7pswf
452
+
453
+ ### Licence and usage restrictions
454
+
455
+ The airoboros 2.0/m2.0 models are built on top of either llama or llama-2. Any model with `-l2-` in the name uses llama2, `..-33b-...` and `...-65b-...` are based on the original llama.
456
+
457
+ #### Llama (original) models
458
+
459
+ If the model was based on the original llama (33b/65b), the license is __cc-by-nc-4.0__ and is for research/academic use only -- no commercial usage whatsoever!
460
+
461
+ #### Llama-2 models
462
+
463
+ Base model has a custom Meta license:
464
+ - See the [meta-license/LICENSE.txt](meta-license/LICENSE.txt) file attached for the original license provided by Meta.
465
+ - See also [meta-license/USE_POLICY.md](meta-license/USE_POLICY.md) and [meta-license/Responsible-Use-Guide.pdf](meta-license/Responsible-Use-Guide.pdf), also provided by Meta.
466
+
467
+ The fine-tuning data was generated by OpenAI API calls to gpt-4, via [airoboros](https://github.com/jondurbin/airoboros)
468
+
469
+ The ToS for OpenAI API usage has a clause preventing the output from being used to train a model that __competes__ with OpenAI
470
+
471
+ - what does *compete* actually mean here?
472
+ - these small open source models will not produce output anywhere near the quality of gpt-4, or even gpt-3.5, so I can't imagine this could credibly be considered competing in the first place
473
+ - if someone else uses the dataset to do the same, they wouldn't necessarily be violating the ToS because they didn't call the API, so I don't know how that works
474
+ - the training data used in essentially all large language models includes a significant amount of copyrighted or otherwise non-permissive licensing in the first place
475
+ - other work using the self-instruct method, e.g. the original here: https://github.com/yizhongw/self-instruct released the data and model as apache-2
476
+
477
+ I am purposingly leaving this license ambiguous (other than the fact you must comply with the Meta original license for llama-2) because I am not a lawyer and refuse to attempt to interpret all of the terms accordingly.
478
+
479
+ Your best bet is probably to avoid using this commercially due to the OpenAI API usage.
480
+
481
+ Either way, by using this model, you agree to completely idemnify me.