Instructions to use DS4AI-UPB/gemma4-ro-re-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use DS4AI-UPB/gemma4-ro-re-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("/export/home/acs/prof/dragos.vasile2603/synasc2026/models/gemma-4-31b-it") model = PeftModel.from_pretrained(base_model, "DS4AI-UPB/gemma4-ro-re-lora") - Notebooks
- Google Colab
- Kaggle
Gemma 4 31B QLoRA adapter — Romanian/English Relation Classification
Dragoș Mitruț Vasile · Elena-Simona Apostol · Stefan-Adrian Toma · Adrian Paschke · Ciprian-Octavian Truică
QLoRA adapter for google/gemma-4-31b-it, fine-tuned for Relation Classification on a Romanian translation of SemEval-2010 Task 8 plus the original English data. Given a sentence with two marked entities (<e1>, <e2>), the model assigns one of ten directional relations.
Results (macro F1-Score, SemEval-2010 Task 8 test set)
| Language | F1-Score | Accuracy |
|---|---|---|
| English | 0.880 | 0.868 |
| Romanian | 0.865 | 0.850 |
On classification, this 31B model is statistically indistinguishable from a fine-tuned XLM-RoBERTa-large (560M) on both languages (paired bootstrap, p = 0.23 English, p = 0.09 Romanian).
Training
- Base:
google/gemma-4-31b-it, loaded in 4-bit - LoRA: rank 32, alpha 64, dropout 0.05, all attention and MLP projections
- 3 epochs, effective batch size 16, peak LR 2e-4, cosine decay, 5% warmup
- Combined English + Romanian training data (15,871 examples)
- Single NVIDIA A100 40GB, about 5h13min
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained("google/gemma-4-31b-it", load_in_4bit=True, device_map="auto")
model = PeftModel.from_pretrained(base, "<HF_REPO_RE>")
tok = AutoTokenizer.from_pretrained("<HF_REPO_RE>")
Prompt format and the full relation label set are in the run_inference.py script in the code repository.
Limitations
The Romanian training data is machine-translated with automatic post-validation, not a human gold standard. See the paper and the code repository for the translation quality analysis.
Citation
@misc{vasile2026crosslingual,
title = {Cross-lingual Relation Extraction with Large Language Models: Zero-Shot, Few-Shot, and Fine-Tuned Evaluation on Romanian},
author = {Vasile, Drago\c{s}-Mitru\c{t} and Apostol, Elena-Simona and Toma, \c{S}tefan-Adrian and Paschke, Adrian and Truic\u{a}, Ciprian-Octavian},
year = {2026},
note = {Preprint}
}
- Downloads last month
- 44