# 学习资源地图：课程、教材与代码仓库怎样配合本站

> 把值得配合本站使用的公开课程、教材、讲解博客、代码仓库与中文资料按学习目的整理成一张地图，写明每一份补充什么、需要什么基础、与本站哪几页搭配；所有链接于 2026 年 11 月逐一打开核对过。

- URL: https://dmxsf.com/wiki/start/resources/
- [DMXSF](https://dmxsf.com/about/)
- 入门
- 更新于: 2026-11-18

## 学完这页，你将能够

- 按自己的目标（建立直觉、从零实现、系统上课、训练与系统、应用与 Agent、评测与研究）选出一两份外部资料，并说出它与本站哪几页搭配。
- 分清课程、教材、讲解博客、代码仓库与工具文档各自擅长什么，避免同时开太多门课。
- 判断一份学习资料是否过时：看日期与版本、是否仍在维护、与官方文档是否一致，并知道冲突时以谁为准。
- 用“一门主课、一份可运行的代码、本站的对应章节”搭出自己的学习组合，并写成一份可检查的学习计划。

这个知识库回答的是“大模型为什么这样设计、数字怎么算”。要把它变成能做事的能力，通常还需要三类外部材料：**成体系的课程**（给节奏和作业）、**从零写一遍的代码**（给手感）、**一手的论文、技术报告与官方文档**（给最新信息）。这一页把公开可查的资料按学习目的整理成一张地图，写明每一份补充什么、需要什么基础、与本站哪几页搭配。

所有链接都在 2026 年 11 月逐一打开核对过。课程页每个学期都会更新，下面各项的介绍只写对方页面上看得到的信息。收录标准有三条：页面能直接打开，需要付费的会注明；内容与本站十二章里的具体章节对得上；页面上有可核对的作者、日期或版本。

## 先选目标，再选资料

下面按目标给出一个最小组合：先读本站的哪几页，再配哪些外部资料（具体介绍见后面各节）。**每个目标配一两份就够**，同时开三门课，通常哪一门都学不完。

- **建立整体直觉（一两个周末）：** 先读[大模型是什么](https://dmxsf.com/wiki/start/what-is-an-llm/)、[注意力机制入门](https://dmxsf.com/wiki/architecture/attention-basics/)；再配 3Blue1Brown 的神经网络系列、The Illustrated Transformer。想听中文讲座，看李宏毅的《生成式 AI 导论》。
- **从零写出一个 GPT：** 先读[神经网络基础](https://dmxsf.com/wiki/foundations/neural-network-basics/)、[下一个 token 预测](https://dmxsf.com/wiki/foundations/next-token-prediction/)、[Transformer Block](https://dmxsf.com/wiki/architecture/transformer-block/)；再配 Karpathy 的 Zero to Hero，接着看 Raschka 图书的配套代码或 nanochat。
- **系统地上一门课：** 先读[学习路线图](https://dmxsf.com/wiki/start/learning-roadmap/)；再配 CS224N（打 NLP 与深度学习的底子）和 CS336（做完整的语言模型流程）。
- **训练与系统工程：** 先读[算力与系统](https://dmxsf.com/wiki/systems/)、[分布式训练](https://dmxsf.com/wiki/pretraining/distributed-training/)；再配 How to Scale Your Model、Ultra-Scale Playbook、GPU MODE 讲座，以及 CS336 的作业 2。
- **后训练与强化学习：** 先读[后训练与对齐](https://dmxsf.com/wiki/post-training/)；再配 Hugging Face 的 LLM Course 与 smol course、alignment-handbook、TRL；强化学习的基础看 Spinning Up。
- **应用与 Agent：** 先读[应用工程](https://dmxsf.com/wiki/applications/)；再配 Anthropic 的 Building effective agents、Prompt Engineering Guide、MCP 文档和伯克利的 LLM Agents 公开课。
- **评测、安全与研究：** 先读[评测](https://dmxsf.com/wiki/evaluation/)、[安全与对齐风险](https://dmxsf.com/wiki/safety/)、[前沿](https://dmxsf.com/wiki/frontier/)；再配 HELM、lm-evaluation-harness、OWASP 的 LLM 应用风险清单、Transformer Circuits Thread 和 Lil'Log。

## 课程与讲座

课程的价值在节奏、作业与讨论。

- **[斯坦福 CS224N：自然语言处理与深度学习](https://web.stanford.edu/class/cs224n/)。** 课程页每年更新讲义与作业；完整录像是 2024 年版的 YouTube 播放列表（页面写明免费），当前学期的录像只对选课学生开放。配合本站：[从 RNN 到注意力](https://dmxsf.com/wiki/architecture/from-rnn-to-attention/)、[Tokenizer 与词嵌入](https://dmxsf.com/wiki/foundations/tokenizer-and-embeddings/)。
- **[斯坦福 CS25：Transformers United](https://web.stanford.edu/class/cs25/)。** 每周一场讲座的研讨课，请研究者介绍 Transformer 与大模型的前沿工作；页面写明唯一的作业是每周出席，允许旁听。想知道各个方向在做什么时看。配合本站：[前沿](https://dmxsf.com/wiki/frontier/)、[多模态](https://dmxsf.com/wiki/multimodal/)。
- **[台湾大学李宏毅《生成式 AI 导论 2024》](https://speech.ee.ntu.edu.tw/~hylee/genai/2024-spring.php)。** 课程页逐讲给出讲义与视频，主题从大型语言模型的概览、提示工程与 AI 代理人，到深度学习与 Transformer，以及大型语言模型的训练。中文授课，页面是繁体中文。配合本站：[大模型是什么](https://dmxsf.com/wiki/start/what-is-an-llm/)、[Prompt Engineering](https://dmxsf.com/wiki/applications/prompt-engineering/)。
- **[伯克利 LLM Agents 公开课（2024 年秋）](https://llmagents-learning.org/f24)。** Dawn Song 与 Xinyun Chen 主讲；课程页写明课程已结束，视频讲座保留在大纲里，并列出了十多位嘉宾。配合本站：[Agent 与工具调用](https://dmxsf.com/wiki/applications/agents-and-tool-calling/)。
- **[Hugging Face LLM Course](https://huggingface.co/learn/llm-course)。** 在线课程，从 Transformer 模型、使用 Transformers 库与微调讲起，一直到整理高质量数据集（第 10 章）、微调大模型（第 11 章）和构建推理模型（第 12 章，页面标注为新）。页面的语言列表里有简体中文，译本的完整程度以页面为准。配合本站：[Tokenizer 与词嵌入](https://dmxsf.com/wiki/foundations/tokenizer-and-embeddings/)、[SFT 数据](https://dmxsf.com/wiki/post-training/sft-data/)、[LoRA 微调](https://dmxsf.com/wiki/post-training/lora-finetuning/)、[推理强化学习](https://dmxsf.com/wiki/post-training/reasoning-rl/)。
- **[Hugging Face smol course](https://github.com/huggingface/smol-course)。** Hugging Face Learn 页的简介是关于小模型后训练的课程（GitHub 简介：a course on aligning smol models）。配合本站：[偏好优化](https://dmxsf.com/wiki/post-training/preference-optimization/)。
- **[Hugging Face Agents Course](https://huggingface.co/learn/agents-course)。** Learn 页的简介是学习构建并部署自己的 AI Agent。配合本站：[Agent 与工具调用](https://dmxsf.com/wiki/applications/agents-and-tool-calling/)。
- **强化学习基础：[Hugging Face Deep RL Course](https://huggingface.co/learn/deep-rl-course) 与 [Spinning Up in Deep RL](https://spinningup.openai.com/)。** Spinning Up 的文档包含强化学习的关键概念、算法分类、策略优化入门，以及 VPG、TRPO、PPO、DDPG、TD3、SAC 的说明。配合本站：[偏好优化](https://dmxsf.com/wiki/post-training/preference-optimization/)、[推理强化学习](https://dmxsf.com/wiki/post-training/reasoning-rl/)（RLHF 与 GRPO 都建立在策略梯度之上）。

### 七门开放课怎么搭配

挑一门主课，按自己的目标产出一份能检查的实现、测量报告或评测记录。下面的自学任务可以先用小数据或已有基线完成；原作业的算力和访问条件以各学期的要求为准。

选课前可以先做一个 CPU 小实验。第一次写神经网络，先用 [Python 记录张量形状](https://dmxsf.com/wiki/foundations/tensors-and-shapes/)，再做 CS336 的基础作业。准备读 CMU ML Systems 的算子讲义，先练[权重怎样进入显存](https://dmxsf.com/wiki/systems/hardware-basics/)。想跟 Berkeley 的 Agent 课或 CMU 生产机器学习教材，先跑通[本机推理接口](https://dmxsf.com/wiki/inference/first-inference-service/)和[只读工具循环](https://dmxsf.com/wiki/applications/first-agent/)，把请求、工具结果和停止原因记下来。

| 主课 | 什么时候选 | 先读本站 | 可检查的产出 |
| --- | --- | --- | --- |
| [Stanford CS336 · Spring 2026](https://cs336.stanford.edu/) | 想看懂语言模型的完整训练栈 | [训练流水线](https://dmxsf.com/wiki/pretraining/training-pipeline/) | 依次完成小模型、性能剖析、算力预算、语料审计和可验证奖励实验，见下表 |
| [CMU 15-442/15-642](https://mlsyscourse.org/schedule) | 想深入 GPU、并行和推理系统 | [GPU 与屋顶线](https://dmxsf.com/wiki/systems/gpu-and-roofline/)、[集合通信](https://dmxsf.com/wiki/systems/collective-communication/) | 用固定形状的算子对照理论上界与实测，交一份含时间线的瓶颈报告 |
| [Berkeley Scalable AI · Spring 2026](https://scalable-ai.eecs.berkeley.edu/S2026/) | 想在固定预算下串起模型和应用 | [扩展定律](https://dmxsf.com/wiki/pretraining/scaling-laws/)、[推理服务](https://dmxsf.com/wiki/inference/serving/) | 按四次作业串起利用率剖析、预训练、SFT 与可验证奖励强化学习、应用联评，每段保留基线 |
| [Berkeley Advanced LLM Agents · Spring 2025](https://agenticai-learning.org/sp25) | 想研究记忆、规划、验证和多模态交互 | [Agent 评测](https://dmxsf.com/wiki/applications/agent-evaluation/)、[测试时计算](https://dmxsf.com/wiki/frontier/test-time-compute/) | 在受控任务上分别开关记忆或验证器，记录终态成功、调用数和失败轨迹 |
| [Stanford CS324 · Winter 2023](https://stanford-cs324.github.io/winter2023/) | 想做一个有明确问题的基础模型项目 | [构建评测集](https://dmxsf.com/wiki/evaluation/building-eval-sets/)、[记忆与隐私](https://dmxsf.com/wiki/safety/memorization-and-privacy/) | 借鉴 [Winter 2022 的评测项目](https://stanford-cs324.github.io/winter2022/projects/CS324_P1.pdf)，交一份含基线、切片与失败样本的报告 |
| [Stanford CS25 · Transformers United](https://web.stanford.edu/class/cs25/) | 想沿讲座追一条研究线 | [多模态大模型](https://dmxsf.com/wiki/multimodal/multimodal-llms/)、[前沿](https://dmxsf.com/wiki/frontier/) | 选一讲原生多模态或大规模训练，画输入到输出的流程，回到论文核对一个可检验的主张 |
| [CMU Machine Learning in Production](https://mlip-cmu.github.io/book/) | 想把原型变成能运维的产品 | [LLM 评测方法论](https://dmxsf.com/wiki/evaluation/llm-evaluation/)、[推理服务](https://dmxsf.com/wiki/inference/serving/) | 给现有应用写上线门槛、观测指标和回滚条件，并用隔离流量验证 |

### CS336 五个作业对应的自学检查点

按所选学期配套使用课程主页的作业讲义与仓库。Spring 2026 的作业 5 主线是推理强化学习，指令微调和 DPO 在补充讲义里。

| 作业 | 先在本站练习 | 交付物 |
| --- | --- | --- |
| 1 · Basics | [分词](https://dmxsf.com/wiki/foundations/tokenizer-and-embeddings/)、[Transformer Block](https://dmxsf.com/wiki/architecture/transformer-block/) | 分词往返、因果掩码和短训练的检查结果 |
| 2 · Systems | [高效注意力](https://dmxsf.com/wiki/architecture/efficient-attention/)、[分布式训练](https://dmxsf.com/wiki/pretraining/distributed-training/) | 同一组输入上的输出误差、峰值显存和耗时，并说明计时是否同步设备 |
| 3 · Scaling | [扩展定律](https://dmxsf.com/wiki/pretraining/scaling-laws/) | 固定预算下不同模型和数据分配的损失曲线，标记拟合区间和外推点 |
| 4 · Data | [预训练数据工程](https://dmxsf.com/wiki/pretraining/data-engineering/) | 每步过滤前后的样本与 token 计数，保留可人工复核的误删切片 |
| 5 · Alignment | [推理强化学习](https://dmxsf.com/wiki/post-training/reasoning-rl/) | 未训练基线、判分器检查和同一测试协议下的对照结果 |

### 按讲次与项目继续读

- **CMU 15-442/15-642。** 第 2、3 周的自动微分接[神经网络基础](https://dmxsf.com/wiki/foundations/neural-network-basics/)。第 4、7 周的 CUDA、数据布局和矩阵乘法接 [GPU 与屋顶线](https://dmxsf.com/wiki/systems/gpu-and-roofline/)和[GPU 内核](https://dmxsf.com/wiki/systems/gpu-kernels/)。第 5、6 周的并行及重计算接[集合通信](https://dmxsf.com/wiki/systems/collective-communication/)与[分布式训练](https://dmxsf.com/wiki/pretraining/distributed-training/)。第 9、10 周的服务案例接[连续批处理](https://dmxsf.com/wiki/inference/continuous-batching/)、[前缀缓存](https://dmxsf.com/wiki/inference/prefix-caching/)与[投机解码](https://dmxsf.com/wiki/inference/speculative-decoding/)。
- **Berkeley Scalable AI。** [2026 秋季](https://scalable-ai.eecs.berkeley.edu/F2026/)的前两个作业分别练 GPU 剖析和预训练数据。春季的合成数据 notebook 可配[结构化输出](https://dmxsf.com/wiki/applications/structured-output-and-function-calling/)。读学生项目时，可先用 [EchoKV](https://dmxsf.com/wiki/inference/quantization/)练习区分冻结分配和运行中调整，再用[解码与采样](https://dmxsf.com/wiki/inference/decoding-and-sampling/)读课程项目 Beyond Temperature 的基线与采样预算。
- **Stanford CS336。** [2024](https://cs336.stanford.edu/spring2024/) 和 [2025](https://cs336.stanford.edu/spring2025/) 可对照历史讲义。2026 版同一任务用当学期的讲义、输入数据和测试，以免把不同版本的要求混在一起。预训练后继续看[扩展定律的外推检验](https://dmxsf.com/wiki/pretraining/scaling-laws/)和[语料过滤的复核记录](https://dmxsf.com/wiki/pretraining/data-engineering/)。
- **Berkeley Advanced LLM Agents。** 记忆和世界模型讲次接 [Agent 的状态与工具调用](https://dmxsf.com/wiki/applications/agents-and-tool-calling/)，多模态 Agent 讲次接[终态评测](https://dmxsf.com/wiki/applications/agent-evaluation/)，形式推理讲次接[测试时计算](https://dmxsf.com/wiki/frontier/test-time-compute/)。
- **Stanford CS324。** [2022 日历](https://stanford-cs324.github.io/winter2022/calendar/)跟[评测集切片](https://dmxsf.com/wiki/evaluation/building-eval-sets/)和[数据工程](https://dmxsf.com/wiki/pretraining/data-engineering/)一起读。[2023 日历](https://stanford-cs324.github.io/winter2023/calendar/)用 FlashAttention、模型扩展、机制可解释性与隐私讲次联系[高效注意力](https://dmxsf.com/wiki/architecture/efficient-attention/)、[机制可解释性](https://dmxsf.com/wiki/frontier/interpretability/)和[记忆与隐私](https://dmxsf.com/wiki/safety/memorization-and-privacy/)。
- **Stanford CS25。** 从 V6 的原生多模态和世界模型讲次切入，配[多模态大模型的时序诊断与表示预测](https://dmxsf.com/wiki/multimodal/multimodal-llms/)。推理服务讲次则配本站的[请求轨迹与达标吞吐](https://dmxsf.com/wiki/inference/serving/)。
- **CMU Machine Learning in Production。** 教材第 5–7 章先定义产品目标与失败代价，第 13–19 章再做运行和质量保障，第 24、26 章补血缘与公平性。本站可依次练[生产评测](https://dmxsf.com/wiki/evaluation/production-evaluation/)和[评测集切片](https://dmxsf.com/wiki/evaluation/building-eval-sets/)。

把三组讲次与本站的实验连起来，先跑[世界模型与规划](https://dmxsf.com/wiki/multimodal/world-models/)，再试[Agent 上下文与记忆](https://dmxsf.com/wiki/applications/context-and-memory/)和[采样与训练调度](https://dmxsf.com/wiki/post-training/rollout-and-training/)。

## 教材与长篇指南

教材给完整的论述，适合把零散的知识串成一张图。标注“付费图书”的需要购买。

- **[Speech and Language Processing](https://web.stanford.edu/~jurafsky/slp3/)**（Dan Jurafsky 与 James H. Martin，第三版草稿）。章节与幻灯片公开。页面写明 2026 年 8 月 19 日的版本把 Transformer、预训练与解码合并成一章，还有一个只写了约一半的可解释性章节（第 10 章）。配合本站：[基础概念](https://dmxsf.com/wiki/foundations/)、[模型架构](https://dmxsf.com/wiki/architecture/)。
- **[动手学深度学习](https://zh.d2l.ai/)**（d2l.ai 中文版；英文版是 [Dive into Deep Learning](https://d2l.ai/)）。带可运行代码的在线书，目录从线性回归、多层感知机、卷积与循环网络，讲到注意力机制与 Transformer（第 10 章）和优化算法。配合本站：[神经网络基础](https://dmxsf.com/wiki/foundations/neural-network-basics/)、[优化器与训练稳定性](https://dmxsf.com/wiki/foundations/optimizers-and-training-stability/)。
- **[Mathematics for Machine Learning](https://mml-book.github.io/)**（Deisenroth、Faisal、Ong，剑桥大学出版社，2020 年 4 月）。配套网页写明，这本书不讲高级的机器学习技术，而是提供读懂其他书所需的数学，分为数学基础与用到这些数学的示例算法两部分。数学基础薄弱时用它补课。配合本站：[信息论回顾](https://dmxsf.com/wiki/foundations/information-theory/)、[神经网络基础](https://dmxsf.com/wiki/foundations/neural-network-basics/)。
- **[How to Scale Your Model](https://jax-ml.github.io/scaling-book/)**（Google DeepMind 的作者团队，2025 年 2 月 4 日发布）。在线书，从屋顶线、TPU、分片矩阵乘，讲到 Transformer、训练、推理与性能剖析，并有 GPU 一章；预备知识是对 LLM 与 Transformer 的基本了解，最好熟悉一点 JAX。配合本站：[GPU 与屋顶线模型](https://dmxsf.com/wiki/systems/gpu-and-roofline/)、[集合通信](https://dmxsf.com/wiki/systems/collective-communication/)、[KV Cache](https://dmxsf.com/wiki/inference/kv-cache/)。
- **[The Ultra-Scale Playbook](https://huggingface.co/spaces/nanotron/ultrascale-playbook)**（Hugging Face 的 nanotron 团队）。Space 简介写的是“The ultimate guide to training LLM on large GPU Clusters”。配合本站：[分布式训练](https://dmxsf.com/wiki/pretraining/distributed-training/)、[集合通信](https://dmxsf.com/wiki/systems/collective-communication/)。
- **[The Smol Training Playbook](https://huggingface.co/spaces/HuggingFaceTB/smol-training-playbook)**（Hugging Face 的 HuggingFaceTB 团队）。Space 简介写的是“The secrets to building world-class LLMs”。配合本站：[训练流水线](https://dmxsf.com/wiki/pretraining/training-pipeline/)、[预训练数据工程](https://dmxsf.com/wiki/pretraining/data-engineering/)。
- **《AI Engineering》**（Chip Huyen，O'Reilly，2025；作者的[图书页面](https://huyenchip.com/books/)）。页面介绍说，这本书讲 AI 工程，即用现成的基础模型构建应用的过程。付费图书。配合本站：[应用工程](https://dmxsf.com/wiki/applications/)、[评测](https://dmxsf.com/wiki/evaluation/)。
- **《Build a Large Language Model (From Scratch)》**（Sebastian Raschka，[Manning](https://www.manning.com/books/build-a-large-language-model-from-scratch)）。付费图书；官方代码见下一节的 LLMs-from-scratch。配合本站：[基础概念](https://dmxsf.com/wiki/foundations/)、[Transformer Block](https://dmxsf.com/wiki/architecture/transformer-block/)。
- **《Hands-On Large Language Models》**（Jay Alammar 与 Maarten Grootendorst，O'Reilly；[官网](https://www.llm-book.com/)，[代码仓库](https://github.com/HandsOnLLM/Hands-On-Large-Language-Models)）。仓库自称书里有近 300 幅专门绘制的插图；The Illustrated Transformer 的页首说，那篇文章已扩写成这本书的第 3 章，补充了 Multi-Query Attention 与 RoPE 等后来的演进。付费图书。配合本站：[注意力机制入门](https://dmxsf.com/wiki/architecture/attention-basics/)、[高效注意力](https://dmxsf.com/wiki/architecture/efficient-attention/)。

## 从零实现与可运行的代码

读懂和写出来之间隔着很多细节，亲手实现一遍是最快的补课方式。

- **[Neural Networks: Zero to Hero](https://karpathy.ai/zero-to-hero.html)**（Andrej Karpathy，视频课程）。从反向传播（micrograd）、字符级语言模型（makemore）一路写到 GPT（“Let's build GPT”）与 GPT Tokenizer；页面写明先修是扎实的 Python 与入门级数学。配合本站：[神经网络基础](https://dmxsf.com/wiki/foundations/neural-network-basics/)、[下一个 token 预测](https://dmxsf.com/wiki/foundations/next-token-prediction/)、[Tokenizer 与词嵌入](https://dmxsf.com/wiki/foundations/tokenizer-and-embeddings/)、[Transformer Block](https://dmxsf.com/wiki/architecture/transformer-block/)。
- **[nanochat](https://github.com/karpathy/nanochat)**（Karpathy）。README 称它是训练 LLM 的最简实验框架，设计为在单个 GPU 节点上运行，覆盖分词、预训练、微调、评测与推理。他早先的 [nanoGPT](https://github.com/karpathy/nanoGPT) 在 2025 年 11 月的更新里自称已经过时，并推荐改用 nanochat。配合本站：[训练流水线](https://dmxsf.com/wiki/pretraining/training-pipeline/)、[SFT 数据](https://dmxsf.com/wiki/post-training/sft-data/)。
- **[LLMs-from-scratch](https://github.com/rasbt/LLMs-from-scratch)**（Sebastian Raschka）。同名图书的官方代码：从头开发、预训练并微调一个类 GPT 的 LLM，也包含加载更大预训练模型权重的代码。配合本站：[基础概念](https://dmxsf.com/wiki/foundations/)、[模型架构](https://dmxsf.com/wiki/architecture/)。
- **[The Annotated Transformer](https://nlp.seas.harvard.edu/annotated-transformer/)**（Harvard NLP；原作者 Sasha Rush，2022 年版由 Austin Huang 等人更新）。把《Attention Is All You Need》写成逐行实现的 notebook，涵盖模型结构、训练，以及一个真实数据上的例子与注意力可视化。配合本站：[Transformer Block](https://dmxsf.com/wiki/architecture/transformer-block/)、论文解读 [Attention Is All You Need](https://dmxsf.com/blog/attention-is-all-you-need/)。
- **[Happy-LLM](https://datawhalechina.github.io/happy-llm/)**（Datawhale，中文，免费）。README 称它是系统性的 LLM 教程：从 NLP 的基本方法讲起，逐层讲架构与训练过程，并动手实现一个完整的 LLaMA2 模型、走通从预训练到微调的流程。配合本站：[模型架构](https://dmxsf.com/wiki/architecture/)、[预训练](https://dmxsf.com/wiki/pretraining/)。
- **[self-llm](https://github.com/datawhalechina/self-llm)**（Datawhale，中文）。仓库简介是《开源大模型食用指南》：在 Linux 环境下快速微调（全参数或 LoRA）并部署国内外开源大模型与多模态大模型的教程。配合本站：[LoRA 微调](https://dmxsf.com/wiki/post-training/lora-finetuning/)、[LLM 推理服务](https://dmxsf.com/wiki/inference/serving/)。
- **[mlabonne/llm-course](https://github.com/mlabonne/llm-course)。** 仓库简介是带路线图与 Colab 笔记本的 LLM 入门课程。配合本站：[学习路线图](https://dmxsf.com/wiki/start/learning-roadmap/)。
- **[GitHub 配套实验目录](https://github.com/dmxsf/dmxsf/tree/main/labs)。** 61 个 Python 实验可在笔记本 CPU 上运行，覆盖 66 篇含实操内容的 Wiki。按课程查找运行命令和简介也可以用[配套代码](https://dmxsf.com/code/)页。

## 讲解博客与可视化

- **[3Blue1Brown 的神经网络系列](https://www.3blue1brown.com/topics/neural-networks)。** 动画讲解。与大模型直接相关的几讲是 [But what is a Neural Network?](https://www.3blue1brown.com/lessons/neural-networks)、[Transformers, the tech behind LLMs](https://www.3blue1brown.com/lessons/gpt)、[Attention in transformers, step-by-step](https://www.3blue1brown.com/lessons/attention) 与 [How might LLMs store facts](https://www.3blue1brown.com/lessons/mlp)。配合本站：[神经网络基础](https://dmxsf.com/wiki/foundations/neural-network-basics/)、[注意力机制入门](https://dmxsf.com/wiki/architecture/attention-basics/)、[Transformer Block](https://dmxsf.com/wiki/architecture/transformer-block/)。
- **[The Illustrated Transformer](https://jalammar.github.io/illustrated-transformer/)**（Jay Alammar）。图解 Transformer，页首列出两个简体中文译本。配合本站：[注意力机制入门](https://dmxsf.com/wiki/architecture/attention-basics/)、[位置编码](https://dmxsf.com/wiki/architecture/positional-encoding/)。
- **[Lil'Log](https://lilianweng.github.io/)**（Lilian Weng）。长篇学习笔记，下面几篇正好对应本站的页面：
  - [Prompt Engineering](https://lilianweng.github.io/posts/2023-03-15-prompt-engineering/)（2023）：[Prompt Engineering](https://dmxsf.com/wiki/applications/prompt-engineering/)。
  - [LLM Powered Autonomous Agents](https://lilianweng.github.io/posts/2023-06-23-agent/)（2023）：[Agent 与工具调用](https://dmxsf.com/wiki/applications/agents-and-tool-calling/)。
  - [Extrinsic Hallucinations in LLMs](https://lilianweng.github.io/posts/2024-07-07-hallucination/)（2024）：[幻觉与校准](https://dmxsf.com/wiki/safety/hallucination-and-calibration/)。
  - [Adversarial Attacks on LLMs](https://lilianweng.github.io/posts/2023-10-25-adv-attack-llm/)（2023）：[提示注入与越狱](https://dmxsf.com/wiki/safety/prompt-injection-and-jailbreaks/)。
  - [Reward Hacking in Reinforcement Learning](https://lilianweng.github.io/posts/2024-11-28-reward-hacking/)（2024）：[奖励模型](https://dmxsf.com/wiki/post-training/reward-models/)。
  - [Why We Think](https://lilianweng.github.io/posts/2025-05-01-thinking/)（2025，讲思考时间、思维链与强化学习）：[测试时计算](https://dmxsf.com/wiki/frontier/test-time-compute/)。

## 工具与开源项目

读文档与源码，是弄清“论文里那句话在工程里怎么落地”最直接的办法。下面每个仓库的介绍来自它自己的简介。

- **[Hugging Face Transformers](https://github.com/huggingface/transformers)。** 文本、视觉、音频与多模态模型的模型定义框架，推理与训练都能用。配合本站：[Transformer Block](https://dmxsf.com/wiki/architecture/transformer-block/)。
- **[vLLM](https://github.com/vllm-project/vllm)。** 高吞吐、省显存的 LLM 推理与服务引擎。配合本站：[LLM 推理服务](https://dmxsf.com/wiki/inference/serving/)、[KV Cache](https://dmxsf.com/wiki/inference/kv-cache/)。
- **[FlashAttention](https://github.com/Dao-AILab/flash-attention)。** 快速、省显存的精确注意力。配合本站：[高效注意力](https://dmxsf.com/wiki/architecture/efficient-attention/)。
- **[Megatron-LM](https://github.com/NVIDIA/Megatron-LM)**（NVIDIA）。大规模训练 Transformer 的研究代码。配合本站：[分布式训练](https://dmxsf.com/wiki/pretraining/distributed-training/)。
- **[TRL](https://github.com/huggingface/trl)。** 用强化学习等方法训练 Transformer 语言模型的库。配合本站：[偏好优化](https://dmxsf.com/wiki/post-training/preference-optimization/)、[推理强化学习](https://dmxsf.com/wiki/post-training/reasoning-rl/)。
- **[alignment-handbook](https://github.com/huggingface/alignment-handbook)。** 仓库简介是让语言模型对齐人类与 AI 偏好的可靠配方。配合本站：[偏好优化](https://dmxsf.com/wiki/post-training/preference-optimization/)。
- **[GPU MODE 讲座](https://github.com/gpu-mode/lectures)。** GPU MODE 讲座的配套材料。配合本站：[GPU 与屋顶线模型](https://dmxsf.com/wiki/systems/gpu-and-roofline/)。

## 应用、评测、安全与可解释性

- **[Building effective AI agents](https://www.anthropic.com/research/building-effective-agents)**（Anthropic，2024 年 12 月 19 日）。讨论什么时候该用 Agent、什么时候该用框架，以及工作流与 Agent 的基本构件和组合方式；页面自己注明，文中描述的工具生态在 2024 年 12 月之后已经变化很多。配合本站：[Agent 与工具调用](https://dmxsf.com/wiki/applications/agents-and-tool-calling/)。
- **[Prompt Engineering Guide](https://www.promptingguide.ai/)。** 目录涵盖零样本与少样本、思维链、自洽性、RAG、ReAct、Reflexion 等提示技术，另有 AI Agents 与上下文工程的章节。配合本站：[Prompt Engineering](https://dmxsf.com/wiki/applications/prompt-engineering/)、[RAG](https://dmxsf.com/wiki/applications/rag/)。
- **[Model Context Protocol 文档](https://modelcontextprotocol.io/)。** MCP 的官方文档，按日期版本组织（链接当前跳转到 2026-07-28 的版本）。配合本站：[Agent 与工具调用](https://dmxsf.com/wiki/applications/agents-and-tool-calling/)（MCP 目前是其中的一节）。
- **[HELM](https://crfm.stanford.edu/helm/)**（斯坦福 CRFM 的 Holistic Evaluation of Language Models；论文见 [arXiv:2211.09110](https://arxiv.org/abs/2211.09110)）。多场景、多指标的评测框架：论文摘要写明，在 16 个核心场景上尽量测量准确率、校准、鲁棒性、公平性、偏见、毒性与效率 7 类指标。配合本站：[LLM 评测方法论](https://dmxsf.com/wiki/evaluation/llm-evaluation/)。
- **[lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness)**（EleutherAI）。仓库简介是评测语言模型少样本能力的框架。配合本站：[LLM 评测方法论](https://dmxsf.com/wiki/evaluation/llm-evaluation/)。
- **[OWASP Top 10 for LLM Applications](https://genai.owasp.org/llm-top-10/)。** OWASP Gen AI Security Project 的页面列出 2025 版风险清单，第一项 LLM01:2025 是提示注入。配合本站：[提示注入与越狱](https://dmxsf.com/wiki/safety/prompt-injection-and-jailbreaks/)。
- **[Transformer Circuits Thread](https://transformer-circuits.pub/)。** Anthropic 可解释性团队的研究发表页，开篇写道：现代大模型有一个出人意料的事实，没有人真正知道它们内部是怎么工作的，他们想改变这一点。配合本站：[前沿](https://dmxsf.com/wiki/frontier/)。
- **[ARENA](https://www.arena.education/)**（Alignment Research Engineer Accelerator）。面向技术型 AI 安全的训练营，网站上有课程大纲与教材使用说明。配合本站：[安全与对齐风险](https://dmxsf.com/wiki/safety/)。

## 给中文读者的几条线索

中文授课的有李宏毅的《生成式 AI 导论》；中文教程有《动手学深度学习》、Happy-LLM 与 self-llm；Hugging Face LLM Course 的语言列表里有简体中文，The Illustrated Transformer 的页首列出两个简体中文译本。论文与大多数仓库文档仍是英文：本站的[论文解读](https://dmxsf.com/blog/)与中英对照的[术语表](https://dmxsf.com/glossary/)可以当桥梁，遇到英文术语先查术语表，再回到原文。

## 怎样搭配，怎样判断是否过时

1. **一门主课，一份代码，本站对应的章节。** 课程给节奏和作业，代码给手感，本站给统一的符号、可核对的数字和术语查询。三者互相印证，比同时开三门课有效。
2. **先看日期与版本。** 大模型资料的半衰期很短：看发布日期，看文中提到的模型与工具是哪个版本。本页就有两个例子：Anthropic 的 Building effective agents 页首注明文中的工具生态已经变化；nanoGPT 的 README 已声明过时，推荐改用 nanochat。
3. **冲突时的优先级。** 原论文与官方文档，高于官方仓库的 README，高于个人博客与视频。各家对同一个词的口径可能不同（参数量算不算嵌入层、上下文长度按训练还是按推理），先弄清口径再比较数字。
4. **自己算一遍数字。** 看到参数量、显存或吞吐，用本站的计算组件或配套实验验算一遍；对不上时，先怀疑口径，再检查自己的算式。

## 小结与练习

- 资料分四种：课程给节奏，教材给完整论述，代码给手感，工具文档给工程细节；一个目标配一两份就够。
- 挑选时看三样：对得上本站的哪一章，页面上有没有可核对的日期或版本，是否仍在维护。
- 冲突时以原论文与官方文档为准，数字自己算一遍。

**练习：写一份属于你的学习合约（30 分钟）。** 写下：目标（上面七条里选一条）、每周能用的小时数、主课（一门）、代码（一份）、本站要读到哪一章、第一个月每周的一条可检查的产出（例如“跑出二元字符模型的损失曲线，并解释这个损失与交叉熵是什么关系”）。

<details>
<summary>参考答案（示例）</summary>

目标是“从零写 GPT”，每周约 6 小时，主课是 Zero to Hero，代码是自己跟着写的 notebook，本站读到[模型架构](https://dmxsf.com/wiki/architecture/)：

1. 第 1 周：读[神经网络基础](https://dmxsf.com/wiki/foundations/neural-network-basics/)，看 micrograd 一讲（页面标注 2 小时 25 分）并手敲一遍。产出：自己的 micrograd 能训练一个小型多层感知机。
2. 第 2 周：读[下一个 token 预测](https://dmxsf.com/wiki/foundations/next-token-prediction/)，看 makemore 的前两讲（页面标注 1 小时 57 分与 1 小时 15 分）。产出：二元字符模型的损失曲线，并说明它的平均负对数似然与那一页讲的交叉熵是同一个量。
3. 第 3 周：读[注意力机制入门](https://dmxsf.com/wiki/architecture/attention-basics/)与[Transformer Block](https://dmxsf.com/wiki/architecture/transformer-block/)，对照 The Annotated Transformer 看一遍实现。产出：用自己的话写出一个注意力头里张量形状的变化。
4. 第 4 周：看 “Let's build GPT”（页面标注 1 小时 56 分）。产出：训练一个字符级的小 GPT，并说出它和[从 RNN 到注意力](https://dmxsf.com/wiki/architecture/from-rnn-to-attention/)里讲的循环模型相比差在哪里、强在哪里。

好的合约有三个特点：每条产出都能被别人检查；每周的时间装得下；换一份资料时，只需要改“主课”那一格。

</details>

## 常见问题

### 学大模型应该先看课程，还是先看这个知识库？

两者配合。先用知识库的学习路线图找到自己的起点与阅读顺序，建立统一的符号与全貌，再选一门课补节奏、作业与讨论。课程强在作业与反馈，知识库强在把每个概念放进统一的符号、可核对的数字和可运行的实验里。已经在上课的话，把知识库当词典与校对表：遇到不熟的概念，先查术语表和对应章节。

### 想从零训练一个小模型，应该看哪些资料？

一条常见的顺序：先看 Karpathy 的 Zero to Hero（从反向传播写到 GPT 与 Tokenizer），再读 Raschka《Build a Large Language Model (From Scratch)》的配套代码，或者看 nanochat（覆盖分词、预训练、微调、评测与推理，设计为在单个 GPU 节点上运行），最后用 CS336 的五个作业补上系统、扩展定律、数据与对齐。本站对应算力与系统、预训练、后训练三章，多数页面带有可以在 CPU 上运行的小实验。

### 有没有适合中文读者的资料？

有。中文授课的有李宏毅的《生成式 AI 导论》（课程页是繁体中文）；中文教程有《动手学深度学习》、Datawhale 的 Happy-LLM 与 self-llm；Hugging Face LLM Course 的语言列表里有简体中文，The Illustrated Transformer 的页首列出两个简体中文译本。论文与大多数仓库文档仍是英文，本站的论文解读与中英对照的术语表可以当桥梁。

### 这些学习资料会过时吗？怎么判断？

会，而且很快。看三样东西：发布日期与文中提到的模型、工具版本；是否仍在维护；与官方文档是否一致。本页就有两个例子：Anthropic 的 Building effective agents 发布于 2024 年 12 月，页首注明文中的工具生态已有很大变化；nanoGPT 的 README 已声明过时，作者推荐改用 nanochat。冲突时以原论文与官方文档为准。
