Training data
- Source passages: Svenska Wikipedia (
WIKIPEDIA-SV), sampled through Språkbanken's Korp API. Språkbanken lists the corpus as CC-BY-4.0.
- Generation and curation: google/gemma-4-31B-it (revision
842da3794eaa0b77d5f08bae87a17459d91ff475), run through NeMo DataDesigner. The method adapts the source-grounded generation and curation of Source2Synth. A candidate was kept only if an independent answer matched it exactly after normalisation and it passed a quality review. Duplicates were then removed.
- Rows: 961 of a target of 1000.
Table with columns: Task, Rows| Task | Rows |
|---|
| classification | 143 |
| sentiment classification | 143 |
| linguistic acceptability | 143 |
| reading comprehension | 143 |
| natural language inference | 143 |
| grammatical error detection | 142 |
| named-entity recognition | 104 |
The named-entity task stopped short of its quota because most of its later candidates duplicated earlier ones. The training data itself is not published here.
Training
Table with columns: Setting, Value| Setting | Value |
|---|
| Method | bf16 LoRA (no quantisation) |
| LoRA rank / alpha / dropout | 16 / 32 / 0.05 |
| Target modules | q, k, v, o, gate, up, down projections |
| Learning rate, warmup | 2e-4, 5% |
| Effective batch size | 16 (8 × 2 accumulation) |
| Epochs, steps | 1, 61 |
| Max length | 2048 tokens |
| Loss | assistant answer and EOS only; prompt tokens masked |
| Final training loss |
Base Gemma 4 12B has no chat template, so training used the plain role template in chat_template.jinja (USER: / ASSISTANT: turns). Use the same template when prompting.
Evaluation
These are pilot numbers: EuroEval few-shot as a base model on the validation split with one iteration, and the full Swedish idioms minimal-pair set. They are not comparable to the EuroEval leaderboard.
Table with columns: Benchmark, Base, Base + this adapter| Benchmark | Base | Base + this adapter |
|---|
EuroEval swerec (MCC) | 77.3 | 74.1 |
EuroEval scala-sv (MCC) | 78.0 | 69.4 |
| Idioms, all 478 pairs (accuracy) | 91.2% | 90.2% |
| Idioms, 100-pair challenge set (accuracy) | 87% | 85% |
The idioms differences are not significant (exact McNemar p = 0.18 and 0.63). The very low final training loss suggests the adapter fits the synthetic answer format closely, which may not transfer to EuroEval's prompts.
Usage
from peft import PeftModelfrom transformers import AutoModelForImageTextToText, AutoTokenizer base = AutoModelForImageTextToText.from_pretrained("google/gemma-4-12B", dtype="bfloat16", device_map="auto")model = PeftModel.from_pretrained(base, "Sinall/gemma-4-12B-sv-source2synth-nlu-lora")tokenizer = AutoTokenizer.from_pretrained("Sinall/gemma-4-12B-sv-source2synth-nlu-lora")
License
The adapter is released under Apache-2.0, the license of the base model. Training data was derived from Swedish Wikipedia (CC-BY-4.0 as listed by Språkbanken).