[!TIP]
🚀 Looking for the fast GGUF version? You can find it, and how to use it with ollama, here. 🚀
Citation
If you use GEITje 7B Ultra (SFT) or any of its derivatives or quantizations, place cite the following paper:
bibtex
1@misc{vanroy2024geitje7bultraconversational,
2 title={GEITje 7B Ultra: A Conversational Model for Dutch},
3 author={Bram Vanroy},
4 year={2024},
5 eprint={2412.04092},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2412.04092},
9}
Model description
This is a Dutch instruction/chat model ultimately based on Mistral and aligned with AI feedback via DPO. It is a DPO continuation of the SFT trained BramVanroy/GEITje-7B-ultra-sft, which in turn is based on Rijgersberg/GEITje-7B, which in turn is based on Mistral 7B and further pretrained on Dutch data. In (rather naive) benchmarks it outperforms all the original GEITje models on average (but barely). However, note that these benchmarks should be taken with a massive grain of salt (see the disclaimer below the benchmarks on that page). The best evaluation is to try the models and see for yourself.
Usage
One-off:
python
1from transformers import pipeline, Conversation
23# load_in_8bit: lower precision but saves a lot of GPU memory4# device_map=auto: loads the model across multiple GPUs5chatbot = pipeline("conversational", model="BramVanroy/GEITje-7B-ultra", model_kwargs={"load_in_8bit":True}, device_map="auto")67start_messages =[8{"role":"system","content":"Je bent een grappige chatbot die Bert heet. Je maakt vaak mopjes."},9{"role":"user","content":"Hallo, ik ben Bram. Ik wil vanavond graag een film kijken. Heb je enkele suggesties?"}10]11conversation = Conversation(start_messages)12conversation = chatbot(conversation)13response = conversation.messages[-1]["content"]14print(response)
Interactive conversation:
python
1from transformers import pipeline, Conversation
23# load_in_8bit: lower precision but saves a lot of memory4# device_map=auto: loads the model across multiple GPUs5# attn_implementation: uses flash attention, if your device supports it - otherwise remove it6chatbot = pipeline("conversational", model="BramVanroy/GEITje-7B-ultra", model_kwargs={"load_in_8bit":True,"attn_implementation":"flash_attention_2"}, device_map="auto")78while(system_message :=input("System message ('q' to quit): "))!="q":9 start_messages =[10{"role":"system","content": system_message},11]12 conversation = Conversation(start_messages)13while(user_input :=input("User ('r' to reset): "))!="r":14 conversation.add_user_input(user_input)15 conversation = chatbot(conversation)16 response = conversation.messages[-1]["content"]17print("Assistant:", response)18
Intended uses & limitations
Although the model has been aligned with gpt-4-turbo output, which has strong content filters, the model could still generate wrong, misleading, and potentially even offensive content. Use at your own risk.
Because the model was trained on synthetic data created with OpenAI/Azure services, this model cannot be used for commercial purposes.
Training and evaluation data
The training data consists of a synthetic dataset based on UltraFeedback binarized created with gpt-4-turbo and geitje-chat. A given prompt, translated from the original dataset, is given to the two models who then generated an answer. Then, gpt-4-turbo is always selected as the best answer which DPO will optimise for. While this is not completely fair, I did not have the budget to actually have gpt-4 rate both replies. Furthermore, while an impressive model, GEITje chat still seems behind gpt-4-turbo in the testing that I have done.
In total the dataset consists of 56,137,090 tokens (combination of prompt + rejected + chosen) and a test set of 6,178,969 tokens (11.00%).
Training procedure
The great alignment handbook was used for training, with a custom slurm script for compatibility with our cluster. It was trained in full, without LoRA or other adapters.
The model was trained in bfloat16 with flash attention 2 on two nodes of four A100 80GB each for around 11 hours. I thank the Flemish Super Computer for their compute.
For conversational usage, the model relies on the Zephyr chat template, which is compatible with system messages. A small portion of the data of *-sft contained system messages, so it is assumed the model can handle system messages at least a little bit.
In earlier iterations I found that using the alignment handbook's defaults (beta=0.01) led to poor results (hallucinations of random tokens). After investigating, it seems that such a low beta does not work well for this dataset as it gives the model too much room to deviate from its initial base model. After a hyperparameter search and manual analysis of the resulting metrics, I selected the current model as the best one, with a beta of 0.1.
Recipe used with the handbook:
yaml
1# Model arguments2model_name_or_path: BramVanroy/GEITje-7B-ultra-sft
3model_revision: main
4torch_dtype: bfloat16
5use_flash_attention_2:true67# Data training arguments8# For definitions, see: src/h4/training/config.py9dataset_mixer:10BramVanroy/ultra_feedback_dutch:1.011dataset_splits:12- train_prefs
13- test_prefs
14preprocessing_num_workers:81516# DPOTrainer arguments17bf16:true18beta:0.119do_eval:true20evaluation_strategy: steps
21eval_steps:10022gradient_accumulation_steps:423gradient_checkpointing:true24gradient_checkpointing_kwargs:25use_reentrant:False26hub_model_id: BramVanroy/GEITje-ultra
27learning_rate:5.0e-728log_level: info
29logging_steps:1030lr_scheduler_type: cosine
31max_length:204832max_prompt_length:153633num_train_epochs:134optim: adamw_torch
35output_dir: data/GEITje-ultra
36per_device_train_batch_size:437per_device_eval_batch_size:438push_to_hub:true39save_strategy:"steps"40save_steps:10041save_total_limit:342seed:4243warmup_ratio:0.1
Training hyperparameters
The following hyperparameters were used during training:
learning_rate: 5e-07
train_batch_size: 4
eval_batch_size: 4
seed: 42
distributed_type: multi-GPU
num_devices: 8
gradient_accumulation_steps: 4
total_train_batch_size: 128
total_eval_batch_size: 32
optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08