Text Generation
Transformers
PyTorch
RefinedWeb
falcon-40b
rlhf
falcon
custom_code
text-generation-inference
Inference Endpoints
Files changed (1) hide show
  1. README.md +170 -0
README.md ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - Anthropic/hh-rlhf
5
+ - OpenAssistant/oasst1
6
+ - databricks/databricks-dolly-15k
7
+ language:
8
+ - en
9
+ - fr
10
+ - de
11
+ - es
12
+ - it
13
+ ---
14
+ # Model Card for Alfred-40B-0723
15
+
16
+ `Alfred-40B-0723` is a finetuned version of [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b), obtained with Reinforcement Learning from Human Feedback (RLHF).
17
+ It is the first of a series of RLHF models based on Falcon-40B that will be regularly released. It is made available under the Apache 2.0 License.
18
+
19
+ ## Model Details
20
+
21
+ ### Model Description
22
+
23
+ - **Developed by:** [LightOn](https://www.lighton.ai/)
24
+ - **Model type:** Causal decoder-only;
25
+ - **Language(s) (NLP):** English, German, Spanish, French (and limited capabilities in Italian, Portuguese, Polish, Dutch, Romanian, Czech, Swedish);
26
+ - **License:** Apache 2.0 license.
27
+ - **Finetuned from model:** [Falcon-40B](https://huggingface.co/tiiuae/falcon-40b)
28
+ - **Training date:** July 2023 (`0723`).
29
+
30
+ ## Uses
31
+
32
+ ### Direct Use
33
+
34
+ `Alfred-40B-0723` can be used as an instruct or chat model. We encourage its usage for research on large language models finetuned with RLHF as well.
35
+
36
+ ### Out-of-Scope Use
37
+
38
+ Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
39
+
40
+ ## Bias, Risks, and Limitations
41
+
42
+ `Alfred-40B-0723` is a finetune of Falcon-40B. As such, it is trained mostly on English, German, Spanish, French, with limited capabilities also in in Italian, Portuguese, Polish, Dutch, Romanian, Czech, Swedish. It will not generalize appropriately to other languages. Furthermore, as it is trained on a large-scale corpora representative of the web, it will carry the stereotypes and biases commonly encountered online.
43
+
44
+ ### Recommendations
45
+
46
+ We recommend users of `Alfred-40B-0723` to implement appropriate guardrails and precautions in any production use.
47
+
48
+ ## How to Get Started with the Model
49
+
50
+ Use the code below to get started with the model.
51
+
52
+ ```
53
+ from transformers import AutoTokenizer, AutoModelForCausalLM
54
+ import transformers
55
+ import torch
56
+
57
+ model = "lightonai/alfred-40b-0723"
58
+ tokenizer = AutoTokenizer.from_pretrained(model)
59
+
60
+ pipeline = transformers.pipeline(
61
+ "text-generation",
62
+ model=model,
63
+ tokenizer=tokenizer,
64
+ torch_dtype=torch.bfloat16,
65
+ trust_remote_code=True,
66
+ device_map="auto",
67
+ )
68
+
69
+
70
+ sequences = pipeline(
71
+ "Write a short text to announce that the new transformer model Alfred is available in open-source on Huggingface, include emojis.",
72
+ max_length=200,
73
+ do_sample=True,
74
+ top_k=10,
75
+ num_return_sequences=1,
76
+ eos_token_id=tokenizer.eos_token_id,
77
+ )
78
+ for seq in sequences:
79
+ print(f"Result: {seq['generated_text']}")
80
+ ```
81
+
82
+ ## Training Details
83
+
84
+ ### Training Data
85
+
86
+ Alfred-40B-0723 was trained on a mixture of publicly available and in-house curated datasets.
87
+
88
+ | **Data source** |
89
+ |--------------------|
90
+ | [oasst1](https://huggingface.co/datasets/OpenAssistant/oasst1) |
91
+ | [hh-rlhf](https://huggingface.co/datasets/Anthropic/hh-rlhf) |
92
+ | [dolly](https://huggingface.co/datasets/databricks/databricks-dolly-15k) |
93
+ | [NatInstV2](https://github.com/allenai/natural-instructions) |
94
+ | momentum-internal |
95
+
96
+ `momentum-internal` is a collection of prompts rated as gold quality from the staff of LightOn in their daily workflow.
97
+
98
+ ### Training Procedure
99
+
100
+ `Alfred-40B-0723` was trained on 128 A100 40GB GPUs, using a 3D parallelism strategy (TP=8, PP=4, DP=4) combined with ZeRO. The value model is initialized from the reward model and does not have any shared parameters with the policy network.
101
+
102
+ #### Preprocessing
103
+
104
+ Samples from each of the datasets have been programmatically formatted to chat, instructions and few-shot promtps.
105
+
106
+ #### Training Hyperparameters
107
+
108
+ ##### Policy and Value Optimizer Config
109
+
110
+ | **Hyperparameter** | **Value** | **Comment** |
111
+ |--------------------|------------|-------------------------------------------|
112
+ | Precision | `bfloat16` | |
113
+ | Optimizer | AdamW | |
114
+ | Learning rate | 1.85e-6 | 10 warm-up steps, cosine decay over a 100 steps to 1.85e-7 |
115
+
116
+ ##### Trainer config
117
+ | **Hyperparameter** | **Value** |
118
+ |--------------------|------------|
119
+ | Num Rollouts | 1024 |
120
+ | Policy Epochs | 1 |
121
+ | Value Epochs | 1 |
122
+ | KL Coef | 0.01 |
123
+ | Gamma | 1.0 |
124
+ | GAE Lambda | 0.95 |
125
+ | Clip Range Policy | 0.2 |
126
+ | Clip Range Value | 0.2 |
127
+ | Whiten Advantages | `true` |
128
+ | Whiten Rewards | `false` |
129
+ | Score on EOD | `true` |
130
+ | Max Steps | 200 |
131
+ | PPO steps/epoch | 1 |
132
+ | Value steps/epoch | 8 |
133
+
134
+ ##### Trajectory data config
135
+ | **Hyperparameter** | **Value** |
136
+ |----------------------|------------|
137
+ | Continuation Max Len | 1024 |
138
+ | Continuation Min Len | 0 |
139
+ | Top P | 1.0 |
140
+ | Temperature | 1.0 |
141
+
142
+
143
+ ## Evaluation
144
+
145
+ ![aggregated evaluation of RAW vs SFT vs PPO - including random baseline - PPO suffers in arithmetic due to effects on calibration](https://i.ibb.co/9yQFJ40/aggregated.png "aggregated evaluation of RAW vs SFT vs PPO - including random baseline")
146
+
147
+ First evaluation results aggregated from the EleutherAI harness:
148
+ - Arithmetic capabilities become much worse
149
+ - Common Sense, Paraphrase, Reasoning, Reading Comprehension stay at about the same level
150
+ - NLI becomes better and QA gets worse
151
+
152
+ Overall these results were expected from the literature. Benchmarks don't really correlate with human preference.
153
+ All these metrics use a Select methodology, and it since RLHF models are far less calibrated than raw LLMs, they will be punished in these evaluations.
154
+
155
+ Human evaluation is currently ongoing.
156
+
157
+ ### Compute Infrastructure
158
+
159
+ #### Hardware
160
+
161
+ Alfred-40B-0723 was trained on AWS SageMaker, on 128 A100 40GB GPUs in P4d instances.
162
+
163
+ #### Software
164
+
165
+ Alfred-40B-0723 was trained with a custom RLHF codebase. Training leverages a 3D parallelism approach combined with ZeRO, as well as high-performance kernels such as FlashAttention.
166
+
167
+ ## Model Card Contact
168
+
169
170
+