Skip to content

Commit a11a369

Browse files
sanbuphyclaude
andcommitted
Add four notebooks: MLA, inference systems, linear/sparse attention
Cover modernization gaps for 2025-2026 LLM practice: - 29 MLA & KV cache compression (DeepSeek-V2/V3, Kimi K2) - 30 Modern inference systems (PagedAttention, continuous batching, prefix caching, prefill/decode disaggregation) - 31 Linear attention & hybrid architecture (MiniMax-01, Jamba, Mamba) - 32 Sparse attention (NSA, DSA) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 4744582 commit a11a369

6 files changed

Lines changed: 2832 additions & 3 deletions

File tree

README-CN.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</a>
2929
<img alt="Python" src="https://img.shields.io/badge/Python-3.9%2B-3776AB">
3030
<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-2.0%2B-EE4C2C">
31-
<img alt="Notebooks" src="https://img.shields.io/badge/Notebooks-27-orange">
31+
<img alt="Notebooks" src="https://img.shields.io/badge/Notebooks-32-orange">
3232
<img alt="Languages" src="https://img.shields.io/badge/Languages-English%20%7C%20Chinese-2ea44f">
3333
</p>
3434

@@ -300,6 +300,7 @@ Modern LLM Notebook
300300
| 15 | [LoRA](notebooks/part2-training/15-lora.ipynb) | 低秩适配为什么有效? | `LoraLinear`、merge 推理 |
301301
| 16 | [函数调用与工具使用](notebooks/part2-training/16-function-calling.ipynb) | 模型如何调用外部工具? | 结构化输出、Tool 调用、训练数据构造 |
302302
| 17 | [RLHF 与偏好对齐](notebooks/part2-training/17-rlhf-alignment.ipynb) | 偏好信号如何变成优化目标? | Reward Model、PPO、DPO |
303+
| 29 | [MLA 与 KV Cache 压缩](notebooks/part2-training/29-mla-kv-cache.ipynb) | 长上下文下 KV Cache 怎么压? | MHA/GQA/MQA 对比、MLA latent 压缩、decoupled RoPE |
303304

304305
### Part 3: Inference
305306

@@ -309,6 +310,7 @@ Modern LLM Notebook
309310
| 19 | [推理加速](notebooks/part3-inference/19-inference-acceleration.ipynb) | 生成为什么常常受显存访问限制? | KV Cache、FlashAttention、PagedAttention |
310311
| 20 | [模型量化](notebooks/part3-inference/20-quantization.ipynb) | 4-bit 量化为什么能保持精度? | 对称/非对称、per-channel/group、GPTQ、AWQ |
311312
| 21 | [投机解码](notebooks/part3-inference/21-speculative-decoding.ipynb) | 小模型如何加速大模型? | Draft-then-verify 接受率 |
313+
| 30 | [现代推理系统](notebooks/part3-inference/30-inference-systems.ipynb) | 多并发请求时吞吐和延迟怎么权衡? | PagedAttention、Continuous batching、Prefix caching、Prefill/Decode 分离 |
312314

313315
### Part 4: Frontiers
314316

@@ -317,6 +319,8 @@ Modern LLM Notebook
317319
| 22 | [长上下文](notebooks/part4-frontiers/22-long-context.ipynb) | 模型如何扩展到训练长度之外? | RoPE 外推、YaRN、Sliding Window Attention |
318320
| 23 | [推理链与 CoT](notebooks/part4-frontiers/23-cot-thinking.ipynb) | 推理链为什么能改善答案? | Self-Consistency、reward 设计 |
319321
| 24 | [视觉语言模型](notebooks/part4-frontiers/24-vlm.ipynb) | 图像信息如何进入语言模型? | Patch Embedding、Cross-Attention |
322+
| 31 | [Linear Attention 与混合架构](notebooks/part4-frontiers/31-linear-attention.ipynb) | 怎么把 attention 复杂度从 O(N²) 压到 O(N)? | Linear attention、SSM/Mamba、Lightning Attention、Hybrid 架构 |
323+
| 32 | [Sparse Attention](notebooks/part4-frontiers/32-sparse-attention.ipynb) | 保留 softmax 但只算一部分 key 行不行? | Sliding Window、Learnable sparse、NSA、DSA |
320324

321325
### Part 5: Production
322326

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</a>
2929
<img alt="Python" src="https://img.shields.io/badge/Python-3.9%2B-3776AB">
3030
<img alt="PyTorch" src="https://img.shields.io/badge/PyTorch-2.0%2B-EE4C2C">
31-
<img alt="Notebooks" src="https://img.shields.io/badge/Notebooks-26-orange">
31+
<img alt="Notebooks" src="https://img.shields.io/badge/Notebooks-32-orange">
3232
<img alt="Languages" src="https://img.shields.io/badge/Languages-English%20%7C%20Chinese-2ea44f">
3333
</p>
3434

@@ -241,7 +241,7 @@ python scripts/execute_notebooks_en_no_kernel.py
241241

242242
| Area | Status |
243243
|:---|:---|
244-
| Chinese notebooks | Complete 27/27 (added 20-quantization; renumbered Part 3–5) |
244+
| Chinese notebooks | Complete 32/32 (added 29-MLA, 30-inference-systems, 31-linear-attention, 32-sparse-attention) |
245245
| English notebooks | Complete 26/26 with executed outputs; renumber pending |
246246
| Web reader | React / Vite app with language switching |
247247
| Static site | Published through GitHub Pages |

0 commit comments

Comments
 (0)