Model Sources

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:

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:

Model LLaMAX LLaMAX-Alpaca
Llama-2 Link Link
Llama-3 Link Link

Citation

If our model helps your work, please cite this paper:

@inproceedings{lu-etal-2024-llamax,
    title = "{LL}a{MAX}: 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",
    editor = "Al-Onaizan, Yaser  and
      Bansal, Mohit  and
      Chen, Yun-Nung",
    booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2024",
    month = nov,
    year = "2024",
    address = "Miami, Florida, USA",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2024.findings-emnlp.631",
    doi = "10.18653/v1/2024.findings-emnlp.631",
    pages = "10748--10772",
    abstract = "Large Language Models (LLMs) demonstrate remarkable translation capabilities in high-resource language tasks, yet their performance in low-resource languages is hindered by insufficient multilingual data during pre-training. To address this, we conduct extensive multilingual continual pre-training on the LLaMA series models, enabling translation support across more than 100 languages. Through a comprehensive analysis of training strategies, such as vocabulary expansion and data augmentation, we develop LLaMAX. Remarkably, without sacrificing its generalization ability, LLaMAX achieves significantly higher translation performance compared to existing open-source LLMs (by more than 10 spBLEU points) and performs on-par with specialized translation model (M2M-100-12B) on the Flores-101 benchmark. Extensive experiments indicate that LLaMAX can serve as a robust multilingual foundation model. The code and the models are publicly available.",
}
Downloads last month
344
Safetensors
Model size
6.74B params
Tensor type
F32
ยท
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 LLaMAX/LLaMAX2-7B-Alpaca

Quantizations
2 models

Space using LLaMAX/LLaMAX2-7B-Alpaca 1