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+
- id
|
| 10 |
+
- th
|
| 11 |
+
- ms
|
| 12 |
+
- km
|
| 13 |
+
- lo
|
| 14 |
+
- my
|
| 15 |
+
- tl
|
| 16 |
+
tags:
|
| 17 |
+
- multilingual
|
| 18 |
+
- sea
|
| 19 |
+
pipeline_tag: text-generation
|
| 20 |
+
base_model: SeaLLMs/SeaLLM-7B-v2.5
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
# SeaLLM-7B-v2.5-GGUF
|
| 24 |
+
- Thsi si quantized version for [SeaLLMs/SeaLLM-7B-v2.5](https://huggingface.co/SeaLLMs/SeaLLM-7B-v2.5)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
## Model Description
|
| 28 |
+
|
| 29 |
+
We introduce [SeaLLM-7B-v2.5](https://huggingface.co/SeaLLMs/SeaLLM-7B-v2.5), the state-of-the-art multilingual LLM for Southeast Asian (SEA) languages 🇬🇧 🇨🇳 🇻🇳 🇮🇩 🇹🇭 🇲🇾 🇰🇭 🇱🇦 🇲🇲 🇵🇭. It is the most significant upgrade since [SeaLLM-13B](https://huggingface.co/SeaLLMs/SeaLLM-13B-Chat), with half the size, outperforming performance across diverse multilingual tasks, from world knowledge, math reasoning, instruction following, etc.
|
| 30 |
+
|
| 31 |
+
### Highlights
|
| 32 |
+
* [SeaLLM-7B-v2.5](https://huggingface.co/SeaLLMs/SeaLLM-7B-v2.5) outperforms GPT-3.5 and achieves 7B SOTA on most multilingual knowledge benchmarks for SEA languages (MMLU, M3Exam & VMLU).
|
| 33 |
+
* It achieves 79.0 and 34.9 on GSM8K and MATH, surpassing GPT-3.5 in MATH.
|
| 34 |
+
|
| 35 |
+
### Release and DEMO
|
| 36 |
+
|
| 37 |
+
- DEMO:
|
| 38 |
+
- [SeaLLMs/SeaLLM-7B-v2.5](https://huggingface.co/spaces/SeaLLMs/SeaLLM-7B-v2.5).
|
| 39 |
+
- [SeaLLMs/SeaLLM-7B | SeaLMMM-7B](https://huggingface.co/spaces/SeaLLMs/SeaLLM-7B) - Experimental multimodal SeaLLM.
|
| 40 |
+
- Technical report: [Arxiv: SeaLLMs - Large Language Models for Southeast Asia](https://arxiv.org/pdf/2312.00738.pdf).
|
| 41 |
+
- Model weights: [SeaLLM-7B-v2.5](https://huggingface.co/SeaLLMs/SeaLLM-7B-v2.5).
|
| 42 |
+
|
| 43 |
+
<blockquote style="color:red">
|
| 44 |
+
<p><strong style="color: red">Terms of Use and License</strong>:
|
| 45 |
+
By using our released weights, codes, and demos, you agree to and comply with the terms and conditions specified in our <a href="https://huggingface.co/SeaLLMs/SeaLLM-Chat-13b/edit/main/LICENSE" target="_blank" rel="noopener">SeaLLMs Terms Of Use</a>.
|
| 46 |
+
</blockquote>
|
| 47 |
+
|
| 48 |
+
> **Disclaimer**:
|
| 49 |
+
> We must note that even though the weights, codes, and demos are released in an open manner, similar to other pre-trained language models, and despite our best efforts in red teaming and safety fine-tuning and enforcement, our models come with potential risks, including but not limited to inaccurate, misleading or potentially harmful generation.
|
| 50 |
+
> Developers and stakeholders should perform their own red teaming and provide related security measures before deployment, and they must abide by and comply with local governance and regulations.
|
| 51 |
+
> In no event shall the authors be held liable for any claim, damages, or other liability arising from the use of the released weights, codes, or demos.
|
| 52 |
+
|
| 53 |
+
> The logo was generated by DALL-E 3.
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
### What's new since SeaLLM-7B-v2?
|
| 57 |
+
|
| 58 |
+
* SeaLLM-7B-v2.5 was built on top of Gemma-7b, and underwent large scale SFT and carefully designed alignment.
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
## Evaluation
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
### Multilingual World Knowledge
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
We evaluate models on 3 benchmarks following the recommended default setups: 5-shot MMLU for En, 3-shot [M3Exam](https://arxiv.org/pdf/2306.05179.pdf) (M3e) for En, Zh, Vi, Id, Th, and zero-shot [VMLU](https://vmlu.ai/) for Vi.
|
| 68 |
+
|
| 69 |
+
| Model | Langs | En<br>MMLU | En<br>M3e | Zh<br>M3e | Vi<br>M3e | Vi<br>VMLU | Id<br>M3e | Th<br>M3e
|
| 70 |
+
|-----| ----- | --- | -- | ----- | ---- | --- | --- | --- |
|
| 71 |
+
| GPT-3.5 | Multi | 68.90 | 75.46 | 60.20 | 58.64 | 46.32 | 49.27 | 37.41
|
| 72 |
+
| Vistral-7B-chat | Mono | 56.86 | 67.00 | 44.56 | 54.33 | 50.03 | 36.49 | 25.27
|
| 73 |
+
| Qwen1.5-7B-chat | Multi | 61.00 | 52.07 | 81.96 | 43.38 | 45.02 | 24.29 | 20.25
|
| 74 |
+
| SailorLM | Multi | 52.72 | 59.76 | 67.74 | 50.14 | --- | 39.53 | 37.73
|
| 75 |
+
| SeaLLM-7B-v2 | Multi | 61.89 | 70.91 | 55.43 | 51.15 | 45.74 | 42.25 | 35.52
|
| 76 |
+
| SeaLLM-7B-v2.5 | Multi | 64.05 | 76.87 | 62.54 | 63.11 | 53.30 | 48.64 | 46.86
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
### Zero-shot CoT Multilingual Math Reasoning
|
| 80 |
+
|
| 81 |
+
<!--
|
| 82 |
+
[SeaLLM-7B-v2](https://huggingface.co/SeaLLMs/SeaLLM-7B-v2) achieves with **78.5** score on the GSM8K with zero-shot CoT reasoning, making it the **state of the art** in the realm of 7B models. It also outperforms GPT-3.5 in the same GSM8K benchmark as translated into SEA languages (🇨🇳 🇻🇳 🇮🇩 🇹🇭). [SeaLLM-7B-v2](https://huggingface.co/SeaLLMs/SeaLLM-7B-v2) also surpasses GPT-3.5 on the Thai-translated MATH benchmark, with **28.4** vs 18.1 scores.
|
| 83 |
+
|
| 84 |
+

|
| 85 |
+
-->
|
| 86 |
+
|
| 87 |
+
| Model | GSM8K<br>en | MATH<br>en | GSM8K<br>zh | MATH<br>zh | GSM8K<br>vi | MATH<br>vi | GSM8K<br>id | MATH<br>id | GSM8K<br>th | MATH<br>th
|
| 88 |
+
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
| 89 |
+
| GPT-3.5 | 80.8 | 34.1 | 48.2 | 21.5 | 55 | 26.5 | 64.3 | 26.4 | 35.8 | 18.1
|
| 90 |
+
| Qwen-14B-chat | 61.4 | 18.4 | 41.6 | 11.8 | 33.6 | 3.6 | 44.7 | 8.6 | 22 | 6.0
|
| 91 |
+
| Vistral-7b-chat | 48.2 | 12.5 | | | 48.7 | 3.1 | | | |
|
| 92 |
+
| Qwen1.5-7B-chat | 56.8 | 15.3 | 40.0 | 2.7 | 37.7 | 9 | 36.9 | 7.7 | 21.9 | 4.7
|
| 93 |
+
| SeaLLM-7B-v2 | 78.2 | 27.5 | 53.7 | 17.6 | 69.9 | 23.8 | 71.5 | 24.4 | 59.6 | 22.4
|
| 94 |
+
| SeaLLM-7B-v2.5 | 78.5 | 34.9 | 51.3 | 22.1 | 72.3 | 30.2 | 71.5 | 30.1 | 62.0 | 28.4
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
Baselines were evaluated using their respective chat-template and system prompts ([Qwen1.5-7B-chat](https://huggingface.co/Qwen/Qwen1.5-7B-Chat/blob/main/tokenizer_config.json), [Vistral](https://huggingface.co/Viet-Mistral/Vistral-7B-Chat)).
|
| 98 |
+
|
| 99 |
+
#### Zero-shot MGSM
|
| 100 |
+
|
| 101 |
+
[SeaLLM-7B-v2.5](https://huggingface.co/SeaLLMs/SeaLLM-7B-v2.5) also outperforms GPT-3.5 and Qwen-14B on the multilingual MGSM for Thai.
|
| 102 |
+
|
| 103 |
+
| Model | MGSM-Zh | MGSM-Th
|
| 104 |
+
|-----| ----- | ---
|
| 105 |
+
| ChatGPT (reported) | 61.2 | 47.2
|
| 106 |
+
| Qwen-14B-chat | 59.6 | 28
|
| 107 |
+
| SeaLLM-7B-v2 | **64.8** | 62.4
|
| 108 |
+
| SeaLLM-7B-v2.5 | 58.0 | **64.8**
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
### Sea-Bench
|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
### Usage
|
| 117 |
+
|
| 118 |
+
#### Instruction format
|
| 119 |
+
|
| 120 |
+
```python
|
| 121 |
+
prompt = """<|im_start|>system
|
| 122 |
+
You are a helpful assistant.<eos>
|
| 123 |
+
<|im_start|>user
|
| 124 |
+
Hello world<eos>
|
| 125 |
+
<|im_start|>assistant
|
| 126 |
+
Hi there, how can I help?<eos>"""
|
| 127 |
+
|
| 128 |
+
# <|im_start|> is not a special token.
|
| 129 |
+
# Transformers chat_template should be consistent with vLLM format below.
|
| 130 |
+
|
| 131 |
+
# ! ENSURE 1 and only 1 bos `<s>` at the beginning of sequence
|
| 132 |
+
print(tokenizer.convert_ids_to_tokens(tokenizer.encode(prompt)))
|
| 133 |
+
|
| 134 |
+
"""
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
#### Using transformers's chat_template
|
| 138 |
+
|
| 139 |
+
Install the latest transformers (>4.40)
|
| 140 |
+
|
| 141 |
+
```python
|
| 142 |
+
|
| 143 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 144 |
+
|
| 145 |
+
device = "cuda" # the device to load the model onto
|
| 146 |
+
|
| 147 |
+
# use bfloat16 to ensure the best performance.
|
| 148 |
+
model = AutoModelForCausalLM.from_pretrained("SeaLLMs/SeaLLM-7B-v2.5", torch_dtype=torch.bfloat16, device_map=device)
|
| 149 |
+
tokenizer = AutoTokenizer.from_pretrained("SeaLLMs/SeaLLM-7B-v2.5")
|
| 150 |
+
|
| 151 |
+
messages = [
|
| 152 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
| 153 |
+
{"role": "user", "content": "Hello world"},
|
| 154 |
+
{"role": "assistant", "content": "Hi there, how can I help you today?"},
|
| 155 |
+
{"role": "user", "content": "Explain general relativity in details."}
|
| 156 |
+
]
|
| 157 |
+
|
| 158 |
+
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True)
|
| 159 |
+
print(tokenizer.convert_ids_to_tokens(encodeds[0]))
|
| 160 |
+
|
| 161 |
+
model_inputs = encodeds.to(device)
|
| 162 |
+
model.to(device)
|
| 163 |
+
|
| 164 |
+
generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True, pad_token_id=tokenizer.pad_token_id)
|
| 165 |
+
decoded = tokenizer.batch_decode(generated_ids)
|
| 166 |
+
print(decoded[0])
|
| 167 |
+
|
| 168 |
+
```
|
| 169 |
+
|
| 170 |
+
#### Using vLLM
|
| 171 |
+
|
| 172 |
+
```python
|
| 173 |
+
from vllm import LLM, SamplingParams
|
| 174 |
+
TURN_TEMPLATE = "<|im_start|>{role}\n{content}<eos>\n"
|
| 175 |
+
TURN_PREFIX = "<|im_start|>{role}\n"
|
| 176 |
+
|
| 177 |
+
def seallm_chat_convo_format(conversations, add_assistant_prefix: bool, system_prompt=None):
|
| 178 |
+
# conversations: list of dict with key `role` and `content` (openai format)
|
| 179 |
+
if conversations[0]['role'] != 'system' and system_prompt is not None:
|
| 180 |
+
conversations = [{"role": "system", "content": system_prompt}] + conversations
|
| 181 |
+
text = ''
|
| 182 |
+
for turn_id, turn in enumerate(conversations):
|
| 183 |
+
prompt = TURN_TEMPLATE.format(role=turn['role'], content=turn['content'])
|
| 184 |
+
text += prompt
|
| 185 |
+
if add_assistant_prefix:
|
| 186 |
+
prompt = TURN_PREFIX.format(role='assistant')
|
| 187 |
+
text += prompt
|
| 188 |
+
return text
|
| 189 |
+
|
| 190 |
+
sparams = SamplingParams(temperature=0.1, max_tokens=1024, stop=['<eos>', '<|im_start|>'])
|
| 191 |
+
llm = LLM("SeaLLMs/SeaLLM-7B-v2.5", dtype="bfloat16")
|
| 192 |
+
|
| 193 |
+
message = "Explain general relativity in details."
|
| 194 |
+
prompt = seallm_chat_convo_format(message, True)
|
| 195 |
+
gen = llm.generate(prompt, sampling_params)
|
| 196 |
+
|
| 197 |
+
print(gen[0].outputs[0].text)
|
| 198 |
+
```
|
| 199 |
+
|
| 200 |
+
#### Fine-tuning SeaLLM-7B-v2.5
|
| 201 |
+
|
| 202 |
+
Should follow the chat format and accurately mask out source tokens. Here is an example.
|
| 203 |
+
|
| 204 |
+
```python
|
| 205 |
+
conversations = [
|
| 206 |
+
{"role": "system", "content": "You are helful assistant."},
|
| 207 |
+
{"role": "user", "content": "Hello world."},
|
| 208 |
+
{"role": "assistant", "content": "Hi there, how can I help?"},
|
| 209 |
+
{"role": "user", "content": "Tell me a joke."},
|
| 210 |
+
{"role": "assistant", "content": "Why don't scientists trust atoms? Because they make up everything."},
|
| 211 |
+
]
|
| 212 |
+
def seallm_7b_v25_tokenize_multi_turns(tokenizer, conversations, add_assistant_prefix=False):
|
| 213 |
+
"""
|
| 214 |
+
Inputs:
|
| 215 |
+
conversations: list of dict following openai format, eg
|
| 216 |
+
conversations = [
|
| 217 |
+
{"role": "system", "content": "You are helful assistant."},
|
| 218 |
+
{"role": "user", "content": "Hello world."},
|
| 219 |
+
{"role": "assistant", "content": "Hi there, how can I help?"},
|
| 220 |
+
{"role": "user", "content": "Tell me a joke."},
|
| 221 |
+
{"role": "assistant", "content": "Why don't scientists trust atoms? Because they make up everything."},
|
| 222 |
+
]
|
| 223 |
+
add_assistant_prefix: whether to add assistant_prefix, only for inference decoding
|
| 224 |
+
Outputs:
|
| 225 |
+
tokenize_output_sample, {
|
| 226 |
+
"input_ids": ...
|
| 227 |
+
"token_type_ids": 1 if train and 0 if masked out (not train)
|
| 228 |
+
}
|
| 229 |
+
During training, need to create a labels, with masked-out tokens = -100 to avoid loss computations.
|
| 230 |
+
labels = sample['input_ids'].clone()
|
| 231 |
+
labels[sample['token_type_ids'] == 0] = -100
|
| 232 |
+
"""
|
| 233 |
+
TURN_TEMPLATE = "<|im_start|>{role}\n{content}<eos>\n"
|
| 234 |
+
TURN_PREFIX = "<|im_start|>{role}\n"
|
| 235 |
+
TURN_SUFFIX = "<eos>\n"
|
| 236 |
+
TURN_SUFFIX_TAKE = "<eos>"
|
| 237 |
+
sample = None
|
| 238 |
+
assistant_prefix_len = None
|
| 239 |
+
assistant_suffix_len = None
|
| 240 |
+
for turn_id, turn in enumerate(conversations):
|
| 241 |
+
prompt = TURN_TEMPLATE.format(role=turn['role'], content=turn['content'])
|
| 242 |
+
turn_sample = tokenizer(
|
| 243 |
+
prompt, padding=False, truncation=False, verbose=False, add_special_tokens=False,
|
| 244 |
+
return_token_type_ids=True,
|
| 245 |
+
)
|
| 246 |
+
if turn['role'] == 'assistant':
|
| 247 |
+
if assistant_prefix_len is None:
|
| 248 |
+
assistant_prefix_len = len(tokenizer.encode(TURN_PREFIX.format(role=turn['role']), add_special_tokens=False))
|
| 249 |
+
if assistant_suffix_len is None:
|
| 250 |
+
assistant_suffix_len = (
|
| 251 |
+
len(tokenizer.encode(TURN_SUFFIX.format(role=turn['role']), add_special_tokens=False)) -
|
| 252 |
+
len(tokenizer.encode(TURN_SUFFIX_TAKE, add_special_tokens=False))
|
| 253 |
+
)
|
| 254 |
+
turn_sample['token_type_ids'][assistant_prefix_len:-assistant_suffix_len] = [1] * (len(turn_sample['input_ids']) - assistant_prefix_len - assistant_suffix_len)
|
| 255 |
+
if sample is None:
|
| 256 |
+
sample = turn_sample
|
| 257 |
+
else:
|
| 258 |
+
for k in turn_sample.keys():
|
| 259 |
+
sample[k].extend(turn_sample[k])
|
| 260 |
+
if add_assistant_prefix:
|
| 261 |
+
assistant_prefix_sample = tokenizer(
|
| 262 |
+
TURN_PREFIX.format(role="assistant"), padding=False, truncation=False, verbose=False, add_special_tokens=False,
|
| 263 |
+
return_token_type_ids=True,
|
| 264 |
+
)
|
| 265 |
+
for k in sample.keys():
|
| 266 |
+
sample[k].extend(assistant_prefix_sample[k])
|
| 267 |
+
if tokenizer.add_bos_token:
|
| 268 |
+
sample['input_ids'] = [tokenizer.bos_token_id] + sample['input_ids']
|
| 269 |
+
sample['attention_mask'] = [1] + sample['attention_mask']
|
| 270 |
+
sample['token_type_ids'] = [sample['token_type_ids'][0]] + sample['token_type_ids']
|
| 271 |
+
return sample
|
| 272 |
+
|
| 273 |
+
# ! testing
|
| 274 |
+
sample = seallm_7b_v25_tokenize_multi_turns(tokenizer, conversations)
|
| 275 |
+
tokens = tokenizer.convert_ids_to_tokens(sample['input_ids'])
|
| 276 |
+
pairs = [(x, y) for x, y in zip(tokens, sample['token_type_ids'])]
|
| 277 |
+
print(pairs)
|
| 278 |
+
|
| 279 |
+
# source and special tokens is masked out (token_type 0), only assistant with <eos> is trained (token_type 1)
|
| 280 |
+
# [('<bos>', 0), ('<', 0), ('|', 0), ..., ('assistant', 0), ('\n', 0), ('Hi', 1), ('▁there', 1), (',', 1), ('▁how', 1), ('▁can', 1), ('▁I', 1), ('▁help', 1), ('?', 1), ('<eos>', 1), ('\n', 0), ('<', 0), ...
|
| 281 |
+
|
| 282 |
+
```
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
## Acknowledgement to Our Linguists
|
| 286 |
+
|
| 287 |
+
We would like to express our special thanks to our professional and native linguists, Tantong Champaiboon, Nguyen Ngoc Yen Nhi and Tara Devina Putri, who helped build, evaluate, and fact-check our sampled pretraining and SFT dataset as well as evaluating our models across different aspects, especially safety.
|
| 288 |
+
|
| 289 |
+
## Citation
|
| 290 |
+
|
| 291 |
+
If you find our project useful, we hope you would kindly star our repo and cite our work as follows: Corresponding Author: [l.bing@alibaba-inc.com](mailto:l.bing@alibaba-inc.com)
|
| 292 |
+
|
| 293 |
+
**Author list and order will change!**
|
| 294 |
+
|
| 295 |
+
* `*` and `^` are equal contributions.
|
| 296 |
+
|
| 297 |
+
```
|
| 298 |
+
@article{damonlpsg2023seallm,
|
| 299 |
+
author = {Xuan-Phi Nguyen*, Wenxuan Zhang*, Xin Li*, Mahani Aljunied*, Weiwen Xu, Hou Pong Chan,
|
| 300 |
+
Zhiqiang Hu, Chenhui Shen^, Yew Ken Chia^, Xingxuan Li, Jianyu Wang,
|
| 301 |
+
Qingyu Tan, Liying Cheng, Guanzheng Chen, Yue Deng, Sen Yang,
|
| 302 |
+
Chaoqun Liu, Hang Zhang, Lidong Bing},
|
| 303 |
+
title = {SeaLLMs - Large Language Models for Southeast Asia},
|
| 304 |
+
year = 2023,
|
| 305 |
+
Eprint = {arXiv:2312.00738},
|
| 306 |
+
}
|
| 307 |
+
```
|