tags:
- Multilingual
license: mit
language:
- af
- am
- ar
- hy
- as
- ast
- az
- be
- bn
- bs
- bg
- my
- ca
- ceb
- zho
- hr
- cs
- da
- nl
- en
- et
- tl
- fi
- fr
- ff
- gl
- lg
- ka
- de
- el
- gu
- ha
- he
- hi
- hu
- is
- ig
- id
- ga
- it
- ja
- jv
- kea
- kam
- kn
- kk
- km
- ko
- ky
- lo
- lv
- ln
- lt
- luo
- lb
- mk
- ms
- ml
- mt
- mi
- mr
- mn
- ne
- ns
- 'no'
- ny
- oc
- or
- om
- ps
- fa
- pl
- pt
- pa
- ro
- ru
- sr
- sn
- sd
- sk
- sl
- so
- ku
- es
- sw
- sv
- tg
- ta
- te
- th
- tr
- uk
- umb
- ur
- uz
- vi
- cy
- wo
- xh
- yo
- zu
Model Sources
Paper: "LLaMAX: Scaling Linguistic Horizons of LLM by Enhancing Translation Capabilities Beyond 100 Languages"
Repository: https://github.com/CONE-MT/LLaMAX/
Model Description
LLaMAX is a language model with powerful multilingual capabilities without loss instruction-following capabilities.
We collected extensive training sets in 102 languages for continued pre-training of Llama2 and leveraged the English instruction fine-tuning dataset, Alpaca, to fine-tune its instruction-following capabilities.
🔥 Effortless Multilingual Translation with a Simple Prompt
LLaMAX supports translation between more than 100 languages, surpassing the performance of similarly scaled LLMs.
def Prompt_template(query, src_language, trg_language):
instruction = f'Translate the following sentences from {src_language} to {trg_language}.'
prompt = (
'Below is an instruction that describes a task, paired with an input that provides further context. '
'Write a response that appropriately completes the request.\n'
f'### Instruction:\n{instruction}\n'
f'### Input:\n{query}\n### Response:'
)
return prompt
And then run the following codes to execute translation:
from transformers import AutoTokenizer, LlamaForCausalLM
model = LlamaForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
query = "你好,今天是个好日子"
prompt = Prompt_template(query, 'Chinese', 'English')
inputs = tokenizer(prompt, return_tensors="pt")
generate_ids = model.generate(inputs.input_ids, max_length=30)
tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
# => "Hello, today is a good day"
🔥 Excellent Translation Performance
LLaMAX achieves an average spBLEU score improvement of over 10 points compared to the LLaMA2-Alpaca model on the Flores-101 dataset.
System | Size | en-X (COMET) | en-X (BLEU) | zh-X (COMET) | zh-X (BLEU) | de-X (COMET) | de-X (BLEU) | ne-X (COMET) | ne-X (BLEU) | ar-X (COMET) | ar-X (BLEU) | az-X (COMET) | az-X (BLEU) | ceb-X (COMET) | ceb-X (BLEU) |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LLaMAX2-7B-Alpaca | 7B | 52.83 | 9.44 | 51.29 | 3.80 | 51.47 | 6.82 | 46.59 | 1.31 | 46.76 | 2.84 | 48.63 | 1.36 | 41.02 | 2.69 |
LLaMAX2-7B-Alpaca | 13B | 57.16 | 11.85 | 53.93 | 6.25 | 54.70 | 9.42 | 51.47 | 3.11 | 50.73 | 5.23 | 50.68 | 2.74 | 47.86 | 4.96 |
LLaMAX2-7B-Alpaca | 7B | 76.66 | 23.17 | 73.54 | 14.17 | 73.82 | 18.96 | 74.64 | 14.49 | 72.00 | 15.82 | 70.91 | 11.34 | 68.67 | 15.53 |
System | Size | X-en (COMET) | X-en (BLEU) | X-zh (COMET) | X-zh (BLEU) | X-de (COMET) | X-de (BLEU) | X-ne (COMET) | X-ne (BLEU) | X-ar (COMET) | X-ar (BLEU) | X-az (COMET) | X-az (BLEU) | X-ceb (COMET) | X-ceb (BLEU) |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LLaMAX2-7B-Alpaca | 7B | 65.85 | 16.44 | 56.53 | 4.46 | 56.76 | 9.01 | 34.96 | 1.03 | 44.10 | 2.18 | 40.67 | 0.63 | 45.69 | 1.73 |
LLaMAX2-7B-Alpaca | 13B | 68.72 | 19.69 | 64.46 | 8.80 | 62.86 | 12.57 | 38.88 | 2.16 | 52.08 | 4.48 | 41.18 | 0.87 | 48.47 | 2.51 |
LLaMAX2-7B-Alpaca | 7B | 80.55 | 30.63 | 75.52 | 13.53 | 74.47 | 19.26 | 67.36 | 15.47 | 75.40 | 15.32 | 72.03 | 10.27 | 65.05 | 16.11 |
🔥 Effective Base Model for Multilingual Task
LLaMAX preserves its efficacy in general tasks and improves the performance on multilingual tasks. We fine-tuned LLaMAX using only the English training set of downstream task, which also shows significant improvements in non-English. We provide fine-tuning LLaMAX models for the following three tasks:
Math Reasoning: https://huggingface.co/LLaMAX/LLaMAX2-7B-MetaMath
Commonsense Reasoning: https://huggingface.co/LLaMAX/LLaMAX2-7B-X-CSQA
Natural Language Inference: https://huggingface.co/LLaMAX/LLaMAX2-7B-XNLI
Supported Languages
Akrikaans (af), Amharic (am), Arabic (ar), Armenian (hy), Assamese (as), Asturian (ast), Azerbaijani (az), Belarusian (be), Bengali (bn), Bosnian (bs), Bulgarian (bg), Burmese (my), Catalan (ca), Cebuano (ceb), Chinese Simpl (zho), Chinese Trad (zho), Croatian (hr), Czech (cs), Danish (da), Dutch (nl), English (en), Estonian (et), Filipino (tl), Finnish (fi), French (fr), Fulah (ff), Galician (gl), Ganda (lg), Georgian (ka), German (de), Greek (el), Gujarati (gu), Hausa (ha), Hebrew (he), Hindi (hi), Hungarian (hu), Icelandic (is), Igbo (ig), Indonesian (id), Irish (ga), Italian (it), Japanese (ja), Javanese (jv), Kabuverdianu (kea), Kamba (kam), Kannada (kn), Kazakh (kk), Khmer (km), Korean (ko), Kyrgyz (ky), Lao (lo), Latvian (lv), Lingala (ln), Lithuanian (lt), Luo (luo), Luxembourgish (lb), Macedonian (mk), Malay (ms), Malayalam (ml), Maltese (mt), Maori (mi), Marathi (mr), Mongolian (mn), Nepali (ne), Northern Sotho (ns), Norwegian (no), Nyanja (ny), Occitan (oc), Oriya (or), Oromo (om), Pashto (ps), Persian (fa), Polish (pl), Portuguese (pt), Punjabi (pa), Romanian (ro), Russian (ru), Serbian (sr), Shona (sn), Sindhi (sd), Slovak (sk), Slovenian (sl), Somali (so), Sorani Kurdish (ku), Spanish (es), Swahili (sw), Swedish (sv), Tajik (tg), Tamil (ta), Telugu (te), Thai (th), Turkish (tr), Ukrainian (uk), Umbundu (umb), Urdu (ur), Uzbek (uz), Vietnamese (vi), Welsh (cy), Wolof (wo), Xhosa (xh), Yoruba (yo), Zulu (zu)
Model Index
We implement multiple versions of the LLaMAX model, the model links are as follows:
Citation
If our model helps your work, please cite this paper:
@article{lu2024llamax,
title={LLaMAX: Scaling Linguistic Horizons of LLM by Enhancing Translation Capabilities Beyond 100 Languages},
author={Lu, Yinquan and Zhu, Wenhao and Li, Lei and Qiao, Yu and Yuan, Fei},
journal={arXiv preprint arXiv:2407.05975},
year={2024}
}