Supported Directions & Scope
Table with columns: Direction, Language Pair, Mix Rows (mix-v5), Clean Eval (CE1 / CE1b), Status| Direction | Language Pair | Mix Rows (mix-v5) | Clean Eval (CE1 / CE1b) | Status |
|---|
akk-en | Akkadian (transliterated) -> English | 17,634 | CE1 (300 items; 258 hits-excluded) | Best on CE1 full (46.26) |
egy-de | Ancient Egyptian (transliterated) -> German | 17,633 | CE1 (300 items; 292 hits-excluded) | Sole CE1 winner (37.52) |
grc-en | Ancient Greek -> English | 25,109 | CE1 (44 papyri) + CE1b (50 CTS) | Strong on CE1 papyri (53.59); trails 12B/31B on CE1b (41.04) |
lat-en | Latin -> English | 13,624 | CE1b (52 CTS, zero-shot) | 30.79 (trails 12B 32.15 and stock Gemma 31B 33.01) |
cop-en | Coptic -> English | 944 | Unbenchmarked | No CE1/CE1b held-out pairs |
syr-en | Classical Syriac -> English | 8 | Unbenchmarked | Experimental only (8 rows) |
Prompt Template & Inference
Use zero-shot (k=0) prompting with Granite's chat template and enable_thinking=False:
Translate the following {SourceLanguage} text into {TargetLanguage}. Output only the translation. {source_text}
import torchfrom peft import PeftModelfrom transformers import AutoModelForCausalLM, AutoTokenizer BASE_ID = "ibm-granite/granite-4.2-8b"BASE_REV = "a7042144125ce5ae64f89610e8289647fc000b9a"ADAPTER_ID = "." # or HF repo id 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 Egyptian text into German. Output only the translation.\n\n" "iw ir.n=i mꜣꜥt n nb=i" ), }]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, FT2-G8 (8B), FT1b (3B), FT2-G12 (12B), Stock Granite 8B (S0), Stock Gemma 4 31B (k=0 / k=3)| Benchmark & Direction | Items | FT2-G8 (8B) | FT1b (3B) | FT2-G12 (12B) | Stock Granite 8B (S0) | Stock Gemma 4 31B (k=0 / k=3) |
|---|
CE1 akk-en (gated) | 300 | 46.26 [42.79, 49.98] | 42.66 | 45.73 | 12.6 | 24.5 / 28.29 |
CE1 egy-de (gated) | 300 | 37.52 [34.63, 40.81] | 35.06 | 35.03 | 9.6 | 25.3 / 27.23 |
CE1 grc-en (descriptive) | 44 | 53.59 [48.32, 58.29] | 49.96 | 54.55 | 34.9 | 49.4 / 49.94 |
CE1b grc-en (gated) | 50 | 41.04 [39.13, 42.83] | 39.16 | 42.72 | 36.6 | 44.0 / 43.82 |
CE1b lat-en (gated) | 52 | 30.79 [23.42, 38.96] | 29.35 | 32.15 | 28.7 | 33.0 / 33.01 (k=0) |
- Macro CE1 (
akk-en, egy-de): 41.89 [39.61, 44.38] (vs FT1b 38.86, FT2-G12 40.38, Gemma 31B k=3 27.76).
- Paired Gains (
T402 / T510):
- vs
FT1b (3B): +3.60 [+2.24, +5.01] akk-en, +2.47 [+0.30, +4.47] egy-de, +3.63 [+1.05, +6.17] CE1 grc-en, +1.87 [+1.35, +2.52] CE1b grc-en, +1.44 [+0.57, +2.63] CE1b lat-en.
- vs
FT2-G12 (12B) on Egyptian: +2.49 [+0.42, +4.89] (FT2-G8 is the clear winner on egy->de).
- vs Stock
Gemma 4 31B (k=0): +21.7 [+17.9, +25.7] akk-en, +12.2 [+9.5, +15.2] egy-de, +4.2 [+1.4, +6.8] CE1 grc-en.
- CE1 Hits-Excluded (
n=258 akk, n=292 egy): akk-en 43.77 (+19.10 [+15.25, +23.16] vs Gemma 31B k=0), egy-de 37.36 (+12.13 [+9.32, +15.07]).
- Descriptive Held-out Bible (
300 verses): grc_nt 62.49, lat 54.80, lxx 55.93 (Bible-style archaism rate on CE1b 0.020 grc-en).
- Runtime (R9700, BF16 base + FP32 unmerged LoRA, batch 1):
3.40 s/item CE1 (19/644 length truncations), 14.27 s/item CE1b (0/102), 2.96 s/item Bible (0/300).
Why FT2-G8 Uses Stock Granite 8B Without CPT (T459 Pilot)
In T459, we tested 15.0M tokens of ancient-domain LoRA CPT (13.5M V10 r5 across 8 ancient languages + 1.5M oasst2 replay) followed by the exact same FT2-G8 SFT recipe (B-8B). Although CPT sharply lowered held-out ancient BPC (e.g., Akkadian 2.829 -> 1.629, Egyptian 6.511 -> 3.009), after SFT it yielded CPT_NO_GAIN across all 4 gated directions (pooled macro +0.30 [-0.29, +0.86], B-8B vs FT2-G8). Accordingly, FT2-G8 directly on stock granite-4.2-8b remains the recommended 8B adapter.
Training Details (FT2-G8)
- Base Model:
ibm-granite/granite-4.2-8b (hidden_size=4096, intermediate_size=12800, layers=40, vocab=100352), BF16 frozen.
- LoRA Config:
r=16, lora_alpha=32, lora_dropout=0.05, all 280 q/k/v/o/gate/up/down linear projections, FP32 (49,479,680 params; 197,993,952 bytes, SHA-256 9f039ddd88080d7a84835ad71cd66b46d02b35c9e2b63b25be6d8fe6d9246481).
- Optimization: 1 epoch over
mix-v5 (74,772 examples after dropping 180 > 2048, 21,591,066 processed / 5,223,483 supervised tokens; --loss-impl full, microbatch=2, effective batch 32, lr=1e-4 cosine to 10%, warmup=0.03, wd=0.1, betas=(0.9, 0.95), clip=1.0, seed=1729).
Dataset Provenance & Upstream Attribution
Trained on mix-v5 (74,952 rows total: 70,641 gold scholarly/PD pairs + 4,311 silver teacher pairs):
- ORACC / State Archives of Assyria Online (
SAAO): 17,634 akk-en rows (L4a_saao, CC BY-SA 3.0).
- Altägyptisches Wörterbuch (
AED / BBAW) & Thesaurus Linguae Aegyptiae (TLA): 17,633 egy-de rows (L2_aed_st, CC BY-SA 4.0).
- Perseus Digital Library & Open Greek and Latin (
First1KGreek, canonical-greekLit, canonical-latinLit), papyri.info (DDbDP, DCLP): 6,041 papyri (CC BY 3.0), 1,093 CTS (CC BY-SA 4.0), plus synthetic silver (10,499 Greek, 6,148 Latin generated with gemma-4-31b-it Q4_K_M and qwen-3.8-27b UD-Q5_K_M).
- Coptic Scriptorium:
944 cop-en rows (CC BY 4.0).
- Digital Syriac Corpus (Oxford, BYU, Vanderbilt, Texas A&M):
8 syr-en rows (CC BY 4.0).
- eBible Public Domain Bibles:
14,952 verses (grcbyz, grcbrent, latVUC aligned to engbsb, eng_web, eng_Brenton).
See NOTICE and LICENSE for full attribution notices and terms.