DeepSeek LLM: Scaling Open-Source Language Models with Longtermism

Xiao Bi, Deli Chen, Guanting Chen, Shanhuang Chen, Damai Dai, Chengqi Deng, Honghui Ding, Kai Dong, Qiushi Du, Zhe Fu, Huazuo Gao, Kaige Gao, Wenjun Gao, Ruiqi Ge, Kang Guan, Daya Guo, Jianzhong Guo, Guangbo Hao, Zhewen Hao, Ying He, Wenjie Hu, Panpan Huang, Erhang Li, Guowei Li, Jiashi Li, Yao Li, Wenfeng Liang, Fangyun Lin, Alex X. Liu, Bo Liu, Wen Liu, Xiaodong Liu, Xin Liu, Yiyuan Liu, Haoyu Lu, Shanghao Lu, Fuli Luo, Shirong Ma, Xiaotao Nie, Tian Pei, Yishi Piao, Junjie Qiu, Hui Qu, Tongzheng Ren, Zehui Ren, Chong Ruan, Zhangli Sha, Zhihong Shao, Junxiao Song, Xuecheng Su, Jingxiang Sun, Yaofeng Sun, Minghui Tang, Bingxuan Wang, Peiyi Wang, Shiyu Wang, Yaohui Wang, Yongji Wang, Tong Wu, Y. Wu, Xin Xie, Zhenda Xie, Ziwei Xie, Yiliang Xiong, Hanwei Xu, R. X. Xu, Yanhong Xu, Dejian Yang, Yuxiang You, Shuiping Yu, Xingkai Yu, B. Zhang, Haowei Zhang, Lecong Zhang, Liyue Zhang, Mingchuan Zhang, Minghua Zhang, Wentao Zhang, Yichao Zhang, Chenggang Zhao, Yao Zhao, Shangyan Zhou, Shunfeng Zhou, Qihao Zhu, Yuheng ZouarXiv 2024 · DOI

TL;DR

This paper introduces DeepSeek LLM, a new family of open-source large language models trained on a massive 2 trillion token dataset in English and Chinese. By meticulously studying scaling laws, the authors developed a novel strategy for allocating model and data scales, leading to impressive performance gains, particularly in code, math, and reasoning, outperforming LLaMA-2 70B and rivaling GPT-3.5.

What Problem Does This Paper Address?

The rapid advancement of large language models (LLMs) has been a defining feature of recent AI progress. However, a significant challenge lies in understanding and applying "scaling laws" – the principles that govern how model performance improves with increased compute, data, and model size. Previous research on scaling laws has yielded conflicting conclusions, creating uncertainty about how to best allocate resources for training increasingly powerful LLMs. This paper aims to resolve these ambiguities by conducting a thorough investigation into scaling laws, particularly for open-source models, and using these insights to build a new, high-performing LLM family.

Methods

The core of this work lies in a deep dive into scaling laws. The authors first investigated the scaling of hyperparameters, identifying that batch size and learning rate are critical and can be modeled with power laws related to compute budget. They then employed an "IsoFLOP profile" approach, similar to Chinchilla, to analyze model and data scaling. A key methodological innovation is the adoption of "non-embedding FLOPs/token" (M) as a more accurate representation of model scale compared to traditional parameter counts. This allowed for a more precise estimation of optimal model and data allocation strategies.

The training process itself involved:

  • Pre-training: A massive 2 trillion token dataset was curated, emphasizing both English and Chinese. The architecture largely follows LLaMA, with modifications to the learning rate scheduler.
  • Supervised Fine-Tuning (SFT): The models were fine-tuned on 1.5 million instruction data instances in English and Chinese, covering general language, math, and coding.
  • Direct Preference Optimization (DPO): This technique was used to further enhance conversational abilities and alignment, leveraging preference data for helpfulness and harmlessness.

Datasets

  • Pre-training: A custom dataset of 2 trillion tokens, primarily in English and Chinese.
  • SFT: Approximately 1.5 million instruction data instances in English and Chinese.
  • DPO: Preference data constructed for helpfulness and harmlessness.
  • Evaluation: A wide array of public benchmarks were used, including MMLU, C-Eval, CMMLU, HellaSwag, PIQA, ARC, OpenBookQA, BigBench Hard, TriviaQA, NaturalQuestions, RACE, DROP, GSM8K, MATH, HumanEval, MBPP, AGIEval, CLUEWSC, CHID, CMath, and CCPM. They also introduced their own ChineseQA test set.

