Baichuan 2: Open Large-scale Language Models

Aiyuan Yang, Bin Xiao, Bingning Wang, Borong Zhang, Ce Bian, Chao Yin, Chenxu Lv, Da Pan, Dian Wang, Dong Yan, Fan Yang, Fei Deng, Feng Wang, Feng Liu, Guangwei Ai, Guosheng Dong, Haizhou Zhao, Hang Xu, Haoze Sun, Hongda Zhang, Hui Liu, Jiaming Ji, Jian Xie, Juntao Dai, Kun Fang, Lei Su, Liang Song, Lifeng Liu, Liyun Ru, Luyao Ma, Mang Wang, Mickel Liu, MingAn Lin, Nuolan Nie, Peidong Guo, Ruiyang Sun, Tao Zhang, Tianpeng Li, Tianyu Li, Wei Cheng, Weipeng Chen, Xiangrong Zeng, Xiaochuan Wang, Xiaoxi Chen, Xin Men, Xin Yu, Xuehai Pan, Yanjun Shen, Yiding Wang, Yiyu Li, Youxin Jiang, Yuchen Gao, Yupeng Zhang, Zenan Zhou, Zhiying Wu · DOI

TL;DR

Baichuan 2 introduces a new family of open-source, large-scale multilingual language models (7B and 13B parameters) trained on an unprecedented 2.6 trillion tokens. These models demonstrate competitive or superior performance across a wide range of benchmarks, including specialized domains like medicine and law, while also excelling in multilingual capabilities, addressing a key gap in current LLM research.

What Problem Does This Paper Address?

The field of large language models (LLMs) has seen rapid advancements, but many of the most powerful models remain closed-source or primarily English-centric. This limits research accessibility, hinders multilingual development, and makes it difficult for the community to deeply study and fine-tune these systems. Baichuan 2 aims to democratize access to high-performing LLMs by releasing open-source, multilingual models trained on a massive dataset, fostering greater transparency and accelerating responsible development.

Methods

Baichuan 2 builds upon the Transformer architecture with several modifications. Key techniques include:

  • Massive Pre-training Data: Trained on 2.6 trillion tokens, significantly more than previous open-source models.
  • Multilingual Focus: Explicitly trained on a Chinese-English bilingual dataset to improve performance in non-English languages.
  • Tokenizer Expansion: An expanded vocabulary size (125,696 tokens) to better handle diverse languages and improve compression.
  • Positional Embeddings: Uses Rotary Positional Embedding (RoPE) for the 7B model and ALiBi for the 13B model, leveraging ALiBi's improved extrapolation performance.
  • Optimized Architecture: Incorporates SwiGLU activation and memory-efficient attention via xFormers.
  • Training Optimizations: Employs AdamW optimizer, BFloat16 mixed precision, and introduces "NormHead" to stabilize training by normalizing output embeddings and a "Max-z loss" to normalize logits, improving inference robustness.
  • Alignment: Utilizes Supervised Fine-Tuning (SFT) and Reinforcement Learning from Human Feedback (RLHF) with a PPO algorithm to create chat models.
  • Safety Enhancements: Rigorous data filtering, curated multilingual datasets, and red-teaming procedures to improve safety and harmlessness.

Datasets

  • Training Data: A massive corpus of 2.6 trillion tokens, sourced from general internet webpages, books, research papers, and codebases. A significant portion includes a curated Chinese-English bilingual dataset.
  • Evaluation Benchmarks:
    • General: MMLU, CMMLU, GSM8K, HumanEval, C-Eval, AGIEval, Gaokao, BBH.
  • Vertical Domains: JEC-QA (law), MedQA, MedMCQA (medicine).
  • Multilingual: Flores-101 (seven subtasks including zh-en, zh-fr, zh-es, zh-ar, zh-ru, zh-ja, and zh-de).
  • Safety: Toxigen, Baichuan Harmless Evaluation Dataset (BHED).

