YC-Chen's picture
Update README.md
b2afa7e verified
|
raw
history blame
9.38 kB
metadata
pipeline_tag: text-generation

Model Card for Breeze-7B-Instruct-v0.1

Breeze-7B-Instruct-v0.1 is a 7-billion-parameter language model built from Mistral-7B and tailored for Traditional Chinese (TC). This model expands the TC vocabulary (extra 30k TC tokens) based on the original Mistral-7B to better adapt to TC and improve inference speed, resulting in a doubling of the original tokenizer's inference speed. To the best of our knowledge, this is the first work on vocabulary expansion in TC. This model uses 250GB of TC data for continued pre-training and uses over 1M instances for further supervised fine-tuning. Breeze-7B-Instruct-v0.1 performs well on both EN and TC benchmarks. This model outperforms Taiwan-LLM-7B-v2.1-chat, Taiwan-LLM-13B-v2.0-chat, and Yi-6B-Chat on all TC benchmarks and is comparable with Mistral-7B-Instruct-v0.1 on MMLU and MT-Bench in English.

A project by the members (in alphabetical order): Chan-Jan Hsu 許湛然, Chang-Le Liu 劉昶樂, Feng-Ting Liao 廖峰挺, Po-Chun Hsu 許博竣, Yi-Chang Chen 陳宜昌, and the supervisor Da-Shan Shiu 許大山.

Features

  • Expanding the vocabulary dictionary for Traditional Chinese from 32k to 62k vocabulary size
  • Multi-turn dialogue (without special handling for harmfulness)
  • 8k context length

Model Details

Base Model Performance

Models TMMLU+ (ACC) DRCD (EM) MMLU (ACC)
TC, Knowledge TC, Reasoning EN, Knowledge
5 shot 3 shot 5 shot
Yi-34B 34B 63.10 84.57 77.42
Qwen-14B 14B 51.30 16.95 * 68.83
Yi-6B 6B 49.63 76.61 65.35
Qwen-7B 7B 42.84 0.0 * 61.00
Breeze-7B-Base-v0.1 7B 40.35 81.13 61.63
Mistral-7B-v0.1 7B 36.93 79.27 64.89

* Few-shot learning cannot effectively guide the model to generate the proper answer.

Category ACC of TMMLU+ (5 shot) STEM Social Science Humanities Other
Yi-34B 56.03 73.06 61.12 62.19
Qwen-14B 46.51 58.20 51.12 49.38
Yi-6B 41.14 57.77 50.22 49.39
Qwen-7B 28.25 47.80 43.14 42.17
Breeze-7B-Base-v0.1 35.74 46.08 40.29 39.27
Mistral-7B-v0.1 33.01 42.23 35.86 37.63

Inference Performance

Models Speed (char/sec) Max Input Length (TC Char)
Breeze-7B-Base-v0.1
Mistral-7B-v0.1
Taiwan-LLM-7B-v2.1-base
Taiwan-LLM-13B-v2.0-base
Yi-6B
Yi-34B
Qwen-7B
Qwen-14B

Chat Model Performance

Models TMMLU+ (ACC) TMMLU+ (ACC) DRCD (EM) MT-Bench-tw (Score) MMLU (ACC) MMLU (ACC) MT-Bench (Score)
TC, Knowledge TC, Knowledge TC, Reasoning TC, Chat EN, Knowledge EN, Knowledge EN, Chat
0 shot 5 shot 3 shot 0 shot 0 shot 5 shot 0 shot
gpt-3.5-turbo-1106 76.30 7.1 7.9
Yi-34B-Chat 34B 54.87 6.9 71.04 7.6
Qwen-14B-Chat 14B 48.41 6.4 64.91 7.2
Yi-6B 6B 44.79 5.0 59.45 6.0
Breeze-7B-Instruct-v0.1 7B 41.61 5.7 63.26 7.1
Breeze-7B-Instruct-64k-v0.1 7B 40.99 63.68 7.1
Qwen-7B-Chat 7B 40.02 5.4 55.94 6.2
Taiwan-LLM-13B-v2.0-chat 13B 29.47 5.0 50.50 -*
Taiwan-LLM-7B-v2.1-chat 7B 28.08 4.2 42.72 -*

* Taiwan-LLM models responds to multi-turn questions (English) in Traditional Chinese.

Category ACC of TMMLU+ STEM Social Science Humanities Other
Yi-6B-Chat 26.28 33.48 29.48 27.62
Breeze-7B-Instruct-v0.1 37.45 48.35 40.26 40.44
Taiwan-LLM-7B-v2.1-chat 26.53 29.47 26.11 26.90
Qwen-7B-Chat 32.89 44.26 38.21 37.83
Taiwan-LLM-13B-v2.0-chat 29.68 37.13 30.31 30.55
Qwen-14B-Chat 46.51 58.20 51.12 49.38
Yi-34B-Chat 46.36 65.02 52.84 52.21
gpt-3.5-turbo-1106

Examples

Use in Transformers

First install direct dependencies:

pip install transformers torch accelerate

If you want faster inference using flash-attention2, you need to install these dependencies:

pip install packaging ninja
pip install flash-attn

Then load the model in transformers:

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model = AutoModelForCausalLM.from_pretrained(
    model="MediaTek-Research/Breeze-7B-Instruct-v0.1",
    device_map="auto",
    torch_dtype=torch.bfloat16,
    use_flash_attn_2=True # optional
)

The structure of the query template follows that of Mistral-7B-Instruct, as shown below.

<s> SYS_PROMPT   [INST] QUERY1 [/INST] RESPONSE1 [INST] QUERY2 [/INST]

where SYS_PROMPT, QUERY1, RESPONSE1, and QUERY2 can be provided by the user.

The suggested default SYS_PROMPT is

You are a helpful AI assistant built by MediaTek Research. The user you are helping speaks Traditional Chinese and comes from Taiwan.