InternLM2 Technical Report

Zheng Cai, Maosong Cao, Haojiong Chen, Kai Chen, Keyu Chen, Xin Chen, Xun Chen, Zehui Chen, Zhi Chen, Pei Chu, Xiaoyi Dong, Haodong Duan, Qi Fan, Zhaoye Fei, Yang Gao, Jiaye Ge, Chenya Gu, Yuzhe Gu, Tao Gui, Aijia Guo, Qipeng Guo, Conghui He, Yingfan Hu, Ting Huang, Tao Jiang, Penglong Jiao, Zhenjiang Jin, Zhikai Lei, Jiaxing Li, Jingwen Li, Linyang Li, Shuaibin Li, Wei Li, Yining Li, Hongwei Liu, Jiangning Liu, Jiawei Hong, Kaiwen Liu, Kuikun Liu, Xiaoran Liu, Chengqi Lv, Haijun Lv, Kai Lv, Li Ma, Runyuan Ma, Zerun Ma, Wenchang Ning, Linke Ouyang, Jiantao Qiu, Yuan Qu, Fukai Shang, Yunfan Shao, Demin Song, Zifan Song, Zhihao Sui, Peng Sun, Yu Sun, Huanze Tang, Bin Wang, Guoteng Wang, Jiaqi Wang, Jiayu Wang, Rui Wang, Yudong Wang, Ziyi Wang, Xingjian Wei, Qizhen Weng, Fan Wu, Yingtong Xiong, Xiaomeng Zhao, et al.arXiv 2024 · DOI

TL;DR

InternLM2 is a new open-source Large Language Model (LLM) that pushes the boundaries of what's possible in the open-source community. It achieves state-of-the-art performance across a wide range of benchmarks, excels at handling extremely long contexts (up to 200k tokens), and introduces innovative techniques for alignment with human preferences.

What Problem Does This Paper Address?

The paper addresses the challenge of replicating the advanced capabilities of proprietary LLMs like ChatGPT and GPT-4 in the open-source domain. While many open-source LLMs have made strides, achieving comparable performance across comprehensive evaluations, handling long contexts effectively, and aligning with nuanced human preferences has remained a significant hurdle. The authors aim to bridge this gap by introducing InternLM2 and detailing its development process.

Methods

InternLM2's development involved several key stages and novel techniques:

  • Innovative Pre-training: The model was trained on a massive corpus of diverse data, including text, code, and crucially, long-context data. A phased approach was used, starting with 4k tokens and progressing to 32k tokens, with positional encoding extrapolation enabling performance on up to 200k tokens.
  • Grouped-Query Attention (GQA): This technique was employed to reduce memory footprint during inference, especially for long sequences.
  • Supervised Fine-Tuning (SFT): The model was fine-tuned on a large dataset of instruction-following data to improve its ability to respond to human instructions.
  • Conditional Online Reinforcement Learning from Human Feedback (COOL RLHF): This novel alignment strategy addresses two major issues in RLHF:
  • Preference Conflicts: A conditional reward model reconciles diverse and potentially conflicting human preferences (e.g., helpfulness vs. harmlessness).
  • Reward Hacking: A multi-round online RLHF approach helps the model adapt to feedback and mitigate reward hacking.
  • InternEvo Framework: An efficient and scalable training framework was used, supporting advanced parallelism techniques (data, tensor, sequence, pipeline) and memory optimization strategies.

Datasets

  • Pre-training Data: Diverse sources including web pages (Common Crawl), papers, patents, books, and technical literature were used.
  • Code Data: Collected from GitHub, public datasets, and online coding resources.
  • Long Context Data: A subset of the pre-training corpus, specifically curated for long text.
  • Capability Specific Enhancement Data: A 24 billion token dataset comprising high-quality retrieved data and open-source data from Hugging Face, focusing on reasoning, math, and knowledge.
  • SFT Data: 10 million instruction data instances covering general conversation, NLP tasks, math, code generation, and function calls.
  • RLHF Data: Human preference data collected through various stages of training.
  • Evaluation Benchmarks: A comprehensive set of 30 benchmarks across 6 dimensions, including MMLU, CMMLU, C-Eval, AGIEval, GAOKAO, TriviaQA, Natural Questions, C3, RACE-High, FLORES, GSM8K, MATH, TheoremQA, MathBench, HumanEval, MBPP, L-Eval, LongBench, and Needle-in-a-Haystack.

