Abkhaz Lemmatizer (ByT5-small)

A lemmatizer for the Abkhaz language (ISO 639-1: ab), fine-tuned from ByT5-small.

Abkhaz is a Northwest Caucasian polysynthetic language — a single verb form can encode subject, object, direction, tense, and negation. ByT5 operates directly on UTF-8 bytes, avoiding the <unk> token problem that plagues vocabulary-based tokenizers on low-resource scripts.

Model Details

  • Base model: google/byt5-small (300M parameters)
  • Task: Sequence-to-sequence lemmatization
  • Input format: POS: {upos} WORD: {word}
  • Output format: {lemma}

Why ByT5?

Standard T5/mT5 models use SentencePiece vocabularies that lack Abkhaz-specific letters (ҩ, ҵ, ҷ, ԥ, ҕ, etc.), causing them to collapse into <unk> tokens. ByT5 works at the byte level, seeing every character natively, making it an ideal fit for polysynthetic languages with rich, non-Latin orthographies.

Training

  • Training samples: 10,335 (word -> lemma pairs)
  • Evaluation samples: 1,355
  • Epochs: 10 | Batch size: 8 | Learning rate: 1e-4
  • Precision: BF16
  • Hardware: NVIDIA RTX 5060 Ti (16 GB)

Usage

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
import torch

model_id = "Grundik/abkhaz-lemma-byt5"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSeq2SeqLM.from_pretrained(model_id)

def lemmatize(word: str, pos: str = "NOUN") -> str:
    prompt = f"POS: {pos} WORD: {word}"
    inputs = tokenizer(prompt, return_tensors="pt")
    with torch.no_grad():
        outputs = model.generate(
            inputs.input_ids,
            attention_mask=inputs.attention_mask,
            max_length=64,
            num_beams=4,
            early_stopping=True,
        )
    return tokenizer.decode(outputs[0], skip_special_tokens=True).strip()

print(lemmatize("дцеит", "VERB"))
print(lemmatize("аҳәынҭқарра", "NOUN"))

Training Data

The model was trained on word-form -> lemma pairs extracted from the UD_Abkhaz-AbNC treebank, a subset of the Abkhaz National Corpus annotated in the Universal Dependencies format.

Limitations & Recommendations

  • Trained on ~10k unique pairs. For a polysynthetic language, this covers only a fraction of possible inflectional paradigms.
  • Recommended Architecture: Use a rule-based morphological generator as the primary tool for exact lookup, with this ByT5 model as a fallback for out-of-vocabulary or OCR-noisy forms.

Citation

@misc{UD_Abkhaz-AbNC,
  author = {Universal Dependencies},
  title  = {UD Abkhaz-AbNC},
  url    = {https://github.com/UniversalDependencies/UD_Abkhaz-AbNC},
  year   = {2024}
}

Author

Trained by Marat Ionov as part of a project on the digital infrastructure of the Abkhaz language (OCR, morphology, newspaper layout analysis).

License

MIT

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