Key Insights and Ideas

  • Scale Matters (and Data Scale Even More): The paper strongly suggests that training on a massive dataset (2.6 trillion tokens) is crucial for achieving state-of-the-art performance, even for models of moderate size (7B and 13B).
  • Multilingualism is Achievable with Open Models: Baichuan 2 demonstrates that high-quality multilingual capabilities can be achieved in open-source models, addressing a significant gap.
  • Architectural Tweaks Yield Benefits: Innovations like "NormHead" and "Max-z loss" contribute to training stability and inference robustness, crucial for large-scale LLMs.
  • Safety is a Multi-Stage Process: Effective safety measures require attention not only during data cleaning but also throughout the alignment and RLHF stages.
  • Openness Accelerates Progress: By releasing checkpoints at various training stages, the authors aim to provide valuable insights into LLM training dynamics, fostering community research.

Key Results

  • Benchmark Performance: Baichuan 2-7B and 13B models match or outperform other open-source models of similar size on general benchmarks like MMLU, CMMLU, GSM8K, and HumanEval.
  • Vertical Domain Excellence: Baichuan 2 shows strong performance in law (JEC-QA) and medicine (MedQA, MedMCQA), often surpassing GPT-3.5 Turbo and LLaMA 2.
  • Multilingual Prowess: Baichuan 2-7B outperforms similar-sized models across seven multilingual tasks. Baichuan 2-13B rivals GPT-4 on some Chinese-English tasks and significantly improves over Baichuan 1 in multilingual settings.
  • Safety Improvements: The alignment process significantly improved harmlessness while largely maintaining helpfulness, as shown in safety evaluations.
  • Training Efficiency: The models were trained efficiently on 1,024 NVIDIA A800 GPUs, achieving high computational efficiency.

Limitations and Future Work

  • Static Knowledge: Like most LLMs, Baichuan 2's knowledge is static and can become outdated, posing challenges for domains requiring up-to-date information (e.g., medicine, law).
  • Multilingual Limitations: While strong in Chinese and English, the model may have limitations in other languages and might not fully capture biases relevant to non-Chinese cultures.
  • Potential for Misuse: The authors acknowledge the potential for misuse, such as generating harmful content, and emphasize the need for responsible use.
  • Safety Over-cautions: Some safety measures might appear overly cautious, potentially affecting usability for certain tasks.
  • Future Work: The authors plan to continue optimizing safety and releasing updated versions. They also highlight the potential for further gains by continuing to scale training data and exploring the correlation between training FLOPs and math problem-solving improvements. The release of intermediate checkpoints is intended to facilitate further research into training dynamics.

Summary updated

BibTeX
@misc{yang2023baichuan,
  author = {Aiyuan Yang and Bin Xiao and Bingning Wang and Borong Zhang and Ce Bian and Chao Yin and Chenxu Lv and Da Pan and Dian Wang and Dong Yan and Fan Yang and Fei Deng and Feng Wang and Feng Liu and Guangwei Ai and Guosheng Dong and Haizhou Zhao and Hang Xu and Haoze Sun and Hongda Zhang and Hui Liu and Jiaming Ji and Jian Xie and Juntao Dai and Kun Fang and Lei Su and Liang Song and Lifeng Liu and Liyun Ru and Luyao Ma and Mang Wang and Mickel Liu and MingAn Lin and Nuolan Nie and Peidong Guo and Ruiyang Sun and Tao Zhang and Tianpeng Li and Tianyu Li and Wei Cheng and Weipeng Chen and Xiangrong Zeng and Xiaochuan Wang and Xiaoxi Chen and Xin Men and Xin Yu and Xuehai Pan and Yanjun Shen and Yiding Wang and Yiyu Li and Youxin Jiang and Yuchen Gao and Yupeng Zhang and Zenan Zhou and Zhiying Wu},
  title = {{Baichuan 2: Open Large-scale Language Models}},
  year = {2023},
  eprint = {2309.10305},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.10305},
}
Figure