Merge branch 'main' of hf.co:openchat/openchat-3.5-1210 into main
Browse files
README.md
CHANGED
@@ -1,3 +1,202 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- openchat
|
5 |
+
- mistral
|
6 |
+
- C-RLFT
|
7 |
+
datasets:
|
8 |
+
- openchat/openchat_sharegpt4_dataset
|
9 |
+
- imone/OpenOrca_FLAN
|
10 |
+
- LDJnr/LessWrong-Amplify-Instruct
|
11 |
+
- LDJnr/Pure-Dove
|
12 |
+
- LDJnr/Verified-Camel
|
13 |
+
- tiedong/goat
|
14 |
+
- glaiveai/glaive-code-assistant
|
15 |
+
- meta-math/MetaMathQA
|
16 |
+
- OpenAssistant/oasst_top1_2023-08-25
|
17 |
+
- TIGER-Lab/MathInstruct
|
18 |
+
library_name: transformers
|
19 |
+
pipeline_tag: text-generation
|
20 |
---
|
21 |
+
|
22 |
+
# OpenChat (1210 Version): Advancing Open-source Language Models with Mixed-Quality Data
|
23 |
+
|
24 |
+
<div align="center">
|
25 |
+
<img src="https://raw.githubusercontent.com/imoneoi/openchat/master/assets/logo_new.png" style="width: 65%">
|
26 |
+
</div>
|
27 |
+
|
28 |
+
<p align="center">
|
29 |
+
<a href="https://github.com/imoneoi/openchat">GitHub Repo</a> •
|
30 |
+
<a href="https://openchat.team">Online Demo</a> •
|
31 |
+
<a href="https://discord.gg/pQjnXvNKHY">Discord</a> •
|
32 |
+
<a href="https://twitter.com/imonenext">Twitter</a> •
|
33 |
+
<a href="https://huggingface.co/openchat">Huggingface</a> •
|
34 |
+
<a href="https://arxiv.org/pdf/2309.11235.pdf">Paper</a>
|
35 |
+
</p>
|
36 |
+
|
37 |
+
**🔥 **
|
38 |
+
|
39 |
+
| Model | HumanEval+ |
|
40 |
+
|-----------------------------|------------|
|
41 |
+
| WizardCoder-Python-34B-V1.0 | 64.6 |
|
42 |
+
| GPT-3.5 (December 2023) | 64.6 |
|
43 |
+
| **OpenChat 3.5 1210** | **63.4** |
|
44 |
+
| OpenHermes 2.5 | 41.5 |
|
45 |
+
|
46 |
+
<div align="center" style="justify-content: center; align-items: center; "'>
|
47 |
+
<img src="https://github.com/alpayariyak/openchat/blob/master/assets/Untitled%20design-17.png?raw=true" style="width: 100%; border-radius: 0.5em">
|
48 |
+
</div>
|
49 |
+
|
50 |
+
OpenChat is an innovative library of open-source language models, fine-tuned with [C-RLFT](https://arxiv.org/pdf/2309.11235.pdf) - a strategy inspired by offline reinforcement learning. Our models learn from mixed-quality data without preference labels, delivering exceptional performance on par with ChatGPT, even with a 7B model. Despite our simple approach, we are committed to developing a high-performance, commercially viable, open-source large language model, and we continue to make significant strides toward this vision.
|
51 |
+
|
52 |
+
[![DOI](https://zenodo.org/badge/645397533.svg)](https://zenodo.org/badge/latestdoi/645397533)
|
53 |
+
|
54 |
+
## Usage
|
55 |
+
|
56 |
+
To use this model, we highly recommend installing the OpenChat package by following the [installation guide](https://github.com/imoneoi/openchat#installation) in our repository and using the OpenChat OpenAI-compatible API server by running the serving command from the table below. The server is optimized for high-throughput deployment using [vLLM](https://github.com/vllm-project/vllm) and can run on a consumer GPU with 24GB RAM. To enable tensor parallelism, append `--tensor-parallel-size N` to the serving command.
|
57 |
+
|
58 |
+
Once started, the server listens at `localhost:18888` for requests and is compatible with the [OpenAI ChatCompletion API specifications](https://platform.openai.com/docs/api-reference/chat). Please refer to the example request below for reference. Additionally, you can use the [OpenChat Web UI](https://github.com/imoneoi/openchat#web-ui) for a user-friendly experience.
|
59 |
+
|
60 |
+
If you want to deploy the server as an online service, you can use `--api-keys sk-KEY1 sk-KEY2 ...` to specify allowed API keys and `--disable-log-requests --disable-log-stats --log-file openchat.log` for logging only to a file. For security purposes, we recommend using an [HTTPS gateway](https://fastapi.tiangolo.com/es/deployment/concepts/#security-https) in front of the server.
|
61 |
+
|
62 |
+
<details>
|
63 |
+
<summary>Example request (click to expand)</summary>
|
64 |
+
|
65 |
+
Default Mode (Chat & Coding)
|
66 |
+
|
67 |
+
```bash
|
68 |
+
curl http://localhost:18888/v1/chat/completions \
|
69 |
+
-H "Content-Type: application/json" \
|
70 |
+
-d '{
|
71 |
+
"model": "openchat_3.5",
|
72 |
+
"messages": [{"role": "user", "content": "You are a large language model named OpenChat. Write a poem to describe yourself"}]
|
73 |
+
}'
|
74 |
+
```
|
75 |
+
|
76 |
+
Mathematical Reasoning Mode
|
77 |
+
|
78 |
+
```bash
|
79 |
+
curl http://localhost:18888/v1/chat/completions \
|
80 |
+
-H "Content-Type: application/json" \
|
81 |
+
-d '{
|
82 |
+
"model": "openchat_3.5",
|
83 |
+
"condition": "Math Correct",
|
84 |
+
"messages": [{"role": "user", "content": "10.3 − 7988.8133 = "}]
|
85 |
+
}'
|
86 |
+
```
|
87 |
+
|
88 |
+
</details>
|
89 |
+
|
90 |
+
| Model | Size | Context | Weights | Serving |
|
91 |
+
|-------------------|------|---------|------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
|
92 |
+
| OpenChat 3.5 1210 | 7B | 8192 | [Huggingface](https://huggingface.co/openchat/openchat_3.5_1210) | `python -m ochat.serving.openai_api_server --model openchat/openchat_3.5_1210 --engine-use-ray --worker-use-ray` |
|
93 |
+
|
94 |
+
### Conversation templates
|
95 |
+
|
96 |
+
Default Mode (GPT4 Correct)
|
97 |
+
|
98 |
+
```
|
99 |
+
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:
|
100 |
+
```
|
101 |
+
|
102 |
+
Mathematical Reasoning Mode
|
103 |
+
|
104 |
+
```
|
105 |
+
Math Correct User: 10.3 − 7988.8133=<|end_of_turn|>Math Correct Assistant:
|
106 |
+
```
|
107 |
+
|
108 |
+
The default (GPT4 Correct) template is also available as the integrated `tokenizer.chat_template`,
|
109 |
+
which can be used instead of manually specifying the template:
|
110 |
+
|
111 |
+
```python
|
112 |
+
messages = [
|
113 |
+
{"role": "user", "content": "Hello"},
|
114 |
+
{"role": "assistant", "content": "Hi"},
|
115 |
+
{"role": "user", "content": "How are you today?"}
|
116 |
+
]
|
117 |
+
tokens = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
|
118 |
+
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]
|
119 |
+
```
|
120 |
+
|
121 |
+
## Comparison with [X.AI Grok models](https://x.ai/)
|
122 |
+
|
123 |
+
| | License | # Param | Average | MMLU | HumanEval | MATH | GSM8k |
|
124 |
+
|-------------------|-------------|---------|----------|------|-----------|----------|----------|
|
125 |
+
| OpenChat 3.5 1210 | Apache-2.0 | **7B** | **60.1** | 65.3 | **68.9** | **28.9** | **77.3** |
|
126 |
+
| OpenChat 3.5 | Apache-2.0 | **7B** | 56.4 | 64.3 | 55.5 | 28.6 | **77.3** |
|
127 |
+
| Grok-0 | Proprietary | 33B | 44.5 | 65.7 | 39.7 | 15.7 | 56.8 |
|
128 |
+
| Grok-1 | Proprietary | ???B | 55.8 | 73 | 63.2 | 23.9 | 62.9 |
|
129 |
+
|
130 |
+
## <a id="benchmarks"></a> Benchmarks
|
131 |
+
|
132 |
+
| Model | # Params | Average | MT-Bench | HumanEval | BBH MC | AGIEval | TruthfulQA | MMLU | GSM8K | BBH CoT |
|
133 |
+
|--------------------|----------|----------|--------------|-----------------|----------|----------|---------------|--------------|--------------|-------------|
|
134 |
+
| OpenChat-3.5-1210 | **7B** | **63.8** | 7.76 | **68.9** | **49.5** | **48.0** | **61.8** | 65.3 | **77.3** | 61.8 |
|
135 |
+
| OpenChat-3.5 | **7B** | 61.6 | 7.81 | 55.5 | 47.6 | 47.4 | 59.1 | 64.3 | **77.3** | 63.5 |
|
136 |
+
| ChatGPT (March)* | ? | 61.5 | **7.94** | 48.1 | 47.6 | 47.1 | 57.7 | **67.3** | 74.9 | **70.1** |
|
137 |
+
| | | | | | | | | | | |
|
138 |
+
| OpenHermes 2.5 | 7B | 59.3 | 7.54 | 48.2 | 49.4 | 46.5 | 57.5 | 63.8 | 73.5 | 59.9 |
|
139 |
+
| OpenOrca Mistral | 7B | 52.7 | 6.86 | 38.4 | 49.4 | 42.9 | 45.9 | 59.3 | 59.1 | 58.1 |
|
140 |
+
| Zephyr-β^ | 7B | 34.6 | 7.34 | 22.0 | 40.6 | 39.0 | 40.8 | 39.8 | 5.1 | 16.0 |
|
141 |
+
| Mistral | 7B | - | 6.84 | 30.5 | 39.0 | 38.0 | - | 60.1 | 52.2 | - |
|
142 |
+
| Open-source SOTA** | 13B-70B | 61.4 | 7.71 | 73.2 | 49.7 | 41.7 | 62.3 | 63.7 | 82.3 | 41.4 |
|
143 |
+
| | | | WizardLM 70B | WizardCoder 34B | Orca 13B | Orca 13B | Platypus2 70B | WizardLM 70B | MetaMath 70B | Flan-T5 11B |
|
144 |
+
|
145 |
+
*: ChatGPT (March) results are from [GPT-4 Technical Report](https://arxiv.org/abs/2303.08774), [Chain-of-Thought Hub](https://github.com/FranxYao/chain-of-thought-hub), and our evaluation. Please note that ChatGPT is not a fixed baseline and evolves rapidly over time.
|
146 |
+
|
147 |
+
^: Zephyr-β often fails to follow few-shot CoT instructions, likely because it was aligned with only chat data but not trained on few-shot data.
|
148 |
+
|
149 |
+
**: Mistral and Open-source SOTA results are taken from reported results in instruction-tuned model papers and official repositories.
|
150 |
+
|
151 |
+
All models are evaluated in chat mode (e.g. with the respective conversation template applied). All zero-shot benchmarks follow the same setting as in the AGIEval paper and Orca paper. CoT tasks use the same configuration as Chain-of-Thought Hub, HumanEval is evaluated with EvalPlus, and MT-bench is run using FastChat. To reproduce our results, follow the instructions in [our repository](https://github.com/imoneoi/openchat/#benchmarks).
|
152 |
+
|
153 |
+
## Limitations
|
154 |
+
|
155 |
+
**Foundation Model Limitations**
|
156 |
+
Despite its advanced capabilities, OpenChat is still bound by the limitations inherent in its foundation models. These limitations may impact the model's performance in areas such as:
|
157 |
+
|
158 |
+
- Complex reasoning
|
159 |
+
- Mathematical and arithmetic tasks
|
160 |
+
- Programming and coding challenges
|
161 |
+
|
162 |
+
**Hallucination of Non-existent Information**
|
163 |
+
OpenChat may sometimes generate information that does not exist or is not accurate, also known as "hallucination". Users should be aware of this possibility and verify any critical information obtained from the model.
|
164 |
+
|
165 |
+
**Safety**
|
166 |
+
OpenChat may sometimes generate harmful, hate speech, biased responses, or answer unsafe questions. It's crucial to apply additional AI safety measures in use cases that require safe and moderated responses.
|
167 |
+
|
168 |
+
## License
|
169 |
+
|
170 |
+
Our OpenChat 3.5 code and models are distributed under the Apache License 2.0.
|
171 |
+
|
172 |
+
## Dataset Details
|
173 |
+
|
174 |
+
OpenChat 3.5 was trained with C-RLFT on a collection of publicly available high-quality instruction data, with a custom processing pipeline. We detail some notable subsets included here:
|
175 |
+
|
176 |
+
- [OpenChat ShareGPT](https://huggingface.co/datasets/openchat/openchat_sharegpt4_dataset)
|
177 |
+
- [Open-Orca with FLAN answers](https://huggingface.co/datasets/imone/OpenOrca_FLAN)
|
178 |
+
- Capybara [1](https://huggingface.co/datasets/LDJnr/Pure-Dove) [2](https://huggingface.co/datasets/LDJnr/Verified-Camel) [3](https://huggingface.co/datasets/LDJnr/LessWrong-Amplify-Instruct)
|
179 |
+
- [GOAT](https://huggingface.co/datasets/tiedong/goat)
|
180 |
+
- [Glaive](https://huggingface.co/datasets/glaiveai/glaive-code-assistant)
|
181 |
+
- [MetaMathQA](https://huggingface.co/datasets/meta-math/MetaMathQA)
|
182 |
+
- [MathInstruct](https://huggingface.co/datasets/TIGER-Lab/MathInstruct)
|
183 |
+
- [OpenAssistant](https://huggingface.co/datasets/OpenAssistant/oasst_top1_2023-08-25)
|
184 |
+
|
185 |
+
## Citation
|
186 |
+
|
187 |
+
```
|
188 |
+
@article{wang2023openchat,
|
189 |
+
title={OpenChat: Advancing Open-source Language Models with Mixed-Quality Data},
|
190 |
+
author={Wang, Guan and Cheng, Sijie and Zhan, Xianyuan and Li, Xiangang and Song, Sen and Liu, Yang},
|
191 |
+
journal={arXiv preprint arXiv:2309.11235},
|
192 |
+
year={2023}
|
193 |
+
}
|
194 |
+
```
|
195 |
+
|
196 |
+
## Acknowledgements
|
197 |
+
|
198 |
+
We extend our heartfelt gratitude to AutoMeta and caesus from Alignment Lab AI, LDJ and Teknium from Nous Research, alpin and TearGosling from Pygmalion AI for their substantial contributions to data collection and model training.
|
199 |
+
|
200 |
+
Special thanks go to Changling Liu from GPT Desk Pte. Ltd., Qiying Yu at Tsinghua University, Baochang Ma, and Hao Wan from 01.AI company for their generous provision of resources. We are also deeply grateful to Jianxiong Li and Peng Li at Tsinghua University for their insightful discussions.
|
201 |
+
|
202 |
+
Furthermore, we appreciate the developers behind the following projects for their significant contributions to our research: [Mistral](https://mistral.ai/), [Chain-of-Thought Hub](https://github.com/FranxYao/chain-of-thought-hub), [Llama 2](https://ai.meta.com/llama/), [Self-Instruct](https://arxiv.org/abs/2212.10560), [FastChat (Vicuna)](https://github.com/lm-sys/FastChat), [Alpaca](https://github.com/tatsu-lab/stanford_alpaca.git), and [StarCoder](https://github.com/bigcode-project/starcoder). Their work has been instrumental in driving our research forward.
|