INSAIT introduces BgGPT-Gemma-2-9B-IT-v1.0, a state-of-the-art Bulgarian language model based on google/gemma-2-9b and google/gemma-2-9b-it.
BgGPT-Gemma-2-9B-IT-v1.0 is free to use and distributed under the Gemma Terms of Use.
This model was created by INSAIT, part of Sofia University St. Kliment Ohridski, in Sofia, Bulgaria.
Model description
The model was built on top of Google’s Gemma 2 9B open models.
It was continuously pre-trained on around 100 billion tokens (85 billion in Bulgarian) using the Branch-and-Merge strategy INSAIT presented at EMNLP’24,
allowing the model to gain outstanding Bulgarian cultural and linguistic capabilities while retaining its English performance.
During the pre-training stage, we use various datasets, including Bulgarian web crawl data, freely available datasets such as Wikipedia, a range of specialized Bulgarian datasets sourced by the INSAIT Institute,
and machine translations of popular English datasets.
The model was then instruction-fine-tuned on a newly constructed Bulgarian instruction dataset created using real-world conversations.
For more information check our blogpost.
Benchmarks and Results
image/png
image/png
We evaluate our models on a set of standard English benchmarks, a translated version of them in Bulgarian, as well as, Bulgarian specific benchmarks we collected:
Winogrande challenge: testing world knowledge and understanding
Hellaswag: testing sentence completion
ARC Easy/Challenge: testing logical reasoning
TriviaQA: testing trivia knowledge
GSM-8k: solving multiple-choice questions in high-school mathematics
Exams: solving high school problems from natural and social sciences
MON: contains exams across various subjects for grades 4 to 12
These benchmarks test logical reasoning, mathematics, knowledge, language understanding and other skills of the models and are provided at https://github.com/insait-institute/lm-evaluation-harness-bg.
The graphs above show the performance of BgGPT 9B and BgGPT 27B compared to other large open models. The results show the excellent abilities of both 9B and 27B models in Bulgarian, which allow them to outperform much larger models,
including Alibaba’s Qwen 2.5 72B and Meta’s Llama3.1 70B. Further, both BgGPT 9B and BgGPT 27B significantly improve upon the previous version of BgGPT based on Mistral-7B (BgGPT-7B-Instruct-v0.2, shown in grey in the figure).
Finally, our models retain the excellent English performance inherited from the original Google Gemma 2 models upon which they are based.
Use in 🤗 Transformers
First install the latest version of the transformers library:
In principle, increasing temperature should work adequately as well.
Instruction format
In order to leverage instruction fine-tuning, your prompt should begin with a beginning-of-sequence token <bos> and be formatted in the Gemma 2 chat template. <bos> should only be the first token in a chat sequence.
E.g.
<bos><start_of_turn>user
Кога е основан Софийският университет?<end_of_turn>
<start_of_turn>model
This format is also available as a chat template via the apply_chat_template() method:
python
1tokenizer = AutoTokenizer.from_pretrained(2"INSAIT-Institute/BgGPT-Gemma-2-9B-IT-v1.0",3 use_default_system_prompt=False,4)56messages =[7{"role":"user","content":"Кога е основан Софийският университет?"},8]910input_ids = tokenizer.apply_chat_template(11 messages,12 return_tensors="pt",13 add_generation_prompt=True,14 return_dict=True15)1617outputs = model.generate(18**input_ids,19 generation_config=generation_params
20)21print(tokenizer.decode(outputs[0]))22
Important Note: Models based on Gemma 2 such as BgGPT-Gemma-2-9B-IT-v1.0 do not support flash attention. Using it results in degraded performance.