NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Qwen2 Technical Report

An Yang, Baosong Yang, Binyuan Hui, Bo Zheng, Bowen Yu, Chang Zhou, Chengpeng Li, Chengyuan Li, Dayiheng Liu, Fei Huang, Guanting Dong, Haoran Wei, Huan Lin, Jialong Tang, Jialin Wang, Jian Yang, Jianhong Tu, Jianwei Zhang, Jianxin Ma, Jin Xu, Jingren Zhou, Jinze Bai, Jinzheng He, Junyang Lin, Kai Dang, Keming Lu, Keqin Chen, Kexin Yang, Mei Li, Mingfeng Xue, Na Ni, Pei Zhang, Peng Wang, Ru Peng, Rui Men, Ruize Gao, Runji Lin, Shijie Wang, Shuai Bai, Sinan Tan, Tianhang Zhu, Tianhao Li, Tianyu Liu, Wenbin Ge, Xiaodong Deng, Xiaohuan Zhou, Xingzhang Ren, Xinyu Zhang, Xipin Wei, Xuancheng Ren, Xuejing Liu, Yang Fan, Yang Yao, Yichang Zhang, Yu Wan, Yunfei Chu, Yuqiong Liu, Zeyu Cui, Zhenru Zhang, Zhifang Guo, Zhihao Fan

TL;DR

Qwen2 is Alibaba’s latest generation of open-weight large language models, ranging from 0.5B to 72B parameters and including both dense and Mixture-of-Experts (MoE) architectures. The flagship Qwen2-72B model significantly outperforms its predecessor and rivals top-tier proprietary models like GPT-4 across coding, mathematics, and multilingual benchmarks, while supporting context windows up to 128K tokens.

What Problem Does This Paper Address?

While proprietary models have dominated the LLM landscape, the open-source community has been striving to close the performance gap. Previous open-weight models often struggled with specialized reasoning (like complex math and coding) and lacked robust support for a wide array of global languages. Furthermore, efficiently scaling models for different deployment scenarios—from edge devices like smartphones to massive GPU clusters—remains a significant engineering challenge. Qwen2 aims to provide a versatile, high-performance suite of models that addresses these gaps in reasoning, multilingualism, and deployment flexibility.

Methods

Qwen2 is built on the Transformer architecture with several key refinements:

  • Architectural Efficiency: All models now utilize Grouped Query Attention (GQA). By sharing key and value heads, GQA reduces KV cache memory usage, which significantly boosts inference throughput—a critical factor for real-world deployment.
  • Long-Context Handling: To support a 128K token context window, the team implemented Dual Chunk Attention (DCA) alongside YARN for length extrapolation. DCA breaks long sequences into manageable chunks while maintaining relative positional information, preventing the "lost in the middle" performance degradation common in long-context models.
  • Mixture-of-Experts (MoE): The Qwen2-57B-A14B model uses a sophisticated MoE setup. Instead of standard experts, it employs fine-grained experts (smaller, more numerous experts) and shared experts (which are always active). This allows for more diverse and dynamic expert utilization, matching the performance of a 30B dense model while only activating 14B parameters per token.
  • Scalable Alignment: Post-training involves a two-step process: collaborative human annotation and automated data synthesis. They used techniques like rejection sampling for math and execution feedback for code to generate high-quality training data at scale with minimal human intervention.
Table 1: Architecture of Qwen2 dense and MoE models. For MoE models, 57B-A14B denotes that the model has 57B parameters in total and for each token 14B parameters are active, the Intermediate size denotes that of each expert, and # Activated Experts excludes the shared experts.

Datasets

  • Pre-training: The models were trained on a massive 7-trillion-token dataset (expanded to 12T for the 0.5B model). This dataset covers ~30 languages and places a heavy emphasis on high-quality code and mathematical content to bolster reasoning.
  • Post-training: An instruction dataset of over 500,000 examples was used for Supervised Fine-Tuning (SFT), followed by Reinforcement Learning from Human Feedback (RLHF) using Direct Preference Optimization (DPO).
  • Evaluation: The team utilized a battery of standard benchmarks (MMLU, GPQA, HumanEval, GSM8K) and specialized ones for instruction following (MT-Bench, Arena-Hard) and long-context retrieval (Needle in a Haystack).

Key Insights and Ideas

  • Data Quality > Data Quantity: The researchers experimented with a 12-trillion-token dataset but found that simply increasing volume didn't yield significant gains if the quality threshold was relaxed. They ultimately prioritized a higher-quality 7T token mix for the larger models.
  • Sub-Billion Scaling: The 0.5B and 1.5B models punch remarkably above their weight class. This suggests that the "scaling laws" for data quality apply just as effectively to tiny models, making them viable for sophisticated tasks on edge devices.
  • The "Alignment Tax" Mitigation: By using an "Online Merging Optimizer" during RLHF, the team was able to align the model with human preferences without sacrificing the core capabilities learned during pre-training.
  • Multilingual Safety: Qwen2 demonstrates that safety alignment can be effectively scaled across languages. In safety evaluations, Qwen2-72B-Instruct actually outperformed GPT-4 in rejecting harmful prompts related to fraud and privacy.

Key Results

  • State-of-the-Art Open Weights: Qwen2-72B (Base) achieved an 84.2 on MMLU and 64.6 on HumanEval, surpassing Llama-3-70B in several categories.
  • Instruction Following: Qwen2-72B-Instruct scored 9.11 on MT-Bench and 48.1 on Arena-Hard, placing it among the top-performing models globally.
  • Coding & Math: The models show massive jumps over Qwen1.5. For instance, Qwen2-72B-Instruct hits 86.0 on HumanEval and 93.2 on GSM8K, showing exceptional logic and reasoning.
  • Long Context: The flagship model maintains near-perfect retrieval accuracy across the entire 128K context window, as evidenced by "Needle in a Haystack" testing.

Limitations and Future Work

Despite its strengths, the authors note that the 7B model still lags behind some competitors in specific instruction-following benchmarks (like IFEval). Additionally, while the MoE model is efficient, its "knowledge understanding" scores were slightly lower than its dense counterparts, which the team attributes to a potential need for even more pre-training tokens for that specific architecture. Future iterations will focus on further scaling the MoE models and refining instruction-following capabilities for the smaller model sizes.

Summary updated

BibTeX
@misc{yang2024qwen,
  author = {An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jianxin Yang and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Xuejing Liu and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhifang Guo and Zhihao Fan},
  title = {{Qwen2 Technical Report}},
  year = {2024},
  eprint = {2407.10671},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.10671},
}
Figure