--- language: - en - id - ta - th - vi license: llama3 --- # LLaMA3 8B CPT SEA-LIONv2 Instruct SEA-LION is a collection of Large Language Models (LLMs) which has been pretrained and instruct-tuned for the Southeast Asia (SEA) region. LLaMA3 8B CPT SEA-LIONv2 Instruct is a multilingual model which has been fine-tuned with **thousands of English and Indonesian instruction-completion pairs** alongside a smaller pool of instruction-completion pairs from other ASEAN languages. These instructions have been carefully curated and rewritten to ensure the model was trained on truly open, commercially permissive and high quality datasets. SEA-LION stands for _Southeast Asian Languages In One Network_. - **Developed by:** Products Pillar, AI Singapore - **Funded by:** Singapore NRF - **Model type:** Decoder - **Languages:** English, Indonesian, Thai, Vietnamese, Tamil - **License:** [LLaMA3 Community License](https://huggingface.co/meta-llama/Meta-Llama-3-8B/blob/main/LICENSE) ## Model Details ### Base model We performed instruction tuning in English and Indonesian on our [continued pre-trained LLaMA3 CPT 8B SEA-LIONv2](https://huggingface.co/aisingapore/llama3-8b-cpt-sealionv2-base), a decoder model using the LLaMA3 architecture, to create LLaMA3 8B SEA-LIONv2 Instruct. ### Benchmark Performance We evaluated LLaMA3 8B CPT SEA-LIONv2 Instruct on the BHASA benchmark ([arXiv](https://arxiv.org/abs/2309.06085v2) and [GitHub](https://github.com/aisingapore/bhasa)) across a variety of tasks. BHASA stands out amongst other evaluations for SEA languages for its holistic approach to evaluation, including not just traditional Natural Language Processing (NLP) benchmarking tasks (such as sentiment analysis and question answering), but also linguistic and cultural diagnostic tests which are meticulously handcrafted. The evaluation was done zero-shot with Indonesian prompts and only a sample of 100-1000 instances for each dataset was used as per the setting described in the BHASA paper. The scores shown in the table below have been adjusted to only consider answers provided in the appropriate language. #### General Language Capabilities (BHASA) | | | | **QA** | **Sentiment** | **Toxicity** | **Eng>Lang** | **Lang>Eng** | **Summary** | **NLI** | **Causal** | **LINDSEA** | |:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:| | **Language** | **Model** | **Win-rate** | **F1** | **F1** | **Macro-F1** | **ChrF++** | **ChrF++** | **F1** | **Accuracy** | **Accuracy** | **Accuracy** | | ID | llama3-8b-cpt-sealionv2-instruct | 76.39% | 72.23 | 84.72 | 54.64 | 66.71 | 65.29 | 18.70 | 68.90 | 87.40 | 39.91 | | ID | gemma-2-9b-it | 76.39% | 54.77 | 78.83 | 53.37 | 66.56 | 65.15 | 18.20 | 72.00 | 94.20 | 72.14 | | ID | aya-23-8B | 61.11% | 64.51 | 82.61 | 45.40 | 64.60 | 63.91 | 22.15 | 44.40 | 89.00 | 50.45 | | ID | SeaLLM3-7B-Chat | 51.39% | 45.42 | 74.58 | 50.42 | 64.03 | 63.44 | 17.44 | 58.20 | 92.00 | 65.22 | | ID | Qwen2-7B-Instruct | 45.83% | 45.77 | 81.97 | 42.92 | 58.83 | 62.79 | 13.66 | 63.70 | 90.80 | 65.32 | | ID | Meta-Llama-3.1-8B-Instruct | 41.67% | 63.98 | 61.34 | 37.10 | 63.90 | **65.35** | 19.44 | 29.40 | 83.20 | 57.12 | | ID | Sailor-7B-Chat | 41.67% | 36.93 | **85.17** | 42.67 | 66.61 | 63.34 | 14.16 | 59.50 | 85.20 | 54.10 | | ID | Meta-Llama-3-8B-Instruct | 36.11% | 55.49 | 72.27 | 44.68 | 56.54 | 55.63 | 15.35 | 71.80 | 82.40 | 59.25 | | ID | Mistral-7B-Instruct-v0.3 | 19.44% | 40.69 | 78.84 | 40.33 | 49.88 | 57.89 | 15.74 | 59.60 | 71.80 | 34.48 | | | | | | | | | | | | | | | VI | gemma-2-9b-it | 78.91% | 48.11 | 64.23 | **50.08** | 57.21 | 59.20 | 17.18 | 52.40 | **92.60** | - | | VI | llama3-8b-cpt-sealionv2-instruct | 64.84% | 57.05 | 54.09 | 21.99 | 58.60 | 58.97 | 18.28 | 52.40 | 87.80 | - | | VI | SeaLLM3-7B-Chat | 57.81% | 48.71 | 51.36 | 27.60 | 55.05 | 57.64 | 16.40 | 54.50 | 89.40 | - | | VI | Qwen2-7B-Instruct | 54.69% | 43.21 | 61.94 | 38.44 | 52.02 | 56.99 | 13.10 | **60.00** | 88.60 | - | | VI | aya-23-8B | 54.69% | **73.69** | 42.14 | 21.17 | 56.70 | 57.02 | **22.40** | 50.80 | 86.80 | - | | VI | Meta-Llama-3.1-8B-Instruct | 50.00% | 63.49 | 61.43 | 7.02 | 55.91 | **60.07** | 18.78 | 33.20 | 78.40 | - | | VI | Sailor-7B-Chat | 40.62% | 31.00 | 13.13 | 30.66 | **58.85** | 59.02 | 11.85 | 49.20 | 85.80 | - | | VI | Meta-Llama-3-8B-Instruct | 25.00% | 35.42 | **70.44** | 20.91 | 48.42 | 52.90 | 9.65 | 41.10 | 83.00 | - | | VI | Mistral-7B-Instruct-v0.3 | 23.44% | 36.13 | 51.01 | 41.30 | 36.89 | 49.06 | 13.22 | 34.70 | 69.60 | - | | | | | | | | | | | | | | | TH | gemma-2-9b-it | 82.81% | 76.33 | 49.01 | 65.49 | 43.49 | **56.48** | **25.79** | 38.90 | **90.40** | - | | TH | llama3-8b-cpt-sealionv2-instruct | 73.44% | 72.41 | **52.51** | 38.25 | **44.84** | 56.05 | 18.73 | 48.80 | 85.80 | - | | TH | Qwen2-7B-Instruct | 62.50% | 39.47 | 50.85 | **65.89** | 36.99 | 52.58 | 21.32 | 47.40 | 88.00 | - | | TH | SeaLLM3-7B-Chat | 56.25% | 45.01 | 40.24 | 55.48 | 41.80 | 54.58 | 23.33 | 36.40 | 90.20 | - | | TH | Sailor-7B-Chat | 48.44% | 31.44 | 48.11 | 33.10 | 44.26 | 56.03 | 15.24 | 45.30 | 85.60 | - | | TH | Meta-Llama-3.1-8B-Instruct | 42.19% | **82.16** | 32.46 | 25.48 | 39.65 | 55.47 | 24.92 | 6.20 | 73.40 | - | | TH | Meta-Llama-3-8B-Instruct | 40.62% | 68.57 | 38.80 | 48.63 | 35.03 | 47.74 | 14.21 | **54.30** | 78.20 | - | | TH | Mistral-7B-Instruct-v0.3 | 29.69% | 29.78 | 45.91 | 55.58 | 22.90 | 41.85 | 18.65 | 41.70 | 59.20 | - | | TH | aya-23-8B | 14.06% | 43.29 | 28.84 | 27.64 | 19.10 | 40.29 | 19.53 | 33.60 | 50.60 | - | | | | | | | | | | | | | | | TA | gemma-2-9b-it | 81.84% | 39.04 | **97.70** | 0.85 | 0.86 | 11.98 | 89.20 | - | 38.30 | - | | TA | llama3-8b-cpt-sealionv2-instruct | 70.51% | 29.35 | 97.19 | 0.87 | 0.86 | 6.80 | 76.80 | - | 34.50 | - | | TA | SeaLLM3-7B-Chat | 56.25% | 31.79 | 91.69 | 0.69 | 0.78 | 11.88 | 51.80 | - | 34.60 | - | | TA | Qwen2-7B-Instruct | 53.12% | 25.13 | 86.39 | 0.47 | 0.71 | 7.49 | 57.60 | - | 37.20 | - | | TA | Meta-Llama-3.1-8B-Instruct | 48.83% | **51.86** | 88.51 | 0.81 | 0.85 | 9.34 | 56.60 | - | 30.80 | - | | TA | aya-23-8B | 43.75% | 41.89 | 41.71 | 0.47 | 0.74 | 6.47 | 43.40 | - | 40.60 | - | | TA | Sailor-7B-Chat | 37.50% | 17.46 | 32.65 | 0.46 | 0.70 | 5.60 | 11.00 | - | 0.00 | - | | TA | Meta-Llama-3-8B-Instruct | 37.50% | 20.88 | 67.40 | 0.71 | 0.70 | 0.74 | 58.60 | - | 41.30 | - | | TA | Mistral-7B-Instruct-v0.3 | 20.70% | 13.85 | 0.00 | 0.37 | 0.52 | 5.31 | 14.20 | - | 0.80 | - | #### Instruction-following Capabilities (IFEval) | | **Indonesian** | **Vietnamese** | **English** | |--- |:---: |:---: |:---: | | **Model** | **Lang normalised score** | **Lang normalised score** | **Lang normalised score** | | gemma-2-9b-it | 0.88 | 0.77 | 0.85 | | Meta-Llama-3.1-8B-Instruct | 0.68 | 0.68 | 0.85 | | Qwen2-7B-Instruct | 0.63 | 0.65 | 0.70 | | llama3-8b-cpt-sealionv2-instruct | 0.61 | 0.66 | 0.70 | | aya-23-8B | 0.58 | 0.56 | 0.67 | | SeaLLMs-v3-7B-Chat | 0.55 | 0.52 | 0.67 | | Mistral-7B-Instruct-v0.3 | 0.43 | 0.39 | 0.70 | | Meta-Llama-3-8B-Instruct | 0.27 | 0.21 | 0.80 | | Sailor-7B-Chat | 0.26 | 0.25 | 0.42 | #### Multi-turn Capatbilities (MT-Bench) | | **Indonesian** | **Vietnamese** | **English** | |---|:---:|:---:|:---:| | **Model** | **Weighted Win Rate** | **Weighted Win Rate** | **Weighted Win Rate** | | gemma-2-9b-it | 0.684 | 0.674 | 0.638 | | SeaLLMs-v3-7B-Chat | 0.583 | 0.656 | 0.429 | | Qwen2-7B-Instruct | 0.498 | 0.556 | 0.597 | | llama3-8b-cpt-sealionv2-instruct | 0.531 | 0.517 | 0.510 | | Meta-Llama-3.1-8B-Instruct | 0.411 | 0.477 | 0.618 | | aya-23-8B | 0.499 | 0.546 | 0.416 | | Meta-Llama-3-8B-Instruct | 0.403 | 0.437 | 0.564 | | Mistral-7B-Instruct-v0.3 | 0.347 | 0.202 | 0.524 | | Sailor-7B-Chat | 0.290 | 0.314 | 0.190 | ### Usage SEA-LION can be run using the 🤗 Transformers library ```python # Please use transformers==4.43.2 from transformers import AutoModelForCausalLM, AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("aisingapore/llama3-8b-cpt-sealionv2-instruct") model = AutoModelForCausalLM.from_pretrained("aisingapore/llama3-8b-cpt-sealionv2-instruct") prompt_template = "### USER:\n{human_prompt}\n\n### RESPONSE:\n" prompt = """Apa sentimen dari kalimat berikut ini? Kalimat: Buku ini sangat membosankan. Jawaban: """ full_prompt = prompt_template.format(human_prompt=prompt) tokens = tokenizer(full_prompt, return_tensors="pt") output = model.generate(tokens["input_ids"], max_new_tokens=20, eos_token_id=tokenizer.eos_token_id) print(tokenizer.decode(output[0], skip_special_tokens=True)) ``` ### Prompting Guide _Coming soon_ ### Caveats It is important for users to be aware that our model exhibits certain limitations that warrant consideration. Firstly, like many LLMs, the model can hallucinate and occasionally generates irrelevant content, introducing fictional elements that are not grounded in the provided context. Users should also exercise caution in interpreting and validating the model's responses due to the potential inconsistencies in its reasoning. Finally, it should be noted that the model has not been optimized for multi-turn dialogue interactions, which may result in reduced effectiveness in extended conversations. ## Limitations ### Safety Current SEA-LION models, including this commercially permissive release, have not been aligned for safety. Developers and users should perform their own safety fine-tuning and related security measures. In no event shall the authors be held liable for any claim, damages, or other liability arising from the use of the released weights and codes. ## Technical Specifications ### Fine-Tuning Details The LLaMA3 8B CPT SEA-LIONv2 Instruct was fine-tuned using 8x A100-40GB using parameter efficient fine tuning in the form of LoRA. ## Data LLaMA3 8B CPT SEA-LIONv2 Instruct was trained on a wide range of instructions that were manually and stringently verified by our team. A large portion of the effort was dedicated to ensuring that each instruction-completion pair that the model sees is of a high quality and any errors were corrected and rewritten by native speakers or else dropped from our mix. In addition, special care was taken to ensure that the datasets used had commercially permissive licenses through verification with the original data source. Link to dataset: _coming soon_ ## Call for Contributions We encourage researchers, developers, and language enthusiasts to actively contribute to the enhancement and expansion of SEA-LION. Contributions can involve identifying and reporting bugs, sharing pre-training, instruction, and preference data, improving documentation usability, proposing and implementing new model evaluation tasks and metrics, or training versions of the model in additional Southeast Asian languages. Join us in shaping the future of SEA-LION by sharing your expertise and insights to make these models more accessible, accurate, and versatile. Please check out our GitHub for further information on the call for contributions. ## The Team Brandon Ong
Bryan Siow
Esther Choa
Huang Yuli
Lee Chwan Ren
Leong Wai Yi
Leong Wei Qi
Li Yier
Liu Bing Jie Darius
Lovenia Holy
Montalan Jann Railey
Ng Boon Cheong Raymond
Ngui Jian Gang
Nguyen Thanh Ngan
Nicholas Cheng
Ong Tat-Wee David
Ong Zhi Hao
Rengarajan Hamsawardhini
Susanto Yosephine
Tai Ngee Chia
Tan Choon Meng
Teo Jin Howe
Teo Eng Sipp Leslie
Teo Wei Yi
Tjhi William
Walter Teng
Wayne Lau
Yeo Yeow Tong
Yong Xianbin
## Acknowledgements [AI Singapore](​​https://aisingapore.org/) is a national programme supported by the National Research Foundation, Singapore and hosted by the National University of Singapore. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not reflect the views of the National Research Foundation or the National University of Singapore. ## Contact For more info, please contact us using this [SEA-LION Inquiry Form](https://forms.gle/sLCUVb95wmGf43hi6) [Link to SEA-LION's GitHub repository](https://github.com/aisingapore/sealion) ## Disclaimer This is the repository for the commercial instruction-tuned model. The model has _not_ been aligned for safety. Developers and users should perform their own safety fine-tuning and related security measures. In no event shall the authors be held liable for any claims, damages, or other liabilities arising from the use of the released weights and codes.