File size: 18,326 Bytes
8590902 c858fcf 8590902 ba2e667 68ee678 8590902 57e9a9f 8590902 77d9264 8590902 b29b252 8590902 b5e01f0 8590902 b5e01f0 8590902 b5e01f0 8590902 6927fdd 8590902 8563d3c 8590902 4e066ee 8590902 ba2e667 8590902 ba2e667 8590902 ba2e667 8590902 ba2e667 8590902 9486361 8590902 9486361 8590902 ba2e667 8590902 |
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 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
---
license: apache-2.0
datasets:
- avemio/GRAG-CPT-HESSIAN-AI
- avemio/GRAG-SFT-ShareGPT-HESSIAN-AI
- avemio/GRAG-ORPO-ShareGPT-HESSIAN-AI
- VAGOsolutions/SauerkrautLM-Fermented-GER-DPO
- VAGOsolutions/SauerkrautLM-Fermented-Irrelevance-GER-DPO
language:
- en
- de
base_model:
- avemio/GRAG-NEMO-12B-SFT-HESSIAN-AI
pipeline_tag: question-answering
tags:
- German
- RAG
- Retrieval
- Question-Answering
- Summarization
- Reasoning
---
<img src="https://www.grag.ai/wp-content/uploads/2024/12/GRAG-ICON-TO-WORDLOGO-Animation_Loop-small-ezgif.com-video-to-gif-converter.gif" alt="GRAG Logo" width="400" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
# GRAG-NEMO-12B-ORPO-HESSIAN-AI
<!-- Provide a quick summary of what the model is/does. -->
**GRAG** (**G**erman **R**etrieval **A**ugmented **G**eneration) 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 GRAG-NEMP-ORPO model are trained on this **[GRAG-ORPO](https://huggingface.co/datasets/avemio/GRAG-ORPO-ShareGPT-HESSIAN-AI) dataset.**
## Model Details
The core models released in this batch are the following:
| Size | Training Tokens |
|------|--------|
| [GRAG-NEMO-CPT](https://huggingface.co/avemio/GRAG-NEMO-12B-CPT-HESSIAN-AI) | 507.47 million |
| [GRAG-NEMO-SFT](https://huggingface.co/avemio/GRAG-NEMO-12B-SFT-HESSIAN-AI) | 2.03 billion |
| [GRAG-NEMO-ORPO](https://huggingface.co/avemio/GRAG-NEMO-12B-ORPO-HESSIAN-AI) | 2.0577 billion |
### Model Description
<!-- Provide a longer summary of what this model is. -->
- **Developed by:** Avemio AI Team
- **Supported by:** Hessian AI
- **Model type:** a Transformer style autoregressive language model.
- **Language(s) (NLP):** German, English
- **License:** The code and model are released under Apache 2.0.
- **Contact:** [[email protected]](mailto:[email protected])
### Model Sources
<!-- Provide the basic links for the model. -->
- **Training Study:** [Training Study](https://avemio.digital/wp-content/uploads/2025/01/GRAG-TRAINING-STUDY-Advancing-German-Language-AI-with-hessian-AI.pdf)
- **Repositories:**
- Training: [Colab-Notebook](https://colab.research.google.com/drive/1U6aP3vIkABaCm7doGV1waHgTLvXNGbBp?usp=sharing)
- Evaluation code:
- [GRAG-LLM-HARD-BENCHMARK](https://github.com/avemio-digital/GRAG-LLM-HARD-BENCHMARK.git)
- [GRAG-LLM-EASY-BENCHMARK](https://github.com/avemio-digital/GRAG-LLM-EASY-BENCHMARK.git)
- **Technical blog post:**
<!-- - **Press release:** TODO -->
## Uses
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
### Inference
Quickly get inference running with the following required installation:
Now, proceed as usual with HuggingFace:
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "avemio/GRAG-NEMO-12B-ORPO-HESSIAN-AI"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
im_end_token_id = tokenizer.convert_tokens_to_ids('<|im_end|>')
im_start_token_id = tokenizer.convert_tokens_to_ids('<|im_start|>')
messages = [
{"role": "system", "content": "Folge den Anweisungen des Benutzers. Bevor du deine finale Antwort gibst, schildere deine Überlegungen zur Lösung des Problems."},
{"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."}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=False
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_length=2024,
temperature=0.01,
do_sample=False,
#bos_token_id=im_start_token_id,
eos_token_id=im_end_token_id,
pad_token_id=tokenizer.eos_token_id,
repetition_penalty=1.1,
num_return_sequences=1,
top_k=40,
top_p=0.95,
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
```
### [](https://huggingface.co/Qwen/Qwen2.5-Coder-32B-Instruct#processing-long-texts)
### 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](https://colab.research.google.com/drive/18SH_aYLCnw1K7cRGOTTZ80y98V5Kquxb?usp=sharing).
## Evaluation
<!-- This section describes the evaluation protocols and provides the results. -->
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.
| Metric | [Vanila-Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407) | [GRAG-NEMO-SFT](https://huggingface.co/avemio/GRAG-NEMO-12B-SFT-HESSIAN-AI) | **[GRAG-NEMO-ORPO](https://huggingface.co/avemio/GRAG-NEMO-12B-ORPO-HESSIAN-AI)** | GPT-3.5-TURBO |
|------------------------------------------|---------------------------------------------------------------------------------|--------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|----------------|
| Average Language Quality | 85.88 | 89.61 | **89.1** | 91.86 |
| **OVERALL SCORES (weighted):** | | | | |
| extraction_recall | 35.2 | 52.3 | **48.8** | 87.2 |
| qa_multiple_references | 65.3 | 71.0 | **74.0** | 77.2 |
| qa_without_time_difference | 71.5 | 85.6 | **85.6** | 83.1 |
| qa_with_time_difference | 65.3 | 87.9 | **85.4** | 83.2 |
| relevant_context | 71.3 | 69.1 | **65.5** | 89.5 |
| summarizations | 73.8 | 81.6 | **80.3** | 86.9 |
## Hard Benchmark Eval
<img src="https://avemio.digital/wp-content/uploads/2025/01/GRAG-NEMO-ORPO.png" alt="GRAG Logo" width="400" style="margin-left:'auto' margin-right:'auto' display:'block'"/>
| Metric | [Vanila-Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407) | **[GRAG-NEMO-ORPO](https://huggingface.co/avemio/GRAG-NEMO-12B-ORPO-HESSIAN-AI)** | GPT-3.5-TURBO | GPT-4o | GPT-4o-mini |
|-------------------------|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|----------------|---------|-------------|
| **OVERALL SCORES (weighted):** | | | | | |
| hard_reasoning_de | 43.6 | **49.7** | 37.9 | 62.9 | 58.4 |
| hard_reasoning_en | 54.2 | **55.6** | 48.3 | 61.7 | 62.9 |
## Model Details
### Data
For training data details, please see the [GRAG-ORPO-Dataset](https://huggingface.co/datasets/avemio/GRAG-ORPO-ShareGPT-HESSIAN-AI) documentation.
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](https://huggingface.co/datasets/VAGOsolutions/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](https://huggingface.co/datasets/VAGOsolutions/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.
- **Hard Reasoning DE & EN**: Synthetic generation inspired by Tencent's ([“Scaling Synthetic Data Creation with 1,000,000,000 Personas”](https://arxiv.org/abs/2406.20094)).
- **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](https://huggingface.co/datasets/Cohere/wikipedia-22-12-de-embeddings)), expanding it with synthetic examples and structured tasks to create a robust training resource.
### Data Subsets
| Subset | Examples per Task |
|-------|------------------|
| SauerkrautLM-Fermented-GER-DPO | 3.31k |
| SauerkrautLM-Fermented-Irrelevance-GER-DPO | 2k |
| hard-reasoning-de | 3.19k |
| hard-reasoning-en | 1.97k |
| multi-turn-qa | 3.2k |
### Source Data: SauerkrautLM
[SauerkrautLM-Fermented-GER-DPO](https://huggingface.co/datasets/VAGOsolutions/SauerkrautLM-Fermented-GER-DPO)
[SauerkrautLM-Fermented-Irrelevance-GER-DPO](https://huggingface.co/datasets/VAGOsolutions/SauerkrautLM-Fermented-Irrelevance-GER-DPO)
### Source Data: Hard-Reasoning DE & EN
- Base: ([proj-Persona/PersonaHub](https://huggingface.co/datasets/proj-persona/PersonaHub))
- Enhancement: Synthetic data generation by Avemio AG
- Quality: Automatic validation and curation of examples by Open Source LLM's
### Methodology: Reasoning-DE & Reasoning-EN
- Providing Persona Descriptions and rewriting in a similar style with a different focus area and name in german/english language
- Generating Simple Logical Problems out of Persona-specific Views & Language.
- Generating Approaches, Thinking-Steps & Solutions separately verified by Llama-3.1-405B-Instruct
- Quality assurance and validation
### Source Data: Multi-Turn-QA
- Base: ([cohere/wikipedia-22-12-de-embeddings](https://huggingface.co/datasets/Cohere/wikipedia-22-12-de-embeddings))
- Enhancement: Synthetic data generation by Avemio AG
- Quality: Automatic validation and curation of examples by Open Source LLM's
### Methodology: Multi-Turn-QA
1. Extraction of base content from German Wikipedia
2. Enhancement through synthetic example generation
3. Structure addition for specific task types
4. Quality assurance and validation
### Architecture
| Parameter | GRAG-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 | GRAG-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
GRAG-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.
| Model | GPU Type | Power Consumption From GPUs |
|----------------|---------------------|-----------------------------|
| GRAG-NEMO-ORPO | A100 ([Hessian AI supercomputer](https://hessian.ai/de/)) | 0.01843 MWh |
## Bias, Risks, and Limitations
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 GRAG-NEMO-ORPO or any LLM will often not be true, so they should be checked.
## Model Card Contact
For errors in this model card, please contact ([[email protected]](mailto:[email protected])). |