---
license: apache-2.0
inference: false
---
# XVERSE-7B-Chat
## 模型介绍
**XVERSE-7B-Chat**为[**XVERSE-7B**](https://huggingface.co/xverse/XVERSE-7B)模型对齐后的版本。
**XVERSE-7B** 是由深圳元象科技自主研发的支持多语言的大语言模型(Large Language Model),参数规模为 70 亿,主要特点如下:
- **模型结构**:XVERSE-7B 使用主流 Decoder-only 的标准 Transformer 网络结构,支持 8K 的上下文长度(Context Length),能满足更长的多轮对话、知识问答与摘要等需求,模型应用场景更广泛。
- **训练数据**:构建了 2.6 万亿 token 的高质量、多样化的数据对模型进行充分训练,包含中、英、俄、西等 40 多种语言,通过精细化设置不同类型数据的采样比例,使得中英两种语言表现优异,也能兼顾其他语言效果。
- **分词**:基于 BPE(Byte-Pair Encoding)算法,使用上百 GB 语料训练了一个词表大小为 100,534 的分词器,能够同时支持多语言,而无需额外扩展词表。
- **训练框架**:自主研发多项关键技术,包括高效算子、显存优化、并行调度策略、数据-计算-通信重叠、平台和框架协同等,让训练效率更高,模型稳定性强,在千卡集群上的峰值算力利用率可达到 58.5%,位居业界前列。
## Model Introduction
**XVERSE-7B-Chat** is the aligned version of model [**XVERSE-7B**](https://huggingface.co/xverse/XVERSE-7B)
**XVERSE-7B** is a multilingual large language model, independently developed by Shenzhen Yuanxiang Technology. Its key features are as follows:
- **Model Structure**: XVERSE-7B uses the mainstream Decoder-only Transformer network structure, supports 8k context length, which can meet the need of longer multi-round dialogues, knowledge question-answering, and summarization. This makes the model more versatile in application scenarios.
- **Training Data**: The model has been thoroughly trained on a diversified and high-quality dataset consisting of 2.6 trillion of tokens, including more than 40 languages such as Chinese, English, Russian, and Spanish. The sampling ratio of different types of data is finely set, which makes the performance of Chinese and English excellent, and also takes into account the effect of other languages.
- **Tokenization**: Based on the BPE (Byte-Pair Encoding) algorithm, a tokenizer with a vocabulary size of 100,534 has been trained using hundreds of gigabytes of language data. This tokenizer is capable of supporting multilingual without the need for additional vocabulary expansion.
- **Training Framework**: Several key technologies have also been independently developed, including efficient operators, memory optimization, parallel scheduling strategies, overlap of data-computation-communication, and synergy between platforms and frameworks. These advancements enhance training efficiency and model stability. With these technologies, the peak computational power utilization rate on a thousand-card cluster can reach 58.5%, ranking at the forefront of the industry.
## 评测结果
为验证模型的各项能力,我们选取了多个学科综合能力评测集,包括 [MMLU](https://arxiv.org/abs/2009.03300)(英文)、 [C-Eval](https://cevalbenchmark.com/)(中文)、[AGIEval](https://arxiv.org/abs/2304.06364)(中英) 、[GAOKAO-Bench](https://github.com/OpenLMLab/GAOKAO-Bench)(中英)、[GAOKAO-English](https://github.com/ExpressAI/AI-Gaokao)(英文),评测结果如下(粗体表示各项最高得分):
| 模型 | 类型 | MMLU | C-Eval | AGIEval1 | GAOKAO-Bench1 | GAOKAO-English1 |
| :----------------: | :--: | :--------------: | :--------------: | :-----------------: | :----------------------: | :------------------------: |
| Baichuan-7B | 底座 | 42.32 | 42.82 | 34.42 | 36.32 | 44.3 |
| Baichuan2-7B-Base | 底座 | 54.22 | 54.02 | 42.72 | 47.52 | 53.1 |
| Baichuan2-7B-Chat | 对话 | 53.2 | 52.2 | 41.3 | 49.7 | 66.6 |
| ChatGLM2-6B | 对话 | 45.52 | 50.12 | 42.6 | 54.2 | 59.7 |
| Falcon-7B | 底座 | 27.82 | 25.8 | 26.2 | 26.3 | 29.9 |
| InternLM-7B | 底座 | 51.02 | 52.4 | 34.1 | 53.6 | 32.3 |
| InternLM-7B-Chat | 对话 | 50.82 | 52.8 | 39.0 | **67.4** | 43.9 |
| Llama-7B | 底座 | 35.12 | 27.0 | 27.4 | 26.0 | 30.1 |
| Llama-2-7B | 底座 | 45.32 | 28.9 | 27.0 | 27.8 | 47.8 |
| MPT-7B | 底座 | 29.62 | 27.8 | 24.2 | 25.3 | 28.1 |
| Vicuna-7B-v1.5 | 对话 | 49.82 | 22.9 | 26.7 | 24.4 | 61.1 |
| **XVERSE-7B** | 底座 | 56.6 | **57.1** | 46.9 | 61.7 | 71.1 |
| **XVERSE-7B-Chat** | 对话 | **63.7** | 55.4 | **48.9** | 57.5 | **78.2** |
> 1:只针对其中的单项选择题进行测试,即排除了填空题、开放性问题和多项选择题
> 2:来源于各模型官方的汇报结果
>
> 对于 MMLU ,我们采用作者提供的[评测工具](https://github.com/hendrycks/test),C-Eval、AGIEval、GAOKAO-Bench、GAOKAO-English 与 MMLU 的评测方式相同,且统一采用 **5-shot** 构造测试样本。
## Model Evaluation
In order to validate the various abilities of the model, we have chosen several comprehensive capability benchmarks across multiple disciplines, including [MMLU](https://arxiv.org/abs/2009.03300) (English), [C-Eval](https://cevalbenchmark.com/) (Chinese), [AGIEval](https://arxiv.org/abs/2304.06364) (Chinese and English), [GAOKAO-Bench](https://github.com/OpenLMLab/GAOKAO-Bench) (Chinese and English), [GAOKAO-English](https://github.com/ExpressAI/AI-Gaokao) (English), the evaluation results are as follows (the bolded score represent the best performances):
| Models | Type | MMLU | C-Eval | AGIEval1 | GAOKAO-Bench1 | GAOKAO-English1 |
| :----------------: | :--------: | :--------------: | :--------------: | :-----------------: | :----------------------: | :------------------------: |
| Baichuan-7B | pretrained | 42.32 | 42.82 | 34.42 | 36.32 | 44.3 |
| Baichuan2-7B-Base | pretrained | 54.22 | 54.02 | 42.72 | 47.52 | 53.1 |
| Baichuan2-7B-Chat | fine-tuned | 53.2 | 52.2 | 41.3 | 49.7 | 66.6 |
| ChatGLM2-6B | fine-tuned | 45.52 | 50.12 | 42.6 | 54.2 | 59.7 |
| Falcon-7B | pretrained | 27.82 | 25.8 | 26.2 | 26.3 | 29.9 |
| InternLM-7B | pretrained | 51.02 | 52.4 | 34.1 | 53.6 | 32.3 |
| InternLM-7B-Chat | fine-tuned | 50.82 | 52.8 | 39.0 | **67.4** | 43.9 |
| Llama-7B | pretrained | 35.12 | 27.0 | 27.4 | 26.0 | 30.1 |
| Llama-2-7B | pretrained | 45.32 | 28.9 | 27.0 | 27.8 | 47.8 |
| MPT-7B | pretrained | 29.62 | 27.8 | 24.2 | 25.3 | 28.1 |
| Vicuna-7B-v1.5 | fine-tuned | 49.82 | 22.9 | 26.7 | 24.4 | 61.1 |
| **XVERSE-7B** | pretrained | 56.6 | **57.1** | 46.9 | 61.7 | 71.1 |
| **XVERSE-7B-Chat** | fine-tuned | **63.7** | 55.4 | **48.9** | 57.5 | **78.2** |
> 1: Tests are conducted only on single-answer multiple-choice questions, thus excluding fill-in-the-blanks, open-ended questions, and multiple-answer multiple-choice questions.
> 2: Reporting results from official results of each model.
>
> For MMLU, we adopt the [evaluation tools](https://github.com/hendrycks/test) provided by the authors, C-Eval, AGIEval, GAOKAO-Bench, GAOKAO-English are the same as MMLU, and uniformly use **5-shot** to construct the test samples.
### MMLU 各类别指标
MMLU Category Results
| Models | Type | Average | STEM | Social Science | Humanities | Others |
| :----------------: | :--------: | :------: | :------: | :------------: | :--------: | :------: |
| Baichuan-7B | pretrained | 42.3 | 35.6 | 48.9 | 38.4 | 48.1 |
| Baichuan2-7B-Chat | fine-tuned | 53.2 | 43.1 | 59.1 | 50.0 | 59.1 |
| ChatGLM2-6B | pretrained | 45.5 | 40.1 | 51.6 | 41.2 | 51.2 |
| InternLM-7B | pretrained | 51.0 | **58.7** | 43.5 | 52.7 | 53.2 |
| LLaMA-7B | pretrained | 35.1 | 30.5 | 38.3 | 34.0 | 38.1 |
| LLaMA2-7B | pretrained | 45.3 | 36.4 | 51.2 | 42.9 | 52.2 |
| **XVERSE-7B** | pretrained | 56.6 | 45.6 | 65.3 | 50.4 | 65.5 |
| **XVERSE-7B-Chat** | fine-tuned | **63.7** | 51.7 | **72.5** | **58.2** | **72.2** |
### C-Eval 各类别指标
C-Eval Category Results
| Models | Type | Average | STEM | Social Science | Humanities | Others |
| :----------------: | :--------: | :------: | :------: | :------------: | :--------: | :------: |
| Baichuan-7B | pretrained | 42.8 | 38.2 | 52.0 | 46.2 | 39.3 |
| Baichuan2-7B-Base | pretrained | 54.9 | 47.9 | 67.3 | 58.4 | 52.8 |
| Baichuan2-7B-Chat | fine-tuned | 52.2 | 44.6 | 65.0 | 55.8 | 50.9 |
| ChatGLM2-6B | fine-tuned | 50.1 | 46.4 | 60.4 | 50.6 | 46.9 |
| Falcon-7B | pretrained | 25.8 | 25.8 | 26.0 | 25.8 | 25.7 |
| InternLM-7B | pretrained | 52.4 | 47.0 | 64.9 | 55.6 | 47.6 |
| InternLM-7B-Chat | fine-tuned | 52.8 | 48.4 | 65.6 | 57.0 | 45.0 |
| LLaMA-7B | pretrained | 27.0 | 26.7 | 26.7 | 28.4 | 26.2 |
| LLaMA2-7B | pretrained | 28.9 | 26.8 | 34.5 | 30.0 | 26.4 |
| MPT-7B | pretrained | 27.8 | 27.4 | 29.8 | 26.9 | 27.7 |
| Vicuna-7B-v1.5 | fine-tuned | 22.9 | 21.8 | 23.3 | 24.0 | 23.3 |
| **XVERSE-7B** | pretrained | **57.1** | **48.9** | **71.0** | **59.7** | **56.7** |
| **XVERSE-7B-Chat** | fine-tuned | 55.4 | 47.9 | 68.5 | 57.3 | 55.1 |
### Loading with Transformers
可通过以下代码加载 XVERSE-7B-Chat 模型进行对话:
The XVERSE-7B-Chat model can be loaded for chat using the following code:
```python
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from transformers.generation.utils import GenerationConfig
model_path = "xverse/XVERSE-7B-Chat"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True, torch_dtype=torch.bfloat16, device_map='auto')
model.generation_config = GenerationConfig.from_pretrained(model_path)
model = model.eval()
history = [{"role": "user", "content": "1955年谁是美国总统?他是什么党派?"}]
response = model.chat(tokenizer, history)
print(response)
history.append({"role": "assistant", "content": response})
history.append({"role": "user", "content": "他任职了多少年"})
response = model.chat(tokenizer, history)
print(response)
```
更多细节,包括对话demo、模型微调及量化等,请参考我们的[Github](https://github.com/xverse-ai/XVERSE-7B)。
For more details, including chat demo, model fine-tuning and quantization, please refer to our [Github](https://github.com/xverse-ai/XVERSE-7B).
## 局限性与免责申明
XVERSE-7B-Chat 与其他所有 LLM 一样,在某些情况下可能会产生不准确、有偏见或其他令人反感的内容。因此,请谨慎使用模型生成的内容,请勿将生成的有害内容进行传播,在部署任何 XVERSE-7B-Chat 的应用之前,开发人员应根据其具体应用对模型进行安全测试和调优。
我们强烈警告不要将 XVERSE-7B-Chat 模型用于制造或传播有害信息,或进行任何可能损害公众、国家、社会安全或违反法规的活动。如果使用 XVERSE-7B-Chat 模型产生任何问题,无论是数据安全问题、公共舆论风险,还是模型被误解、滥用、传播或不合规使用所引发的任何风险和问题,我们将不承担任何责任。
## Limitations and Disclaimer
Like all other Large Language Models (LLMs), XVERSE-7B-Chat may produce inaccurate, biased, or otherwise offensive content under certain circumstances. Therefore, please use the content generated by the model with caution and refrain from disseminating harmful content. Before deploying any application of XVERSE-7B-Chat, developers should conduct safety tests and optimization of the model according to its specific application.
We strongly warn against the use of the XVERSE-7B-Chat model for producing or spreading harmful information, or conducting any activities that might harm the public, national, or social security, or violate regulations. We assume no responsibility for any problems arising from the use of the XVERSE-7B-Chat model, whether it be data security issues, public opinion risks, or any risks and issues caused by misunderstanding, misuse, dissemination, or non-compliance with the model.
## 模型开源协议
使用本仓库的源码需要遵循 [Apache-2.0](https://github.com/xverse-ai/XVERSE-7B/blob/main/LICENSE) 开源协议,使用 XVERSE-7B-Chat 的模型权重则需要遵循[模型许可协议](https://github.com/xverse-ai/XVERSE-7B/blob/main/MODEL_LICENSE.pdf)。
XVERSE-7B-Chat 模型权重对学术研究**完全开放**,并且支持**免费商用**。如需申请商业许可证,请填写【[申请表](https://chat.xverse.cn/home/business.html)】,如有其他问题或合作,请联系 。
## Open Source License
The use of the source code in this repository must follow the [Apache-2.0](https://github.com/xverse-ai/XVERSE-7B/blob/main/LICENSE) open-source license, while the use of the model weights of XVERSE-7B-Chat needs to adhere to the [Model License Agreement](https://github.com/xverse-ai/XVERSE-7B/blob/main/MODEL_LICENSE.pdf).
The XVERSE-7B-Chat model weights are **fully open** to academic research and support **free commercial use**. To apply for a commercial license, please fill in the [application form](https://chat.xverse.cn/home/business.html). For other questions or collaborations, please contact .