perlthoughts commited on
Commit
94d735e
1 Parent(s): eb8f308

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +143 -0
README.md ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-RM-11B-alpha
15
+
16
+ # Original Model Card
17
+
18
+ # Starling-RM-7B-alpha
19
+
20
+ <!-- Provide a quick summary of what the model is/does. -->
21
+
22
+ - **Developed by:** Banghua Zhu * , Evan Frick * , Tianhao Wu * , Hanlin Zhu and Jiantao Jiao.
23
+ - **Model type:** Language Model finetuned with RLHF / RLAIF
24
+ - **License:** Non commercial license
25
+ - **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))
26
+
27
+
28
+
29
+ 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.
30
+
31
+ 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.
32
+
33
+
34
+ | Model | Tuning Method | MT Bench | AlpacaEval | MMLU |
35
+ |-----------------------|------------------|----------|------------|------|
36
+ | GPT-4-Turbo | ? | 9.32 | 97.70 | |
37
+ | GPT-4 | SFT + PPO | 8.99 | 95.28 | 86.4 |
38
+ | **Starling-7B** | C-RLFT + APA | 8.09 | 91.99 | 63.9 |
39
+ | Claude-2 | ? | 8.06 | 91.36 | 78.5 |
40
+ | GPT-3.5-Turbo | ? | 7.94 | 89.37 | 70 |
41
+ | Claude-1 | ? | 7.9 | 88.39 | 77 |
42
+ | Tulu-2-dpo-70b | SFT + DPO | 7.89 | 95.1 | |
43
+ | Openchat-3.5 | C-RLFT | 7.81 | 88.51 | 64.3 |
44
+ | Zephyr-7B-beta | SFT + DPO | 7.34 | 90.60 | 61.4 |
45
+ | Llama-2-70b-chat-hf | SFT + PPO | 6.86 | 92.66 | 63 |
46
+ | Neural-chat-7b-v3-1 | SFT + DPO | 6.84 | 84.53 | 62.4 |
47
+ | Tulu-2-dpo-7b | SFT + DPO | 6.29 | 85.1 | |
48
+
49
+
50
+
51
+ For more detailed discussions, please check out our [blog post](https://starling.cs.berkeley.edu), and stay tuned for our upcoming code and paper!
52
+ <!-- Provide the basic links for the model. -->
53
+
54
+ - **Blog:** https://starling.cs.berkeley.edu/
55
+ - **Paper:** Coming soon!
56
+ - **Code:** Coming soon!
57
+
58
+
59
+
60
+ ## Uses
61
+
62
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
63
+
64
+ **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.**
65
+
66
+ 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.
67
+ In addition, our model is hosted on LMSYS [Chatbot Arena](https://chat.lmsys.org) for free test.
68
+
69
+ The conversation template is the same as Openchat 3.5:
70
+ ```
71
+ import transformers
72
+ tokenizer = transformers.AutoTokenizer.from_pretrained("openchat/openchat_3.5")
73
+
74
+ # Single-turn
75
+ tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant:").input_ids
76
+ assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
77
+
78
+ # Multi-turn
79
+ 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
80
+ 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]
81
+
82
+ # Coding Mode
83
+ tokens = tokenizer("Code User: Implement quicksort using C++<|end_of_turn|>Code Assistant:").input_ids
84
+ assert tokens == [1, 7596, 1247, 28747, 26256, 2936, 7653, 1413, 334, 1680, 32000, 7596, 21631, 28747]
85
+ ```
86
+ ## Code Examples
87
+
88
+ ```python
89
+ import transformers
90
+
91
+ tokenizer = transformers.AutoTokenizer.from_pretrained("berkeley-nest/Starling-LM-7B-alpha")
92
+ model = transformers.AutoModelForCausalLM.from_pretrained("berkeley-nest/Starling-LM-7B-alpha")
93
+
94
+ def generate_response(prompt):
95
+ input_ids = tokenizer(prompt, return_tensors="pt").input_ids
96
+ outputs = model.generate(
97
+ input_ids,
98
+ max_length=256,
99
+ pad_token_id=tokenizer.pad_token_id,
100
+ eos_token_id=tokenizer.eos_token_id,
101
+ )
102
+ response_ids = outputs[0]
103
+ response_text = tokenizer.decode(response_ids, skip_special_tokens=True)
104
+ return response_text
105
+
106
+ # Single-turn conversation
107
+ prompt = "Hello, how are you?"
108
+ single_turn_prompt = f"GPT4 Correct User: {prompt}<|end_of_turn|>GPT4 Correct Assistant:"
109
+ response_text = generate_response(single_turn_prompt)
110
+ print("Response:", response_text)
111
+
112
+ ## Multi-turn conversation
113
+ prompt = "Hello"
114
+ follow_up_question = "How are you today?"
115
+ response = ""
116
+ 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:"
117
+ response_text = generate_response(multi_turn_prompt)
118
+ print("Multi-turn conversation response:", response_text)
119
+
120
+ ### Coding conversation
121
+ prompt = "Implement quicksort using C++"
122
+ coding_prompt = f"Code User: {prompt}<|end_of_turn|>Code Assistant:"
123
+ response = generate_response(coding_prompt)
124
+ print("Coding conversation response:", response)
125
+ ```
126
+
127
+ ## License
128
+ 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.
129
+
130
+
131
+ ## Acknowledgment
132
+ 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.
133
+
134
+ ## Citation
135
+ ```
136
+ @misc{starling2023,
137
+ title = {Starling-7B: Improving LLM Helpfulness & Harmlessness with RLAIF},
138
+ url = {},
139
+ author = {Zhu, Banghua and Frick, Evan and Wu, Tianhao and Zhu, Hanlin and Jiao, Jiantao},
140
+ month = {November},
141
+ year = {2023}
142
+ }
143
+ ```