Adapters
dddddd1367 commited on
Commit
b5eaa54
1 Parent(s): 8bcebc3

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +153 -0
README.md ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: adapter-transformers
4
+ ---
5
+
6
+ # OpenChat: Advancing Open-source Language Models with Mixed-Quality Data
7
+
8
+ <div align="center">
9
+ <img src="https://raw.githubusercontent.com/imoneoi/openchat/master/assets/logo_new.png" style="width: 65%">
10
+ </div>
11
+
12
+ <p align="center">
13
+ <a href="https://github.com/imoneoi/openchat">GitHub Repo</a> •
14
+ <a href="https://openchat.team">Online Demo</a> •
15
+ <a href="https://discord.gg/pQjnXvNKHY">Discord</a> •
16
+ <a href="https://twitter.com/imonenext">Twitter</a> •
17
+ <a href="https://huggingface.co/openchat">Huggingface</a> •
18
+ <a href="https://arxiv.org/pdf/2309.11235.pdf">Paper</a>
19
+ </p>
20
+
21
+ **🔥 The first 7B model Achieves Comparable Results with ChatGPT (March)! 🔥**
22
+
23
+ **🤖 #1 Open-source model on MT-bench scoring 7.81, outperforming 70B models 🤖**
24
+
25
+ <div align="center">
26
+ <img src="https://raw.githubusercontent.com/imoneoi/openchat/master/assets/openchat.png" style="width: 50%">
27
+ </div>
28
+
29
+ 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.
30
+
31
+ [![DOI](https://zenodo.org/badge/645397533.svg)](https://zenodo.org/badge/latestdoi/645397533)
32
+
33
+ ## Usage
34
+
35
+ 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.
36
+
37
+ 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.
38
+
39
+ 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.
40
+
41
+ <details>
42
+ <summary>Example request (click to expand)</summary>
43
+
44
+ ```bash
45
+ curl http://localhost:18888/v1/chat/completions \
46
+ -H "Content-Type: application/json" \
47
+ -d '{
48
+ "model": "openchat_3.5",
49
+ "messages": [{"role": "user", "content": "You are a large language model named OpenChat. Write a poem to describe yourself"}]
50
+ }'
51
+ ```
52
+
53
+ Coding Mode
54
+
55
+ ```bash
56
+ curl http://localhost:18888/v1/chat/completions \
57
+ -H "Content-Type: application/json" \
58
+ -d '{
59
+ "model": "openchat_3.5",
60
+ "condition": "Code",
61
+ "messages": [{"role": "user", "content": "Write an aesthetic TODO app using HTML5 and JS, in a single file. You should use round corners and gradients to make it more aesthetic."}]
62
+ }'
63
+ ```
64
+
65
+ </details>
66
+
67
+ | Model | Size | Context | Weights | Serving |
68
+ |--------------|------|---------|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
69
+ | OpenChat 3.5 | 7B | 8192 | [Huggingface](https://huggingface.co/openchat/openchat_3.5) | `python -m ochat.serving.openai_api_server --model openchat/openchat_3.5 --engine-use-ray --worker-use-ray` |
70
+
71
+ For inference with Huggingface Transformers (slow and not recommended), follow the conversation template provided below.
72
+
73
+ <details>
74
+ <summary>Conversation templates (click to expand)</summary>
75
+
76
+ ```python
77
+ import transformers
78
+ tokenizer = transformers.AutoTokenizer.from_pretrained("openchat/openchat_3.5")
79
+
80
+ # Single-turn
81
+ tokens = tokenizer("GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant:").input_ids
82
+ assert tokens == [1, 420, 6316, 28781, 3198, 3123, 1247, 28747, 22557, 32000, 420, 6316, 28781, 3198, 3123, 21631, 28747]
83
+
84
+ # Multi-turn
85
+ 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
86
+ 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]
87
+
88
+ # Coding Mode
89
+ tokens = tokenizer("Code User: Implement quicksort using C++<|end_of_turn|>Code Assistant:").input_ids
90
+ assert tokens == [1, 7596, 1247, 28747, 26256, 2936, 7653, 1413, 334, 1680, 32000, 7596, 21631, 28747]
91
+ ```
92
+
93
+ </details>
94
+
95
+ ## <a id="benchmarks"></a> Benchmarks
96
+
97
+ | Model | # Params | Average | MT-Bench | AGIEval | BBH MC | TruthfulQA | MMLU | HumanEval | BBH CoT | GSM8K |
98
+ |--------------------|----------|----------|--------------|----------|----------|---------------|--------------|-----------------|-------------|--------------|
99
+ | OpenChat-3.5 | **7B** | **61.6** | 7.81 | **47.4** | **47.6** | **59.1** | 64.3 | **55.5** | 63.5 | **77.3** |
100
+ | ChatGPT (March)* | ? | 61.5 | **7.94** | 47.1 | **47.6** | 57.7 | **67.3** | 48.1 | **70.1** | 74.9 |
101
+ | | | | | | | | | | | |
102
+ | OpenHermes 2.5 | 7B | 59.3 | 7.54 | 46.5 | 49.4 | 57.5 | 63.8 | 48.2 | 59.9 | 73.5 |
103
+ | OpenOrca Mistral | 7B | 52.7 | 6.86 | 42.9 | 49.4 | 45.9 | 59.3 | 38.4 | 58.1 | 59.1 |
104
+ | Zephyr-β^ | 7B | 34.6 | 7.34 | 39.0 | 40.6 | 40.8 | 39.8 | 22.0 | 16.0 | 5.1 |
105
+ | Mistral | 7B | - | 6.84 | 38.0 | 39.0 | - | 60.1 | 30.5 | - | 52.2 |
106
+ | Open-source SOTA** | 13B-70B | 61.4 | 7.71 | 41.7 | 49.7 | 62.3 | 63.7 | 73.2 | 41.4 | 82.3 |
107
+ | | | | WizardLM 70B | Orca 13B | Orca 13B | Platypus2 70B | WizardLM 70B | WizardCoder 34B | Flan-T5 11B | MetaMath 70B |
108
+
109
+ *: 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.
110
+
111
+ ^: 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.
112
+
113
+ **: Mistral and Open-source SOTA results are taken from reported results in instruction-tuned model papers and official repositories.
114
+
115
+ 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).
116
+
117
+ ## Limitations
118
+
119
+ **Foundation Model Limitations**
120
+ 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:
121
+
122
+ - Complex reasoning
123
+ - Mathematical and arithmetic tasks
124
+ - Programming and coding challenges
125
+
126
+ **Hallucination of Non-existent Information**
127
+ 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.
128
+
129
+ **Safety**
130
+ 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.
131
+
132
+ ## License
133
+
134
+ Our OpenChat 3.5 code and models are distributed under the Apache License 2.0.
135
+
136
+ ## Citation
137
+
138
+ ```
139
+ @article{wang2023openchat,
140
+ title={OpenChat: Advancing Open-source Language Models with Mixed-Quality Data},
141
+ author={Wang, Guan and Cheng, Sijie and Zhan, Xianyuan and Li, Xiangang and Song, Sen and Liu, Yang},
142
+ journal={arXiv preprint arXiv:2309.11235},
143
+ year={2023}
144
+ }
145
+ ```
146
+
147
+ ## Acknowledgements
148
+
149
+ We extend our heartfelt gratitude to Alignment Lab AI, Nous Research, and Pygmalion AI for their substantial contributions to data collection and model training.
150
+
151
+ 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.
152
+
153
+ 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.