初始化项目,由ModelHub XC社区提供模型
Model: GaMS-Beta/GaMS-9B-SFT-Translator-DPO Source: Original Platform
This commit is contained in:
111
README.md
Normal file
111
README.md
Normal file
@@ -0,0 +1,111 @@
|
||||
---
|
||||
license: gemma
|
||||
language:
|
||||
- sl
|
||||
- en
|
||||
- hr
|
||||
- sr
|
||||
- bs
|
||||
base_model:
|
||||
- GaMS-Beta/GaMS-9B-SFT-Translator
|
||||
pipeline_tag: text-generation
|
||||
---
|
||||
|
||||
# Model Card for GaMS-DPO-Translator
|
||||
|
||||
GaMS-Beta/GaMS-9B-SFT-Translator-DPO is a fine-tuned version of GaMS-9B-SFT-Translator. Direct Preference Optimization (DPO) was performed on the original model. The learning dataset was synthetially generated by using GaMS-9B-SFT-Translator and EuroLLM-9B-Instruct.
|
||||
|
||||

|
||||
|
||||
## Basic information
|
||||
|
||||
- **Developed by:** team of researchers at the University of Ljubljana, Faculty for Computer and Information Science. Team members: Dario Vajda, Domen Vreš and Marko Robnik-Šikonja.
|
||||
- **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.
|
||||
- **Base model:** [cjvt/GaMS-9B-Instruct](https://huggingface.co/cjvt/GaMS-9B-Instruct)
|
||||
- **License:** [Gemma](https://ai.google.dev/gemma/terms)
|
||||
|
||||
## Usage
|
||||
|
||||
The model can be run through `pipeline` API using the following code:
|
||||
|
||||
```python
|
||||
from transformers import pipeline
|
||||
|
||||
model_id = "GaMS-Beta/GaMS-9B-SFT-Translator-DPO"
|
||||
|
||||
pline = pipeline(
|
||||
"text-generation",
|
||||
model=model_id,
|
||||
device_map="cuda" # replace with "mps" to run on a Mac device
|
||||
)
|
||||
|
||||
# Example of response generation
|
||||
message = [{"role": "user", "content": "Prevedi naslednje angleško besedilo v slovenščino.\nToday is a nice day."}]
|
||||
response = pline(message, max_new_tokens=512)
|
||||
print("Translation:", response[0]["generated_text"][-1]["content"])
|
||||
```
|
||||
|
||||
For multi GPU inference set the `device_map` to `auto`:
|
||||
|
||||
```python
|
||||
from transformers import pipeline
|
||||
|
||||
model_id = "GaMS-Beta/GaMS-9B-SFT-Translator-DPO"
|
||||
|
||||
pline = pipeline(
|
||||
"text-generation",
|
||||
model=model_id,
|
||||
device_map="auto"
|
||||
)
|
||||
|
||||
# Example of response generation
|
||||
message = [{"role": "user", "content": "Prevedi naslednje angleško besedilo v slovenščino.\nToday is a nice day."}]
|
||||
response = pline(message, max_new_tokens=512)
|
||||
print("Model's response:", response[0]["generated_text"][-1]["content"])
|
||||
|
||||
# Example of conversation chain
|
||||
new_message = response[0]["generated_text"]
|
||||
new_message.append({"role": "user", "content": "Lahko bolj podrobno opišeš ta dogodek?"})
|
||||
response = pline(new_message, max_new_tokens=1024)
|
||||
print("Model's response:", response[0]["generated_text"][-1]["content"])
|
||||
```
|
||||
|
||||
## Data
|
||||
|
||||
Data for fine-tuning the original model was acquired by translating a large corpora of wikipedia articles, ccnews articles, bookcorpus texts and english conversational datasets by two models(GaMS-9B-SFT-Translator and EuroLLM-9B-Instruct) which were then ranked by some automatic metrics for translation quality and reliability.
|
||||
|
||||
## Training
|
||||
|
||||
The model was trained on the [Vega HPC](https://izum.si/vega_slv/)
|
||||
|
||||
## Evaluation
|
||||
|
||||
The model was evaluated by our custom script on three types of data. The results are show in the following table.
|
||||
|
||||
| Model | Overall Comet | ccnews | nemotron | wikipedia | Bad Lang (%) | Short (%) | Bad Markdown (%) |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| gemini-2.5-flash | 0.717982 | 0.702981 | 0.697498 | 0.753924 | 0.35% | 0.42% | 3.70% |
|
||||
| GaMS-9B-Instruct-DPO-Translator | 0.714729 | 0.708317 | 0.689316 | 0.746768 | 1.88% | 1.56% | 13.22% |
|
||||
| **GaMS-9B-SFT-Translator-DPO** | **0.708042** | **0.702903** | **0.679462** | **0.742583** | **0.91%** | **0.28%** | **18.28%** |
|
||||
| GaMS-27B-Instruct | 0.701284 | 0.686480 | 0.680014 | 0.730733 | 27.28% | 5.36% | 62.07% |
|
||||
| GaMS-9B-Instruct | 0.693659 | 0.685006 | 0.673394 | 0.723470 | 13.50% | 4.83% | 33.15% |
|
||||
| EuroLLM-9B-Instruct | 0.689321 | 0.668084 | 0.670723 | 0.729227 | 8.97% | 1.89% | 35.08% |
|
||||
| GaMS-9B-SFT-Translator | 0.682467 | 0.676580 | 0.673650 | 0.699602 | 5.14% | 1.48% | 30.53% |
|
||||
|
||||
|
||||
*Note* - the evaluation script and evaluation data can be found in this [github repo](https://github.com/DarioVajda/translation_dpo) under the data_pipeline folder. See the README for more detailed instructions.
|
||||
|
||||
|
||||
## Citation
|
||||
If you found this project useful in your work, please cite our paper with the following BibTeX citation:
|
||||
```txt
|
||||
@misc{vajda2025improvingllmsmachinetranslation,
|
||||
title={Improving LLMs for Machine Translation Using Synthetic Preference Data},
|
||||
author={Dario Vajda and Domen Vreš and Marko Robnik-Šikonja},
|
||||
year={2025},
|
||||
eprint={2508.14951},
|
||||
archivePrefix={arXiv},
|
||||
primaryClass={cs.CL},
|
||||
url={https://arxiv.org/abs/2508.14951},
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user