TheBloke commited on
Commit
4a45d25
1 Parent(s): 9c8de3e

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +457 -0
README.md ADDED
@@ -0,0 +1,457 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: perlthoughts/Starling-LM-alpha-8x7B-MoE
3
+ datasets:
4
+ - berkeley-nest/Nectar
5
+ inference: false
6
+ language:
7
+ - en
8
+ library_name: transformers
9
+ license: cc-by-nc-4.0
10
+ model_creator: Ray Hernandez
11
+ model_name: Starling LM Alpha 8X7B MoE
12
+ model_type: mixtral
13
+ prompt_template: 'GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:
14
+
15
+ '
16
+ quantized_by: TheBloke
17
+ tags:
18
+ - reward model
19
+ - RLHF
20
+ - RLAIF
21
+ ---
22
+ <!-- markdownlint-disable MD041 -->
23
+
24
+ <!-- header start -->
25
+ <!-- 200823 -->
26
+ <div style="width: auto; margin-left: auto; margin-right: auto">
27
+ <img src="https://i.imgur.com/EBdldam.jpg" alt="TheBlokeAI" style="width: 100%; min-width: 400px; display: block; margin: auto;">
28
+ </div>
29
+ <div style="display: flex; justify-content: space-between; width: 100%;">
30
+ <div style="display: flex; flex-direction: column; align-items: flex-start;">
31
+ <p style="margin-top: 0.5em; margin-bottom: 0em;"><a href="https://discord.gg/theblokeai">Chat & support: TheBloke's Discord server</a></p>
32
+ </div>
33
+ <div style="display: flex; flex-direction: column; align-items: flex-end;">
34
+ <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>
35
+ </div>
36
+ </div>
37
+ <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>
38
+ <hr style="margin-top: 1.0em; margin-bottom: 1.0em;">
39
+ <!-- header end -->
40
+
41
+ # Starling LM Alpha 8X7B MoE - GGUF
42
+ - Model creator: [Ray Hernandez](https://huggingface.co/perlthoughts)
43
+ - Original model: [Starling LM Alpha 8X7B MoE](https://huggingface.co/perlthoughts/Starling-LM-alpha-8x7B-MoE)
44
+
45
+ <!-- description start -->
46
+ ## Description
47
+
48
+ This repo contains GGUF format model files for [Ray Hernandez's Starling LM Alpha 8X7B MoE](https://huggingface.co/perlthoughts/Starling-LM-alpha-8x7B-MoE).
49
+
50
+ <!-- description end -->
51
+ <!-- README_GGUF.md-about-gguf start -->
52
+ ### About GGUF
53
+
54
+ 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.
55
+
56
+ ### Mixtral GGUF
57
+
58
+ Support for Mixtral was merged into Llama.cpp on December 13th.
59
+
60
+ These Mixtral GGUFs are known to work in:
61
+
62
+ * llama.cpp as of December 13th
63
+ * KoboldCpp 1.52 as later
64
+ * LM Studio 0.2.9 and later
65
+ * llama-cpp-python 0.2.23 and later
66
+
67
+ Other clients/libraries, not listed above, may not yet work.
68
+
69
+ <!-- README_GGUF.md-about-gguf end -->
70
+ <!-- repositories-available start -->
71
+ ## Repositories available
72
+
73
+ * [GPTQ models for GPU inference, with multiple quantisation parameter options.](https://huggingface.co/TheBloke/Starling-LM-alpha-8x7B-MoE-GPTQ)
74
+ * [2, 3, 4, 5, 6 and 8-bit GGUF models for CPU+GPU inference](https://huggingface.co/TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF)
75
+ * [Ray Hernandez's original unquantised fp16 model in pytorch format, for GPU inference and for further conversions](https://huggingface.co/perlthoughts/Starling-LM-alpha-8x7B-MoE)
76
+ <!-- repositories-available end -->
77
+
78
+ <!-- prompt-template start -->
79
+ ## Prompt template: OpenChat-Correct
80
+
81
+ ```
82
+ GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:
83
+
84
+ ```
85
+
86
+ <!-- prompt-template end -->
87
+
88
+
89
+ <!-- compatibility_gguf start -->
90
+ ## Compatibility
91
+
92
+ These Mixtral GGUFs are compatible with llama.cpp from December 13th onwards. Other clients/libraries may not work yet.
93
+
94
+ ## Explanation of quantisation methods
95
+
96
+ <details>
97
+ <summary>Click to see details</summary>
98
+
99
+ The new methods available are:
100
+
101
+ * 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)
102
+ * 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.
103
+ * 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.
104
+ * GGML_TYPE_Q5_K - "type-1" 5-bit quantization. Same super-block structure as GGML_TYPE_Q4_K resulting in 5.5 bpw
105
+ * 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
106
+
107
+ Refer to the Provided Files table below to see what files use which methods, and how.
108
+ </details>
109
+ <!-- compatibility_gguf end -->
110
+
111
+ <!-- README_GGUF.md-provided-files start -->
112
+ ## Provided files
113
+
114
+ | Name | Quant method | Bits | Size | Max RAM required | Use case |
115
+ | ---- | ---- | ---- | ---- | ---- | ----- |
116
+ | [starling-lm-alpha-8x7b-moe.Q2_K.gguf](https://huggingface.co/TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF/blob/main/starling-lm-alpha-8x7b-moe.Q2_K.gguf) | Q2_K | 2 | 15.64 GB| 18.14 GB | smallest, significant quality loss - not recommended for most purposes |
117
+ | [starling-lm-alpha-8x7b-moe.Q3_K_M.gguf](https://huggingface.co/TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF/blob/main/starling-lm-alpha-8x7b-moe.Q3_K_M.gguf) | Q3_K_M | 3 | 20.36 GB| 22.86 GB | very small, high quality loss |
118
+ | [starling-lm-alpha-8x7b-moe.Q4_0.gguf](https://huggingface.co/TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF/blob/main/starling-lm-alpha-8x7b-moe.Q4_0.gguf) | Q4_0 | 4 | 26.44 GB| 28.94 GB | legacy; small, very high quality loss - prefer using Q3_K_M |
119
+ | [starling-lm-alpha-8x7b-moe.Q4_K_M.gguf](https://huggingface.co/TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF/blob/main/starling-lm-alpha-8x7b-moe.Q4_K_M.gguf) | Q4_K_M | 4 | 26.44 GB| 28.94 GB | medium, balanced quality - recommended |
120
+ | [starling-lm-alpha-8x7b-moe.Q5_0.gguf](https://huggingface.co/TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF/blob/main/starling-lm-alpha-8x7b-moe.Q5_0.gguf) | Q5_0 | 5 | 32.23 GB| 34.73 GB | legacy; medium, balanced quality - prefer using Q4_K_M |
121
+ | [starling-lm-alpha-8x7b-moe.Q5_K_M.gguf](https://huggingface.co/TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF/blob/main/starling-lm-alpha-8x7b-moe.Q5_K_M.gguf) | Q5_K_M | 5 | 32.23 GB| 34.73 GB | large, very low quality loss - recommended |
122
+ | [starling-lm-alpha-8x7b-moe.Q6_K.gguf](https://huggingface.co/TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF/blob/main/starling-lm-alpha-8x7b-moe.Q6_K.gguf) | Q6_K | 6 | 38.38 GB| 40.88 GB | very large, extremely low quality loss |
123
+ | [starling-lm-alpha-8x7b-moe.Q8_0.gguf](https://huggingface.co/TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF/blob/main/starling-lm-alpha-8x7b-moe.Q8_0.gguf) | Q8_0 | 8 | 49.63 GB| 52.13 GB | very large, extremely low quality loss - not recommended |
124
+
125
+ **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.
126
+
127
+
128
+
129
+ <!-- README_GGUF.md-provided-files end -->
130
+
131
+ <!-- README_GGUF.md-how-to-download start -->
132
+ ## How to download GGUF files
133
+
134
+ **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.
135
+
136
+ The following clients/libraries will automatically download models for you, providing a list of available models to choose from:
137
+
138
+ * LM Studio
139
+ * LoLLMS Web UI
140
+ * Faraday.dev
141
+
142
+ ### In `text-generation-webui`
143
+
144
+ Under Download Model, you can enter the model repo: TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF and below it, a specific filename to download, such as: starling-lm-alpha-8x7b-moe.Q4_K_M.gguf.
145
+
146
+ Then click Download.
147
+
148
+ ### On the command line, including multiple files at once
149
+
150
+ I recommend using the `huggingface-hub` Python library:
151
+
152
+ ```shell
153
+ pip3 install huggingface-hub
154
+ ```
155
+
156
+ Then you can download any individual model file to the current directory, at high speed, with a command like this:
157
+
158
+ ```shell
159
+ huggingface-cli download TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF starling-lm-alpha-8x7b-moe.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
160
+ ```
161
+
162
+ <details>
163
+ <summary>More advanced huggingface-cli download usage (click to read)</summary>
164
+
165
+ You can also download multiple files at once with a pattern:
166
+
167
+ ```shell
168
+ huggingface-cli download TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF --local-dir . --local-dir-use-symlinks False --include='*Q4_K*gguf'
169
+ ```
170
+
171
+ 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).
172
+
173
+ To accelerate downloads on fast connections (1Gbit/s or higher), install `hf_transfer`:
174
+
175
+ ```shell
176
+ pip3 install hf_transfer
177
+ ```
178
+
179
+ And set environment variable `HF_HUB_ENABLE_HF_TRANSFER` to `1`:
180
+
181
+ ```shell
182
+ HF_HUB_ENABLE_HF_TRANSFER=1 huggingface-cli download TheBloke/Starling-LM-alpha-8x7B-MoE-GGUF starling-lm-alpha-8x7b-moe.Q4_K_M.gguf --local-dir . --local-dir-use-symlinks False
183
+ ```
184
+
185
+ Windows Command Line users: You can set the environment variable by running `set HF_HUB_ENABLE_HF_TRANSFER=1` before the download command.
186
+ </details>
187
+ <!-- README_GGUF.md-how-to-download end -->
188
+
189
+ <!-- README_GGUF.md-how-to-run start -->
190
+ ## Example `llama.cpp` command
191
+
192
+ Make sure you are using `llama.cpp` from commit [d0cee0d](https://github.com/ggerganov/llama.cpp/commit/d0cee0d36d5be95a0d9088b674dbb27354107221) or later.
193
+
194
+ ```shell
195
+ ./main -ngl 35 -m starling-lm-alpha-8x7b-moe.Q4_K_M.gguf --color -c 32768 --temp 0.7 --repeat_penalty 1.1 -n -1 -p "GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:"
196
+ ```
197
+
198
+ Change `-ngl 32` to the number of layers to offload to GPU. Remove it if you don't have GPU acceleration.
199
+
200
+ Change `-c 32768` 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. Note that longer sequence lengths require much more resources, so you may need to reduce this value.
201
+
202
+ If you want to have a chat-style conversation, replace the `-p <PROMPT>` argument with `-i -ins`
203
+
204
+ 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)
205
+
206
+ ## How to run in `text-generation-webui`
207
+
208
+ Note that text-generation-webui may not yet be compatible with Mixtral GGUFs. Please check compatibility first.
209
+
210
+ Further instructions can be found in the text-generation-webui documentation, here: [text-generation-webui/docs/04 ‐ Model Tab.md](https://github.com/oobabooga/text-generation-webui/blob/main/docs/04%20%E2%80%90%20Model%20Tab.md#llamacpp).
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) version 0.2.23 and later.
215
+
216
+ ### How to load this model in Python code, using llama-cpp-python
217
+
218
+ For full documentation, please see: [llama-cpp-python docs](https://abetlen.github.io/llama-cpp-python/).
219
+
220
+ #### First install the package
221
+
222
+ Run one of the following commands, according to your system:
223
+
224
+ ```shell
225
+ # Base ctransformers with no GPU acceleration
226
+ pip install llama-cpp-python
227
+ # With NVidia CUDA acceleration
228
+ CMAKE_ARGS="-DLLAMA_CUBLAS=on" pip install llama-cpp-python
229
+ # Or with OpenBLAS acceleration
230
+ CMAKE_ARGS="-DLLAMA_BLAS=ON -DLLAMA_BLAS_VENDOR=OpenBLAS" pip install llama-cpp-python
231
+ # Or with CLBLast acceleration
232
+ CMAKE_ARGS="-DLLAMA_CLBLAST=on" pip install llama-cpp-python
233
+ # Or with AMD ROCm GPU acceleration (Linux only)
234
+ CMAKE_ARGS="-DLLAMA_HIPBLAS=on" pip install llama-cpp-python
235
+ # Or with Metal GPU acceleration for macOS systems only
236
+ CMAKE_ARGS="-DLLAMA_METAL=on" pip install llama-cpp-python
237
+
238
+ # In windows, to set the variables CMAKE_ARGS in PowerShell, follow this format; eg for NVidia CUDA:
239
+ $env:CMAKE_ARGS = "-DLLAMA_OPENBLAS=on"
240
+ pip install llama-cpp-python
241
+ ```
242
+
243
+ #### Simple llama-cpp-python example code
244
+
245
+ ```python
246
+ from llama_cpp import Llama
247
+
248
+ # Set gpu_layers to the number of layers to offload to GPU. Set to 0 if no GPU acceleration is available on your system.
249
+ llm = Llama(
250
+ model_path="./starling-lm-alpha-8x7b-moe.Q4_K_M.gguf", # Download the model file first
251
+ n_ctx=32768, # The max sequence length to use - note that longer sequence lengths require much more resources
252
+ n_threads=8, # The number of CPU threads to use, tailor to your system and the resulting performance
253
+ n_gpu_layers=35 # The number of layers to offload to GPU, if you have GPU acceleration available
254
+ )
255
+
256
+ # Simple inference example
257
+ output = llm(
258
+ "GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:", # Prompt
259
+ max_tokens=512, # Generate up to 512 tokens
260
+ stop=["</s>"], # Example stop token - not necessarily correct for this specific model! Please check before using.
261
+ echo=True # Whether to echo the prompt
262
+ )
263
+
264
+ # Chat Completion API
265
+
266
+ llm = Llama(model_path="./starling-lm-alpha-8x7b-moe.Q4_K_M.gguf", chat_format="llama-2") # Set chat_format according to the model you are using
267
+ llm.create_chat_completion(
268
+ messages = [
269
+ {"role": "system", "content": "You are a story writing assistant."},
270
+ {
271
+ "role": "user",
272
+ "content": "Write a story about llamas."
273
+ }
274
+ ]
275
+ )
276
+ ```
277
+
278
+ ## How to use with LangChain
279
+
280
+ Here are guides on using llama-cpp-python and ctransformers with LangChain:
281
+
282
+ * [LangChain + llama-cpp-python](https://python.langchain.com/docs/integrations/llms/llamacpp)
283
+
284
+ <!-- README_GGUF.md-how-to-run end -->
285
+
286
+ <!-- footer start -->
287
+ <!-- 200823 -->
288
+ ## Discord
289
+
290
+ For further support, and discussions on these models and AI in general, join us at:
291
+
292
+ [TheBloke AI's Discord server](https://discord.gg/theblokeai)
293
+
294
+ ## Thanks, and how to contribute
295
+
296
+ Thanks to the [chirper.ai](https://chirper.ai) team!
297
+
298
+ Thanks to Clay from [gpus.llm-utils.org](llm-utils)!
299
+
300
+ 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.
301
+
302
+ 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.
303
+
304
+ Donaters will get priority support on any and all AI/LLM/model questions and requests, access to a private Discord room, plus other benefits.
305
+
306
+ * Patreon: https://patreon.com/TheBlokeAI
307
+ * Ko-Fi: https://ko-fi.com/TheBlokeAI
308
+
309
+ **Special thanks to**: Aemon Algiz.
310
+
311
+ **Patreon special mentions**: Michael Levine, 阿明, Trailburnt, Nikolai Manek, John Detwiler, Randy H, Will Dee, Sebastain Graf, NimbleBox.ai, Eugene Pentland, Emad Mostaque, Ai Maven, Jim Angel, Jeff Scroggin, Michael Davis, Manuel Alberto Morcote, Stephen Murray, Robert, Justin Joy, Luke @flexchar, Brandon Frisco, Elijah Stavena, S_X, Dan Guido, Undi ., Komninos Chatzipapas, Shadi, theTransient, Lone Striker, Raven Klaugh, jjj, Cap'n Zoog, Michel-Marie MAUDET (LINAGORA), Matthew Berman, David, Fen Risland, Omer Bin Jawed, Luke Pendergrass, Kalila, OG, Erik Bjäreholt, Rooh Singh, Joseph William Delisle, Dan Lewis, TL, John Villwock, AzureBlack, Brad, Pedro Madruga, Caitlyn Gatomon, K, jinyuan sun, Mano Prime, Alex, Jeffrey Morgan, Alicia Loh, Illia Dulskyi, Chadd, transmissions 11, fincy, Rainer Wilmers, ReadyPlayerEmma, knownsqashed, Mandus, biorpg, Deo Leter, Brandon Phillips, SuperWojo, Sean Connelly, Iucharbius, Jack West, Harry Royden McLaughlin, Nicholas, terasurfer, Vitor Caleffi, Duane Dunston, Johann-Peter Hartmann, David Ziegler, Olakabola, Ken Nordquist, Trenton Dambrowitz, Tom X Nguyen, Vadim, Ajan Kanaga, Leonard Tan, Clay Pascal, Alexandros Triantafyllidis, JM33133, Xule, vamX, ya boyyy, subjectnull, Talal Aujan, Alps Aficionado, wassieverse, Ari Malik, James Bentley, Woland, Spencer Kim, Michael Dempsey, Fred von Graf, Elle, zynix, William Richards, Stanislav Ovsiannikov, Edmond Seymore, Jonathan Leane, Martin Kemka, usrbinkat, Enrico Ros
312
+
313
+
314
+ Thank you to all my generous patrons and donaters!
315
+
316
+ And thank you again to a16z for their generous grant.
317
+
318
+ <!-- footer end -->
319
+
320
+ <!-- original-model-card start -->
321
+ # Original model card: Ray Hernandez's Starling LM Alpha 8X7B MoE
322
+
323
+
324
+ # Starling-LM-alpha-8x7B-MoE
325
+
326
+ Starling MoE 8x7B model.
327
+
328
+ # Original Model Card
329
+
330
+ # Starling-RM-7B-alpha
331
+
332
+ <!-- Provide a quick summary of what the model is/does. -->
333
+
334
+ - **Developed by:** Banghua Zhu * , Evan Frick * , Tianhao Wu * , Hanlin Zhu and Jiantao Jiao.
335
+ - **Model type:** Language Model finetuned with RLHF / RLAIF
336
+ - **License:** Non commercial license
337
+ - **Finetuned from model:** [Openchat 3.5](https://huggingface.co/openchat/openchat_3.5) (based on [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1))
338
+
339
+
340
+
341
+ We introduce Starling-7B, an open large language model (LLM) trained by Reinforcement Learning from AI Feedback (RLAIF). The model harnesses the power of our new GPT-4 labeled ranking dataset, [berkeley-nest/Nectar](https://huggingface.co/datasets/berkeley-nest/Nectar), and our new reward training and policy tuning pipeline. Starling-7B-alpha scores 8.09 in MT Bench with GPT-4 as a judge, outperforming every model to date on MT-Bench except for OpenAI's GPT-4 and GPT-4 Turbo. We release the ranking dataset [Nectar](https://huggingface.co/datasets/berkeley-nest/Nectar), the reward model [Starling-RM-7B-alpha](https://huggingface.co/berkeley-nest/Starling-RM-7B-alpha) and the language model [Starling-LM-7B-alpha](https://huggingface.co/berkeley-nest/Starling-LM-7B-alpha) on HuggingFace, and an online demo in LMSYS [Chatbot Arena](https://chat.lmsys.org). Stay tuned for our forthcoming code and paper, which will provide more details on the whole process.
342
+
343
+ Starling-LM-7B-alpha is a language model trained from [Openchat 3.5](https://huggingface.co/openchat/openchat_3.5) with reward model [berkeley-nest/Starling-RM-7B-alpha](https://huggingface.co/berkeley-nest/Starling-RM-7B-alpha) and policy optimization method [advantage-induced policy alignment (APA)](https://arxiv.org/abs/2306.02231). The evaluation results are listed below.
344
+
345
+
346
+ | Model | Tuning Method | MT Bench | AlpacaEval | MMLU |
347
+ |-----------------------|------------------|----------|------------|------|
348
+ | GPT-4-Turbo | ? | 9.32 | 97.70 | |
349
+ | GPT-4 | SFT + PPO | 8.99 | 95.28 | 86.4 |
350
+ | **Starling-7B** | C-RLFT + APA | 8.09 | 91.99 | 63.9 |
351
+ | Claude-2 | ? | 8.06 | 91.36 | 78.5 |
352
+ | GPT-3.5-Turbo | ? | 7.94 | 89.37 | 70 |
353
+ | Claude-1 | ? | 7.9 | 88.39 | 77 |
354
+ | Tulu-2-dpo-70b | SFT + DPO | 7.89 | 95.1 | |
355
+ | Openchat-3.5 | C-RLFT | 7.81 | 88.51 | 64.3 |
356
+ | Zephyr-7B-beta | SFT + DPO | 7.34 | 90.60 | 61.4 |
357
+ | Llama-2-70b-chat-hf | SFT + PPO | 6.86 | 92.66 | 63 |
358
+ | Neural-chat-7b-v3-1 | SFT + DPO | 6.84 | 84.53 | 62.4 |
359
+ | Tulu-2-dpo-7b | SFT + DPO | 6.29 | 85.1 | |
360
+
361
+
362
+
363
+ For more detailed discussions, please check out our [blog post](https://starling.cs.berkeley.edu), and stay tuned for our upcoming code and paper!
364
+ <!-- Provide the basic links for the model. -->
365
+
366
+ - **Blog:** https://starling.cs.berkeley.edu/
367
+ - **Paper:** Coming soon!
368
+ - **Code:** Coming soon!
369
+
370
+
371
+
372
+ ## Uses
373
+
374
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
375
+
376
+ **Important: Please use the exact chat template provided below for the model. Otherwise there will be a degrade in the performance. The model output can be verbose in rare cases. Please consider setting temperature = 0 to make this happen less.**
377
+
378
+ Our model follows the exact chat template and usage as [Openchat 3.5](https://huggingface.co/openchat/openchat_3.5). Please refer to their model card for more details.
379
+ In addition, our model is hosted on LMSYS [Chatbot Arena](https://chat.lmsys.org) for free test.
380
+
381
+ The conversation template is the same as Openchat 3.5:
382
+ ```
383
+ import transformers
384
+ tokenizer = transformers.AutoTokenizer.from_pretrained("openchat/openchat_3.5")
385
+
386
+ # Single-turn
387
+ tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant:").input_ids
388
+ assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
389
+
390
+ # Multi-turn
391
+ tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant: Hi<|end_of_turn|>GPT4 Correct User: How are you today?<|end_of_turn|>GPT4 Correct Assistant:").input_ids
392
+ assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747, 15359, 32000, 420, 6316, 28781, 3198, 3123, 1247, 28747, 1602, 460, 368, 3154, 28804, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
393
+
394
+ # Coding Mode
395
+ tokens = tokenizer("Code User: Implement quicksort using C++<|end_of_turn|>Code Assistant:").input_ids
396
+ assert tokens == [1, 7596, 1247, 28747, 26256, 2936, 7653, 1413, 334, 1680, 32000, 7596, 21631, 28747]
397
+ ```
398
+ ## Code Examples
399
+
400
+ ```python
401
+ import transformers
402
+
403
+ tokenizer = transformers.AutoTokenizer.from_pretrained("berkeley-nest/Starling-LM-7B-alpha")
404
+ model = transformers.AutoModelForCausalLM.from_pretrained("berkeley-nest/Starling-LM-7B-alpha")
405
+
406
+ def generate_response(prompt):
407
+ input_ids = tokenizer(prompt, return_tensors="pt").input_ids
408
+ outputs = model.generate(
409
+ input_ids,
410
+ max_length=256,
411
+ pad_token_id=tokenizer.pad_token_id,
412
+ eos_token_id=tokenizer.eos_token_id,
413
+ )
414
+ response_ids = outputs[0]
415
+ response_text = tokenizer.decode(response_ids, skip_special_tokens=True)
416
+ return response_text
417
+
418
+ # Single-turn conversation
419
+ prompt = "Hello, how are you?"
420
+ single_turn_prompt = f"GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:"
421
+ response_text = generate_response(single_turn_prompt)
422
+ print("Response:", response_text)
423
+
424
+ ## Multi-turn conversation
425
+ prompt = "Hello"
426
+ follow_up_question = "How are you today?"
427
+ response = ""
428
+ multi_turn_prompt = f"GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant: {response}<|end_of_turn|>GPT4 Correct User: {follow_up_question}<|end_of_turn|>GPT4 Correct Assistant:"
429
+ response_text = generate_response(multi_turn_prompt)
430
+ print("Multi-turn conversation response:", response_text)
431
+
432
+ ### Coding conversation
433
+ prompt = "Implement quicksort using C++"
434
+ coding_prompt = f"Code User: {prompt}<|end_of_turn|>Code Assistant:"
435
+ response = generate_response(coding_prompt)
436
+ print("Coding conversation response:", response)
437
+ ```
438
+
439
+ ## License
440
+ The dataset, model and online demo is a research preview intended for non-commercial use only, subject to the data distillation [License](https://github.com/facebookresearch/llama/blob/main/MODEL_CARD.md) of LLaMA, [Terms of Use](https://openai.com/policies/terms-of-use) of the data generated by OpenAI, and [Privacy Practices](https://chrome.google.com/webstore/detail/sharegpt-share-your-chatg/daiacboceoaocpibfodeljbdfacokfjb) of ShareGPT. Please contact us if you find any potential violation.
441
+
442
+
443
+ ## Acknowledgment
444
+ We would like to thank Wei-Lin Chiang from Berkeley for detailed feedback of the blog and the projects. We would like to thank the [LMSYS Organization](https://lmsys.org/) for their support of [lmsys-chat-1M](https://huggingface.co/datasets/lmsys/lmsys-chat-1m) dataset, evaluation and online demo. We would like to thank the open source community for their efforts in providing the datasets and base models we used to develope the project, including but not limited to Anthropic, Llama, Mistral, Hugging Face H4, LMSYS, OpenChat, OpenBMB, Flan and ShareGPT.
445
+
446
+ ## Citation
447
+ ```
448
+ @misc{starling2023,
449
+ title = {Starling-7B: Improving LLM Helpfulness & Harmlessness with RLAIF},
450
+ url = {},
451
+ author = {Zhu, Banghua and Frick, Evan and Wu, Tianhao and Zhu, Hanlin and Jiao, Jiantao},
452
+ month = {November},
453
+ year = {2023}
454
+ }
455
+ ```
456
+
457
+ <!-- original-model-card end -->