Adding README
Browse files
README.md
CHANGED
@@ -1,3 +1,173 @@
|
|
1 |
-
---
|
2 |
-
license: cc-by-nc-4.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: cc-by-nc-4.0
|
3 |
+
datasets:
|
4 |
+
- berkeley-nest/Nectar
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
library_name: transformers
|
8 |
+
tags:
|
9 |
+
- reward model
|
10 |
+
- RLHF
|
11 |
+
- RLAIF
|
12 |
+
---
|
13 |
+
|
14 |
+
# Starling-LM-11B-alpha (GGUF)
|
15 |
+
|
16 |
+
I am re-uploading my copy of starling-11b-q4_k_m.gguf (renamed to Starling-LM-11B-alpha-Q4_K_M.gguf) originally downloaded from https://huggingface.co/perlthoughts/Starling-LM-11B-alpha-GGUF.git because Ray Hernandez (perlthoughts) took his copy down from Huggingface.
|
17 |
+
|
18 |
+
Starling-LM-11B-alpha is a fantastic model, and outperforms other models of the same parameter count at a variety of tasks (though note it is not great at creative writing, being better suited to encyclopedic or clinical tasks).
|
19 |
+
|
20 |
+
It is the product of a self-merge of the 32-layer Starling-LM-7B-alpha model, appending its bottom 24 layers to its own top 24 layers, duplicating sixteen of its middle layers to make an 11B version of itself.
|
21 |
+
|
22 |
+
This model works best for me with a temperature of 0.7, a repeat penalty of 1.1, and the following prompt format:
|
23 |
+
|
24 |
+
```
|
25 |
+
GPT4 Correct User: $PROMPT<|end_of_turn|>
|
26 |
+
GPT4 Correct Assistant:
|
27 |
+
```
|
28 |
+
|
29 |
+
Note that there should be no space or newline after "Assistant:".
|
30 |
+
|
31 |
+
The remainder of this README is a copy of Ray Hernandez's original README.
|
32 |
+
|
33 |
+
Merge configuration with mergekit:
|
34 |
+
|
35 |
+
```
|
36 |
+
slices:
|
37 |
+
- sources:
|
38 |
+
- model: berkeley-nest/Starling-LM-7B-alpha
|
39 |
+
layer_range: [0, 24]
|
40 |
+
- sources:
|
41 |
+
- model: berkeley-nest/Starling-LM-7B-alpha
|
42 |
+
layer_range: [8, 32]
|
43 |
+
merge_method: passthrough
|
44 |
+
dtype: float16
|
45 |
+
```
|
46 |
+
|
47 |
+
# Original Model Card
|
48 |
+
|
49 |
+
# Starling-RM-7B-alpha
|
50 |
+
|
51 |
+
<!-- Provide a quick summary of what the model is/does. -->
|
52 |
+
|
53 |
+
- **Developed by:** Banghua Zhu * , Evan Frick * , Tianhao Wu * , Hanlin Zhu and Jiantao Jiao.
|
54 |
+
- **Model type:** Language Model finetuned with RLHF / RLAIF
|
55 |
+
- **License:** Non commercial license
|
56 |
+
- **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))
|
57 |
+
|
58 |
+
|
59 |
+
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.
|
60 |
+
|
61 |
+
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.
|
62 |
+
|
63 |
+
|
64 |
+
| Model | Tuning Method | MT Bench | AlpacaEval | MMLU |
|
65 |
+
|-----------------------|------------------|----------|------------|------|
|
66 |
+
| GPT-4-Turbo | ? | 9.32 | 97.70 | |
|
67 |
+
| GPT-4 | SFT + PPO | 8.99 | 95.28 | 86.4 |
|
68 |
+
| **Starling-7B** | C-RLFT + APA | 8.09 | 91.99 | 63.9 |
|
69 |
+
| Claude-2 | ? | 8.06 | 91.36 | 78.5 |
|
70 |
+
| GPT-3.5-Turbo | ? | 7.94 | 89.37 | 70 |
|
71 |
+
| Claude-1 | ? | 7.9 | 88.39 | 77 |
|
72 |
+
| Tulu-2-dpo-70b | SFT + DPO | 7.89 | 95.1 | |
|
73 |
+
| Openchat-3.5 | C-RLFT | 7.81 | 88.51 | 64.3 |
|
74 |
+
| Zephyr-7B-beta | SFT + DPO | 7.34 | 90.60 | 61.4 |
|
75 |
+
| Llama-2-70b-chat-hf | SFT + PPO | 6.86 | 92.66 | 63 |
|
76 |
+
| Neural-chat-7b-v3-1 | SFT + DPO | 6.84 | 84.53 | 62.4 |
|
77 |
+
| Tulu-2-dpo-7b | SFT + DPO | 6.29 | 85.1 | |
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
For more detailed discussions, please check out our [blog post](https://starling.cs.berkeley.edu), and stay tuned for our upcoming code and paper!
|
82 |
+
<!-- Provide the basic links for the model. -->
|
83 |
+
|
84 |
+
- **Blog:** https://starling.cs.berkeley.edu/
|
85 |
+
- **Paper:** Coming soon!
|
86 |
+
- **Code:** Coming soon!
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
## Uses
|
91 |
+
|
92 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
93 |
+
|
94 |
+
**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.**
|
95 |
+
|
96 |
+
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.
|
97 |
+
In addition, our model is hosted on LMSYS [Chatbot Arena](https://chat.lmsys.org) for free test.
|
98 |
+
|
99 |
+
The conversation template is the same as Openchat 3.5:
|
100 |
+
```
|
101 |
+
import transformers
|
102 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained("openchat/openchat_3.5")
|
103 |
+
|
104 |
+
# Single-turn
|
105 |
+
tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant:").input_ids
|
106 |
+
assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
|
107 |
+
|
108 |
+
# Multi-turn
|
109 |
+
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
|
110 |
+
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]
|
111 |
+
|
112 |
+
# Coding Mode
|
113 |
+
tokens = tokenizer("Code User: Implement quicksort using C++<|end_of_turn|>Code Assistant:").input_ids
|
114 |
+
assert tokens == [1, 7596, 1247, 28747, 26256, 2936, 7653, 1413, 334, 1680, 32000, 7596, 21631, 28747]
|
115 |
+
```
|
116 |
+
## Code Examples
|
117 |
+
|
118 |
+
```python
|
119 |
+
import transformers
|
120 |
+
|
121 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained("berkeley-nest/Starling-LM-7B-alpha")
|
122 |
+
model = transformers.AutoModelForCausalLM.from_pretrained("berkeley-nest/Starling-LM-7B-alpha")
|
123 |
+
|
124 |
+
def generate_response(prompt):
|
125 |
+
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
|
126 |
+
outputs = model.generate(
|
127 |
+
input_ids,
|
128 |
+
max_length=256,
|
129 |
+
pad_token_id=tokenizer.pad_token_id,
|
130 |
+
eos_token_id=tokenizer.eos_token_id,
|
131 |
+
)
|
132 |
+
response_ids = outputs[0]
|
133 |
+
response_text = tokenizer.decode(response_ids, skip_special_tokens=True)
|
134 |
+
return response_text
|
135 |
+
|
136 |
+
# Single-turn conversation
|
137 |
+
prompt = "Hello, how are you?"
|
138 |
+
single_turn_prompt = f"GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:"
|
139 |
+
response_text = generate_response(single_turn_prompt)
|
140 |
+
print("Response:", response_text)
|
141 |
+
|
142 |
+
## Multi-turn conversation
|
143 |
+
prompt = "Hello"
|
144 |
+
follow_up_question = "How are you today?"
|
145 |
+
response = ""
|
146 |
+
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:"
|
147 |
+
response_text = generate_response(multi_turn_prompt)
|
148 |
+
print("Multi-turn conversation response:", response_text)
|
149 |
+
|
150 |
+
### Coding conversation
|
151 |
+
prompt = "Implement quicksort using C++"
|
152 |
+
coding_prompt = f"Code User: {prompt}<|end_of_turn|>Code Assistant:"
|
153 |
+
response = generate_response(coding_prompt)
|
154 |
+
print("Coding conversation response:", response)
|
155 |
+
```
|
156 |
+
|
157 |
+
## License
|
158 |
+
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.
|
159 |
+
|
160 |
+
|
161 |
+
## Acknowledgment
|
162 |
+
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.
|
163 |
+
|
164 |
+
## Citation
|
165 |
+
```
|
166 |
+
@misc{starling2023,
|
167 |
+
title = {Starling-7B: Improving LLM Helpfulness & Harmlessness with RLAIF},
|
168 |
+
url = {},
|
169 |
+
author = {Zhu, Banghua and Frick, Evan and Wu, Tianhao and Zhu, Hanlin and Jiao, Jiantao},
|
170 |
+
month = {November},
|
171 |
+
year = {2023}
|
172 |
+
}
|
173 |
+
```
|