Use
One user turn with this prompt, where {text} is the English source (there are two empty lines before it):
Translate the following English text into natural, idiomatic Dutch, as a native speaker would write it, not word for word. Translate everything: leave nothing out and add nothing; keep every name, number, detail and nuance, and the tone. Be as concise as the original. Keep the paragraphs, line breaks and formatting. Output only the translation, without explanation or commentary. {text}
Use the base model's chat template with thinking off (its default) and decode greedily. Training sequences were at
most 4,096 tokens.
With transformers and peft (bf16 needs ~62 GB of accelerator or CPU memory):
import torchfrom peft import PeftModelfrom transformers import AutoModelForCausalLM, AutoTokenizer base_id = "google/gemma-4-31B-it"adapter_id = "yhavinga/gemma-4-31b-it-en-nl-lora" tokenizer = AutoTokenizer.from_pretrained(base_id)model = AutoModelForCausalLM.from_pretrained(base_id, dtype=torch.bfloat16, device_map="auto")model = PeftModel.from_pretrained(model, adapter_id)model.eval() PROMPT = ( "Translate the following English text into natural, idiomatic Dutch, as a native speaker would write " "it, not word for word. Translate everything: leave nothing out and add nothing; keep every name, " "number, detail and nuance, and the tone. Be as concise as the original. Keep the paragraphs, line " "breaks and formatting. Output only the translation, without explanation or commentary.\n\n\n{text}") def translate(text, max_new_tokens=1024): messages = [{"role": "user", "content": PROMPT.format(text=text.strip())}] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, return_tensors="pt", return_dict=True ).to(model.device) with torch.no_grad(): output = model.generate(**inputs, max_new_tokens=max_new_tokens, do_sample=False) return tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True).strip() print(translate("The weather was so nice that we decided to have lunch outside."))
For faster inference, merge the adapter (model = model.merge_and_unload()) or use the GGUF repository above.
Training
- Sources: 24,000 English source passages from the five datasets in the
Dutch originals with English translations, Gemma 4
collection (
fineweb-2-nl-en-gemma4,
handelingen-tweede-kamer-nl-en-gemma4,
openraadsinformatie-nl-en-gemma4,
rijksoverheid-websites-nl-en-gemma4,
rechtspraak-nl-en-gemma4) and English prompts
from yhavinga/flan-nl. Only the English column from these
datasets was used as input; the Dutch training targets were the base model's own judge-selected translations
(below), not the datasets' original Dutch (nl) column.
- Targets: per source 8 samples from the base model (temperature 1). Gemma 4 31B-it judged each sample against the
base model's greedy translation with a rubric (accuracy first, then natural Dutch), in both orders. The sample was
kept as target when the judge preferred it (mean probability > 0.5) and its MetricX-24 QE was not worse than the
greedy translation's. Sources where no sample beat the greedy translation were left out: 15,194 targets (63% of the
sources).
- Adapter: LoRA rank 32, alpha 16 (scale 0.5) on the attention (
q_proj, k_proj, v_proj, o_proj) and MLP
(gate_proj, up_proj, down_proj) projections of all 60 layers of the text decoder; the 10 global-attention
layers have no v_proj (their values come from k_proj), so 410 modules and 244.9M parameters, stored in float32.
Embeddings frozen, dropout 0.
- Optimisation: AdamW, LR 5e-5 constant after 10 warm-up steps, gradient clipping 1.0, loss on the target only.
This release is the checkpoint at step 140 of 205 (about 1.4 passes over the data), chosen on a search split before
the evaluation below.
- Trained with MaxText and converted to PEFT; the conversion was checked teacher-forced in
transformers against the
greedy output of the trained model.
Why not SFT on the original Dutch?
Earlier runs trained directly on (en → nl) back-translation pairs using the datasets' original Dutch (nl) column as
targets. Held-out loss on original Dutch dropped sharply (e.g. 1.85 → 0.55 on back-translation validation, chrF
+4.1 to +5.5), but loss on the base model's own greedy translations only rose from 0.075 → 0.339—leaving the old
phrasing as the greedy argmax. A single temperature (T∗=2.05) explained 62–67% of the loss drop: off-policy SFT
mainly flattened calibration and fit source-domain style while barely moving C1 on WMT24++ + FLAN (+0.4 to +1.0 pp)
and slightly regressing MetricX-24 QE on all benchmarks. Sampling at T=1 showed that better, more natural
translations were already in Gemma 4's distribution, so training on-policy—either on judge-filtered best-of-8 samples
(this model) or online GRPO rollouts—shifted the greedy output without hurting QE.
Evaluation
Held-out decision splits (not used for training or for choosing the checkpoint). MetricX-24 QE (lower is better) and
COMET-22, against the base model with the same prompt and greedy decoding:
Table with columns: set, n, QE adapter, QE base, QE human reference, COMET-22 adapter, COMET-22 base| set | n | QE adapter | QE base | QE human reference | COMET-22 adapter | COMET-22 base |
|---|
| WMT24++ en-nl | 480 | 2.167 | 2.276 | 2.463 | 0.8519 | 0.8502 |
| FLORES-200 en-nl | 504 | 1.105 | 1.115 | 1.493 | 0.8892 | 0.8895 |
| NTREX-128 en-nl | 999 | 1.498 | 1.547 | 1.874 | 0.8818 | 0.8820 |
Pairwise comparisons with the base model, where the two translations differ:
- An LLM reviewer (Claude, blind, same rubric as the judge) compared the two on 100 evaluation passages:
39 / 22 / 39 (adapter better / base better / equal), on 100 other passages 40 / 19 / 41, and on 45 held-out
back-translation passages 16 / 5 / 24.
- One human reviewer, 40 blind pairs from several source types: 18 / 16 / 6, no clear preference (back-translation
6 / 1 / 3).
Original-vs-translated Dutch classifiers (C1 and C2, WMT24++ 480 + FLAN 500):
- C1 is an independent Dutch ModernBERT 230M classifier (fine-tuned on an earlier 1-epoch predecessor of
yhavinga/dmbert-230m-culturax) trained to distinguish
original Dutch from machine-translated Dutch (nl→en→nl round-trips from TranslateGemma 27B; 95.8% test accuracy),
never used during training. On held-out WMT24++ + FLAN, C1 rates 32.0% of this adapter's translations as original
Dutch, against 30.0% for the base model (+2.0 pp).
- C2 is a second Dutch ModernBERT 230M classifier
(yhavinga/dmbert-230m-fineweb2-optout) fine-tuned on
original Dutch vs. Gemma 4 31B-it round-trip Dutch from the
Gemma 4 dataset collection
(used as the reward model for the companion
GRPO variant, not used here). C2 rates 15.0%
of this adapter's outputs as original Dutch vs 16.5% for the base model (−1.5 pp).
Limitations
- The gain is in faithful, fluent translation as judged by MetricX and an LLM reviewer; a human reviewer saw no clear
difference, and the translations do not read measurably more like original Dutch.
- The judge that chose the targets is the base model itself, so a preference for its own style cannot be excluded.
- Evaluated on English→Dutch only, with the prompt above; other prompts and directions are untested.
Acknowledgements
Research supported with Cloud TPUs from Google's TPU Research Cloud (TRC).