MediaTek Research Breeze-7B (hereinafter referred to as Breeze-7B) is a language model family that builds on top of [Mistral-7B], specifically intended for Traditional Chinese use.
[Breeze-7B-Base] is the base model for the Breeze-7B series. It is suitable for use if you have substantial fine-tuning data to tune it for your specific use case.
Breeze-7B-Instruct derives from the base model Breeze-7B-Base, making the resulting model amenable to be used as-is for commonly seen tasks.
[Breeze-7B-Instruct-64k] is a slightly modified version of Breeze-7B-Instruct to enable a 64k-token context length. Roughly speaking, that is equivalent to 88k Traditional Chinese characters.
Update (Mar. 7th, 2024): The current release version of Breeze-7B is v1.0. See Breeze-7B-Instruct-v1_0.
The current release version of Breeze-7B is v0.1.
Practicality-wise:
Performance-wise:
Here we compare Breeze-7B-Base-v0_1 with other open-source base language models of similar parameter size that are widely recognized for their good performance in Chinese. TMMLU+, DRCD, and Table source from [MediaTek-Research/TCEval-v2]. [MediaTek-Research/TCEval-v2] derives from [TCEval-v1] and [ikala/tmmluplus]. MMLU sources from [hails/mmlu_no_train]. We use the code revised from [EleutherAI/lm-evaluation-harness] to evaluate TMMLU+, DRCD, Table, and MMLU. All choice problems adapt the selection by the log-likelihood.
| Models | 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-34B] | 34B | 63.10 | 84.57 | 49.31 | 77.42 |
| [Qwen-14B] | 14B | 51.30 | 16.95 * | 50.69 | 68.83 |
| [Yi-6B] | 6B | 49.63 | 76.61 | 34.72 | 65.35 |
| [Qwen-7B] | 7B | 42.84 | 0.0 * | 39.58 | 61.00 |
| [Breeze-7B-Base-v0_1] | 7B | 40.35 | 81.13 | 28.47 | 61.63 |
| [Mistral-7B-v0.1] | 7B | 36.93 | 79.27 | 27.78 | 64.89 |
Here we compare Breeze-7B-Instruct-v1_0 with other open-source instruction-tuned language models of similar parameter size that are widely recognized for their good performance in Chinese. TMMLU+, DRCD, Table, and MT-Bench-tw source from [MediaTek-Research/TCEval-v2]. [MediaTek-Research/TCEval-v2] derives from [TCEval-v1] and [ikala/tmmluplus]. MMLU sources from [hails/mmlu_no_train]. MT-Bench source from [lmsys/mt_bench_human_judgments]. We use the code revised from [EleutherAI/lm-evaluation-harness] to evaluate TMMLU+, DRCD, Table, and MMLU. All choice problems adapt the selection by the log-likelihood.
| Models | MT-Bench-tw (Score) | TMMLU+ (ACC) | TMMLU+ (ACC) | DRCD (EM) | Table (ACC) | MT-Bench (Score) | MMLU (ACC) | MMLU (ACC) | |
|---|---|---|---|---|---|---|---|---|---|
| TC, Chat | TC, Knowledge | TC, Knowledge | TC, Reasoning | TC, Reasoning | EN, Chat | EN, Knowledge | EN, Knowledge | ||
| 0 shot | 0 shot | 5 shot | 3 shot | 0 shot | 0 shot | 0 shot | 5 shot | ||
| [Yi-34B-Chat] | 34B | 6.9 | 54.87 | 36.81 | 7.6 | 71.04 | |||
| [Qwen-14B-Chat] | 14B | 6.4 | 48.41 | 41.67 | 7.2 | 64.91 | |||
| Breeze-7B-Instruct-v0_1 | 7B | 5.7 | 41.61 | 45.83 | 7.1 | 63.26 | |||
| [Breeze-7B-Instruct-64k-v0_1] | 7B | 5.5 | 40.99 | 36.11 | 7.1 | 63.68 | |||
| [Qwen-7B-Chat] | 7B | 5.4 | 40.02 | 33.33 | 6.2 | 55.94 | |||
| [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 | -* | 50.50 | |||
| [Taiwan-LLM-7B-v2.1-chat] | 7B | 4.2 | 28.08 | 31.25 | -* | 42.72 |
| Details on MT-Bench-tw (0 shot): Models | STEM | Extraction | Reasoning | Math | Coding | Roleplay | Writing | Humanities | AVG |
|---|---|---|---|---|---|---|---|---|---|
| Yi-34B-Chat | 9.0 | 4.8 | 5.7 | 4.0 | 4.7 | 8.5 | 8.7 | 9.8 | 6.9 |
| Qwen-14B-Chat | 7.6 | 5.7 | 4.5 | 4.2 | 5.3 | 7.5 | 7.3 | 9.1 | 6.4 |
| Breeze-7B-Instruct-v0_1(https://modelers.cn/models/FuJianAscend/Breeze-7B-Instruct-v0_1) | 6.5 | 5.6 | 3.9 | 3.6 | 4.3 | 6.9 | 5.7 | 9.3 | 5.7 |
| Breeze-7B-Instruct-64k-v0_1 | 6.1 | 5.3 | 3.7 | 2.9 | 4.2 | 7.0 | 6.7 | 8.3 | 5.5 |
| Qwen-7B-Chat | 6.6 | 4.5 | 4.8 | 2.9 | 3.6 | 6.2 | 6.8 | 8.2 | 5.4 |
| 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 |
|---|---|---|---|---|---|
| Yi-34B-Chat | 47.65 | 64.25 | 52.73 | 54.91 | 54.87 |
| Qwen-14B-Chat | 43.83 | 55.00 | 48.55 | 46.22 | 48.41 |
| Yi-6B-Chat | 37.80 | 51.74 | 45.36 | 44.25 | 44.79 |
| Breeze-7B-Instruct-v0_1(https://modelers.cn/models/FuJianAscend/Breeze-7B-Instruct-v0_1) | 37.41 | 46.81 | 42.06 | 40.16 | 41.61 |
| Breeze-7B-Instruct-64k-v0_1 | 37.88 | 46.35 | 40.31 | 39.40 | 40.99 |
| Qwen-7B-Chat | 35.44 | 46.22 | 38.35 | 40.06 | 40.02 |
| 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 |
In this test, we use the first 700 characters of the [web article] as the input and ask the model to write the same article again.
All inferences run on Atlas 800T A2 (using vllm, with a tensor-parallel size of 2).
| Models | Inference Time (sec) | Estimated Max Input Length (Char) |
|---|---|---|
| Yi-6B-Chat | 10.62 | 5.2k |
| Breeze-7B-Instruct-v0_1(https://modelers.cn/models/FuJianAscend/Breeze-7B-Instruct-v0_1) | 10.74 | 11.1k |
| Breeze-7B-Instruct-64k-v0_1 | 10.74 | 88.8k |
| Qwen-7B-Chat | 10.86 | 9.8k |
| Qwen-14B-Chat | 18.89 | 9.8k |
| Mistral-7B-v0.1-Instruct | 20.48 | 5.1k |
| Taiwan-LLM-7B-v2.1-chat | 26.26 | 2.2k |
| Taiwan-LLM-13B-v2.0-chat | 36.80 | 2.2k |
| Yi-34B-Chat | 43.71 | 4.5k |
import argparse
from openmind import AutoModel, AutoTokenizer
from openmind import is_torch_npu_available
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--model_name_or_path",type=str,help="Path to model",default=None,)
args = parser.parse_args()
return args
if __name__ == '__main__':
if is_torch_npu_available():
device = "npu:0"
else:
device = "cpu"
args = parse_args()
model_path = args.model_name_or_path
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True, add_eos_token=True)
model = AutoModel.from_pretrained(model_path, trust_remote_code=True).to(device)
inputs = tokenizer.encode("def print_hello_world():\tprint('Hello World!')", return_tensors="pt").to(device)
embedding = model(inputs)[0]
print(f'Dimension of the embedding: {embedding[0].size()}')
print(embedding)