German-RAG (German Retrieval Augmented Generation) models are designed for the German-speaking market, enabling innovation and AI solutions to drive German research collaboration in business-focused Generative AI by 2025
Our German-RAG-NEMP-ORPO model are trained on this German-RAG-ORPO dataset.
Model Details
The core models released in this batch are the following:
Quickly get inference running with the following required installation:
Now, proceed as usual with HuggingFace:
python
1from transformers import AutoModelForCausalLM, AutoTokenizer
23model_name ="avemio/German-RAG-NEMO-12B-ORPO-HESSIAN-AI"45model = AutoModelForCausalLM.from_pretrained(6 model_name,7 torch_dtype="auto",8 device_map="auto"9)10tokenizer = AutoTokenizer.from_pretrained(model_name)11im_end_token_id = tokenizer.convert_tokens_to_ids('<|im_end|>')12im_start_token_id = tokenizer.convert_tokens_to_ids('<|im_start|>')1314messages =[15{"role":"system","content":"Folge den Anweisungen des Benutzers. Bevor du deine finale Antwort gibst, schildere deine Überlegungen zur Lösung des Problems."},16{"role":"user","content":"Ferdinand steht vor der Herausforderung, eine faire Besuchsregelung für seine drei Kinder zu finden, die den Bedürfnissen jedes einzelnen Kindes gerecht wird. Jedes Kind hat unterschiedliche Vorlieben und Bedürfnisse, die in den Besuchsplan integriert werden müssen. Er muss sicherstellen, dass die Regelung sowohl den Interessen der Kinder als auch den rechtlichen Vorgaben entspricht. Ferdinand hat eine Woche Zeit, um einen Vorschlag zu erarbeiten, den er mit seinem Anwalt besprechen kann."}17]18text = tokenizer.apply_chat_template(19 messages,20 tokenize=False,21 add_generation_prompt=False22)23model_inputs = tokenizer([text], return_tensors="pt").to(model.device)2425generated_ids = model.generate(26**model_inputs,27 max_length=2024,28 temperature=0.01,29 do_sample=False,30#bos_token_id=im_start_token_id,31 eos_token_id=im_end_token_id,32 pad_token_id=tokenizer.eos_token_id,33 repetition_penalty=1.1,34 num_return_sequences=1,35 top_k=40,36 top_p=0.95,37)38generated_ids =[39 output_ids[len(input_ids):]for input_ids, output_ids inzip(model_inputs.input_ids, generated_ids)40]4142response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]43
Fine-tuning
We are providing a comprehensive Google Colab notebook to guide users through the process of fine-tuning our model, complete with detailed instructions, essential dependencies, and configurable settings.
Colab-Notebook.
German-RAG-LLM-EASY-BENCHMARK EVAL
The evaluation was performed using seven subsets, focusing on extraction recall, question answering (QA) with multiple references, and time difference reasoning. Relevant context and summarization were treated as distinct subsets, each playing a crucial role in the evaluation process. For relevant context, the model's ability to identify and extract pertinent information from the source material was assessed. In contrast, the summarization subset evaluated the model's capability to generate concise and accurate summaries based on the relevant context.
Four evaluation metrics were employed across all subsets: language quality, overall correctness, instruction following, and an overall score.
Language quality: This metric focused on the overall linguistic quality of the outputs, considering factors such as grammar, fluency, and clarity.
Overall correctness: The accuracy and correctness of the content were evaluated under this metric.
Instruction following: This metric assessed the model's ability to follow specific instructions provided for each task.
Overall score: This metric combined the results from the previous three metrics, offering a comprehensive evaluation of the model's capabilities across all subsets.
The ORPO Tasks Dataset represents a specialized collection for fine-tuning language models with a focus on RAG-specific capabilities.
The subsets can be for this training step are derived from 3 different sources:
SauerkrautLM Preference Datasets:
SauerkrautLM-Fermented-GER-DPO: is a specialized dataset designed for training language models in function calling irrelevance detection using Preference Optimization. The dataset consists of 2,000 carefully evaluated instruction-response pairs, specifically curated to help models recognize situations where function calls are unnecessary and direct responses are more appropriate.
SauerkrautLM-Fermented-Irrelevance-GER-DPO: is a high-quality German instruction-response dataset specifically designed for Preference Optimization training. The dataset consists of 3,305 instruction-response pairs. Rather than being merged from existing German datasets, it was carefully created through a sophisticated augmentation process, transforming curated English instructions and responses into culturally adapted German content. Each pair includes comprehensive quality metrics and rejected responses for Preference training.
Multi-Turn-QA: Developed by Avemio AG, this dataset builds upon and enhances the German Wikipedia dump provided by Cohere (wikipedia-22-12-de-embeddings), expanding it with synthetic examples and structured tasks to create a robust training resource.
Enhancement: Synthetic data generation by Avemio AG
Quality: Automatic validation and curation of examples by Open Source LLM's
Methodology: Multi-Turn-QA
Extraction of base content from German Wikipedia
Enhancement through synthetic example generation
Structure addition for specific task types
Quality assurance and validation
Architecture
Parameter
German-RAG-NEMO-ORPO
d_model
5120
num heads
32
num layers
40
MLP ratio
2.8
LayerNorm type
RMSNorm
pos embeddings
RoPE
attention variant
Standard Multi-Head Self Attention
biases
none
block type
sequential
activation
SiLU
sequence length
1024000
weight typing
bfloat16
Hyperparameters
Parameter
German-RAG-NEMO-ORPO
warmup steps
50
peak LR
5.0E-07
weight decay
0.1
LR schedule
linear
gradient reduce dtype
FP32
optimizer state dtype
FP32
Environmental Impact
German-RAG-NEMO-ORPO, running on NVIDIA A100 with 80 GPUs for 4 days, has an approximate power consumption as follows:
It's important to note that the actual power consumption may vary depending on the specific workload and operational conditions. For accurate power consumption measurements, using dedicated power monitoring tools is recommended.
Like any base language model or fine-tuned model without safety filtering, it is relatively easy for a user to prompt these models to generate harmful and generally sensitive content.
Such content can also be produced unintentionally, especially in the case of bias, so we recommend users consider the risks of applications of this technology.
Otherwise, many facts from German-RAG-NEMO-ORPO or any LLM will often not be true, so they should be checked.