valid not_valid
---
language: "ca"
license: mit
tags:
- text classification
task_categories:
- text-scoring
task_ids:
- semantic-similarity-scoring
datasets:
- projecte-aina/gencata
inference: false
---

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

## Table of Contents
- [Model Description](#model-description)
- [Intended Uses and Limitations](#intended-use)
- [How to Use](#how-to-use)
- [Training](#training)
  - [Training Data](#training-data)
  - [Training Procedure](#training-procedure)
    - [Tokenization](#tokenization)
    - [Hyperparameters](#hyperparameters)
- [Evaluation](#evaluation)
  - [Variable and Metrics](#variable-and-metrics)
  - [Evaluation Results](#evaluation-results)
- [Citation Information](#citation-information)
- [Contributions](#contributions)
- [Funding](#funding)

## Model description

We fine-tuned [mBERT](https://huggingface.co/bert-base-multilingual-cased) for the task of Catalan-English Parallel Corpus Filtering with the [GEnCaTa](https://huggingface.co/datasets/projecte-aina/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](https://huggingface.co/transformers/main_classes/pipelines.html):

```python
from transformers import pipeline
filterer = pipeline("text-classification", model="projecte-aina/mbert-base-gencata")
ca = '- El vostre vehicle quedi immobilitzat per l'aigua'
en = 'You must leave your car and head for higher ground when:'

print(filterer([(ca, en)], max_length=512, truncation=True))
```

## Training

### Training Data

As training data, we used the [GEnCaTa](https://huggingface.co/datasets/projecte-aina/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)](https://github.com/openai/gpt-2) 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](https://huggingface.co/datasets/gsarti/flores_101) with BLEU scores.

## Evaluation Results

Below the evaluation results on [Flores-101](https://huggingface.co/datasets/gsarti/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**  |

## Licensing Information

[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)

## 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}
}
```

## Contributions

[N/A]

## 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](https://politiquesdigitals.gencat.cat/ca/economia/catalonia-ai/aina).
