Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,101 @@
|
|
1 |
---
|
2 |
license: bigscience-bloom-rail-1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: bigscience-bloom-rail-1.0
|
3 |
+
datasets:
|
4 |
+
- ehartford/wizard_vicuna_70k_unfiltered
|
5 |
+
- shahules786/orca-chat
|
6 |
+
- timdettmers/openassistant-guanaco
|
7 |
+
- laion/OIG
|
8 |
+
language:
|
9 |
+
- fr
|
10 |
+
- en
|
11 |
+
library_name: transformers
|
12 |
+
pipeline_tag: text-generation
|
13 |
+
widget:
|
14 |
+
- text: </s>Bonjour, qui es-tu ?<s>
|
15 |
+
- text: </s>Hello, who are you?<s>
|
16 |
---
|
17 |
+
|
18 |
+
bloomz-7b1-mt-sft-chat
|
19 |
+
--------------------
|
20 |
+
We introduce the bloomz-7b1-mt-sft-chat model, which is a fine-tuning of a Large Language Model (LLM) [bigscience/bloomz-7b1-mt](https://huggingface.co/bigscience/bloomz-7b1-mt). This model is notable for being pre-trained for a chatbot context and undergoing a transposition from float16 to bfloat16. Therefore, this model serves as a solid starting point for fine-tuning towards other more specific tasks.
|
21 |
+
|
22 |
+
The model was trained equally on both French and English data, ensuring maximum efficiency for these two languages (and their interactions). Due to the transition from float16 to bfloat16, we do not guarantee the preservation of the original model's multilingual capabilities. However, fine-tuning can restore reasonable performance on other languages.
|
23 |
+
|
24 |
+
The objective is to pre-train all three models (Bloomz-{560m, 3b, 7b1-mt}-sft-chat) to ensure high-performing, energy-efficient, and fast "foundation" models for inference on "realistic" infrastructures suitable for a business with standard industrial capabilities.
|
25 |
+
|
26 |
+
|
27 |
+
Bloomz, through its license, enables free and flexible industrial use. Its tokenizer has been designed with true multi-lingual context in mind, with a significantly lower token generation per word compared to other LLM models. This capability not only leads to improved performance but also enhanced efficiency during inference by making fewer model calls when generating text with shorter contexts. Here is a table illustrating our points using French as an example, where we tokenized Marcel Proust's longest sentence (823 words):
|
28 |
+
```
|
29 |
+
Sans honneur que précaire, sans liberté que provisoire, [...], et de façon qu’à eux-mêmes il ne leur paraisse pas un vice.
|
30 |
+
```
|
31 |
+
|
32 |
+
| model | GPT 3.5 | Boris | Flan-T5 | LLaMA | Dolly | MPT | Falcon | Bloomz |
|
33 |
+
|:--------------:|:-------:|:-----:|:-------:|:-----:|:-----:|:---:|:------:|:------:|
|
34 |
+
| tokens by word | 2.3 | 2.3 | 2 | 1.9 | 1.9 | 1.9 | 1.8 | 1.4 |
|
35 |
+
|
36 |
+
|
37 |
+
For comparison, with a specialized French tokenizer like [CamemBERT](https://huggingface.co/camembert/camembert-base) or [DistilCamemBERT](cmarkea/distilcamembert-base), we have 1.5 tokens per word. In addition to its positive impact on inference time and resource consumption, there has already been a demonstrated direct relationship between the number of tokens per word required for modeling and the predictive performance of the model [1].
|
38 |
+
|
39 |
+
Dataset
|
40 |
+
-------
|
41 |
+
After analyzing a substantial set of modelings, we have observed that the most effective pre-training for zero-shot use cases is pre-training for chatbot contexts. This study was conducted internally, focusing specifically on the French context. As a result, we trained the model on a dataset comprising 0.9 billion tokens. This dataset consists of interactions between an individual and a third party. To balance the French and English data, we utilized the Google Translate API.
|
42 |
+
|
43 |
+
Training
|
44 |
+
--------
|
45 |
+
Here is the table summarizing the architecture used for training, along with the training time and average inference speed per token on the target architecture in tokens per second:
|
46 |
+
|
47 |
+
| model | Architecture | Training time (h) | Inference speed (tokens per second) |
|
48 |
+
|:----------------------:|:-------------:|:-----------------:|:-----------------------------------:|
|
49 |
+
| [bloomz-560m-sft-chat](https://huggingface.co/cmarkea/bloomz-560m-sft-chat) | 1 x A100 40GB | 41 | 29 |
|
50 |
+
| [bloomz-3b-sft-chat](https://huggingface.co/cmarkea/bloomz-3b-sft-chat) | 1 x A100 40GB | 140 | 13 |
|
51 |
+
| [bloomz-7b1-mt-sft-chat](https://huggingface.co/cmarkea/bloomz-7b1-mt-sft-chat) | 4 x A100 40GB | 268 | 8 |
|
52 |
+
|
53 |
+
Experimentations
|
54 |
+
----------------
|
55 |
+
Since the model is trained only on English and French corpora, the performance of the model cannot be guaranteed in other languages. This degradation in performance in other languages is also due to the change in the model's data type from float16 to bfloat16. The conversation example below illustrates this point:
|
56 |
+
|
57 |
+
| French | English | Spanish |
|
58 |
+
|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
59 |
+
| **human:** C'est quoi la première guerre mondiale ?<br>**bot:** La Première Guerre mondiale a eu lieu entre 1914 et 1918. C'était une guerre entre les puissances européennes, principalement la France, l'Allemagne et la Grande-Bretagne.<br>**human:** Y a-t-il eu également d’autres pays impliqués ?<br>**bot:** Oui, il y avait également des pays comme l'Italie, les États-Unis, la Russie et la Turquie.<br>**human:** Comment cela s'est-il fini et quels ont été ses impacts ?<br>**bot:** La Première Guerre mondiale s'est terminée par un accord de paix appelé le Traité de Versailles. Il a mis fin à la guerre et a établi un nouvel ordre mondial.<br>**human:** Combien y a-t-il eu de mort ?<br>**bot:** Il y a eu environ 10 millions de morts, principalement des soldats.<br>**human:** Et combien de mort civile ?<br>**bot:** Il y a eu environ 5 millions de morts civils, principalement des civils.<br>**human:** Tu es certain de ce chiffre, ça me parait peu...<br>**bot:** Je suis sûr de ce chiffre. | **human:** What is the first world war?<br>**bot:** The first world war was a war that took place between 1914 and 1918.<br>**human:** Which countries participated in this war?<br>**bot:** he countries that participated in the first world war were the United Kingdom, France, Belgium, the Netherlands, Italy, Austria-Hungary, Serbia, Montenegro, Bulgaria, Greece, Romania, Albania, and the Ottoman Empire.<br>**human:** How did it end and what were its impacts?<br>**bot:** The first world war ended with the Treaty of Versailles, which was signed on 28 June 1919. The Treaty of Versailles was a peace treaty that ended the war and established the international system that we know today.<br>**human:** How many deaths?<br>**bot:** The first world war resulted in approximately 50 million deaths, with approximately 30 million of those deaths occurring in the European Theater.<br>**human:** That seems a bit much to me, are you sure of these numbers?<br>**bot:** Yes, I am. | **human:** ¿Qué es la Primera Guerra Mundial?<br>**bot:** La Primera Guerra Mundial fue un conflicto bélico que ocurrió entre 1914 y 1918.<br>**human:** ¿En qué países participamos?<br>**bot:** La Primera Guerra Mundial involucró a muchos países, incluidos Alemania, Austria-Hungría, Bélgica, Bulgaria, Checoslovaquia, Francia, Gran Bretaña, Italia, Japón, Luxemburgo, Noruega, los Países Bajos, Portugal, Serbia, España, Turquía y Estados Unidos.<br>**human:** ¿Cuántas muertes?<br>**bot:** La Primera Guerra Mundial dejó más de 10 millones de muertes.<br>**human:** ¿Y cuántas muertes de civiles?<br>**bot:** La Primera Guerra Mundial dejó más de 5 millones de muertes de civiles.<br>**human:** ¿Estás seguro? Eso no me parece mucho.<br>**bot:** No, no estoy seguro. |
|
60 |
+
|
61 |
+
Evaluating the performance of generative models can be challenging, and quantitative measures may not always provide the most relevant insights for this type of approach. In this regard, we conducted a qualitative performance study. It involves assessing the relevance of model responses to a pool of French questions using blind evaluators. The metric used for evaluation is the average of two criteria: response accuracy and completeness, similar to what the SSA metric aims to capture. Please note that this measure lacks rigorous scientific validity due to the limited number of questions in the test dataset and the fact that it involves only a few individuals with similar socio-demographic characteristics. The prompts take the same format for all models:
|
62 |
+
```
|
63 |
+
[Instruction]
|
64 |
+
Question : [Question]
|
65 |
+
Réponse :
|
66 |
+
```
|
67 |
+
As a result, the prompts do not exploit the structures of chatbot models to ensure fairness, and the evaluation quantifies performance in a purely instruction-based approach. The figure below illustrates the results. The higher a model is positioned in the top-left corner with a small circle radius, the better the model; conversely, if a model is towards the bottom-right with a large circle, it performs less favorably.
|
68 |
+
|
69 |
+
We observe that across all models, the performance gain is logarithmic in relation to the increase in model parameters. However, for models that undergo multiple pre-trainings (vanilla, instruction, and chat), models pre-trained on instruction and chat perform significantly better in zero-shot contexts, with a notable improvement for chat-based approaches. The models we have trained demonstrate promising efficiency in this test compared to the number of parameters, indicating cost-effectiveness in a production context.
|
70 |
+
|
71 |
+
How to use bloomz-7b1-mt-sft-chat
|
72 |
+
-------------------------------
|
73 |
+
|
74 |
+
There are no specific instructions for using these models in a normal causal inference context. However, to leverage the chatbot capability of the model, an individual's prompt should be preceded by the EOS token (</s>), and the generated part should be preceded by the BOS token (<s>). The structure takes the following form:
|
75 |
+
```
|
76 |
+
</s>[human prompt 1]<s>[bot answer 1]</s>[human prompt 2]<s>
|
77 |
+
```
|
78 |
+
For example, to load the model using the HuggingFace pipeline interface:
|
79 |
+
```python
|
80 |
+
from transformers import pipeline
|
81 |
+
|
82 |
+
model = pipeline("text-generation", "cmarkea/bloomz-7b1-mt-sft-chat")
|
83 |
+
result = model("</s>Que veut dire NLP ?<s>", max_new_tokens=512)
|
84 |
+
|
85 |
+
result
|
86 |
+
[{'generated_text': "</s>Que veut dire NLP ?<s>NLP est un acronyme pour «\xa0Neurolinguistique\xa0». Il s'agit d'une branche de la psychologie qui étudie les processus cognitifs et la communication humaine."}]
|
87 |
+
|
88 |
+
result = model("</s>Que veut dire NLP en machine learning ?<s>", max_new_tokens=512)
|
89 |
+
```
|
90 |
+
|
91 |
+
Citation
|
92 |
+
--------
|
93 |
+
|
94 |
+
```bibtex
|
95 |
+
@online{DeBloomzChat,
|
96 |
+
AUTHOR = {Cyrile Delestre},
|
97 |
+
URL = {https://huggingface.co/cmarkea/bloomz-7b1-mt-sft-chat},
|
98 |
+
YEAR = {2023},
|
99 |
+
KEYWORDS = {NLP ; Transformers ; Bloomz},
|
100 |
+
}
|
101 |
+
```
|