Adam
commited on
Commit
•
11979a6
1
Parent(s):
2aa5cce
feat: updated README
Browse files
README.md
CHANGED
@@ -1,3 +1,91 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
license: apache-2.0
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
tags:
|
5 |
+
- deepspeed
|
6 |
+
- chatgpt
|
7 |
+
- opt
|
8 |
+
- sft
|
9 |
+
- rlhf
|
10 |
license: apache-2.0
|
11 |
---
|
12 |
+
---
|
13 |
+
|
14 |
+
# ChatGPT OPT 1.3B DeepSpeed Reinforcement Learning from Human feedback
|
15 |
+
|
16 |
+
*fsalab-chat-opt-1.3b-rlhf-deepspeed*
|
17 |
+
|
18 |
+
This model consists of the final step of a modified pipeline the to the traditional training process of Chat-GPT models, which is comprised of a three-step procedure of [supervised fine tuning](https://huggingface.co/FSALab/fsalab-chat-opt-1.3b-sft-deepspeed), [reward model](https://huggingface.co/FSALab/fsalab-chat-opt-350m-reward-deepspeed) and **reinforcement learning from human feedback**.
|
19 |
+
|
20 |
+
This project's main goal was to make proper use of existing frameworks that revolve around the minimisation of training costs and thus the eventual improvements towards both the feasibility and usability of ChatGPT-like models. The framework selected here is DeepSpeed which has been instrumental in the development of this model and through this framework it was possible to train the ChatGPT-like model on much larger data-sets with a reasonable number of GPUs and consequently achieve significantly better performance.
|
21 |
+
|
22 |
+
This model follows the blog of ChatGPT and the paper of InstructGPT and especially the [Microsoft DeepSpeed Chat Blog](https://github.com/microsoft/DeepSpeedExamples/tree/master/applications/DeepSpeed-Chat).
|
23 |
+
|
24 |
+
## Our Training Methodology and Speedup Recipes
|
25 |
+
|
26 |
+
This training process is broken up into three key steps:
|
27 |
+
|
28 |
+
1. **Supervised fine-tuning (SFT):** See [here](https://huggingface.co/FSALab/fsalab-chat-opt-1.3b-sft-deepspeed)
|
29 |
+
|
30 |
+
2. **Reward Model (RM) fine-tuning:** See [here](https://huggingface.co/FSALab/fsalab-chat-opt-350m-reward-deepspeed)
|
31 |
+
|
32 |
+
3. **Reinforcement-learning from Human feedback (RLHF) fine-tuning:** At the completion of the prior two steps, the final RLHF fine-tuning can be initiated. This involves the collection of both the *fine-tuned model* from step 1 and the *reward model** from step 2 and train them on the data-set with comparisons.
|
33 |
+
|
34 |
+
To view the details behind each step head into their respective links and view the model card there.
|
35 |
+
|
36 |
+
### Reinforcement learning from human feedback
|
37 |
+
|
38 |
+
**Model Configurations:**
|
39 |
+
|
40 |
+
| Parameter | Value |
|
41 |
+
|:-----------------------|:------|
|
42 |
+
| Parameters | 1.3B |
|
43 |
+
| Model type | OPT |
|
44 |
+
| FFN Dimensions | 8192 |
|
45 |
+
| Hidden Size | 2048 |
|
46 |
+
| Max Position Embedding | 2048 |
|
47 |
+
| Attention Heads | 16 |
|
48 |
+
| Hidden layers | 24 |
|
49 |
+
|
50 |
+
|
51 |
+
**Training Configurations:**
|
52 |
+
| Parameter | Value |
|
53 |
+
|:-----------------------|:------|
|
54 |
+
| Train Batch size | 32 |
|
55 |
+
| Train micro batch size | 4 |
|
56 |
+
| ZeRO stage | 2 |
|
57 |
+
| FP16 | True |
|
58 |
+
| Gradient clipping | 1.0 |
|
59 |
+
| Dropout | 0.1 |
|
60 |
+
| Attention Dropout | 0.0 |
|
61 |
+
| Attention Dropout | 0.0 |
|
62 |
+
| Prescale gradients | False |
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
## Why did we choose DeepSpeed?
|
67 |
+
|
68 |
+
**DeepSpeed Training:**
|
69 |
+
|
70 |
+
The `main.py` Python code take the DeepSpeed config with the argument `--deepspeed_config ./ds_config.json`.
|
71 |
+
|
72 |
+
We read up on the DeepSpeed documentation and created a specific coniguration based on their work. The json file `ds_config.json` here is set to take the [ZeRO-2](https://www.microsoft.com/en-us/research/blog/ZeRO-2-deepspeed-shattering-barriers-of-deep-learning-speed-scale/) stage and FP16, allowing must faster training and GPU memory saving. Note that ZeRO-2 is just one of the examples using our DeepSpeed. You may use ZeRO-1, Zero-3, ZeRO-Offload and ZeRO-infinity. For more information on DeepSpeed ZeRO family, please see this [tutorial link](https://www.deepspeed.ai/tutorials/zero/) for Zero-1/2/3 and this [tutorial ](https://www.deepspeed.ai/tutorials/zero-offload/)for Zero-Offload.
|
73 |
+
|
74 |
+
To enable the DeepSpeed Zero family training, we injected several lines of code in order to enable this i.e.:
|
75 |
+
|
76 |
+
```python
|
77 |
+
model, optimizer, _, lr_scheduler = deepspeed.initialize(model=model, \
|
78 |
+
optimizer=optimizer, \
|
79 |
+
args=args, \
|
80 |
+
lr_scheduler=lr_scheduler, \
|
81 |
+
dist_init_required=True)
|
82 |
+
```
|
83 |
+
|
84 |
+
|
85 |
+
## **Acknowledgements**
|
86 |
+
|
87 |
+
We thank the following papers and open-source repositories. We especially thank DeepSpeed for their frameworks as well.
|
88 |
+
|
89 |
+
* [1] Schulman, John, et al. "Introducing ChatGPT", https://openai.com/blog/chatgpt (2022).
|
90 |
+
* [2] Transformers [Hugging Face (github.com)](https://github.com/huggingface)
|
91 |
+
* [3] DeepSpeed Chat [DeepSpeed Chat](https://github.com/microsoft/DeepSpeedExamples/tree/master/applications/DeepSpeed-Chat)
|