Key Insights and Ideas

  • Phased Context Window Expansion: The strategy of gradually increasing the context window from 4k to 32k during pre-training, combined with positional encoding extrapolation, is highly effective for achieving long-context capabilities.
  • COOL RLHF for Robust Alignment: The proposed COOL RLHF strategy offers a promising solution to the inherent challenges of preference conflicts and reward hacking in RLHF, leading to more reliable and aligned models.
  • Importance of Data Quality and Diversity: The paper emphasizes the critical role of meticulously prepared and diverse datasets (text, code, long-context, and specialized enhancement data) in achieving high performance across various tasks.
  • Open-Sourcing for Community Advancement: By releasing models at different training stages and sizes, the authors aim to foster research and provide valuable insights into LLM development.

Key Results

  • State-of-the-Art Performance: InternLM2 outperforms existing open-source models across a wide range of benchmarks, including comprehensive examinations, language and knowledge tasks, reasoning, mathematics, and coding.
  • Exceptional Long-Context Handling: The model demonstrates remarkable performance on the 200k "Needle-in-a-Haystack" test, nearly perfectly identifying crucial information within extremely long texts.
  • Improved Alignment: The COOL RLHF strategy leads to significant improvements in subjective evaluations, demonstrating better alignment with human preferences.
  • Efficiency Gains: The InternEvo framework and GQA contribute to efficient training and inference, especially for long contexts.

Limitations and Future Work

  • Data Contamination: The paper discusses the potential issue of data contamination in LLMs and its impact on evaluation, suggesting further investigation into this area.
  • Performance Gap in Other Languages: While strong in Chinese, the model's performance in other languages might be slightly less effective, potentially due to fine-tuning choices.
  • Future Work: The authors plan to release checkpoints from various training phases to facilitate community research and provide insights into model evolution. They also aim to further investigate the performance differences across model sizes and explore more advanced alignment strategies.

Summary updated

BibTeX
@misc{cai2024internlm,
  author = {Zheng Cai and Maosong Cao and Haojiong Chen and Kai Chen and Keyu Chen and Xin Chen and Xun Chen and Zehui Chen and Zhi Chen and Pei Chu and Xiaoyi Dong and Haodong Duan and Qi Fan and Zhaoye Fei and Yang Gao and Jiaye Ge and Chenya Gu and Yuzhe Gu and Tao Gui and Aijia Guo and Qipeng Guo and Conghui He and Yingfan Hu and Ting Huang and Tao Jiang and Penglong Jiao and Zhenjiang Jin and Zhikai Lei and Jiaxing Li and Jingwen Li and Linyang Li and Shuaibin Li and Wei Li and Yining Li and Hongwei Liu and Jiangning Liu and Jiawei Hong and Kaiwen Liu and Kuikun Liu and Xiaoran Liu and Chengqi Lv and Haijun Lv and Kai Lv and Li Ma and Runyuan Ma and Zerun Ma and Wenchang Ning and Linke Ouyang and Jiantao Qiu and Yuan Qu and Fukai Shang and Yunfan Shao and Demin Song and Zifan Song and Zhihao Sui and Peng Sun and Yu Sun and Huanze Tang and Bin Wang and Guoteng Wang and Jiaqi Wang and Jiayu Wang and Rui Wang and Yudong Wang and Ziyi Wang and Xingjian Wei and Qizhen Weng and Fan Wu and Yingtong Xiong and Xiaomeng Zhao and et al.},
  title = {{InternLM2 Technical Report}},
  year = {2024},
  eprint = {2403.17297},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.17297},
}
Figure