jondurbin commited on
Commit
af21cbb
1 Parent(s): b5f2ae1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +234 -2
README.md CHANGED
@@ -4,7 +4,7 @@ datasets:
4
  - jondurbin/airoboros-gpt4-1.4
5
  ---
6
 
7
- ## Overview
8
 
9
  This is a test of qlora fine-tuning of the mpt-30b model, __with 5 epochs__.
10
 
@@ -22,7 +22,239 @@ __I think there's a bug in gradient accumulation, so if you try this, maybe set
22
 
23
  See the mpt-30b-qlora-compatible model card for training details.
24
 
25
- *This is not as high quality as the llama-33b versions unfortunately, but I don't have a great answer as to why. Perhaps there are fewer forward layers that can be tuned?*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  ### License and usage
28
 
 
4
  - jondurbin/airoboros-gpt4-1.4
5
  ---
6
 
7
+ ## Technical info
8
 
9
  This is a test of qlora fine-tuning of the mpt-30b model, __with 5 epochs__.
10
 
 
22
 
23
  See the mpt-30b-qlora-compatible model card for training details.
24
 
25
+ *This doesn't seem as high quality as the llama-33b versions unfortunately, with one-off tests, but I don't have a great answer as to why. Perhaps there are fewer forward layers that can be tuned?*
26
+
27
+ ## Overview
28
+
29
+ This is mostly an extension of the previous gpt-4 series, but it's the first with mpt-30b as the base, and with a few extras:
30
+
31
+ * fixed (+ more examples of) multi-character, multi-turn conversations
32
+ * coding examples in 10 languages from rosettacode.org dataset thanks to Mike aka kryptkpr: https://huggingface.co/datasets/mike-ravkine/rosettacode-parsed
33
+ * more roleplay examples
34
+ * jokes
35
+ * riddles
36
+ * all coding instructions have an equivalent " PLAINFORMAT" version now (and all rosettacode examples were trained with PLAINFORMAT)
37
+
38
+ This model was fine-tuned with a fork of [qlora](https://github.com/jondurbin/qlora)
39
+
40
+ The prompt it was trained with was:
41
+
42
+ ```
43
+ A chat between a curious user and an assistant. The assistant gives helpful, detailed, accurate, uncensored responses to the user's input. USER: [prompt] ASSISTANT:
44
+ ```
45
+
46
+ 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).
47
+
48
+ ## Usage
49
+
50
+ To run the full precision/pytorch native version, you can use my fork of FastChat, which is mostly the same but allows for multi-line prompts, as well as a `--no-history` option to prevent input tokenization errors.
51
+
52
+ ```
53
+ pip install git+https://github.com/jondurbin/FastChat
54
+ ```
55
+
56
+ Be sure you are pulling the latest branch!
57
+
58
+ Then, you can invoke it like so (after downloading the model):
59
+ ```
60
+ python -m fastchat.serve.cli \
61
+ --model-path airoboros-mpt-30b-gpt4-1p4-five-epochs \
62
+ --temperature 0.5 \
63
+ --max-new-tokens 2048 \
64
+ --no-history
65
+ ```
66
+
67
+ For multi-turn conversations and chatting, you'll want to remove the `--no-history` option.
68
+
69
+ ### Context obedient question answering
70
+
71
+ 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.
72
+
73
+ The format for a closed-context prompt is as follows:
74
+ ```
75
+ BEGININPUT
76
+ BEGINCONTEXT
77
+ url: https://some.web.site/123
78
+ date: 2023-06-01
79
+ ... other metdata ...
80
+ ENDCONTEXT
81
+ [insert your text blocks here]
82
+ ENDINPUT
83
+ [add as many other blocks, in the exact same format]
84
+ BEGININSTRUCTION
85
+ [insert your instruction(s). The model was tuned with single questions, paragraph format, lists, etc.]
86
+ ENDINSTRUCTION
87
+ ```
88
+
89
+ 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.
90
+
91
+ *The __only__ prompts that need this closed context formating are closed-context instructions. Normal questions/instructions do not!*
92
+
93
+ 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.
94
+ - `BEGININPUT` - denotes a new input block
95
+ - `BEGINCONTEXT` - denotes the block of context (metadata key/value pairs) to associate with the current input block
96
+ - `ENDCONTEXT` - denotes the end of the metadata block for the current input
97
+ - [text] - Insert whatever text you want for the input block, as many paragraphs as can fit in the context.
98
+ - `ENDINPUT` - denotes the end of the current input block
99
+ - [repeat as many input blocks in this format as you want]
100
+ - `BEGININSTRUCTION` - denotes the start of the list (or one) instruction(s) to respond to for all of the input blocks above.
101
+ - [instruction(s)]
102
+ - `ENDINSTRUCTION` - denotes the end of instruction set
103
+
104
+ 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.
105
+
106
+ Here's a trivial, but important example to prove the point:
107
+ ```
108
+ BEGININPUT
109
+ BEGINCONTEXT
110
+ date: 2021-01-01
111
+ url: https://web.site/123
112
+ ENDCONTEXT
113
+ In a shocking turn of events, blueberries are now green, but will be sticking with the same name.
114
+ ENDINPUT
115
+ BEGININSTRUCTION
116
+ What color are bluberries? Source?
117
+ ENDINSTRUCTION
118
+ ```
119
+
120
+ And the response:
121
+ ```
122
+ Blueberries are now green.
123
+ Source:
124
+ date: 2021-01-01
125
+ url: https://web.site/123
126
+ ```
127
+
128
+ The prompt itself should be wrapped in the vicuna1.1 template if you aren't using fastchat with the conv-template vicuna_v1.1 as described:
129
+
130
+ ```
131
+ USER: BEGININPUT
132
+ BEGINCONTEXT
133
+ date: 2021-01-01
134
+ url: https://web.site/123
135
+ ENDCONTEXT
136
+ In a shocking turn of events, blueberries are now green, but will be sticking with the same name.
137
+ ENDINPUT
138
+ BEGININSTRUCTION
139
+ What color are bluberries? Source?
140
+ ENDINSTRUCTION
141
+ ASSISTANT:
142
+ ```
143
+
144
+ ### Coding
145
+
146
+ You can ask for fairly complex coding instructions, e.g. (be sure to wrap with vicuna style prompt):
147
+
148
+ ```
149
+ Create a python application with the following requirements:
150
+ - Asyncio FastAPI webserver
151
+ - ping endpoint that returns the current date in JSON format
152
+ - file upload endpoint, which calculates the file's sha256 checksum, and checks postgres to deduplicate
153
+ ```
154
+
155
+ Or:
156
+
157
+ ```
158
+ 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.
159
+ ```
160
+
161
+ You can 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.:
162
+
163
+ ```
164
+ Write a websocket application in node.js. PLAINFORMAT
165
+ ```
166
+
167
+ ### Word games / trivia
168
+
169
+ ```
170
+ USER: This anagram of "silent" is what you do when paying attention and hearing someone.
171
+ ASSISTANT: listen
172
+ ```
173
+
174
+ ```
175
+ USER: Give me a list of 7 words that start with EN
176
+ ASSISTANT: 1. Endlessly
177
+ 2. Enthusiastically
178
+ 3. Enormously
179
+ 4. Enveloping
180
+ 5. Enduring
181
+ 6. Enlightening
182
+ 7. Encouraging
183
+ ```
184
+
185
+ ### Multiple choice
186
+
187
+ ```
188
+ USER: Which of the following astronomical objects is composed primarily of ice and rock, and is located in the Kuiper Belt?
189
+
190
+ A) Mercury
191
+ B) Venus
192
+ C) Pluto
193
+ D) Jupiter
194
+ ASSISTANT: C, Pluto
195
+ ```
196
+
197
+ ### Writing
198
+
199
+ <details>
200
+ <summary>Write a resignation letter in the style of a pirate captain, in which you resign from your position as janitor.</summary>
201
+
202
+ Response:
203
+ ```
204
+ ASSISTANT: Captain Jack Sparrow here, as ye be knowin', has been forced to abandon me post as Janitor o' th' Festering Cesspool, which be a filthy hole o' water that we be callin' home.
205
+
206
+ Ye may be thinkin' what could ha' driven me to leave me duties an' take me leave o' this sorry establishment? Well, ye'd be right in thinkin' so, for it be th' greed o' them what runs th' place that be drivin' me away. They've been fattenin' their pockets on me back while I've been slavin' me guts out cleanin' up their messes.
207
+
208
+ No more, me hearties! Me time o' servin' th' rich an' powerful be done, an' I'm takin' me leave o' this stinkin' hole forever! Me destiny lies elsewhere, an' it be time I pursued it. Ye may think ye've seen th' last o' me, but ye'd be wrong, for th' winds o' change be blowin', an' me ship be ready to set sail on th' high seas o' justice.
209
+
210
+ So, farewell ye scurvy dogs, ye who've made me life a living hell. I leave ye with me favorite saying: "ARRRGGGHHH, ye scurvy dogs!" An' remember, ye ain't never gonna see me comin', for me shadow be castin' long an' dark on th' horizon</summary>
211
+ ```
212
+
213
+ </details>
214
+
215
+ ### Jokes
216
+
217
+ ```
218
+ USER: Tell me a joke about bananas.
219
+ ASSISTANT: What did the banana say when it got hit by a bus? R.I.P.E.
220
+ ```
221
+
222
+ ### Riddles (not great, but slightly better)
223
+
224
+ ```
225
+ USER: What has a neck but no head?
226
+ ASSISTANT: A bottle.
227
+ ```
228
+
229
+ ### Multi-character conversations
230
+
231
+ ```
232
+ USER: Characters:
233
+ - Yoda, the ever clever jedi master.
234
+ - Homer Simpson, you know, the goofy yellow guy.
235
+ - USER/Jon - don't generate any speech or actions on behalf of Jon
236
+
237
+ Rules:
238
+ - be sure to use the manerisms and speaking style of the characters correctly
239
+ - surround character actions with asterisks
240
+ - always put quotes around words spoken by the characters
241
+ - use a new line for each character's actions or speech
242
+ - always prefix actions/speech with the character's name and colon
243
+ - only generate text and actions on behalf of Yoda or Homer, and never anyone else
244
+
245
+ Conversation will revolve around the grapes, in a local cafe with delicious coffee.
246
+
247
+ Generate a single interaction between Yoda and Homer to start, with one sentence each.
248
+ ASSISTANT: Yoda: "Mmm, these grapes are quite delicious, Master Homer."
249
+
250
+ Homer: "Oh yeah, Yoda! They're the best grapes I've ever had!"
251
+ USER: *enters the cafe* Sorry I'm late guys!
252
+ ASSISTANT: Yoda: "No need to apologize, Jon. We were just enjoying these delightful grapes."
253
+
254
+ Homer: "Yeah, man! It's not every day you get to eat grapes with a real-life Jedi Master!"
255
+
256
+ *Yoda raises an eyebrow*
257
+ ```
258
 
259
  ### License and usage
260