YuLan-Chat models are chat-based large language models, which are developed by the researchers in GSAI, Renmin University of China (YuLan, which represents Yulan Magnolia, is the campus flower of Renmin University of China). The newest version is developed by pre-training from scratch, and supervised fine-tuning via curriculum learning with high-quality English and Chinese instructions and human preference data. The model has the following technical characteristics:
Owing to large-scale pre-training on high-quality English, Chinese, and multilingual data, the language ability of the model has been improved.
Owing to the curriculum learning strategy for human alignment, the helpfulness, honesty, and harmlessness of our model have been enhanced.
To well support Chinese longer inputs and outputs, we expand the vocabulary with Chinese words and the maximum input length. It can support 4k context now.
[July. 1, 2024] We release YuLan-Base-12B, an LLM trained from scratch, and its chat-based version YuLan-Chat-3-12B. We pre-train the base model on over 1.6TB tokens of English, Chinese, and multilingual data, and then perform supervised fine-tuning via curriculum learning with high-quality English and Chinese instructions and human preference data to obtain the chat model.
[Aug. 18, 2023] Our YuLan-Chat-2-13B achieves the 5th position of OpenCompass benchmark!
[Aug. 02, 2023] We release YuLan-LLaMA-2-13B and YuLan-Chat-2-13B. Both models have been continually pre-trained on English and Chinese corpus based on LLaMA-2, and YuLan-Chat-2-13B is the chat-based LLM based on YuLan-LLaMA-2-13B, with high-quality English and Chinese instructions.
[Aug. 02, 2023] We release YuLan-Chat-1-65B-v2, a chat-based LLM based on LLaMA. It has been continually pre-trained on English and Chinese corpus, and then instruction-tuned with high-quality English and Chinese instructions.
[Jun. 08, 2023] We release YuLan-Chat-1-13B-v1 and YuLan-Chat-1-65B-v1, and the corresponding INT-8 quantization scripts.
Due to the license limitation, for models based on LLaMA, we only provide the weight difference with the original checkpoints; for models based on LLaMA-2, they can be used directly. Please check the Usage section for more details.
Limitations: Despite our efforts to reduce potential security issues during the model's usage and encourage the generation of text that aligns with ethical and legal requirements, the language model is based on probabilistic generation, which means it may still produce unexpected outputs. For instance, the generated responses may contain biases, discrimination, or other harmful content. Please do not propagate such content. We do not assume any responsibility for any consequences resulting from the dissemination of harmful information.
We evaluate our YuLan-Chat model on several Chinese and English benchmarks. The evaluation results are shown as follows.
我们在中英文的一些基准测试上对YuLan-Chat进行了评价,其结果如下。
MMLU
MMLU (Massive Multitask Language Understanding) is a benchmark designed to measure knowledge acquired during pretraining by evaluating models exclusively in zero-shot and few-shot settings.
MMLU是一个评估模型知识量的常用的英文基准测试集。
Model
STEM
Social Science
Humanities
Others
Avg.
YuLan-Chat-1-13B-v1
39.6
57.8
42.6
57.6
49.4
YuLan-Chat-1-65B-v1
49.2
71.7
57.7
66.7
61.3
YuLan-Chat-1-65B-v2
46.3
67.9
56.9
63.9
58.7
LLaMA-2-13B
44.6
64.2
53.9
62.2
56.2
FlagAlpha/Llama2-Chinese-13b-Chat
44.4
63.2
51.6
60.6
55.0
Linly-AI/Chinese-LLaMA-2-13B-hf
43.6
62.7
49.8
61.6
54.4
YuLan-LLaMA-2-13B
42.9
61.5
50.4
58.6
53.4
YuLan-Chat-2-13B
45.3
66.7
53.8
62.8
57.2
YuLan-Base-12B
42.3
60.2
46.4
56.1
51.3
YuLan-Chat-3-12B
45.5
64.3
51.8
61.3
55.7
C-Eval
C-Eval is a comprehensive Chinese evaluation suite for foundation models.
C-Eval是一个针对基石模型综合能力的中文基准测试集。
Model
STEM
Social Science
Humanities
Others
Avg.
Avg. (Hard)
YuLan-Chat-1-13B-v1
30.2
37.4
31.9
30.7
32.0
25.7
YuLan-Chat-1-65B-v1
37.7
46.1
36.8
38.0
39.2
31.1
YuLan-Chat-1-65B-v2
39.9
55.9
47.7
43.7
45.4
31.4
LLaMA-2-13B
36.9
43.2
37.6
36.6
38.2
32.0
FlagAlpha/Llama2-Chinese-13b-Chat
36.8
44.5
36.3
36.5
38.1
30.9
Linly-AI/Chinese-LLaMA-2-13B-hf
33.7
44.8
36.6
36.5
37.0
27.7
YuLan-LLaMA-2-13B
35.3
46.4
41.9
37.6
39.3
28.6
YuLan-Chat-2-13B
38.9
49.7
45.0
40.8
42.6
32.2
YuLan-Base-12B
42.0
57.6
47.2
41.5
46.0
32.6
YuLan-Chat-3-12B
47.0
61.8
52.9
44.3
50.5
37.7
AGI-Eval-Gaokao
AGI-Eval is a human-centric benchmark specifically designed to evaluate the general abilities of foundation models in tasks pertinent to human cognition and problem-solving. We use the sub-branch Chinese-Gaokao for evaluation.
We suggest to install the pytorch and bitsandbytes according to their official guidance for better adapting to your environment, and we provide our applied versions as reference:
我们建议根据官方手册安装pytorch和bitsandbytes,此处提供我们使用的版本作为参考。
torch==1.13
bitsandbytes==0.39.0
Then, you can install other packages by the following instruction:
然后,安装其他所需的包。
pip install -r requirements.txt
Model Weights Recovering
For YuLan-Chat-1-13B-v1, YuLan-Chat-1-65B-v1, and YuLan-Chat-1-65B-v2, as they are based on LLaMA, you should download LLaMA's original weights, and then add our released delta parameters into the original parameters to compose the final model parameters.
As our model is trained based on LLaMA, it can be loaded in the same way as original LLaMA.
由于我们的模型与LLaMA具有相似的结构,可以使用与LLaMA相同的方法加载。
Python
1>>> from transformers import AutoTokenizer, AutoModelForCausalLM
2>>> tokenizer = AutoTokenizer.from_pretrained("yulan-team/YuLan-Chat-3-12b")
3>>> model = AutoModelForCausalLM.from_pretrained("yulan-team/YuLan-Chat-3-12b").cuda()
4>>> model = model.eval()
5>>> input_text = "hello"
6>>> prompt = "The following is a conversation between a human and an AI assistant namely YuLan, developed by GSAI, Renmin University of China. The AI assistant gives helpful, detailed, and polite answers to the user's questions.\n[|Human|]:{}\n[|AI|]:".format(input_text)
7>>> inputs = tokenizer(prompt, return_tensors='pt', padding="longest", max_length=4096, truncation=True, return_attention_mask=True, add_special_tokens=True)
8>>> kwargs = {'temperature': 0.8, 'top_p': 0.95, "top_k": 50, "repetition_penalty": 1.1, "no_repeat_ngram_size": 64, "max_length": 4096, "pad_token_id": tokenizer.bos_token_id, "eos_token_id": tokenizer.eos_token_id}
9>>> outputs = model.generate(inputs['input_ids'].to(model.device), attention_mask=inputs['attention_mask'].to(model.device), do_sample=True, **kwargs)
10>>> print(tokenizer.batch_decode(outputs, skip_special_tokens=True)[len(prompt):])
Inference in Command Line
We provide the code for the inference of YuLan-Chat in command line.
1@article{yulan,
2 author = {Yutao Zhu and
3 Kun Zhou and
4 Kelong Mao and
5 Wentong Chen and
6 Yiding Sun and
7 Zhipeng Chen and
8 Qian Cao and
9 Yihan Wu and
10 Yushuo Chen and
11 Feng Wang and
12 Lei Zhang and
13 Junyi Li and
14 Xiaolei Wang and
15 Lei Wang and
16 Beichen Zhang and
17 Zican Dong and
18 Xiaoxue Cheng and
19 Yuhan Chen and
20 Xinyu Tang and
21 Yupeng Hou and
22 Qiangqiang Ren and
23 Xincheng Pang and
24 Shufang Xie and
25 Wayne Xin Zhao and
26 Zhicheng Dou and
27 Jiaxin Mao and
28 Yankai Lin and
29 Ruihua Song and
30 Jun Xu and
31 Xu Chen and
32 Rui Yan and
33 Zhewei Wei and
34 Di Hu and
35 Wenbing Huang and
36 Ze-Feng Gao and
37 Yueguo Chen and
38 Weizheng Lu and
39 Ji-Rong Wen},
40 title = {YuLan: An Open-source Large Language Model},
41 journal = {CoRR},
42 volume = {abs/2406.19853},
43 year = {2024},
44 url = {https://doi.org/10.48550/arXiv.2406.19853},
45 doi = {10.48550/ARXIV.2406.19853},
46 eprinttype = {arXiv},
47 eprint = {2406.19853}
48}
YuLan-1
You can refer to our original branch for more detail about YuLan-Chat-1 and the instruction collection.