Makron-seed2

DOI

A small character-level transformer (0.87M parameters) that marks the phonemic length of the Ancient Greek dichrona α, ι and υ: ^ after a short vowel, _ after a long one.

ἀνὴρ → ἀ^νὴρ

Makron is the revised version of Ericu950/oga-macronizer-char. It has the same architecture but different training data and settings:

  • Decontaminated training data: it is trained on Urdatorn/oga-macronized-no-norma (revision 5d737f8), silver labels from the rule-based grc-macronizer (a949b76, with bug fixes) on Opera Graeca Adnotata. Every sentence overlapping the Norma benchmark, and every line without Greek text, has been removed.
  • Tuned hyperparameters: learning rate, weight decay and dropout were chosen by an Optuna search (24 trials) on Norma validation, and the training length (30 epochs) by a follow-up comparison on Norma validation. A second, learning-rate-only search (12 trials) on the regenerated silver data kept the same learning rate.
  • Seeds: this is seed 2 of three final models (seed1, seed2, seed3), identical except for the seed. Seed 1 has the best Norma validation score.

Training, search and evaluation code, logs and all three seeds: Urdatorn/Makron-code.

Results on Norma Syllabarum Graecarum

Test: 1,916 gold dichrona in open syllables.

label Acc P R F1 Cov
long 70.6 85.4 70.6 77.3 98.8
short 97.4 94.5 97.4 95.9 99.9
mixed 92.9 93.2 92.9 93.0 99.7
  • How accuracy is counted: an unmarked position counts as wrong.
  • Mixed metrics: P, R and F1 are micro-averaged.
  • Validation (Norma, 2,498 positions): 94.36% mixed accuracy.
  • Variation across the three seeds: 93.1 ± 0.5 mixed accuracy on test.

Previous version

Until 2026-11-24 this repository held a model trained on the earlier silver data (revision 880b94a, before the grc-macronizer bug fixes); it is kept in the repository history. On Norma test it reached the following mixed accuracy / long-vowel accuracy: seed 1 91.8 / 66.3, seed 2 91.3 / 60.4, seed 3 90.8 / 58.8.

Training

setting value
architecture 4 layers, hidden size 128, 4 heads, intermediate size 512
optimizer AdamW, lr 2.23e-3, weight decay 0.17, batch size 2048
schedule one-cycle, 5% warmup, 30 epochs
dropout 0.0
checkpoint best Norma validation accuracy (step 16,169)
seed 2

Usage

The repository is self-contained: the model code (model.py, tokenizer.py, predict.py, identical to those in Urdatorn/Makron-code) ships with the weights.

pip install torch "transformers>=4.49,<5" safetensors huggingface_hub grc_utils==0.2.2
import sys
from huggingface_hub import snapshot_download

path = snapshot_download("Urdatorn/Makron-seed2")
sys.path.insert(0, path)
from predict import MacronPredictor

p = MacronPredictor(path)
print(p.macronize("ἀνὴρ"))                     # one text
print(p.macronize_lines(["μῆνιν ἄειδε θεά", "ἀνὴρ"]))  # many lines, batched

Limitations

  • Attic lengths throughout: like its training data, Makron normalizes to Attic vowel lengths, so it is systematically wrong for Homeric, Doric and other non-Attic forms.
  • Teacher's mistakes: it learns from silver labels, so it inherits the rule-based system's errors.
  • Long vowels are hard: they are its weak point (71% recall).

Citation

Thörn Cleland, Albin and Eric Cullhed (forthcoming). Automatic Annotation of Ancient Greek Vowel Length.

License

GNU GPL v3.

Downloads last month
38
Safetensors
Model size
867k params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Datasets used to train Urdatorn/Makron-seed2

Collection including Urdatorn/Makron-seed2