datawhalechina/diy-llm
Covers pre-training data, Tokenizer, Transformer, MoE,distributed training, Scaling Laws, inference & alignment .6 progressive code assignments for full-stack LLM learning | 涵盖预训练数据、分词器、Transformer、MoE、分布式训练、缩放定律、推理与对齐,6 项渐进代码作业,掌握 LLM 全栈知识
What it solves
Building large language models (LLMs) from scratch often feels like opaque "alchemy" with steep learning curves, especially for Chinese speakers who face language and environment barriers when studying advanced courses like Stanford CS336. This project breaks down the entire LLM engineering process—from tokenizers and training to system optimization, inference, alignment, and evaluation—into reproducible principles and code.
How it works
The project provides a comprehensive Chinese-localized curriculum featuring 16 chapters and 6 hands-on coursework assignments. It reorganizes the learning path to build up necessary background knowledge in mathematics, PyTorch, and GPU systems smoothly. Learners write code for custom BPE tokenizers, model architectures, optimization loops, distributed training, data processing pipelines, and evaluation harnesses, while also exploring domestic models and contemporary techniques like DeepSeekMoE and GRPO.
Who it’s for
This guide is designed for developers, students, and researchers with solid Python programming skills, a grounding in machine learning and PyTorch, and basic linear algebra and calculus who want to understand how to build, optimize, and train LLMs from the ground up.
Highlights
- Includes 16 detailed text chapters and 6 practical programming assignments covering the full LLM lifecycle
- Localized for Chinese learners with adapted explanations, domestic model examples (such as Qwen and DeepSeek), and C-EVAL benchmarks
- Provides hands-on implementation tasks ranging from custom tokenizers and Triton FlashAttention-2 kernels to data filtering and model alignment
- Offers offline PDF lecture notes and troubleshooting guides for CPU and MacBook MPS environments
Related
- Project
- Project
- Project
- Project
- Project