File size: 9,128 Bytes
de1935c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
---
language:
- en
- es
license: apache-2.0
tags:
- gguf
pipeline_tag: text-generation
---

![image/png](https://huggingface.co./datasets/malteos/images/resolve/main/occiglot.medium.png)

# Occiglot-7B-ES-EN-Instruct

> A [polyglot](https://en.wikipedia.org/wiki/Multilingualism#In_individuals) language model for the [Occident](https://en.wikipedia.org/wiki/Occident).
> 

**Occiglot-7B-ES-EN-Instruct** is a the instruct version of [occiglot-7b-es-en](https://huggingface.co./occiglot/occiglot-7b-es-en), a generative language model with 7B parameters supporting the Spanish and English and trained by the [Occiglot Research Collective](https://occiglot.github.io/occiglot/).
It was trained on 160M tokens of additional multilingual and code instructions.
Note that the model was not safety aligned and might generate problematic outputs.

This is the first release of an ongoing open research project for multilingual language models. 
If you want to train a model for your own language or are working on evaluations, please contact us or join our [Discord server](https://discord.gg/wUpvYs4XvM). **We are open for collaborations!**


### Model details

- **Instruction tuned from:** [occiglot-7b-es-en](https://huggingface.co./occiglot/occiglot-7b-es-en)
- **Model type:** Causal decoder-only transformer language model
- **Languages:** English, Spanish, and code.
- **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)
- **Compute resources:** [DFKI cluster](https://www.dfki.de/en/web)
- **Contributors:** Manuel Brack, Patrick Schramowski, Pedro Ortiz, Malte Ostendorff, Fabio Barth, Georg Rehm, Kristian Kersting
- **Research labs:** [Occiglot](https://occiglot.github.io/occiglot/) with support from [SAINT](https://www.dfki.de/en/web/research/research-departments/foundations-of-systems-ai) and [SLT](https://www.dfki.de/en/web/research/research-departments/speech-and-language-technology)
- **Contact:** [Discord](https://discord.gg/wUpvYs4XvM)

### How to use

The model was trained using the chatml instruction template. You can use the transformers chat template feature for interaction.
Since the generation relies on some randomness, we
set a seed for reproducibility:

```python
>>> from transformers import AutoTokenizer, MistralForCausalLM, set_seed
>>> tokenizer = AutoTokenizer.from_pretrained("occiglot/occiglot-7b-es-en-instruct")
>>> model = MistralForCausalLM.from_pretrained('occiglot/occiglot-7b-es-en-instruct')  # You may want to use bfloat16 and/or move to GPU here
>>> set_seed(42)
>>> messages = [
>>>    {"role": "system", 'content': 'You are a helpful assistant. Please give short and concise answers.'},
>>>    {"role": "user", "content": "¿quién es el presidente del gobierno español?"},
>>> ]
>>> tokenized_chat = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_dict=False, return_tensors='pt',)
>>> set_seed(42)
>>> outputs = model.generate(tokenized_chat.to('cuda'), max_new_tokens=200,)
>>> tokenizer.decode(out[0][len(tokenized_chat[0]):])
'Actualmente el presidente del gobierno español es Pedro Sánchez Pérez-Castejón'
```

## Dataset

The training data was split evenly amongst Spanish and English based on the total number of tokens.

**English and Code**
 - [Open-Hermes-2B](https://huggingface.co./datasets/teknium/OpenHermes-2.5)


**Spanish**
 - [Mentor-ES](https://huggingface.co./datasets/projecte-aina/MentorES)
 - [Squad-es](https://huggingface.co./datasets/squad_es)
 - [OASST-2](https://huggingface.co./datasets/OpenAssistant/oasst2) (Spanish subset)
 - [Aya-Dataset](https://huggingface.co./datasets/CohereForAI/aya_dataset) (Spanish subset)

## Training settings

- Full instruction fine-tuning on 8xH100.
- 0.6 - 4 training epochs (depending on dataset sampling).
- Framework: [axolotl](https://github.com/OpenAccess-AI-Collective/axolotl)
- Precision: bf16
- Optimizer: AdamW
- Global batch size: 128 (with 8192 context length)
- Cosine Annealing with Warmup


## Tokenizer

Tokenizer is unchanged from [Mistral-7B-v0.1](https://huggingface.co./mistralai/Mistral-7B-v0.1).

## Evaluation

Preliminary evaluation results can be found below. 
Please note that the non-English results are based on partially machine-translated datasets and English prompts ([Belebele](https://huggingface.co./datasets/facebook/belebele) and [Okapi framework](https://github.com/nlp-uoregon/Okapi)) and thus should be interpreted with caution, e.g., biased towards English model performance.
Currently, we are working on more suitable benchmarks for Spanish, French, German, and Italian.

<details>
<summary>Evaluation results</summary>
  
### All 5 Languages

|                            |      avg |   arc_challenge |   belebele |   hellaswag |     mmlu |   truthfulqa |
|:---------------------------|---------:|----------------:|-----------:|------------:|---------:|-------------:|
| Occiglot-7b-eu5            | 0.516895 |        0.508109 |   0.675556 |    0.718963 | 0.402064 |     0.279782 |
| Occiglot-7b-eu5-instruct   | 0.537799 |        0.53632  |   0.691111 |    0.731918 | 0.405198 |     0.32445  |
| Occiglot-7b-es-en          | 0.483388 |        0.482949 |   0.606889 |    0.653902 | 0.398922 |     0.274277 |
| Occiglot-7b-es-en-instruct | 0.504023 |        0.494576 |   0.65     |    0.670847 | 0.406176 |     0.298513 |
| Lince-mistral-7b-it-es     | 0.543427 |        0.540222 |   0.745111 |    0.692931 | 0.426241 |     0.312629 |
| Mistral-7b-v0.1            | 0.547111 |        0.528937 |   0.768444 |    0.682516 | 0.448253 |     0.307403 |
| Mistral-7b-instruct-v0.2   | 0.56713  |        0.547228 |   0.741111 |    0.69455  | 0.422501 |     0.430262 |


### English

|                            |      avg |   arc_challenge |   belebele |   hellaswag |     mmlu |   truthfulqa |
|:---------------------------|---------:|----------------:|-----------:|------------:|---------:|-------------:|
| Occiglot-7b-eu5            | 0.59657  |        0.530717 |   0.726667 |    0.789882 | 0.531904 |     0.403678 |
| Occiglot-7b-eu5-instruct   | 0.617905 |        0.558874 |   0.746667 |    0.799841 | 0.535109 |     0.449    |
| Occiglot-7b-es-en          | 0.593609 |        0.543515 |   0.697778 |    0.788289 | 0.548355 |     0.390109 |
| Occiglot-7b-es-en-instruct | 0.615707 |        0.552048 |   0.736667 |    0.797451 | 0.557328 |     0.435042 |
| Leo-mistral-hessianai-7b   | 0.600949 |        0.522184 |   0.736667 |    0.777833 | 0.538812 |     0.429248 |
| Mistral-7b-v0.1            | 0.668385 |        0.612628 |   0.844444 |    0.834097 | 0.624555 |     0.426201 |
| Mistral-7b-instruct-v0.2   | 0.713657 |        0.637372 |   0.824444 |    0.846345 | 0.59201  |     0.668116 |

### Spanish

|                            |      avg |   arc_challenge_es |   belebele_es |   hellaswag_es |   mmlu_es |   truthfulqa_es |
|:---------------------------|---------:|-------------------:|--------------:|---------------:|----------:|----------------:|
| Occiglot-7b-eu5            | 0.533194 |           0.508547 |      0.676667 |       0.725411 |  0.499325 |        0.25602  |
| Occiglot-7b-eu5-instruct   | 0.548155 |           0.535043 |      0.68     |       0.737039 |  0.503525 |        0.285171 |
| Occiglot-7b-es-en          | 0.527264 |           0.529915 |      0.627778 |       0.72253  |  0.512749 |        0.243346 |
| Occiglot-7b-es-en-instruct | 0.5396   |           0.545299 |      0.636667 |       0.734372 |  0.524374 |        0.257288 |
| Lince-mistral-7b-it-es     | 0.547212 |           0.52906  |      0.721111 |       0.687967 |  0.512749 |        0.285171 |
| Mistral-7b-v0.1            | 0.554817 |           0.528205 |      0.747778 |       0.672712 |  0.544023 |        0.281369 |
| Mistral-7b-instruct-v0.2   | 0.568575 |           0.54188  |      0.73     |       0.685406 |  0.511699 |        0.373891 |

</details>

## Acknowledgements

The pre-trained model training was supported by a compute grant at the [42 supercomputer](https://hessian.ai/) which is a central component in the development of [hessian AI](https://hessian.ai/), the [AI Innovation Lab](https://hessian.ai/infrastructure/ai-innovationlab/) (funded by the [Hessian Ministry of Higher Education, Research and the Art (HMWK)](https://wissenschaft.hessen.de) & the [Hessian Ministry of the Interior, for Security and Homeland Security (HMinD)](https://innen.hessen.de)) and the [AI Service Centers](https://hessian.ai/infrastructure/ai-service-centre/) (funded by the [German Federal Ministry for Economic Affairs and Climate Action (BMWK)](https://www.bmwk.de/Navigation/EN/Home/home.html)).
The curation of the training data is partially funded by the [German Federal Ministry for Economic Affairs and Climate Action (BMWK)](https://www.bmwk.de/Navigation/EN/Home/home.html)
through the project [OpenGPT-X](https://opengpt-x.de/en/) (project no. 68GX21007D).


## License

[Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)

## See also

- https://huggingface.co./collections/occiglot/occiglot-eu5-7b-v01-65dbed502a6348b052695e01
- https://huggingface.co./NikolayKozloff/occiglot-7b-es-en-GGUF