Loading…
Loading…
google/madlad400-3b-mt fine-tuned to translate into and out of three Romance languages of the Iberian Peninsula: Asturian (asturianu), Aragonese (aragonés) and Aranese (aranés, the Occitan of the Val d'Aran). One model, one target tag per language:
| Language | Target tag | |
|---|---|---|
| Asturian | <2ast> |
new tag (the base model has no Asturian) |
| Aragonese | <2an> |
the base model's own tag, retrained |
| Aranese | <2oc_aranes> |
new tag (oc-aranes is the IETF tag for Aranese) |
<2es>, <2ca>, <2en>, <2fr>). Other source languages of the base model
may work, but they are not tested.<2es> still gives Spanish and <2oc> standard (Languedocien) Occitan, and the other languages keep working
as in the base model, with a small loss (see Other languages).The model is dedicated to the TAN-IBE project (Neural machine translation for the Romance languages of the Iberian Peninsula, Universitat Oberta de Catalunya), whose openly published corpora made the Asturian and Aragonese parts of this model possible. It is not a TAN-IBE model: it was prepared by Ugiat Technologies as an independent work, and it is not produced, reviewed or endorsed by the TAN-IBE project, by Google or by the MADLAD-400 authors.
MADLAD-400-3B-MT has no Asturian tag, its <2an> often answers in Spanish or produces unrelated text, and its <2oc>
produces standard Occitan, not Aranese. (Its <2arn> tag is Mapudungun, ISO 639-3 arn, not Aranese.)
| English | Original model | This model |
|---|---|---|
| Hey guys, are you coming to the party on Saturday? | <2an> Se veigan as imáchens de Commons sobre o sábado. |
<2an> Ei chicos, venitz a la fiesta d'o sabado? |
| It rained all night, but this morning the sky is clear. | <2an> Pluvió toda la noche, pero esta mañana el cielo está despejado. |
<2an> Pluvió toda la nueit, pero iste maitín o cielo ye claro. |
| My phone died, so I couldn't call you. | <2oc> Lo m'telefon qu'ei mort, doncas que't podèvi pas telefonar. |
<2oc_aranes> Eth mèn telèfon s'a mòrt, per çò que non t'è pogut cridar. |
| It rained all night, but this morning the sky is clear. | <2es> Llovió toda la noche, pero esta mañana el cielo está despejado. |
<2ast> Llovió toa la nueche, pero esta mañana'l cielu ye claru. |
More examples, into each language (this model, English source):
| English | Asturian <2ast> |
Aragonese <2an> |
Aranese <2oc_aranes> |
|---|---|---|---|
| Our new product will be available in stores next month. | El nuesu nuevu productu va tar disponible nes tiendes el mes siguiente. | O nuestro nuevo producto estará disponible en as botigas o mes que viene. | Eth nòste nau producte serà disponible enes botigues eth mes que ven. |
| Click here to download the file to your computer. | Fai clic equí pa descargar l'archivu nel so ordenador. | Clica aquí ta descargar l'archivo en o tuyo ordenador. | Cliquetz aciu entà descarregar eth fichèr en vòste ordenador. |
| The town council has approved the new budget for next year. | El conceyu aprobó'l nuevu presupuestu pa l'añu que viene. | O concello ha aprobau o nuevo presupuesto ta l'anyo que viene. | Er ajuntament a aprovat eth nau pressupòst entar an que ven. |
| He drives to work every day because the bus is always late. | Conduce al trabayu tolos díes porque l'autobús siempres llega tarde. | Conduce ta o treballo cada día porque l'autobús siempre tarda. | Qu'amie eth coche entà trabalhar toti es dies pr'amor qu'er autobús tostemp se tarde. |
These examples were not reviewed by native speakers. See Limitations for the kinds of error we have seen.
from transformers import AutoTokenizer, T5ForConditionalGeneration
repo = "Ugiat/madlad400-3b-mt-ast-an-oc_aranes"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = T5ForConditionalGeneration.from_pretrained(repo, dtype="auto", device_map="auto")
def translate(text, tag):
ids = tokenizer(f"{tag} {text}", return_tensors="pt").input_ids.to(model.device)
out = model.generate(input_ids=ids, max_new_tokens=128, num_beams=4)
return tokenizer.decode(out[0], skip_special_tokens=True)
for tag in ("<2ast>", "<2an>", "<2oc_aranes>"):
print(tag, translate("Tomorrow we will go to the market to buy fruit and vegetables.", tag))
print(translate("Mañá vamos dir al mercáu a mercar fruta y verdura.", "<2en>")) # out of Asturian
<2oc_aranes> (id 256000) and <2ast> (id 256001) are SentencePiece pieces,
defined like MADLAD-400's own <2xx> tags. The base model's tokenizer does not know them.import ctranslate2
from huggingface_hub import snapshot_download
from transformers import AutoTokenizer
path = snapshot_download("Ugiat/madlad400-3b-mt-ast-an-oc_aranes-ct2")
tokenizer = AutoTokenizer.from_pretrained(path)
translator = ctranslate2.Translator(path, device="cuda", compute_type="int8_float16") # or device="cpu", compute_type="int8"
def translate(sentences, tag):
batch = [tokenizer.convert_ids_to_tokens(tokenizer.encode(f"{tag} {s}")) for s in sentences]
return [tokenizer.decode(tokenizer.convert_tokens_to_ids(r.hypotheses[0]), skip_special_tokens=True)
for r in translator.translate_batch(batch, beam_size=4)]
print(translate(["El museo estará cerrado durante las obras de reforma."], "<2an>"))
FLORES+ devtest (1,012 sentences), BLEU / chrF (higher is better), sacrebleu 2.6 defaults. We ran every model ourselves on the same test files, with the decoding of their model cards (notes below the tables). A dash means the model does not translate that direction.
Models compared: TAN-IBE Marian models (aoliverg/MTUOC-Marian-TAN-IBE-*, Spanish ↔
each language, under 0.1B parameters, GPL-3.0),
SalamandraTA-7B (GPL-3.0) and
2B (Apache-2.0),
IbRo-nllb (1.3B, Apache-2.0) and the base model.
| Into Asturian | Spanish | Catalan | English | French |
|---|---|---|---|---|
This model <2ast> |
17.8 / 51.5 | 27.7 / 59.2 | 29.9 / 60.8 | 24.5 / 56.4 |
| TAN-IBE | 17.8 / 51.3 | — | — | — |
| SalamandraTA-7B | 24.3 / 54.7 | 31.0 / 59.9 | 35.7 / 63.3 | 29.0 / 58.0 |
| SalamandraTA-2B | 17.9 / 51.6 | 25.5 / 57.9 | 27.4 / 59.0 | 22.4 / 54.6 |
| IbRo-nllb | 16.8 / 50.9 | — | — | — |
| Out of Asturian | Spanish | Catalan | English | French |
|---|---|---|---|---|
| This model | 21.5 / 50.1 | 32.5 / 58.5 | 39.1 / 64.2 | 34.9 / 60.0 |
| TAN-IBE | 20.7 / 49.2 | — | — | — |
| SalamandraTA-7B | 23.8 / 51.9 | 36.3 / 61.1 | 45.2 / 68.2 | 39.1 / 63.1 |
| SalamandraTA-2B | 24.7 / 52.3 | 34.8 / 59.9 | 40.9 / 65.3 | 35.1 / 60.2 |
| IbRo-nllb | 21.3 / 49.9 | — | — | — |
| Base model | 21.2 / 49.5 | 31.0 / 57.2 | 37.3 / 62.6 | 32.9 / 58.2 |
Spanish ↔ Asturian scores are low for every model: the FLORES+ Asturian sentences are free translations, far from the Spanish sentence structure.
| Into Aragonese | Spanish | Catalan | English | French |
|---|---|---|---|---|
This model <2an> |
44.0 / 72.7 ‡ | 19.6 / 53.5 | 17.4 / 51.6 | 15.8 / 49.5 |
| TAN-IBE | 60.4 / 78.8 | — | — | — |
| SalamandraTA-7B | 59.1 / 78.2 | 27.2 / 56.5 | 27.0 / 56.1 | 23.6 / 53.0 |
| SalamandraTA-2B | 39.0 / 68.0 | 17.8 / 50.6 | 16.3 / 48.8 | 14.7 / 46.5 |
| IbRo-nllb | 59.9 / 78.8 | — | — | — |
Base model <2an> |
35.0 / 67.7 | 16.4 / 50.9 | 15.0 / 48.9 | 13.4 / 46.4 |
| Out of Aragonese | Spanish | Catalan | English | French |
|---|---|---|---|---|
| This model | 68.1 / 80.4 | 30.4 / 59.2 | 30.4 / 60.2 | 30.1 / 58.3 |
| TAN-IBE | 63.8 / 78.5 | — | — | — |
| SalamandraTA-7B | 69.6 / 81.5 | 33.4 / 61.1 | 36.6 / 64.1 | 33.7 / 61.0 |
| SalamandraTA-2B | 60.8 / 76.3 | 31.6 / 59.1 | 32.6 / 61.2 | 30.3 / 58.2 |
| IbRo-nllb | 65.3 / 78.8 | — | — | — |
| Base model | 65.5 / 79.1 | 29.5 / 58.8 | 31.1 / 60.6 | 30.0 / 57.7 |
‡ Spanish → Aragonese: a difference of written variety. The FLORES+ Aragonese reference writes the articles lo, la, los, las and per, pa, puede; Aragonese Wikipedia, where all of this model's human Aragonese comes from, mostly writes o, a, os, as and por, ta, puet, and so does this model. Word counts over the 1,012 Spanish → Aragonese outputs:
| lo / la / los / las | o / os / as | per / pa | por / ta | |
|---|---|---|---|---|
| FLORES+ reference | 693 / 650 / 446 / 301 | 150 / 43 / 47 | 242 / 199 | 0 / 59 |
| TAN-IBE | 785 / 639 / 444 / 291 | 156 / 53 / 51 | 233 / 201 | 2 / 4 |
| IbRo-nllb | 794 / 637 / 446 / 293 | 157 / 49 / 49 | 237 / 203 | 0 / 0 |
| This model | 143 / 108 / 38 / 53 | 762 / 467 / 284 | 0 / 3 | 231 / 209 |
TAN-IBE and IbRo-nllb, trained largely on Apertium output, write like the reference. On 224 held-out Spanish–Aragonese sentence pairs from Wikipedia (TAN-IBE's corpus), which none of our models was trained on, the order reverses: this model 50.9 / 73.3, TAN-IBE 45.0 / 70.2, IbRo-nllb 42.6 / 69.4. That test is in this model's training domain and may be in TAN-IBE's training data, so neither test settles which model is better; each favours its own variety.
| Into Aranese | Spanish | Catalan | English | French |
|---|---|---|---|---|
This model <2oc_aranes> |
49.0 / 72.5 | 31.3 / 60.2 | 22.2 / 53.4 | 20.3 / 51.4 |
| Ugiat/madlad400-3b-mt-oc_aranes (our Aranese-only model) | 50.2 / 73.0 | 31.7 / 60.5 | 22.8 / 53.7 | 21.1 / 51.8 |
| TAN-IBE | 50.9 / 73.0 | — | — | — |
| SalamandraTA-7B | 54.2 / 75.0 | 33.0 / 61.2 | 27.5 / 56.9 | 23.9 / 53.5 |
| SalamandraTA-2B | 45.6 / 70.3 | 29.5 / 59.0 | 20.3 / 50.7 | 17.5 / 48.5 |
| IbRo-nllb | 50.3 / 73.2 | 31.4 / 60.5 | — | — |
| aina-translator-es-oc (CC BY-NC 4.0) | 53.0 / 74.4 | — | — | — |
Base model <2oc> (standard Occitan) |
10.8 / 46.1 | 8.5 / 42.8 | 6.8 / 39.4 | 5.8 / 37.8 |
| Out of Aranese | Spanish | Catalan | English | French |
|---|---|---|---|---|
| This model | 61.2 / 76.5 | 38.7 / 64.7 | 31.0 / 60.6 | 31.4 / 59.0 |
| Ugiat/madlad400-3b-mt-oc_aranes | 61.2 / 76.5 | 39.5 / 65.1 | 31.7 / 61.1 | 31.7 / 59.3 |
| TAN-IBE | 51.6 / 71.8 | — | — | — |
| SalamandraTA-7B | 63.0 / 77.7 | 41.1 / 66.1 | 36.1 / 63.7 | 33.5 / 60.7 |
| SalamandraTA-2B | 54.4 / 72.3 | 38.9 / 64.7 | 31.8 / 61.0 | 30.8 / 58.9 |
| IbRo-nllb | 56.4 / 73.3 | 15.8 / 48.6 † | — | — |
| Base model | 55.4 / 72.6 | 36.9 / 63.8 | 28.3 / 57.9 | 28.4 / 56.5 |
Held-out test of 1,000 Catalan–Aranese pairs from the BSC corpus (in this model's training domain; the corpus' Catalan side was partly generated by SalamandraTA-7B): Catalan → Aranese 51.9 / 73.3 (SalamandraTA-7B 46.7 / 70.3, IbRo-nllb 45.5 / 69.6), Aranese → Catalan 61.3 / 77.5 (SalamandraTA-7B 65.1 / 80.7).
Aranese, not standard Occitan. 79–82 % of this model's FLORES+ outputs into Aranese contain typically Aranese
words (eth, deth, ath, ena, damb, ua…) and 1–3 % typically Languedocien words (lo, los, dins, amb, pas…); the
reference: 80 % and 1 %; the base model's <2oc>: 2–4 % and 87–91 %.
ast_Latn, arg_Latn, arn_Latn. This model: beam 4.Every direction loses a little, −0.69 chrF++ on average, most for Chinese and Japanese. English → Spanish: chrF++ 54.1 → 53.5, spBLEU 32.9 → 31.9.
| Direction | chrF++ original | chrF++ this model | Δ |
|---|---|---|---|
| English → French | 69.9 | 69.6 | −0.3 |
| English → German | 64.3 | 63.8 | −0.5 |
| English → Portuguese | 69.8 | 69.2 | −0.5 |
| English → Italian | 57.3 | 56.8 | −0.5 |
| English → Catalan | 65.7 | 65.1 | −0.5 |
| English → Russian | 56.3 | 55.5 | −0.8 |
| English → Chinese | 26.8 | 25.4 | −1.4 |
| English → Japanese | 27.2 | 25.3 | −1.9 |
| English → Arabic | 53.5 | 53.0 | −0.6 |
| English → Hindi | 52.8 | 52.7 | −0.1 |
| Spanish → English | 58.5 | 57.7 | −0.8 |
| French → English | 67.9 | 67.2 | −0.7 |
| German → English | 67.6 | 67.2 | −0.4 |
LoRA fine-tune of the base model with two new tag embeddings (<2oc_aranes> initialised from <2oc>, <2ast> from
<2es>), merged into the weights. One epoch over 1.61M pairs plus 0.53M replay pairs (the base model's own
translations of MADLAD-400 sentences, to limit forgetting).
<2ast> / <2an> → the human sentence and with <2es> → its
Spanish, and with <2oc_aranes> → Aranese and <2oc> → standard Occitan, so that each tag keeps its own language.<2ast> (e.g. Oye chicos, ¿vienen a la fiesta el
sábado?), and meaning errors occur, such as a wrong person (nun pudo llamar-y, "he couldn't call him", for "I
couldn't call you") or a wrong word (Aragonese charrar, "to talk", for "to call").<2es> on Spanish input. The tag was trained on other source languages; on Spanish input it can
answer in Asturian.Please cite the MADLAD-400 paper, which introduced the base model, and PILAR:
@misc{kudugunta2023madlad400,
title={MADLAD-400: A Multilingual And Document-Level Large Audited Dataset},
author={Sneha Kudugunta and Isaac Caswell and Biao Zhang and Xavier Garcia and Christopher A. Choquette-Choo and Katherine Lee and Derrick Xin and Aditya Kusupati and Romi Stella and Ankur Bapna and Orhan Firat},
year={2023},
eprint={2309.04662},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
@misc{PILAR,
editor={Galiano-Jiménez, Aarón and Sánchez-Martínez, Felipe and Pérez-Ortiz, Juan Antonio},
title={PILAR},
url={https://github.com/transducens/PILAR},
year={2024}
}
Suggested reference for this model:
@misc{madlad400_3b_mt_ast_an_oc_aranes,
title={MADLAD-400-3B-MT for Asturian, Aragonese and Aranese},
author={Ugiat},
organization={Ugiat Technologies},
year={2026},
howpublished={\url{https://huggingface.co/Ugiat/madlad400-3b-mt-ast-an-oc_aranes}}
}
Ugiat Technologies, ugiat@ugiat.com.
google/madlad400-3b-mt