RUCAIBox/awesome-llm-pretraining
关于
LLM 预训练资源精选,涵盖数据、框架和方法。
人工智能与机器学习实测星标增长
- 24小时
- 0
- 7天
- +1
- 15天
- +3
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README_ZH.md
原文Awesome LLM Pre-training
中文版 | English Version
预训练是研发大语言模型的第一个训练阶段,也是最为重要的一个阶段。随着开源社区在模型架构、训练策略、开源数据集、数据方法等方面的完善,我们持续关注可用于大模型预训练的资源,以回馈开源社区中的大语言模型的开发者。
相比于完整的综述,我们覆盖的范围将局限于预训练相关的常用资源和前沿尝试,以快速上手大语言模型预训练。同时我们欢迎开源社区提交更新,以共同促进大模型的发展。
相关项目链接:[LLMSurvey] [YuLan-Chat] | [YuLan-Mini]
目录
一、技术报告
技术报告的背后往往都是成百上千的算力资源作为支撑,因此很推荐阅读一些开源技术报告。
1.1 Dense模型
- The Llama 3 Herd of Models. [paper]
- Qwen2.5 Technical Report. [paper]
- Gemma 3 Technical Report. [paper]
- Nemotron-4 340B Technical Report. [paper]
- Pangu Ultra: Pushing the Limits of Dense Large Language Models on Ascend NPUs. [paper]
- Baichuan 2: Open Large-scale Language Models. [paper]
1.2 MoE模型
- DeepSeek-V3 Technical Report. [paper]
- DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models. [paper]
- Mixtral of Experts. [paper]
- Skywork-MoE: A Deep Dive into Training Techniques for Mixture-of-Experts Language Models. [paper]
- Every FLOP Counts: Scaling a 300B Mixture-of-Experts LING LLM without Premium GPUs. [paper]
- OLMoE: Open Mixture-of-Experts Language Models. [paper]
- Hunyuan-Large: An Open-Source MoE Model with 52 Billion Activated Parameters by Tencent. [paper]
1.3 带开源数据集的模型
- YuLan-Mini: An Open Data-efficient Language Model. [code] [resource] [paper]
- MAP-Neo: Highly Capable and Transparent Bilingual Large Language Model Series. [paper]
- LLM360: Towards Fully Transparent Open-Source LLMs. [paper]
- Nemotron-4 15B Technical Report. [paper]
1.4 训练/数据策略
- Phi-4 Technical Report. [paper]
- OLMo: Accelerating the Science of Language Models. [paper]
- 2 OLMo 2 Furious. [paper]
- Yi: Open Foundation Models by 01.AI. [paper]
- MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategies. [paper]
1.5 混合/线性模型
- Falcon Mamba: The First Competitive Attention-free 7B Language Model. [paper]
- MiniMax-01: Scaling Foundation Models with Lightning Attention. [paper]
- Nemotron-H: A Family of Accurate and Efficient Hybrid Mamba-Transformer Models. [paper]
全部技术报告
LLaMA 系列
- LLaMA: Open and Efficient Foundation Language Models. [paper]
- Llama 2: Open Foundation and Fine-Tuned Chat Models. [paper]
- The Llama 3 Herd of Models. [paper]
Qwen 系列
DeepSeek 系列
- DeepSeek LLM: Scaling Open-Source Language Models with Longtermism. [paper]
- DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models. [paper]
- DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models. [paper]
- DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model. [paper]
- DeepSeek-V3 Technical Report. [paper]
Gemma 系列
- Gemma: Open Models Based on Gemini Research and Technology. [paper]
- Gemma 2: Improving Open Language Models at a Practical Size. [paper]
- Gemma 3 Technical Report. [paper]
Gemini 系列
- Gemini: A Family of Highly Capable Multimodal Models. [paper]
- Gemini 1.5: Unlocking multimodal understanding across millions of tokens of context. [paper]
Mistral 系列
Phi 系列
- Textbooks Are All You Need. [paper]
- Textbooks Are All You Need II: phi-1.5 technical report. [paper]
- Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone. [paper]
- Phi-4 Technical Report. [paper]
GLM 系列
- GLM: General Language Model Pretraining with Autoregressive Blank Infilling. [paper]
- GLM-130B: An Open Bilingual Pre-trained Model. [paper]
- ChatGLM: A Family of Large Language Models from GLM-130B to GLM-4 All Tools. [paper]
Baichuan 系列
- Baichuan 2: Open Large-scale Language Models. [paper]
- Baichuan-M1: Pushing the Medical Capability of Large Language Models. [paper]
Falcon 系列
- The Falcon Series of Open Language Models. [paper]
- Falcon2-11B Technical Report. [paper]
- Falcon Mamba: The First Competitive Attention-free 7B Language Model. [paper]
InternLM 系列
- InternLM: A Multilingual Language Model with Progressively Enhanced Capabilities. [paper]
- InternLM2 Technical Report. [paper]
MiniCPM
- MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategies. [paper]
Yi 系列
Minimax 系列
- MiniMax-01: Scaling Foundation Models with Lightning Attention. [paper]
Reka 系列
- Reka Core, Flash, and Edge: A Series of Powerful Multimodal Language Models. [paper]
Skywork 系列
- Skywork: A More Open Bilingual Foundation Model. [paper]
- Skywork-MoE: A Deep Dive into Training Techniques for Mixture-of-Experts Language Models. [paper]
Hunyuan 系列
- Hunyuan-Large: An Open-Source MoE Model with 52 Billion Activated Parameters by Tencent. [paper]
Nemotron 系列
- Nemotron-4 15B Technical Report. [paper]
- Nemotron-4 340B Technical Report. [paper]
- Nemotron-H: A Family of Accurate and Efficient Hybrid Mamba-Transformer Models. [paper]
Ling 系列
- Every FLOP Counts: Scaling a 300B Mixture-of-Experts LING LLM without Premium GPUs. [paper]
OLMo 系列
- OLMo: Accelerating the Science of Language Models. [paper]
- 2 OLMo 2 Furious. [paper]
- OLMoE: Open Mixture-of-Experts Language Models. [paper]
YuLan 系列
- YuLan: An Open-source Large Language Model. [resource] [code] [paper]
- YuLan-Mini: An Open Data-efficient Language Model. [code] [resource] [paper]
MAP-Neo 系列
- MAP-Neo: Highly Capable and Transparent Bilingual Large Language Model Series. [paper]
LLM360 项目
- LLM360: Towards Fully Transparent Open-Source LLMs. [paper]
二、训练策略
我们从训练框架、训练策略、可解释性、模型架构改进、学习率退火等方面讨论了训练策略。
2.1 训练框架
最常使用的训练框架为Megatron-LM,提供了一个良好的开箱即用的高效基准。结合其他库可以达到更好的训练速度。
- Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism. [code] [paper]
最常用的预训练框架,上手门槛高但更加稳定
- Comet: Fine-grained Computation-communication Overlapping for Mixture-of-Experts. [paper]
MoE计算通信重叠
- DeepEP: an efficient expert-parallel communication library. [code]
专家并行加速
- DeepGEMM: clean and efficient FP8 GEMM kernels with fine-grained scaling. [code]
利用Hopper的异步特性加速FP8矩阵乘法
- Liger Kernel: Efficient Triton Kernels for LLM Training. [code] [paper]
Triton加速算子库
2.2 训练策略
关于超参数Scaling Law、并行策略、初始化策略、优化器选择、FP8训练等。
- Predictable Scale: Part I -- Optimal Hyperparameter Scaling Law in Large Language Model Pretraining. [paper] [homepage]
关于超参数的 Scaling Law
- The Ultra-Scale Playbook: Training LLMs on GPU Clusters. [demo]
可视化并行策略显存占用
- A Spectral Condition for Feature Learning. [paper]
MuP的进阶版本
- Muon is Scalable for LLM Training. [code] [paper]
高效优化器
- COAT: Compressing Optimizer states and Activation for Memory-Efficient FP8 Training. [paper] [code]
优化器状态和激活值也为FP8的训练
- Parameters vs FLOPs: Scaling Laws for Optimal Sparsity for Mixture-of-Experts Language Models. [paper]
关于MoE的Scaling Law
2.3 可解释性
我们不完全列举了一些对于预训练有启发的可解释性工作。
- On the Biology of a Large Language Model. [blog]
- Physics of Language Models. [homepage]
- In-context Learning and Induction Heads. [blog] [paper]
- Rethinking Reflection in Pre-Training. [paper]
2.4 模型架构改进
我们不完全列举了一些近期针对模型架构的改进。
- Gated Delta Networks: Improving Mamba2 with Delta Rule. [paper]
- RWKV-7 "Goose" with Expressive Dynamic State Evolution. [paper]
- Mixture of Hidden-Dimensions Transformer. [paper]
- Titans: Learning to Memorize at Test Time. [paper]
- Ultra-Sparse Memory Network. [paper]
- Large Language Diffusion Models. [paper]
- Better & Faster Large Language Models via Multi-token Prediction. [paper]
- Quantizable Transformers: Removing Outliers by Helping Attention Heads Do Nothing. [paper]
- Stick-breaking Attention. [code] [paper]
- Forgetting Transformer: Softmax Attention with a Forget Gate. [paper]
- Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention. [unofficial code] [paper]
- MoBA: Mixture of Block Attention for Long-Context LLMs. [code] [paper]
- KV Shifting Attention Enhances Language Modeling. [paper]
- Demons in the Detail: On Implementing Load Balancing Loss for Training Specialized Mixture-of-Expert Models. [paper]
- Auxiliary-Loss-Free Load Balancing Strategy for Mixture-of-Experts. [paper]
- ReLU2 Wins: Discovering Efficient Activation Functions for Sparse LLMs. [paper]
- μnit Scaling: Simple and Scalable FP8 LLM Training. [paper]
2.5 学习率退火
学习率退火往往和数据质量筛选相结合。
- MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategies. [paper]
- Scaling Laws and Compute-Optimal Training Beyond Fixed Training Durations. [paper]
- Scaling Law with Learning Rate Annealing. [paper]
三、开源数据集
我们主要从网页、数学、代码、通用四个方面讨论现有开源数据集。
3.1 网页
网页数据将构成预训练中的核心语料。
- DCLM. [paper] [resource]
开源网页数据集,经过Fasttext等筛选后得到的3.8T数据集
- FineWeb-Edu [paper] [resource]
教育质量打分语料,从FineWeb中筛选打分,对于知识密集型题目有一定效果
- Nemotron-CC-HQ. [paper] [resource]
英伟达的CC语料
- Chinese-FineWeb-Edu. [resource]
OpenCSG开源的中文教育质量打分语料,从Map-CC、SkyPile、WuDao、Wanjuan等筛选打分
- FineWeb2: A sparkling update with 1000s of languages [resource]
多语言数据集
3.2 数学
数学预训练语料可以显著提升基模的数学能力以及后训练的上限。
- MegaMath: Pushing the Limits of Open Math Corpora. [resource] [paper]
开源最大的高质量数学CC语料
- JiuZhang3.0: Efficiently Improving Mathematical Reasoning by Training Small Data Synthesis Models. [resource] [paper]
合成数学指令数据
- mlfoundations-dev/stackoverflow_math. [resource]
数学相关提问
- DeepMath-103K: A Large-Scale, Challenging, Decontaminated, and Verifiable Mathematical Dataset for Advancing Reasoning. [resource] [paper]
高难度数学数据集
- YuLan-Mini: An Open Data-efficient Language Model. [code] [resource] [paper]
收集开源Lean定理证明数据集
3.3 代码
代码数据不仅可以增强基模生成代码的能力,还可以增强数学、逻辑等方面。
- OpenCoder: The Open Cookbook for Top-Tier Code Large Language Models. [resource] [paper]
从 The-Stack-V2 中清洗
- SmolLM-corpus. [resource]
Python教育质量打分
- The-Stack-V2. [resource]
最大规模未清洗的代码数据
- YuLan-Mini: An Open Data-efficient Language Model. [code] [resource] [paper]
以教育质量清洗Jupyter-Notebook和Python数据
- HuggingFaceTB/issues-kaggle-notebooks. [resource]
GitHub Issues和Kaggle Notebooks数据
- mlfoundations-dev/stackoverflow. [resource]
编程问答论坛
- Magicoder: Empowering Code Generation with OSS-Instruct. [resource] [paper]
利用开源代码生成合成指令数据训练
3.4 通用(书籍、百科、指令、长上下文等)
通用数据往往是较为稀缺的长尾数据,对于后训练模型的可用性起到至关重要的作用。
- YuLan: An Open-source Large Language Model. [resource] [code] [paper]
长尾知识增强和多种通用数据源清洗
- MinerU: An Open-Source Solution for Precise Document Content Extraction. [code] [paper]
PDF转Markdown,兼容性较强
- The Pile: An 800GB Dataset of Diverse Text for Language Modeling. [homepage] [paper]
arXiv、对话、DM Math等
- Dolma: an Open Corpus of Three Trillion Tokens for Language Model Pretraining Research. [resource] [paper]
百科、书籍、论文、Reddit等
- WanJuan: A Comprehensive Multimodal Dataset for Advancing English and Chinese Large Models. [resource] [paper]
法律、考试、新闻、专利、百科等
- MAmmoTH2: Scaling Instructions from the Web. [resource] [paper]
针对网页的问答
- togethercomputer/Long-Data-Collections. [resource]
从RedPajama、Pile、P3等数据集过滤的书籍、论文、网页和指令
- Longattn: Selecting long-context training data via token-level attention. [resource] [paper]
长程依赖的问答
四、数据方法
数据集往往配合高质量的数据方法。我们从分词器、数据配比和课程、数据合成等方面详细阐述。
4.1 分词器
分词是模型重要又常被忽视的一块,会显著影响模型在数学、知识等方面能力。
- SuperBPE: Space Travel for Language Models. [code] [paper]
多单词的分词器训练方式
- Scaling Laws with Vocabulary: Larger Models Deserve Larger Vocabularies. [code] [demo] [paper]
预测词表大小
- Tokenization counts: the impact of tokenization on arithmetic in frontier LLMs. [code] [paper]
数字的分词方式比较
4.2 数据配比和课程
多阶段预训练往往能使得模型充分学习高质量、少量的数据。在继续预训练(CPT)阶段引入更多的数学、代码、CoT甚至长思维链数据,将构成下一代预训练模型的核心能力。
- Nemotron-4 15B Technical Report. [paper]
分为 8T 预训练 + 更少数据规模的 CPT
- YuLan-Mini: An Open Data-efficient Language Model. [code] [resource] [paper]
使用教育分数进行课程数据
- DoReMi: Optimizing Data Mixtures Speeds Up Language Model Pretraining. [code] [paper]
预训练数据混合比例优化
- Efficient Online Data Mixing For Language Model Pre-Training. [paper]
在线数据混合
- Data Mixing Laws: Optimizing Data Mixtures by Predicting Language Modeling Performance. [paper]
数据混合定律
- Data Mixture Inference: What do BPE Tokenizers Reveal about their Training Data?. [paper]
通过 BPE 分词器的合并规则,破解GPT等商业模型的数据比例
- CLIMB: CLustering-based Iterative Data Mixture Bootstrapping for Language Model Pre-training. [homepage] [paper]
基于聚类的迭代数据混合自举框架
- Infini-gram: Scaling Unbounded n-gram Language Models to a Trillion Tokens. [demo] [homepage] [paper]
为大规模预训练数据集构建索引,以检查数据质量
4.3 数据合成
除了前文提到的数学和代码的合成数据,我们总结了部分通用的合成数据方法和资源。除此之外,在预训练后期使用更多的长思维数据,也逐渐成为值得探索的方向。
- Imitate, Explore, and Self-Improve: A Reproduction Report on Slow-thinking Reasoning Systems. [resource] [code] [paper]
基于长思维链合成数据的模仿学习
- Knowledge-Instruct: Effective Continual Pre-training from Limited Data using Instructions. [code] [paper]
生成信息密集型的合成指令数据,从有限的语料库中学习知识
- LongWriter: Unleashing 10,000+ Word Generation from Long Context LLMs. [resource] [code] [paper]
构造长文本 Creative Writing
- Synthetic Data Generation & Multi-Step RL for Reasoning & Tool Use. [paper]
多步骤推理数据合成,将复杂任务分解为子轨迹,结合强化学习优化数据生成
- WildChat: 1M ChatGPT Interaction Logs in the Wild. [resource] [paper]
用户真实对话的开源数据集
- Magpie: Alignment Data Synthesis from Scratch by Prompting Aligned LLMs with Nothing. [resource] [code] [paper]
对齐数据合成
贡献
如果您对于项目内容有建议,欢迎提交 Issue 和 PR,以共同促进大模型的发展。
探索相关项目
加载中…