rcojocaru commited on
Commit
0665b94
1 Parent(s): 5228826

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +215 -0
README.md ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - tiiuae/falcon-refinedweb
4
+ ---
5
+
6
+ # 🚀 Falcon-11B
7
+
8
+ **Falcon-11B is a 11B parameters causal decoder-only model built by [TII](https://www.tii.ae) and trained over 5,000B tokens of [RefinedWeb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) enhanced with curated corpora. The model is made available under the Apache 2.0 license.**
9
+
10
+ *Paper coming soon 😊.*
11
+
12
+
13
+ 🤗 To get started with Falcon (inference, finetuning, quantization, etc.), we recommend reading [this great blogpost fron HF](https://huggingface.co/blog/falcon)!
14
+
15
+ ⚠️ **This is a raw, pretrained model, which should be further finetuned for most usecases.** If you are looking for a version better suited to taking generic instructions in a chat format, we recommend taking a look at [Falcon-11B-Chat](https://huggingface.co/tiiuae/falcon-11B-chat).
16
+
17
+ ```python
18
+ from transformers import AutoTokenizer, AutoModelForCausalLM
19
+ import transformers
20
+ import torch
21
+
22
+ model = "tiiuae/falcon-11B"
23
+
24
+ tokenizer = AutoTokenizer.from_pretrained(model)
25
+ pipeline = transformers.pipeline(
26
+ "text-generation",
27
+ model=model,
28
+ tokenizer=tokenizer,
29
+ torch_dtype=torch.bfloat16,
30
+ trust_remote_code=True,
31
+ device_map="auto",
32
+ )
33
+ sequences = pipeline(
34
+ "Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
35
+ max_length=200,
36
+ do_sample=True,
37
+ top_k=10,
38
+ num_return_sequences=1,
39
+ eos_token_id=tokenizer.eos_token_id,
40
+ )
41
+ for seq in sequences:
42
+ print(f"Result: {seq['generated_text']}")
43
+
44
+ ```
45
+
46
+ 💥 **Falcon LLMs require PyTorch 2.0 for use with `transformers`!**
47
+
48
+ For fast inference with Falcon, check-out [Text Generation Inference](https://github.com/huggingface/text-generation-inference)! Read more in this [blogpost]((https://huggingface.co/blog/falcon).
49
+
50
+ # Model Card for Falcon-11B
51
+
52
+ ## Model Details
53
+
54
+ ### Model Description
55
+
56
+ - **Developed by:** [https://www.tii.ae](https://www.tii.ae);
57
+ - **Model type:** Causal decoder-only;
58
+ - **Language(s) (NLP):** English, German, Spanish, French, Italian, Portuguese, Polish, Dutch, Romanian, Czech, Swedish
59
+ - **License:** TII Falcon License 2.0
60
+
61
+ ### Model Source
62
+
63
+ - **Paper:** *coming soon*.
64
+
65
+ ## Uses
66
+
67
+ ### Direct Use
68
+
69
+ Research on large language models; as a foundation for further specialization and finetuning for specific usecases (e.g., summarization, text generation, chatbot, etc.)
70
+
71
+ ### Out-of-Scope Use
72
+
73
+ Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
74
+
75
+ ## Bias, Risks, and Limitations
76
+
77
+ Falcon-11B is trained mostly on English, but also German, Spanish, French, 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.
78
+
79
+ ### Recommendations
80
+
81
+ We recommend users of Falcon-11B to consider finetuning it for the specific set of tasks of interest, and for guardrails and appropriate precautions to be taken for any production use.
82
+
83
+ ## How to Get Started with the Model
84
+
85
+
86
+ ```python
87
+ from transformers import AutoTokenizer, AutoModelForCausalLM
88
+ import transformers
89
+ import torch
90
+
91
+ model = "tiiuae/falcon-11B"
92
+
93
+ tokenizer = AutoTokenizer.from_pretrained(model)
94
+ pipeline = transformers.pipeline(
95
+ "text-generation",
96
+ model=model,
97
+ tokenizer=tokenizer,
98
+ torch_dtype=torch.bfloat16,
99
+ trust_remote_code=True,
100
+ device_map="auto",
101
+ )
102
+ sequences = pipeline(
103
+ "Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
104
+ max_length=200,
105
+ do_sample=True,
106
+ top_k=10,
107
+ num_return_sequences=1,
108
+ eos_token_id=tokenizer.eos_token_id,
109
+ )
110
+ for seq in sequences:
111
+ print(f"Result: {seq['generated_text']}")
112
+
113
+ ```
114
+
115
+ ## Training Details
116
+
117
+ ### Training Data
118
+
119
+ Falcon-11B was trained over 5,000B tokens of [RefinedWeb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb), a high-quality filtered and deduplicated web dataset which we enhanced with curated corpora. It followed a 4 stage training strategy. The first three stages being focused on increasing the context length, from to 2048 to 4096 and finally to 8192 tokens. The last stage aimed to further enhance performance using only high quality data.
120
+
121
+ Overall, the data sources included RefinedWeb-English, Refined Web-Europe (en, de, es, fr, it, pt, pl, nl, ro, sv, cs), high quality technical data, code data, and conversational data extracted from public sources.
122
+
123
+
124
+ | Technical | 2% | 20B | arXiv, PubMed, USPTO, etc. |
125
+
126
+ The training stages were as follows:
127
+
128
+ | **Stage** | **Context length** | ** Tokens** |
129
+ |--------------|-----------------|-------------|
130
+ | Stage 1 | 2048 | 4500B |
131
+ | Stage 2 | 4096 | 250B |
132
+ | Stage 3 | 8192 | 250B |
133
+ | Stage 4 | 8192 | 240B |
134
+
135
+
136
+ The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[11B](https://huggingface.co/tiiuae/falcon-11B) tokenizer.
137
+
138
+ ### Training Procedure
139
+
140
+ Falcon-11B was trained on 1024 A100 40GB GPUs, using a 3D parallelism strategy (TP=8, PP=1, DP=128) combined with ZeRO.
141
+
142
+ #### Training Hyperparameters
143
+
144
+ | **Hyperparameter** | **Value** | **Comment** |
145
+ |--------------------|------------|-------------------------------------------|
146
+ | Precision | `bfloat16` | |
147
+ | Optimizer | AdamW | |
148
+ | Max learning rate | 3.7e-4 | Following a linear warm=up, then cosine decay to 1.89e-5 across 4500 B tokens. |
149
+ | Weight decay | 1e-1 | |
150
+ | Z-loss | 1e-4 | |
151
+ | Batch size | Variable | Batch size was gradually increased duringthe training |
152
+
153
+
154
+ #### Speeds, Sizes, Times
155
+
156
+ The model training took roughly two months.
157
+
158
+
159
+ ## Evaluation
160
+
161
+ |English Benchmark | **Value** | **Comment** |
162
+ |--------------------|------------|-------------------------------------------|
163
+ | HellaSwag-10shots | 82.91 | |
164
+ | Winogrande-5shots | 78.30 | |
165
+ | ARC-Challenge-25shots | 59.73 | |
166
+ | TruthfulQA-0shot | 52.56 | |
167
+ | MMLU-5shots | 58.37 | |
168
+ | GSM8k-5shots | 53.83 | |
169
+ | ARC-Challenge-0shot | 50.17 | |
170
+ | ARC-Easy-0shot | 77.78 | |
171
+
172
+ We thank the leaderboard team from HuggingFace for providing an official evaluation of our model on the leaderboard tasks.
173
+
174
+ ## Technical Specifications
175
+
176
+ ### Model Architecture and Objective
177
+
178
+ Falcon-11B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
179
+
180
+ The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
181
+
182
+ * **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
183
+ * **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
184
+ * **Decoder-block:** parallel attention/MLP with a two layer norms.
185
+
186
+ For multiquery, we are using an internal variant which uses independent key and values per tensor parallel degree.
187
+
188
+ | **Hyperparameter** | **Value** | **Comment** |
189
+ |--------------------|-----------|----------------------------------------|
190
+ | Layers | 60 | |
191
+ | `d_model` | 4096 | |
192
+ | `head_dim` | 128 | |
193
+ | Vocabulary | 65024 | |
194
+ | Sequence length | 8192 | During stages 3 and 4 |
195
+
196
+ ### Compute Infrastructure
197
+
198
+ #### Hardware
199
+
200
+ Falcon-11B was trained on AWS SageMaker, using on average 1024 A100 40GB GPUs in 128 p4d instances.
201
+
202
+ #### Software
203
+
204
+ Falcon-11B was trained a custom distributed training codebase, Gigatron. It uses a 3D parallelism approach combined with ZeRO and high-performance Triton kernels (FlashAttention2, etc.)
205
+
206
+ ## Citation
207
+
208
+ *Paper coming soon* 😊.
209
+
210
+ ## License
211
+
212
+ Falcon2 11B is licenced under TII Falcon License 2.0, the permissive Apache 2.0-based software license which includes an acceptable use policy that promotes the responsible use of AI.
213
+
214
+ ## Contact
215
+ falconllm@tii.ae