bojieli/ai-infra-book
《深入理解 AI Infra:量化分析与系统设计》(李博杰 著)开源书稿:从硬件约束和模型架构出发,量化推导 LLM 推理与训练系统设计。含全书正文、PDF、配套计算工具与实验
Older snapshot: check the original source for current information.
From the publisher
README & documentation
Source previewRead the project’s overview, installation instructions and usage examples. The original README is the source of truth.
[](https://github.com/bojieli/ai-infra-book/actions/workflows/book-site.yml) [](LICENSE) [](https://github.com/bojieli/ai-infra-book) 简体中文 · English · 繁體中文 · Русский — community edition 《深入理解 AI Infra》是 GitHub 上获得 50k+ Star 的《深入理解 AI Agent:设计原理与工程实践》的姊妹篇。 写完《深入理解 AI Agent》后,在与读者交流的过程中,我越来越感到:要开发好基于模型的应用,还需要理解它赖以运行的基础设施。大多数软件工程师不必亲自开发操作系统、编译器和芯片,却仍要学习操作系统、编译原理和计算机体系结构,因为申请内存、读取文件、调用函数,背后都有资源与时间代价。基于模型开发应用也是如此。延迟相差几倍,产品体验就可能完全不同;成本相差一个数量级,能够支撑的商业模式也随之改变。 更深层的变化是编程抽象的上移:从操作系统到模型上下文。传统的操作系统、编译器和硬件要为事先未知的各种程序提供通用能力,系统优化总要在可编程性与性能之间取舍。如今 LLM 成了最重要的应用,从算子执行到分布式调度,都可以针对特定的模型和加速器架构优化;模型设计也开始反过来适应硬件,DeepSeek V4/V4.1 重新设计长上下文的表示方式,就是一例。从某种意义上说,模型成了 LLM 时代的操作系统,AI Infra 成了 LLM 时代的计算机体系结构。《计算机体系结构:量化研究方法》是我在体系结构领域的入门书,而 AI Infra 领域还缺少一本从硬件约束和模型架构出发、量化推导系统设计的书,这是我写作本书的动机。 贯穿全书的方法是从约束推导设计:先明确任务与质量要求,列出计算、存储、通信和依赖关系,对照硬件的容量、带宽和算力做数量级估算。这类估算人容易出错,AI 也一样:只算权重读取而忘了 KV 缓存,按峰值算力推算速度而不查带宽能否供给,把工作平分给多张卡却遗漏卡间通信,漏掉任何一项,结论都可能偏离几倍甚至几个数量级。估算还有另一层用意:读博时导师张霖涛博士反复叮嘱,优化一定要做到物理所允许的极限。本书贯彻这一习惯,先按第一性原理算出硬件允许的上限,再看实测离上限还有多远;差距不是模型漏了项,就是系统有可以去掉的开销。从 FPGA 加速 Bing 搜索排序、昇腾 AKG 算子生成到 UB 万卡互联,我反复遇到的是同一条线索:数据搬移。本书因此反复追问五个问题:搬什么、搬多少、搬几次、经过哪里、谁必须等它。 更多写作背景见前言。 目前书稿仍是初稿,正在持续修订。 如果你已经调用过模型 API,或在自己的机器上运行过模型,想进一步弄清模型为什么慢、如何降低成本,这本书可以作为起点。从事系统、网络和芯片工作的工程师,以及相关方向的研究人员和学生,也能从书中看到各层设计与实际模型任务的联系。 阅读时需要一些 Python、线性代数和计算机系统基础,具体要求见前言。建议先读第 1—3 章,了解模型与负载,再根据自己的兴趣选择重点: 遇到书中的算例,不妨先自己估一下,再看推导和实验结果。也可以换成你正在使用的模型和硬件,看看结论是否改变。 配套计算工具可以用来复算书中的数字,也可以换一组模型和输入,估算资源需求。工具附有模型配置和结果索引,静态计算只需 Python 3.10+ 标准库,无需 GPU 或模型权重。 仓库使用 Git LFS 保存论文和较大的输入与测量记录,合计约 20 GB。为避免克隆时全部下载,.lfsconfig 默认跳过所有 LFS 文件,工作区中只留下指针;正文、配图和静态计算都不需要它们。复现某个实验时,只下载对应目录:…
Read the full README ↗ · Preview checked 2026-10-29T04:36:45.456Z
Inside the original README — Document outline
Headings are captured from the source. Links open the publisher’s document, not a locally hosted copy.
Links from the README
References supplied by the publisher, not independently verified endorsements. Check the destination before downloading files or entering credentials.
Documentation belongs to its respective authors. Reported project/model license: Apache-2.0. A listing is not a grant of reuse or training rights. Confirm the document’s own terms at the source.
What this repository does
《深入理解 AI Infra:量化分析与系统设计》(李博杰 著)开源书稿:从硬件约束和模型架构出发,量化推导 LLM 推理与训练系统设计。含全书正文、PDF、配套计算工具与实验
Repository facts
- Owner
- bojieli
- Primary language
- Python
- Stars
- 4,838
- Forks
- 350
- Open issues + pull requests
- 0
- License
- Apache-2.0
- Archived
- No
- Default branch
- main
- Created
- 2026-08-22T15:30:41.000Z
- Last push
- 2026-09-19T14:01:37.000Z
Topics and intended use
Owner-supplied topics: accelerator, ai-infra, ai-infrastructure, book, datacenter-network, deepseek, distributed-systems, gpu, kv-cache, llm, llm-inference, llm-serving, llm-training, mixture-of-experts, performance-engineering
Review the README for scope, installation, examples and limitations. We do not run repository code or certify it.
Evaluate before installing
Review licensing and dependencies, inspect recent commits and unresolved issues, and test in an isolated environment before production use. Stars and forks alone cannot answer these questions.
Source and freshness
Source: GitHub. Metadata observed 2026-09-21T12:01:34.222Z. Daily imports are snapshots, not real-time monitoring.
Popularity and source listings do not establish security, suitability, licensing rights or benchmark performance.
Related repositories
EbookFoundation/free-programming-books
donnemartin/system-design-primer