Edit model card

LiBERTa

LiBERTa Large is a BERT-like model pre-trained from scratch exclusively for Ukrainian. It was presented during the UNLP @ LREC-COLING 2024. Further details are in the LiBERTa: Advancing Ukrainian Language Modeling through Pre-training from Scratch paper.

All the code is available in the Goader/ukr-lm repository.

Evaluation

Read the paper for more detailed tasks descriptions.

NER-UK (Micro F1) WikiANN (Micro F1) UD POS (Accuracy) News (Macro F1)
Base Models
xlm-roberta-base 90.86 (0.81) 92.27 (0.09) 98.45 (0.07) -
roberta-base-wechsel-ukrainian 90.81 (1.51) 92.98 (0.12) 98.57 (0.03) -
electra-base-ukrainian-cased-discriminator 90.43 (1.29) 92.99 (0.11) 98.59 (0.06) -
Large Models
xlm-roberta-large 90.16 (2.98) 92.92 (0.19) 98.71 (0.04) 95.13 (0.49)
roberta-large-wechsel-ukrainian 91.24 (1.16) 93.22 (0.17) 98.74 (0.06) 96.48 (0.09)
liberta-large 91.27 (1.22) 92.50 (0.07) 98.62 (0.08) 95.44 (0.04)
liberta-large-v2 91.73 (1.81) 93.22 (0.14) 98.79 (0.06) 95.67 (0.12)

Fine-Tuning Hyperparameters

Hyperparameter Value
Peak Learning Rate 3e-5
Warm-up Ratio 0.05
Learning Rate Decay Linear
Batch Size 16
Epochs 10
Weight Decay 0.05

How to Get Started with the Model

Use the code below to get started with the model. Note, that the repository contains custom code for tokenization:

Pipeline usage:

>>> from transformers import pipeline

>>> fill_mask = pipeline("fill-mask", "Goader/liberta-large", trust_remote_code=True)
>>> fill_mask("Арсенальна - найглибша станція <mask> у світі.")

[{'score': 0.929235577583313,
  'token': 8670,
  'token_str': 'метро',
  'sequence': 'Арсенальна - найглибша станція метро у світі.'},
 {'score': 0.005501953419297934,
  'token': 8608,
  'token_str': 'світла',
  'sequence': 'Арсенальна - найглибша станція світла у світі.'},
 {'score': 0.0037314200308173895,
  'token': 3808,
  'token_str': 'Європи',
  'sequence': 'Арсенальна - найглибша станція Європи у світі.'},
 {'score': 0.0032518072985112667,
  'token': 21678,
  'token_str': 'ЮНЕСКО',
  'sequence': 'Арсенальна - найглибша станція ЮНЕСКО у світі.'},
 {'score': 0.002941741142421961,
  'token': 20250,
  'token_str': 'залізниці',
  'sequence': 'Арсенальна - найглибша станція залізниці у світі.'}]

Extracting embeddings:

from transformers import AutoTokenizer, AutoModel

tokenizer = AutoTokenizer.from_pretrained("Goader/liberta-large", trust_remote_code=True)
model = AutoModel.from_pretrained("Goader/liberta-large")

encoded = tokenizer('Арсенальна - найглибша станція метро у світі.', return_tensors='pt')

output = model(**encoded)

Citation

@inproceedings{haltiuk-smywinski-pohl-2024-liberta,
    title = "{L}i{BERT}a: Advancing {U}krainian Language Modeling through Pre-training from Scratch",
    author = "Haltiuk, Mykola  and
      Smywi{\'n}ski-Pohl, Aleksander",
    editor = "Romanyshyn, Mariana  and
      Romanyshyn, Nataliia  and
      Hlybovets, Andrii  and
      Ignatenko, Oleksii",
    booktitle = "Proceedings of the Third Ukrainian Natural Language Processing Workshop (UNLP) @ LREC-COLING 2024",
    month = may,
    year = "2024",
    address = "Torino, Italia",
    publisher = "ELRA and ICCL",
    url = "https://aclanthology.org/2024.unlp-1.14",
    pages = "120--128",
    abstract = "Recent advancements in Natural Language Processing (NLP) have spurred remarkable progress in language modeling, predominantly benefiting English. While Ukrainian NLP has long grappled with significant challenges due to limited data and computational resources, recent years have seen a shift with the emergence of new corpora, marking a pivotal moment in addressing these obstacles. This paper introduces LiBERTa Large, the inaugural BERT Large model pre-trained entirely from scratch only on Ukrainian texts. Leveraging extensive multilingual text corpora, including a substantial Ukrainian subset, LiBERTa Large establishes a foundational resource for Ukrainian NLU tasks. Our model outperforms existing multilingual and monolingual models pre-trained from scratch for Ukrainian, demonstrating competitive performance against those relying on cross-lingual transfer from English. This achievement underscores our ability to achieve superior performance through pre-training from scratch with additional enhancements, obviating the need to rely on decisions made for English models to efficiently transfer weights. We establish LiBERTa Large as a robust baseline, paving the way for future advancements in Ukrainian language modeling.",
}

Licence

CC-BY 4.0

Authors

The model was trained by Mykola Haltiuk as a part of his Master's Thesis under the supervision of Aleksander Smywiński-Pohl, PhD, AGH University of Krakow.

Downloads last month
4
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for Goader/liberta-large

Finetunes
3 models

Dataset used to train Goader/liberta-large

Collection including Goader/liberta-large