cjvt
/

dvres commited on
Commit
89c50d0
·
verified ·
1 Parent(s): 70d4bd7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +281 -3
README.md CHANGED
@@ -1,3 +1,281 @@
1
- ---
2
- license: gemma
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ license: gemma
4
+ language:
5
+ - sl
6
+ - en
7
+ - hr
8
+ - sr
9
+ - bs
10
+ base_model:
11
+ - google/gemma-2-27b
12
+ pipeline_tag: text-generation
13
+ ---
14
+
15
+ # Model Card for GaMS-27B
16
+
17
+ GaMS-2B, GaMS-9B and GaMS-27B represent new improved and larger models of the GaMS (Generative Model for Slovene) familly. The models are based on Google's Gemma 2 familly and continually pretrained on Slovene, English and some portion of Croatian, Serbian and Bosnian corpora.
18
+
19
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/652d40a78fa1fbb0aae165bb/94gX0PG8zRB_Zg31K2y_i.png)
20
+
21
+ ## Acknowledgment
22
+
23
+ The model was developed within the [PoVeJMo](https://www.cjvt.si/povejmo/en/project/) research program (Adaptive Natural Language Processing with Large Language Models), particularly within the research project titled SloLLaMai -- Open-access computationally efficient models for Slovenian. The program is funded within the Recovery and Resilience Plan by the Slovenian Research and Innovation Agency (ARIS) and NextGenerationEU. The authors also acknowledge the financial support from the Slovenian Research and Innovation Agency (research core funding No. P6-0411 -- Language Resources and Technologies for Slovene).
24
+
25
+ We thank everyone who worked on data collection and preparation, enabling us to train our model. Special thanks go to Nikola Ljubešić, Taja Kuzman, Tjaša Arčon, Jaka Čibej, Simon Krek, Tomaž Erjavec, Iztok Kosem and Tomaž Savodnik.
26
+
27
+ ## Basic information
28
+
29
+ - **Developed by:** team of researchers at the University of Ljubljana, Faculty for Computer and Information Science. Team members: Domen Vreš, Iztok Lebar Bajec, Tjaša Arčon, Gašper Jelovčan and Marko Robnik-Šikonja.
30
+ - **Languages:** Slovene, English (primary), Croatian, Bosnian and Serbian (secondary). The model might also work for other languages supported by Gemma 2, even though it was not continually pretrained on them.
31
+ - **Base model:** [google/gemma2-27b](https://huggingface.co/google/gemma-2-27b)
32
+ - **License:** [Gemma](https://ai.google.dev/gemma/terms)
33
+
34
+ ## Usage
35
+
36
+ The model can be run through `pipeline` API using the following code:
37
+
38
+ ```python
39
+ from transformers import pipeline
40
+
41
+ model_id = "cjvt/GaMS-27B"
42
+
43
+ pline = pipeline(
44
+ "text-generation",
45
+ model=model_id,
46
+ device_map="cuda" # replace with "mps" to run on a Mac device
47
+ )
48
+
49
+ prompts = [
50
+ "The examples of antonyms are:\nhigh => low\nwide => narrow\nbig =>",
51
+ "Pristanek je bil prvi nadzorovani spust ameriškega vesoljskega plovila na površje Lune po Apollu 17 leta 1972, ko je na Luni pristala zadnja Nasina misija s posadko.\nDoslej so na Luni pristala vesoljska plovila le iz štirih drugih držav –",
52
+ "U četvrtak je bila prva polufinalna večer Dore, a komentari na društvenim mrežama ne prestaju. U nedjeljno finale prošli su:"
53
+ ]
54
+
55
+ sequences = pline(
56
+ prompts,
57
+ max_new_tokens=512,
58
+ num_return_sequences=1
59
+ )
60
+
61
+ for seq in sequences:
62
+ print("--------------------------")
63
+ print(f"Result: {seq[0]['generated_text']}")
64
+ print("--------------------------\n")
65
+ ```
66
+
67
+ For multi GPU inference set the `device_map` to `auto`:
68
+
69
+ ```python
70
+ from transformers import pipeline
71
+
72
+ model_id = "cjvt/GaMS-27B"
73
+
74
+ pline = pipeline(
75
+ "text-generation",
76
+ model=model_id,
77
+ device_map="auto"
78
+ )
79
+
80
+ prompts = [
81
+ "The examples of antonyms are:\nhigh => low\nwide => narrow\nbig =>",
82
+ "Pristanek je bil prvi nadzorovani spust ameriškega vesoljskega plovila na površje Lune po Apollu 17 leta 1972, ko je na Luni pristala zadnja Nasina misija s posadko.\nDoslej so na Luni pristala vesoljska plovila le iz štirih drugih držav –",
83
+ "U četvrtak je bila prva polufinalna večer Dore, a komentari na društvenim mrežama ne prestaju. U nedjeljno finale prošli su:"
84
+ ]
85
+
86
+ sequences = pline(
87
+ prompts,
88
+ max_new_tokens=512,
89
+ num_return_sequences=1
90
+ )
91
+
92
+ for seq in sequences:
93
+ print("--------------------------")
94
+ print(f"Result: {seq[0]['generated_text']}")
95
+ print("--------------------------\n")
96
+ ```
97
+
98
+ ## Data
99
+
100
+ ### CPT Data
101
+
102
+ Model was continually pre-trained in two stages. In the first stage, parallel English-Slovene (and Croatian in some cases) corpora was used to align the languages. In the second stage, the model was trained on separate English, Slovene, Croatian, Bosnian and Serbian corpora.
103
+
104
+ #### Parallel alignment corpora
105
+
106
+ | Corpus | Alignment level | # Tokens | Percentage |
107
+ | :----- | :------- | :------: | :--------: |
108
+ | KAS Abstracts | Document level | 31 M | 1.65 % |
109
+ | DGT | Separate documents | 697 M | 36.56 % |
110
+ | MaCoCu Parallel | Separate documents | 430 M | 22.53 % |
111
+ | CC-News | Paragraph level | 749 M | 39.25 % |
112
+ | Total | | 1.91 B | |
113
+
114
+ Explanation of each alignment level:
115
+ - Document level: Parallel documents were concatenated into a single document
116
+ - Separate documents: Parallel documents were not explicitly aligned
117
+ - Paragraph level: Paragraphs of parallel documents were concatenated (the first paragraph of Slovene/English document was followed by the first paragraph in the other language, which was then followed by the second paragraph in the first language and so on)
118
+
119
+ #### Second stage corpora
120
+
121
+ | Corpus | Language | # Tokens | Percentage |
122
+ | :----- | :------- | :------: | :--------: |
123
+ | [KAS](https://www.clarin.si/repository/xmlui/handle/11356/1448) | Slovene | 2.77 B | 20.34 % |
124
+ | [MetaFida](https://www.clarin.si/repository/xmlui/handle/11356/1775)* | Slovene | 4.66 B | 34.18 % |
125
+ | [Wikipedia-En](https://huggingface.co/datasets/zidsi/wikipedia_markdown) (Date: January 23rd 2025) | English | 5.45 B | 39.99 % |
126
+ | [Wikipedia-Sl](https://huggingface.co/datasets/zidsi/wikipedia_markdown) (Date: January 1st 2025) | Slovene | 0.16 B | 1.19 % |
127
+ | [Wikipedia-Hr](https://huggingface.co/datasets/zidsi/wikipedia_markdown) (Date: January 1st 2025) | Croatian | 0.15 B | 1.13 % |
128
+ | [Wikipedia-Bs](https://huggingface.co/datasets/zidsi/wikipedia_markdown) (Date: January 1st 2025) | Bosnian | 0.07 B | 0.50 % |
129
+ | [Wikipedia-Sr-Latin](https://huggingface.co/datasets/zidsi/wikipedia_markdown)* | Serbian | 0.36 B | 2.68 % |
130
+ | Total | | 13.62 B | |
131
+
132
+ Remarks:
133
+ - The following corpora was excluded from MetaFida: dgt15_sl, classlawiki_sl, tweet_sl, janes_tweet, janes_forum, janes_news
134
+ - Serbian Wikipedia was converted from Cyrillic to Latin
135
+
136
+ ## Training
137
+
138
+ The model was continually pre-trained on the Booster partition of [Leonardo HPC](https://www.hpc.cineca.it/systems/hardware/leonardo/) using [NVIDIA NeMo 2.0 framework](https://github.com/NVIDIA/NeMo). The model was trained in BF16-Mixed precision using tensor parallelism across 8 GPUs, sequence parallelism, and activation recomputation. The model was trained across 32 nodes, each containing 4 A100 64GB GPUs. The parallel alignment training took approximately 8 hours and second stage took approximately 110 hours.
139
+
140
+ The model was trained using a cosine learning rate scheduler with linear warmup and the following hyperparameters.
141
+
142
+ **Parallel alignment**:
143
+ - warmup steps: 150
144
+ - minimal learning rate: 5e-6
145
+ - maximal learning rate: 2e-5
146
+ - constant steps: 0
147
+ - batch size: 512 (4 million tokens)
148
+
149
+ **Second stage**:
150
+ - warmup steps: 500
151
+ - minimal learning rate: 5e-6
152
+ - maximal learning rate: 5e-5
153
+ - constant steps: 100
154
+ - batch size: 512 (4 million tokens)
155
+
156
+ ## Evaluation
157
+
158
+ The models were evaluated using [Slovene SuperGLUE](https://slobench.cjvt.si/leaderboard/view/3) collection of classification tasks on [SloBench](https://slobench.cjvt.si). Additionally, we evaluated our models on [Slovenian-LLM-Eval](https://huggingface.co/datasets/cjvt/slovenian-llm-eval).
159
+
160
+ Code for evaluation:
161
+ - [SloBench tasks](https://github.com/SloLama/slobench_evaluation)
162
+ - [Slovenian-LLM-Eval](https://github.com/SloLama/slovenian-llm-eval)
163
+
164
+ ### Slovenian-LLM-Eval results
165
+
166
+ Comparison between GaMS models, base Gemma 2 models and SlovenianGPT (open source model for Slovene based on Mistral 7B) is shown in the figure below. All models were evaluated in 0-shot scenario.
167
+
168
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/652d40a78fa1fbb0aae165bb/tDyAjB2dgYXv1dLpFHikd.png)
169
+
170
+ ### Slobench Results
171
+
172
+ GaMS 2B, 9B and 27B models were evaluated in 3-shot scenario, except for MultiRC and translation tasks, where 0-shot was used. GaMS-9B-Instruct was evaluated in 0-shot scenarion on all tasks. We used guided decoding to ensure the correct format of the responses.
173
+
174
+ #### Slovene SuperGLUE
175
+
176
+ | Rank | Title | Average | BoolQ Accuracy | CB Accuracy | CB F1 Score | CB Average | COPA Accuracy | MultiRC EM | MultiRC F1a Score | MultiRC Average | RTE Accuracy | WSC Accuracy |
177
+ |------|------------------------|---------|---------------|-------------|-------------|------------|--------------|------------|----------------|----------------|-------------|-------------|
178
+ | 1 | GaMS-27B | 0.7601 | 0.8333 | 0.6440 | 0.5864 | 0.6152 | 0.9540 | 0.3904 | 0.7504 | 0.5704 | 0.7931 | 0.7945 |
179
+ | 2 | PrešernGPT 0.1 | 0.7568 | 0.8333 | 0.8520 | 0.5868 | 0.7194 | 0.9740 | 0.4985 | 0.8061 | 0.6523 | 0.8276 | 0.5342 |
180
+ | 3 | Gemma 2 27B | 0.7546 | 0.8333 | 0.6680 | 0.5972 | 0.6326 | 0.9140 | 0.4174 | 0.7295 | 0.5735 | 0.8276 | 0.7466 |
181
+ | 4 | GaMS-9B | 0.7309 | 0.7000 | 0.8400 | 0.7955 | 0.8178 | 0.9000 | 0.3243 | 0.6551 | 0.4897 | 0.7931 | 0.6849 |
182
+ | 5 | GaMS-9B-Instruct | 0.6997 | 0.8000 | 0.7960 | 0.7128 | 0.7544 | 0.8140 | 0.0721 | 0.6174 | 0.3447 | 0.7931 | 0.6918 |
183
+ | 6 | Gemma 2 9B | 0.6980 | 0.8333 | 0.8240 | 0.5683 | 0.6962 | 0.8700 | 0.2282 | 0.5310 | 0.3796 | 0.7241 | 0.6849 |
184
+ | 8 | CroSloEngual BERT | 0.6078 | 0.7333 | 0.7920 | 0.7437 | 0.7679 | 0.5720 | 0.0931 | 0.5241 | 0.3086 | 0.6552 | 0.6096 |
185
+ | 11 | SlovenianGPT-Chat | 0.5078 | 0.7333 | 0.3920 | 0.3829 | 0.3874 | 0.6840 | 0.2432 | 0.4944 | 0.3688 | 0.5172 | 0.3562 |
186
+ | 12 | Gemma 2 2B | 0.4876 | 0.6333 | 0.4520 | 0.2123 | 0.3321 | 0.5180 | 0.1471 | 0.4419 | 0.2945 | 0.5862 | 0.5616 |
187
+ | 13 | GaMS-2B | 0.4790 | 0.5667 | 0.6080 | 0.4880 | 0.5480 | 0.5240 | 0.0631 | 0.5234 | 0.2932 | 0.5517 | 0.3904 |
188
+ | 14 | GaMS-1B | 0.4604 | 0.5000 | 0.6200 | 0.4565 | 0.5382 | 0.4920 | 0.1351 | 0.2675 | 0.2013 | 0.4828 | 0.5479 |
189
+ | 15 | GaMS-1B-Chat | 0.4570 | 0.8000 | 0.4880 | 0.3023 | 0.3951 | 0.4840 | 0.1081 | 0.2428 | 0.1755 | 0.5172 | 0.3692 |
190
+
191
+
192
+ ## Usage and Limitations (taken from Gemma 2)
193
+
194
+ These models have certain limitations that users should be aware of.
195
+
196
+ ### Intended Usage
197
+
198
+ Open Large Language Models (LLMs) have a wide range of applications across
199
+ various industries and domains. The following list of potential uses is not
200
+ comprehensive. The purpose of this list is to provide contextual information
201
+ about the possible use-cases that the model creators considered as part of model
202
+ training and development.
203
+
204
+ * Content Creation and Communication
205
+ * Text Generation: These models can be used to generate creative text formats
206
+ such as poems, scripts, code, marketing copy, and email drafts.
207
+ * Chatbots and Conversational AI: Power conversational interfaces for customer
208
+ service, virtual assistants, or interactive applications.
209
+ * Text Summarization: Generate concise summaries of a text corpus, research
210
+ papers, or reports.
211
+ * Research and Education
212
+ * Natural Language Processing (NLP) Research: These models can serve as a
213
+ foundation for researchers to experiment with NLP techniques, develop
214
+ algorithms, and contribute to the advancement of the field.
215
+ * Language Learning Tools: Support interactive language learning experiences,
216
+ aiding in grammar correction or providing writing practice.
217
+ * Knowledge Exploration: Assist researchers in exploring large bodies of text
218
+ by generating summaries or answering questions about specific topics.
219
+
220
+ ### Limitations
221
+
222
+ * Training Data
223
+ * The quality and diversity of the training data significantly influence the
224
+ model's capabilities. Biases or gaps in the training data can lead to
225
+ limitations in the model's responses.
226
+ * The scope of the training dataset determines the subject areas the model can
227
+ handle effectively.
228
+ * Context and Task Complexity
229
+ * LLMs are better at tasks that can be framed with clear prompts and
230
+ instructions. Open-ended or highly complex tasks might be challenging.
231
+ * A model's performance can be influenced by the amount of context provided
232
+ (longer context generally leads to better outputs, up to a certain point).
233
+ * Language Ambiguity and Nuance
234
+ * Natural language is inherently complex. LLMs might struggle to grasp subtle
235
+ nuances, sarcasm, or figurative language.
236
+ * Factual Accuracy
237
+ * LLMs generate responses based on information they learned from their
238
+ training datasets, but they are not knowledge bases. They may generate
239
+ incorrect or outdated factual statements.
240
+ * Common Sense
241
+ * LLMs rely on statistical patterns in language. They might lack the ability
242
+ to apply common sense reasoning in certain situations.
243
+
244
+ ### Ethical Considerations and Risks
245
+
246
+ The development of large language models (LLMs) raises several ethical concerns.
247
+ In creating an open model, we have carefully considered the following:
248
+
249
+ * Bias and Fairness
250
+ * LLMs trained on large-scale, real-world text data can reflect socio-cultural
251
+ biases embedded in the training material. These models underwent careful
252
+ scrutiny, input data pre-processing described and posterior evaluations
253
+ reported in this card.
254
+ * Misinformation and Misuse
255
+ * LLMs can be misused to generate text that is false, misleading, or harmful.
256
+ * Guidelines are provided for responsible use with the model, see the
257
+ [Responsible Generative AI Toolkit][rai-toolkit].
258
+ * Transparency and Accountability:
259
+ * This model card summarizes details on the models' architecture,
260
+ capabilities, limitations, and evaluation processes.
261
+ * A responsibly developed open model offers the opportunity to share
262
+ innovation by making LLM technology accessible to developers and researchers
263
+ across the AI ecosystem.
264
+
265
+ Risks identified and mitigations:
266
+
267
+ * Perpetuation of biases: It's encouraged to perform continuous monitoring
268
+ (using evaluation metrics, human review) and the exploration of de-biasing
269
+ techniques during model training, fine-tuning, and other use cases.
270
+ * Generation of harmful content: Mechanisms and guidelines for content safety
271
+ are essential. Developers are encouraged to exercise caution and implement
272
+ appropriate content safety safeguards based on their specific product policies
273
+ and application use cases.
274
+ * Misuse for malicious purposes: Technical limitations and developer and
275
+ end-user education can help mitigate against malicious applications of LLMs.
276
+ Educational resources and reporting mechanisms for users to flag misuse are
277
+ provided. Prohibited uses of Gemma models are outlined in the
278
+ [Gemma Prohibited Use Policy][prohibited-use].
279
+ * Privacy violations: Models were trained on data filtered for removal of PII
280
+ (Personally Identifiable Information). Developers are encouraged to adhere to
281
+ privacy regulations with privacy-preserving techniques.