Leonida: Greek ⇄ Tsakonian translator (merged 16-bit)
Leonida translates between Modern Greek and Tsakonian, in both directions, with a single model. Tsakonian is a highly endangered Hellenic language of the Peloponnese, which descends largely from ancient Laconian Doric. Its name honours Leonidas, the Spartan king, a nod to that Laconian ancestry; the logo shows a Spartan shield with the lambda of Lacedaemon.
Leonida is part of the Tsakonian Digital project and was trained mainly on Panos Marneris' website, tsakonika.online alongside with other open sources.
- Scores: chrF++ 83.8 / BLEU 71.3 / TER 16.7 on Bench V2.2; chrF++ 71.4 / BLEU 53.3 / TER 29.4 on Bench V3.
- Two training stages: supervised fine-tuning on 19,004 sentence pairs, then reinforcement learning (GRPO) on 2,132 further pairs that the first stage never saw.
- Small enough to run locally: 8 billion parameters; the Q4_K_M file runs on a laptop.
| Repository | Contents |
|---|---|
| jgchaparro/Llama-Leonida | Merged 16-bit model (transformers) |
| jgchaparro/Llama-Leonida-GGUF | GGUF Q8_0, Q5_K_M, Q4_K_M for llama.cpp, Ollama and LM Studio |
| jgchaparro/Llama-Leonida-lora | LoRA adapter for ilsp/Llama-Krikri-8B-Instruct-v1.5 |
Usage
Tsakonian is written in the Kostakis orthography, with combining diacritics: τσ̑, σ̌, κ̔, ν̇, λ̣, ν̂, α̈. The model reads and writes this spelling; text in other spellings translates less well.
Use the model's Llama 3.1 chat template with this prompt. The model replies with the translation only.
- System:
You are a precise translation assistant. Output only the translation, nothing else. - User:
Translate from {origin} to {target}:\n\n{source}, where{origin}and{target}areGreekorTsakonian.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "jgchaparro/Llama-Leonida"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.bfloat16, device_map="auto")
messages = [
{"role": "system", "content": "You are a precise translation assistant. Output only the translation, nothing else."},
{"role": "user", "content": "Translate from Greek to Tsakonian:\n\nΚαλημέρα, τι κάνεις;"},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False) + "<|start_header_id|>assistant<|end_header_id|>\n\n"
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to(model.device)
out = model.generate(**inputs, max_new_tokens=256, do_sample=False)
print(tokenizer.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Training data
Leonida was trained on 19,004 Tsakonian–Greek sentence pairs, each used in both directions (38,008 training examples). All of them come from openly available sources, mainly the website of Panos Marneris, tsakonika.online. The pairs were cleaned and reviewed again before this model was trained.
The reinforcement-learning stage used 2,132 further pairs (4,045 prompts, both directions) from the same sources, held out from the first stage. The validation pairs and the benchmark pairs belong to separate splits and are used in neither stage.
The Tsakonian side of every pair is written in the Kostakis orthography; texts written in other orthographies were converted and reviewed.
How it was trained
Stage 1: supervised fine-tuning.
- Base model:
ilsp/Llama-Krikri-8B-Instruct-v1.5, fine-tuned with Unsloth: bf16 LoRA, LoRA rank 64, alpha 64, on the attention and MLP layers. The base model is Llama-Krikri, Llama 3.1 8B adapted to Greek by ILSP (Athena Research Center) with additional Greek training and an extended Greek vocabulary. - Optimisation: learning rate 0.0002 with cosine decay and 3 % warmup, AdamW 8-bit, effective batch 16, maximum sequence length 768 tokens, up to 3 epochs (7,128 steps). The loss covers the model's reply only.
- Checkpoint selection: every 750 steps, the adapter translated 400 validation examples (200 held-out pairs × 2 directions, greedy) and was scored with chrF++. The best checkpoint scored validation chrF++ 80.78.
Stage 2: reinforcement learning (GRPO).
- Method: Group Relative Policy Optimization (Dr. GRPO loss, no KL term), continuing the stage-1 adapter. For each prompt the model sampled 8 translations at temperature 0.9, and each translation was rewarded against the reference.
- Reward: half sentence chrF++, half (1 − TER), plus a bonus for an exact match. Automatic checks on punctuation, numbers, capitals and diacritics subtract a penalty for each error the reference does not share. Empty output, a copy of the source, a translation of very different length or a truncated reply score 0.
- Optimisation: learning rate 0.00001, 400 updates of 16 prompts.
- Checkpoint selection: validation chrF++ every 50 updates, on the same 400 examples as stage 1. The published adapter is from update 350, validation chrF++ 81.30 (stage 1: 80.78).
| Update | Validation chrF++ | TER | Tsakonian → Greek chrF++ | Greek → Tsakonian chrF++ |
|---|---|---|---|---|
| 0 (stage 1) | 80.78 | 20.23 | 81.31 | 80.29 |
| 50 | 80.92 | 20.20 | 81.56 | 80.32 |
| 100 | 80.95 | 20.12 | 81.50 | 80.44 |
| 150 | 81.12 | 19.91 | 81.67 | 80.60 |
| 200 | 81.23 | 19.76 | 81.76 | 80.74 |
| 250 | 81.25 | 19.78 | 81.91 | 80.64 |
| 300 | 81.16 | 19.82 | 81.75 | 80.61 |
| 350 (selected) | 81.30 | 19.67 | 81.79 | 80.84 |
| 400 | 81.17 | 19.84 | 81.80 | 80.58 |
Evaluation
Every benchmark pair is translated in both directions with greedy decoding and scored with sacreBLEU 2.5.1: BLEU, chrF++ and TER. The 95% confidence intervals come from bootstrap resampling, and the comparisons with earlier models use a paired bootstrap on the same translations. None of the benchmark pairs is used in training or in validation. Scores are only comparable within one benchmark.
Tsakonian Digital Bench V2.2
Tsakonian Digital Bench V2.2 has 300 Tsakonian–Greek sentence pairs from the test split of the Tsakonian Digital database, mostly web texts of the same kind as the main training data. Levels: 100 easy (fewer than 7 Tsakonian words), 100 medium (7–11) and 100 hard (12 or more). Every pair was reviewed one by one for alignment, spelling and punctuation. V2.2 is V2.1 after a further review: 6 pairs corrected and 1 replaced.
The benchmark is in benchmark/tsakonian_digital_bench_v2_2.csv, with the model's translations in benchmark/predictions_v2_2.jsonl and the full scores in benchmark/metrics_v2_2.json.
| Group (translations) | BLEU ↑ (95% CI) | chrF++ ↑ (95% CI) | TER ↓ (95% CI) |
|---|---|---|---|
| All (600) | 71.3 (69.3–73.4) | 83.8 (82.6–85.0) | 16.7 (15.5–17.9) |
| Tsakonian → Greek (300) | 74.8 | 85.3 | 14.6 |
| Greek → Tsakonian (300) | 67.9 | 82.3 | 18.7 |
| Easy (200) | 70.3 | 83.3 | 16.3 |
| Medium (200) | 70.3 | 82.4 | 17.7 |
| Hard (200) | 71.8 | 84.4 | 16.3 |
| Easy / Tsakonian → Greek (100) | 74.3 | 84.2 | 15.1 |
| Easy / Greek → Tsakonian (100) | 66.5 | 82.6 | 17.4 |
| Medium / Tsakonian → Greek (100) | 72.9 | 83.7 | 15.8 |
| Medium / Greek → Tsakonian (100) | 67.8 | 81.1 | 19.6 |
| Hard / Tsakonian → Greek (100) | 75.5 | 86.2 | 14.0 |
| Hard / Greek → Tsakonian (100) | 68.2 | 82.7 | 18.6 |
| Model | BLEU ↑ | chrF++ ↑ | TER ↓ |
|---|---|---|---|
| Leonida (this model) | 71.3 | 83.8 | 16.7 |
| Leonida Beta 2, the previous version | 69.6 | 82.9 | 17.6 |
Against Leonida Beta 2 on the same 600 translations (paired bootstrap, 95% intervals): chrF++ +0.81 (+0.26 to +1.45), BLEU +1.60 (+0.57 to +2.70), TER -0.85 (-1.58 to -0.21). Every interval excludes zero. Leonida has the higher sentence chrF++ on 28.8 % of the translations, Leonida Beta 2 on 22.8 %; the rest are ties.
Tsakonian Digital Bench V3
Tsakonian Digital Bench V3 has 300 new test pairs chosen for the vocabulary that Bench V2 misses: 150 sentences from books, 90 dictionary examples and 60 web texts, spread over the Southern dialects. Levels: 100 easy, 100 medium and 100 hard. No sentence also occurs in the training or validation data, even after removing case and accents. V3 is harder than V2.2, so the two sets of scores are not comparable.
| Group (translations) | BLEU ↑ (95% CI) | chrF++ ↑ (95% CI) | TER ↓ (95% CI) |
|---|---|---|---|
| All (600) | 53.3 (50.7–55.9) | 71.4 (69.8–73.0) | 29.4 (27.6–31.3) |
| Tsakonian → Greek (300) | 58.6 | 73.8 | 26.1 |
| Greek → Tsakonian (300) | 48.1 | 69.1 | 32.5 |
| Easy (200) | 51.6 | 68.8 | 31.5 |
| Medium (200) | 51.1 | 70.2 | 30.3 |
| Hard (200) | 54.5 | 72.6 | 28.4 |
| Easy / Tsakonian → Greek (100) | 56.9 | 70.7 | 28.2 |
| Easy / Greek → Tsakonian (100) | 46.4 | 67.0 | 34.7 |
| Medium / Tsakonian → Greek (100) | 53.2 | 70.4 | 28.8 |
| Medium / Greek → Tsakonian (100) | 49.1 | 70.0 | 31.8 |
| Hard / Tsakonian → Greek (100) | 61.2 | 76.3 | 24.2 |
| Hard / Greek → Tsakonian (100) | 48.0 | 69.2 | 32.4 |
| Model | BLEU ↑ | chrF++ ↑ | TER ↓ |
|---|---|---|---|
| Leonida (this model) | 53.3 | 71.4 | 29.4 |
| Leonida Beta 2, the previous version | 50.1 | 69.9 | 35.1 |
Against Leonida Beta 2 on the same 600 translations (paired bootstrap, 95% intervals): chrF++ +1.47 (+0.49 to +2.65), BLEU +3.12 (+0.16 to +7.31), TER -5.70 (-14.68 to -0.87). Every interval excludes zero. Leonida has the higher sentence chrF++ on 37.3 % of the translations, Leonida Beta 2 on 27.0 %; the rest are ties.
Intended use
- Drafting translations between Greek and Tsakonian, for learners, teachers and researchers.
- Reading Tsakonian texts with a Greek gloss.
- A starting point for further research on Tsakonian and other low-resource Greek varieties.
Leonida is not a substitute for a native speaker. Any text meant for publication, teaching or signage needs review by a speaker.
Limitations
- Dialects. Most of the training text is in the Tyros dialect (Τ). Other varieties are less well covered.
- One reference per sentence. BLEU and chrF++ count a valid paraphrase or dialect variant as an error, so the scores understate the quality of good alternative translations.
- Tsakonian output can be wrong. The model can produce plausible but wrong forms, misplace diacritics or choose the wrong gender or number when the source does not determine it.
- Sentence level. The model was trained on single sentences. Translate long texts sentence by sentence.
License
Built with Llama. The model is subject to the Llama 3.1 Community License and its Acceptable Use Policy.