text classification

mBERT fine-tuned on the GEnCaTa dataset for Parallel Corpus Filtering

Table of Contents

<details> <summary>Click to expand</summary>

Model description

We fine-tuned mBERT for the task of Catalan-English Parallel Corpus Filtering with the GEnCaTa dataset.

The model has been fine-tuned on general domain data and is expected to work best with that type of text.

Intended uses and limitations

You can use this model for parallel corpus fitering, also known as, sentence alignment filtering.

How to use

Here is how to use this model with the pipeline API:

from transformers import AutoModelForSequenceClassification, pipeline,AutoTokenizer

filterer = pipeline("text-classification", model="projecte-aina/mbert-base-gencata")

tokenizer = AutoTokenizer.from_pretrained("projecte-aina/mbert-base-gencata")

def prepare(sentence_pairs):
    sentence_pairs_prep = []
    for s1, s2 in sentence_pairs:
        sentence_pairs_prep.append(f"{tokenizer.cls_token} {s1}{tokenizer.sep_token}{tokenizer.sep_token} {s2}{tokenizer.sep_token}")
    return sentence_pairs_prep

sentence_pairs = [("La depressió pot afectar a persones de qualsevol edat.", "Depression can affect people at any age."),
                  ("Publicació de la llista dels resultats de la 5a prova: entrevista personal (Annex 1), i de la llista de les persones convocades a la realització del curs de formació selectiu (Annex 2)", "It also receives accident reports from 112 calls made by the public, or from businesses, the police, etc. When an incident alert is received, CECAT carries out a real-time analysis of the consequences and any significant risk associated with it, to determine if an emergency plan and its relevant procedures should be activated.")]

print(filterer(prepare(sentence_pairs), max_length=512, truncation=True,padding=True))

Expected output:

[{'label': 'aligned', 'score': 0.9081919193267822},
{'label': 'not_aligned', 'score': 0.5506048798561096}]

Limitations and bias

At the time of submission, no measures have been taken to estimate the bias embedded in the model. However, we are well aware that our models may be biased since the corpora have been collected using crawling techniques on multiple web sources. We intend to conduct research in these areas in the future, and if completed, this model card will be updated.

Training

Training data

As training data, we used the GEnCaTa dataset, a Catalan-English dataset annotated for Parallel Corpus Filtering for MT. It is extracted from a general domain corpus crawled from the Catalan Government domains and subdomains.

Training procedure

Tokenization

The training corpus has been tokenized using a byte version of Byte-Pair Encoding (BPE) with a vocabulary size of 51,200 tokens.

Hyperparameters

Hyper-parameter Value
Learning Rate 0.8e-5
Learning Rate Decay Linear
Warmup 0.06
Batch Size 64
Weight Decay 0.01
Max. Training Epochs 10

Variable and metrics

Although we can report accuracy scores, the best way to evaluate this model is to filter a parallel corpus and train a Machine Translation system with the filtered data. For that, we train two different MT models and evaluate them on Flores-101 with BLEU scores.

Evaluation results

Below the evaluation results on Flores-101 from two MT systems: RAW and FIL (filtered corpus with our model).

Direction RAW FIL
EN > CA 35.7 38.0
CA > EN 34.7 37.6

Additional information

Author

Text Mining Unit (TeMU) at the Barcelona Supercomputing Center (bsc-temu@bsc.es)

Contact information

For further information, send an email to aina@bsc.es

Copyright

Copyright (c) 2022 Text Mining Unit at Barcelona Supercomputing Center

Licensing information

Apache License, Version 2.0

Funding

This work was funded by MT4All CEF project and the [Departament de la Vicepresidència i de Polítiques Digitals i Territori de la Generalitat de Catalunya](https://politiquesdigitals.gencat.cat/ca/inici/index.html#googtrans(ca|en) within the framework of Projecte AINA.

Citation

If you use any of these resources (datasets or models) in your work, please cite our latest paper:

@inproceedings{degibertbonet-EtAl:2022:SIGUL,
abstract = {In this work, we make the case of quality over quantity when training a MT system for a medium-to-low-resource language pair, namely Catalan-English. We compile our training corpus out of existing resources of varying quality and a new high-quality corpus. We also provide new evaluation translation datasets in three different domains. In the process of building Catalan-English parallel resources, we evaluate the impact of drastically filtering alignments in the resulting MT engines. Our results show that even when resources are limited, as in this case, it is worth filtering for quality. We further explore the cross-lingual transfer learning capabilities of the proposed model for parallel corpus filtering by applying it to other languages. All resources generated in this work are released under open license to encourage the development of language technology in Catalan.},
address = {Marseille, France},
author = {{de Gibert Bonet}, Ona and Kharitonova, Ksenia and {Calvo Figueras}, Blanca and Armengol-Estap{\'{e}}, Jordi and Melero, Maite},
booktitle = {Proceedings of the the 1st Annual Meeting of the ELRA/ISCA Special Interest Group on Under-Resourced Languages},
pages = {59--69},
publisher = {European Language Resources Association},
title = {{Quality versus Quantity: Building Catalan-English MT Resources}},
url = {http://www.lrec-conf.org/proceedings/lrec2022/workshops/SIGUL/pdf/2022.sigul-1.8.pdf},
year = {2022}
}

Disclaimer

<details> <summary>Click to expand</summary>

The models published in this repository are intended for a generalist purpose and are available to third parties. These models may have bias and/or any other undesirable distortions.

When third parties, deploy or provide systems and/or services to other parties using any of these models (or using systems based on these models) or become users of the models, they should note that it is their responsibility to mitigate the risks arising from their use and, in any event, to comply with applicable regulations, including regulations regarding the use of Artificial Intelligence.

In no event shall the owner and creator of the models (BSC – Barcelona Supercomputing Center) be liable for any results arising from the use made by third parties of these models.