Supported Translation Directions & Scope
Table with columns: Direction, Language Pair, Mix Rows (mix-v5), Clean Eval (CE1 / CE1b)| Direction | Language Pair | Mix Rows (mix-v5) | Clean Eval (CE1 / CE1b) |
|---|
akk-en | Akkadian (transliterated) -> English | 17,634 | CE1 gated (300 items; 258 hits-excluded) |
egy-de | Ancient Egyptian (transliterated) -> German | 17,633 | CE1 gated (300 items; 292 hits-excluded) |
grc-en | Ancient Greek -> English | 25,109 | CE1 (44 papyri, descriptive) + CE1b (50 CTS, gated) |
lat-en | Latin -> English | 13,624 | CE1b (52 CTS, gated, zero-shot) |
cop-en | Coptic -> English | 944 | Unbenchmarked in CE1/CE1b (no held-out pairs) |
syr-en | Classical Syriac -> English | 8 | Unbenchmarked in CE1/CE1b (too few rows; treat as experimental) |
Prompt Template & Inference
Use zero-shot (k=0) prompting with Granite's chat template and enable_thinking=False. In paired ablations (T510), 3-shot exemplars degraded FT1b across all tested directions (-1.7 akk-en, -2.5 egy-de, -4.8 CE1 grc-en).
Evaluation instruction string:
Translate the following {SourceLanguage} text into {TargetLanguage}. Output only the translation. {source_text}
(Training rows omit Output only the translation.; both styles work closely, with CE1/CE1b benchmark numbers reported using Output only the translation. and greedy decoding.)
import torchfrom peft import PeftModelfrom transformers import AutoModelForCausalLM, AutoTokenizer BASE_ID = "ibm-granite/granite-4.2-3b"BASE_REV = "4e9c275e232f10211ec88644d106a1f6a1b60e06"ADAPTER_ID = "." # or HF repo id; use "./variants/b3b-akkadian-cpt" for Akkadian CPT+SFT tok = AutoTokenizer.from_pretrained(BASE_ID, revision=BASE_REV)base = AutoModelForCausalLM.from_pretrained( BASE_ID, revision=BASE_REV, torch_dtype=torch.bfloat16, device_map="auto",)model = PeftModel.from_pretrained(base, ADAPTER_ID).eval() messages = [ { "role": "user", "content": ( "Translate the following Akkadian text into English. Output only the translation.\n\n" "a-na LUGAL be-lí-ia ARAD-ka mdPA-PAB-ir" ), }]prompt = tok.apply_chat_template( messages, tokenize=False, add_generation_prompt=True, enable_thinking=False,)inputs = tok(prompt, add_special_tokens=False, return_tensors="pt").to(model.device)eos_ids = sorted({x for x in (tok.eos_token_id, tok.convert_tokens_to_ids("<|end_of_text|>")) if x is not None}) with torch.inference_mode(): out = model.generate( **inputs, max_new_tokens=256, do_sample=False, eos_token_id=eos_ids, pad_token_id=eos_ids[0], )raw = tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True).strip()if raw.startswith("Translation:"): raw = raw[len("Translation:"):].strip()print(raw)
Benchmark Results (Zero-Shot k=0, Greedy chrF2)
Scored with sacrebleu corpus-level chrF2 (char_order=6, word_order=0, beta=2), 95% CIs over 2,000 family-cluster bootstrap resamples (seed=1729):
Table with columns: Benchmark & Direction, Items, FT1b (3B), B-3B (3B Akk CPT), FT2-G8 (8B), FT2-G12 (12B), Stock Gemma 4 31B (k=0 / k=3)| Benchmark & Direction | Items | FT1b (3B) | B-3B (3B Akk CPT) | FT2-G8 (8B) | FT2-G12 (12B) | Stock Gemma 4 31B (k=0 / k=3) |
|---|
CE1 akk-en (gated) | 300 | 42.66 [39.15, 46.17] | 44.68 [41.03, 48.61] | 46.26 | 45.73 | 24.5 / 28.29 |
CE1 egy-de (gated) | 300 | 35.06 [32.28, 38.02] | 34.61 [31.98, 37.50] | 37.52 | 35.03 | 25.3 / 27.23 |
CE1 grc-en (descriptive) | 44 | 49.96 [45.84, 54.00] | 50.76 [46.45, 54.69] | 53.59 | 54.55 | 49.4 / 49.94 |
CE1b grc-en (gated) | 50 | 39.16 [37.30, 40.94] | — | 41.04 | 42.72 | 44.0 / 43.82 |
CE1b lat-en (gated) | 52 | 29.35 [22.40, 36.97] | — | 30.79 | 32.15 | 33.0 / 33.01 (k=0) |
CE1 Hits-Excluded Sensitivity Check (T402)
mix-v5 inherited 269 base-row overlap hits (50 CE1 items: 42 akk-en, 8 egy-de). Removing all 50 hit items preserves the strong lead over stock Gemma 4 31B (k=0):
- Hits-excluded
akk-en (n=258): FT1b 40.46 (+15.79 [+12.09, +19.63] vs Gemma 31B 24.66); B-3B 42.14 (+1.68 [+0.29, +3.16] vs FT1b).
- Hits-excluded
egy-de (n=292): FT1b 34.81 (+9.58 [+6.07, +12.80] vs Gemma 31B 25.23).
Held-Out Bible (300 PD verses, descriptive) & Runtime (RTX 4060 Ti BF16)
- Held-out Bible
chrF2: grc_nt 56.95, lat 53.34, lxx 53.75 (FT1b). Bible-style archaism share on classical CE1b stays negligible (0.020 grc-en, no style leakage).
- Speed (
RTX 4060 Ti, BF16 base + FP32 unmerged LoRA, batch 1): 1.73 s/item on CE1 (21/644 length truncations), 7.21 s/item on CE1b (0/102 truncations), 1.49 s/item on Bible (0/300 truncations).
Training Details (FT1b)
- Base Model:
ibm-granite/granite-4.2-3b (hidden_size=2560, layers=40, vocab=100352), loaded in BF16 and frozen.
- LoRA Config:
r=16, lora_alpha=32, lora_dropout=0.05, all 7 linear module types (q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj across all 40 layers = 280 modules), FP32 trainable weights (31,129,600 params; 124,593,064 bytes, SHA-256 fec44d445b2dd810ceba161c3ddcd049c58083c3d3ed4cca03c2b5e5a132823e).
- Optimization: 1 epoch over
mix-v5 (74,952 mix rows -> 74,772 examples after dropping 180 rows > 2048 tokens; 21,591,066 processed tokens / 5,223,483 supervised assistant-only tokens; 2,337 optimizer steps), lr=1e-4 (cosine decay to 10%, 3% warmup), AdamW betas=(0.9, 0.95), weight_decay=0.1, clip=1.0, effective batch 32 (microbatch=4), seed=1729.
Dataset Provenance & Upstream Attribution
mix-v5 combines 60,000 expanded rows from merged-v4 (41,737 unique IDs) and 14,952 public-domain eBible verses (3,738 Greek NT + 3,738 LXX + 7,476 Latin Vulgate). Source corpora:
- Akkadian (
17,634 rows): State Archives of Assyria Online (SAAO) / ORACC (L4a_saao, CC BY-SA 3.0).
- Egyptian (
17,633 rows): Altägyptisches Wörterbuch (AED / BBAW) & Thesaurus Linguae Aegyptiae (TLA, CC BY-SA 4.0).
- Ancient Greek (
25,109 rows): Duke Databank of Documentary Papyri (DDbDP), Digital Corpus of Literary Papyri (DCLP), papyri.info (6,041 rows, CC BY 3.0); Perseus/OGL CTS (1,093 rows, CC BY-SA 4.0); Public Domain eBible Greek NT/LXX (7,476 rows); synthetic silver (10,499 rows generated from First1KGreek / canonical-greekLit via gemma-4-31b-it Q4_K_M and qwen-3.8-27b UD-Q5_K_M).
- Latin (
13,624 rows): Public Domain eBible Vulgate (7,476 rows); synthetic silver (6,148 rows from canonical-latinLit via gemma-4-31b-it and qwen-3.8-27b).
- Coptic (
944 rows): Coptic Scriptorium (CC BY 4.0).
- Syriac (
8 rows): Digital Syriac Corpus (CC BY 4.0).
See NOTICE and LICENSE for full obligations. Notice that trained weights carry apache-2.0, while cop-en/syr-en have no CE1/CE1b benchmark and classical literary Latin/Greek (CE1b) trail larger baselines (FT2-G12, Gemma 4 31B).