Instructions to use Hodfa71/gemma4-e4b-da-saga-delta-dpo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Hodfa71/gemma4-e4b-da-saga-delta-dpo with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("google/gemma-4-E4B-it") model = PeftModel.from_pretrained(base_model, "Hodfa71/gemma4-e4b-da-saga-delta-dpo") - Notebooks
- Google Colab
- Kaggle
Gemma4-E4B β Danish Grammar-Aligned (SAGA Ξ-DPO, no SFT)
Fine-tuned with SAGA (Syntax-Aware Grammar Alignment). Danish base PS (85.5%) is above Ο=0.80 so SFT is skipped; Ξ-DPO is applied directly from base.
This is a LoRA adapter. Load it on top of google/gemma-4-E4B-it.
Results (Stanza DA β held-out evaluator)
| Metric | Base | + Ξ-DPO |
|---|---|---|
| Stanza PS β | 85.5% | 100.0% |
| Stanza score β | 0.427 | 0.658 |
| PPL-Wiki β | 12.2 | 13.1 |
| Summarisation PS β | 27.5% | 100.0% |
+14.5pp parse success; 100% summarisation PS confirms strong Danish grammar transfer.
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained("google/gemma-4-E4B-it", torch_dtype="auto")
model = PeftModel.from_pretrained(base, "Hodfa71/gemma4-e4b-da-saga-delta-dpo")
tokenizer = AutoTokenizer.from_pretrained("google/gemma-4-E4B-it")
prompt = "Dansk er"
inputs = tokenizer(prompt, return_tensors="pt")
output = model.generate(**inputs, max_new_tokens=60, temperature=0.8, do_sample=True)
print(tokenizer.decode(output[0], skip_special_tokens=True))
Training details
- Base model: Gemma 4 E4B (base DA PS 85.5% β₯ Ο=0.80 β SFT skipped)
- Stage: Ξ-DPO directly from base β N=8 candidates, Ξ΄β₯0.25, Ξ²=0.1
- Oracle: SpaCy
da_core_news_lg(Danish dependency parser) - LoRA: rank 16, Ξ±=32, all linear layers, bfloat16
Citation
@article{fakhar2025saga,
title={SAGA: Syntax-Aware Grammar Alignment for Low-Resource Nordic Languages},
author={Fakhar, Hoda and others},
year={2025},
note={Under review}
}
License
Apache-2.0 (Gemma 4 license).
- Downloads last month
- 1