Key Insights and Ideas

  • Data Quality Matters: The study revealed that the quality of the pre-training data significantly influences the optimal model/data scaling strategy. Higher quality data allows for more compute budget to be allocated to model scaling, suggesting that better data can drive the training of larger, more capable models.
  • Model Scale Representation: Using "non-embedding FLOPs/token" (M) as a measure of model scale proved more accurate for predicting performance and optimal allocation than traditional parameter counts. This is because it better accounts for computational overheads like attention.
  • Hyperparameter Scaling Laws: The optimal batch size and learning rate can be predictably modeled as power laws of the compute budget, providing a framework for efficient hyperparameter selection across different scales.
  • Language Conflict Impact: Smaller models showed a greater performance disparity when dealing with multilingual data, suggesting that language conflict has a more pronounced effect on smaller model architectures.
  • DPO Enhances Generation: Direct Preference Optimization (DPO) was found to strengthen open-ended generation skills without significantly compromising performance on standard benchmarks.

Key Results

  • LLaMA-2 70B Outperformed: DeepSeek LLM 67B demonstrated superior performance compared to LLaMA-2 70B across various benchmarks, particularly in code, mathematics, and reasoning.
  • GPT-3.5 Level Performance: DeepSeek LLM 67B Chat achieved performance comparable to GPT-3.5 in open-ended evaluations in both Chinese and English.
  • Strong Math and Code Capabilities: The models showed significant improvements in math and coding tasks after fine-tuning, with HumanEval and GSM8K scores improving by over 20 points.
  • Safety: The DeepSeek 67B Chat model exhibited good security performance across numerous safety test categories and achieved a high safety score on the "Do-Not-Answer" dataset, surpassing ChatGPT and GPT-4.
  • Scaling Laws Validation: The developed scaling laws accurately predicted the performance of DeepSeek LLM 7B and 67B models, demonstrating their predictive power.

Limitations and Future Work

  • Chinese Data Exhaustiveness: The authors acknowledge that their initial Chinese data might not be exhaustive, potentially leading to suboptimal performance on certain Chinese-specific topics.
  • Other Languages: Due to the primary focus on Chinese and English data, the model's proficiency in other languages remains delicate and requires caution.
  • Future Work: The team plans to release technique reports on code intelligence and Mixture-of-Experts (MoE). They are also working on a larger, improved dataset for the next version of DeepSeek LLM to enhance reasoning, Chinese knowledge, math, and code capabilities. Further research into reinforcement learning for complex reasoning is also planned.

Summary updated

BibTeX
@misc{bi2024deepseek,
  author = {Xiao Bi and Deli Chen and Guanting Chen and Shanhuang Chen and Damai Dai and Chengqi Deng and Honghui Ding and Kai Dong and Qiushi Du and Zhe Fu and Huazuo Gao and Kaige Gao and Wenjun Gao and Ruiqi Ge and Kang Guan and Daya Guo and Jianzhong Guo and Guangbo Hao and Zhewen Hao and Ying He and Wenjie Hu and Panpan Huang and Erhang Li and Guowei Li and Jiashi Li and Yao Li and Y. K. Li and Wenfeng Liang and Fangyun Lin and Alex X. Liu and Bo Liu and Wen Liu and Xiaodong Liu and Xin Liu and Yiyuan Liu and Haoyu Lu and Shanghao Lu and Fuli Luo and Shirong Ma and Xiaotao Nie and Tian Pei and Yishi Piao and Junjie Qiu and Hui Qu and Tongzheng Ren and Zehui Ren and Chong Ruan and Zhangli Sha and Zhihong Shao and Junxiao Song and Xuecheng Su and Jingxiang Sun and Yaofeng Sun and Minghui Tang and Bingxuan Wang and Peiyi Wang and Shiyu Wang and Yaohui Wang and Yongji Wang and Tong Wu and Y. Wu and Xin Xie and Zhenda Xie and Ziwei Xie and Yiliang Xiong and Hanwei Xu and R. X. Xu and Yanhong Xu and Dejian Yang and Yuxiang You and Shuiping Yu and Xingkai Yu and B. Zhang and Haowei Zhang and Lecong Zhang and Liyue Zhang and Mingchuan Zhang and Minghua Zhang and Wentao Zhang and Yichao Zhang and Chenggang Zhao and Yao Zhao and Shangyan Zhou and Shunfeng Zhou and Qihao Zhu and Yuheng Zou},
  title = {{DeepSeek LLM: Scaling Open-Source Language Models with Longtermism}},
  year = {2024},
  eprint = {2401.02954},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.02954},
}
Figure