Views
No views yet
| Models | #Parameters | ↑ TMMLU+ (ACC) | DRCD (EM) | Table (ACC) | MMLU (ACC) |
|---|---|---|---|---|---|
| TC, Knowledge | TC, Reasoning | TC, Reasoning | EN, Knowledge | ||
| 5 shot | 3 shot | 5 shot | 5 shot | ||
| Yi-6B | 6B | 49.63 | 76.61 | 34.72 | 65.35 |
| Qwen1.5-7B | 7B | 46.59 | 74.41 | 30.56 | 63.07 |
| Breeze-7B-Base-v1_0 | 7B | 42.67 | 80.61 | 31.99 | 61.24 |
| Mistral-7B-v0.1 | 7B | 36.93 | 79.27 | 27.78 | 64.89 |
| Models | #Parameters | ↑ MT-Bench-tw (Score) | TMMLU+ (ACC) | Table (ACC) | MT-Bench (Score) | MMLU (ACC) |
|---|---|---|---|---|---|---|
| TC, Chat | TC, Knowledge | TC, Reasoning | EN, Chat | EN, Knowledge | ||
| 0 shot | 0 shot | 0 shot | 0 shot | 0 shot | ||
| GPT-3.5-Turbo | 7.1 | 43.56 | 45.14 | 7.9 | 67.09 | |
| Qwen1.5-7B-Chat | 7B | 6.4 | 45.65 | 34.72 | 7.6 | 61.85 |
| Breeze-7B-Instruct-v1_0 | 7B | 6.0 | 42.67 | 39.58 | 7.4 | 61.73 |
| Mistral-7B-v0.2-Instruct | 7B | 5.6 | 34.95 | 33.33 | 7.6 | 59.97 |
| Yi-6B-Chat | 6B | 5.0 | 44.79 | 25.69 | 6.0 | 59.45 |
| Taiwan-LLM-13B-v2.0-chat | 13B | 5.0 | 29.47 | 23.61 | N/A* | 50.50 |
| Taiwan-LLM-7B-v2.1-chat | 7B | 4.2 | 28.08 | 31.25 | N/A* | 42.72 |
| Details on MT-Bench-tw (0 shot): Models | STEM | Extraction | Reasoning | Math | Coding | Roleplay | Writing | Humanities | AVG |
|---|---|---|---|---|---|---|---|---|---|
| GPT-3.5-Turbo | 7.8 | 6.1 | 5.1 | 6.4 | 6.2 | 8.7 | 7.4 | 9.3 | 7.1 |
| Qwen1.5-7B-Chat | 9 | 5.6 | 4.7 | 2.8 | 3.7 | 8.0 | 8.0 | 9.4 | 6.4 |
| Breeze-7B-Instruct-v1_0 | 7.8 | 5.2 | 4.2 | 4.2 | 4.1 | 7.6 | 5.9 | 9.1 | 6.0 |
| Mistral-7B-v0.2-Instruct | 6.9 | 4.6 | 4.3 | 3.3 | 4.4 | 7.2 | 6.2 | 7.8 | 5.6 |
| Yi-6B-Chat | 7.3 | 2.7 | 3.1 | 3.3 | 2.3 | 7.2 | 5.2 | 8.8 | 5.0 |
| Taiwan-LLM-13B-v2.0-chat | 6.1 | 3.4 | 4.1 | 2.3 | 3.1 | 7.4 | 6.6 | 6.8 | 5.0 |
| Taiwan-LLM-7B-v2.1-chat | 5.2 | 2.6 | 2.3 | 1.2 | 3.4 | 6.6 | 5.7 | 6.8 | 4.2 |
| Details on TMMLU+ (0 shot): Model | STEM | Social Science | Humanities | Other | AVG |
|---|---|---|---|---|---|
| GPT-3.5-Turbo | 41.58 | 48.52 | 40.96 | 43.18 | 43.56 |
| Qwen1.5-7B-Chat | 41.48 | 51.66 | 44.05 | 45.40 | 45.65 |
| Breeze-7B-Instruct-v1_0 | 36.46 | 48.38 | 45.11 | 40.75 | 42.67 |
| Mistral-7B-v0.2-Instruct | 32.79 | 38.05 | 34.89 | 34.04 | 34.94 |
| Yi-6B-Chat | 37.80 | 51.74 | 45.36 | 44.25 | 44.79 |
| Taiwan-LLM-13B-v2.0-chat | 27.74 | 33.69 | 27.03 | 29.43 | 29.47 |
| Taiwan-LLM-7B-v2.1-chat | 25.58 | 31.76 | 27.36 | 27.61 | 28.08 |
vllm, with a tensor-parallel size of 2).| Models | ↓ Inference Time (sec) | Estimated Max Input Length (Char) |
|---|---|---|
| Qwen1.5-7B-Chat | 9.35 | 38.9k |
| Yi-6B-Chat | 10.62 | 5.2k |
| Breeze-7B-Instruct-v1_0 | 10.74 | 11.1k |
| Mistral-7B-Instruct-v0.2 | 20.48 | 5.1k |
| Taiwan-LLM-7B-v2.1-chat | 26.26 | 2.2k |
pip install transformers torch accelerate1pip install packaging ninja
2pip install flash-attn1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4# Instruction Model
5model = AutoModelForCausalLM.from_pretrained(
6 "MediaTek-Research/Breeze-7B-Instruct-v1_0",
7 device_map="auto",
8 torch_dtype=torch.bfloat16,
9 # attn_implementation="flash_attention_2" # optional
10)
11
12# Basemodel
13model = AutoModelForCausalLM.from_pretrained(
14 "MediaTek-Research/Breeze-7B-Base-v1_0",
15 device_map="auto",
16 torch_dtype=torch.bfloat16,
17 # attn_implementation="flash_attention_2" # optional
18)<s>SYS_PROMPT [INST] QUERY1 [/INST] RESPONSE1 [INST] QUERY2 [/INST] SYS_PROMPT, QUERY1, RESPONSE1, and QUERY2 can be provided by the user.SYS_PROMPT isYou are a helpful AI assistant built by MediaTek Research. The user you are helping speaks Traditional Chinese and comes from Taiwan.chat_template into tokenizer_config.json, so you can apply_chat_template to get the prompt.1>>> from transformers import AutoTokenizer
2>>> tokenizer = AutoTokenizer.from_pretrained("MediaTek-Research/Breeze-7B-Instruct-v1_0")
3>>> chat = [
4... {"role": "user", "content": "你好,請問你可以完成什麼任務?"},
5... {"role": "assistant", "content": "你好,我可以幫助您解決各種問題、提供資訊和協助您完成許多不同的任務。例如:回答技術問題、提供建議、翻譯文字、尋找資料或協助您安排行程等。請告訴我如何能幫助您。"},
6... {"role": "user", "content": "太棒了!"},
7... ]
8>>> tokenizer.apply_chat_template(chat, tokenize=False)
9"<s>You are a helpful AI assistant built by MediaTek Research. The user you are helping speaks Traditional Chinese and comes from Taiwan. [INST] 你好,請問你可以完成什麼任務? [/INST] 你好,我可以幫助您解決各種問題、提供資訊和協助您完成許多不同的任務。例如:回答技術問題、提供建議、翻譯文字、尋找資料或協助您安排行程等。請告訴我如何能幫助您。 [INST] 太棒了! [/INST] "
10# Tokenized results
11# ['▁', '你好', ',', '請問', '你', '可以', '完成', '什麼', '任務', '?']
12# ['▁', '你好', ',', '我', '可以', '幫助', '您', '解決', '各種', '問題', '、', '提供', '資訊', '和', '協助', '您', '完成', '許多', '不同', '的', '任務', '。', '例如', ':', '回答', '技術', '問題', '、', '提供', '建議', '、', '翻譯', '文字', '、', '尋找', '資料', '或', '協助', '您', '安排', '行程', '等', '。', '請', '告訴', '我', '如何', '能', '幫助', '您', '。']
13# ['▁', '太', '棒', '了', '!']generate and apply_chat_template functions:1>>> outputs = model.generate(tokenizer.apply_chat_template(chat, return_tensors="pt"),
2>>> # adjust below parameters if necessary
3>>> max_new_tokens=128,
4>>> top_p=0.01,
5>>> top_k=85,
6>>> repetition_penalty=1.1,
7>>> temperature=0.01)
8>>>
9>>> print(tokenizer.decode(outputs[0]))@article{MediaTek-Research2024breeze7b,
title={Breeze-7B Technical Report},
author={Chan-Jan Hsu and Chang-Le Liu and Feng-Ting Liao and Po-Chun Hsu and Yi-Chang Chen and Da-Shan Shiu},
year={2024},
eprint={2403.02712},
archivePrefix={arXiv},
primaryClass={cs.CL}
}