Thank you for reading the whole thing and congratulations on making it all the way to the end. Before we conclude, a few acknowledgments:
**感谢你一路读到最后,也恭喜你读完了全书。**结束前,我们想向参与这本书的人致谢。
Acknowledgments致谢
This document represents a significant collective investment from many people at Google DeepMind, who we’d like to briefly acknowledge!
Google DeepMind 的许多同事为这本书投入了大量时间,我们想在此向他们致谢。
- James Bradbury, Reiner Pope, Noam Shazeer, and Blake Hechtman originally derived many of the ideas in this manuscript, and were early to understand the systems view of the Transformer.
- Sholto Douglas wrote the first version of this doc and is responsible for kicking off the project. He is more than anyone responsible for the overall narrative of this doc.
- Jacob Austin led the work of transforming this first version from rough notes into a more polished and comprehensive artifact. He did much of the work of editing, formatting, and releasing this document, and coordinated contributions from other authors.
- Most of the figures and animations were made by Anselm Levskaya and Charlie Chen.
- Charlie Chen wrote the inference section and drew many of the inference figures.
- Roy Frostig helped with publication, editing, and many other steps of the journey.
- James Bradbury、Reiner Pope、Noam Shazeer 和 Blake Hechtman 最早推导出本书中的许多观点。他们也是最早从系统角度理解 Transformer 的一批人。
- Sholto Douglas 写了初稿,发起了这个项目。本书的叙述主线主要由他确立。
- Jacob Austin 主持了从初稿笔记到完整成稿的工作。他承担了大部分编辑、排版和发布工作,并协调了其他作者的贡献。
- 大部分插图和动画由 Anselm Levskaya 和 Charlie Chen 制作。
- Charlie Chen 撰写了推理章节,也绘制了其中许多插图。
- Roy Frostig 协助出版、编辑和其他许多环节。
We’d also like to thank many others who gave critical feedback throughout the process, in particular Zak Stone, Nikhil Sethi, Caitlin Stanton, Alek Dimitriev, Sridhar Lakshmanamurthy, Albert Magyar, Diwakar Gupta, Jeff Dean, Corry Wang, Matt Johnson, Peter Hawkins, and many others. Thanks to Ruiqi Gao for help with the HTML formatting.
我们也感谢在写作过程中提出关键反馈的人,尤其是 Zak Stone、Nikhil Sethi、Caitlin Stanton、Alek Dimitriev、Sridhar Lakshmanamurthy、Albert Magyar、Diwakar Gupta、Jeff Dean、Corry Wang、Matt Johnson 和 Peter Hawkins 等。感谢 Ruiqi Gao 协助调整 HTML 排版。
Thank you all!
谢谢大家!
Further Reading延伸阅读
There is a bunch of related writing, including the following:
下面是一些相关资料:
- TPU Deep Dive: a wonderful in-depth look at the TPU architecture in the spirit of this book.
- Domain specific architectures for AI inference: a hardware and model deep dive in the spirit of this book.
- A Domain-Specific Supercomputer for Training Deep Neural Networks: one of the OG TPU papers, this has a lot of great details about the Google TPU program not covered here.
- Making Deep Learning Go Brrrr From First Principles: a more GPU and PyTorch-focused tutorial on LLM rooflines and performance engineering.
- Writing TPU Kernels with Pallas: increasingly, TPU programming involves writing custom kernels in Pallas. This series discusses how to write kernels and many lower level TPU details that aren’t mentioned here.
- How to Optimize a CUDA Matmul Kernel for cuBLAS-like Performance: a Worklog: while GPU and CUDA specific, this is an excellent blog post showing how to optimize a matmul kernel in CUDA. This might be a good deep dive into how TPUs and GPUs are different.
- Distributed arrays and automatic parallelization: this is a really nice guide to parallelism APIs in JAX and is a good way to learn how to actually implement some of the ideas we’ve discussed here.
- Rafi Witten’s High Performance LLMs 2024 Class: our former colleague Rafi gave a great course on TPU performance engineering and the slides are all on GitHub. This covers a bunch of things in more depth than we do here.
- [2211.05102] Efficiently Scaling Transformer Inference: a detailed paper on the mathematics of Transformer inference. This is the inspiration for a lot of this document.
- Huggingface Ultra-Scale Playbook: something of a GPU analog to this book, this talks more at depth about how PyTorch implements parallelism techniques and memory-saving techniques during training.
- Transformer Inference Arithmetic: a blog with many of the same ideas as this book and some excellent illustrations.
- Stanford CS336 Slides and Videos: a fantastic Stanford course covering many details of LLM training and serving, with some useful exercises. Assignments 1 and 2 are particularly relevant.
- Stas Bekman’s ML Engineering Handbook: a highly practical guide to ML infrastructure, covering topics not addressed in this book like how to negotiate with cloud providers, cluster management, and empirical measurements of GPU throughput.
- ezyang’s blog: a PyTorch lead’s blog on all things sharding + PyTorch, including a guide to PyTorch internals and a writeup of sharded matrix multiplication. Lots of other good things here.
- The Anatomy of Collective Communication: a nice walkthrough of GPU and TPU collectives in the spirit of this book. Has a better writeup of N-D and GPU collectives than this book.
- 深入剖析 TPU:沿着本书的思路深入介绍 TPU 架构。
- 面向 AI 推理的专用架构:沿着本书的思路深入探讨硬件与模型。
- 用于训练深度神经网络的专用超级计算机:早期 TPU 论文之一,介绍了 Google TPU 项目的许多细节。
- 从第一性原理加速深度学习:以 GPU 和 PyTorch 为主,介绍大语言模型的屋顶线与性能工程。
- 用 Pallas 编写 TPU 内核:TPU 编程越来越常用 Pallas 编写自定义内核。这个系列介绍内核写法及本书未涉及的许多 TPU 底层细节。
- 将 CUDA 矩阵乘法内核优化到接近 cuBLAS 的性能:工作日志:展示如何用 CUDA 优化 GPU 上的矩阵乘法内核,也可借此理解 TPU 与 GPU 的区别。
- 分布式数组与自动并行化:介绍 JAX 的并行 API,有助于把书中的一些方法付诸实践。
- Rafi Witten 的 2024 年高性能大语言模型课程:我们以前的同事 Rafi 开设的 TPU 性能工程课程,全部课件都在 GitHub 上。许多话题讲得比本书更深入。
- [2211.05102] 高效扩展 Transformer 推理:详细分析 Transformer 推理的数学,也是本书许多内容的灵感来源。
- Hugging Face 超大规模实践手册:可视作本书在 GPU 侧的对应读物,更深入地介绍用 PyTorch 实现训练并行和节省内存的方法。
- Transformer 推理算术:采用了许多与本书相同的思路,并配有精心制作的插图。
- 斯坦福 CS336 课件和视频:涵盖大语言模型训练与服务的诸多细节,提供多道练习。其中作业 1 和 2 与本书尤其相关。
- Stas Bekman 的机器学习工程手册:实用的机器学习基础设施指南,涉及本书没有展开的话题,例如如何与云服务商谈判、怎样管理集群,以及如何实测 GPU 吞吐量。
- ezyang 的博客:一位 PyTorch 负责人的博客,讨论分片与 PyTorch 的方方面面,包括PyTorch 内部机制指南和分片矩阵乘法详解,还有许多其他资料。
- 集合通信详解:沿着本书的思路介绍 GPU 和 TPU 上的集合通信,对 N 维拓扑和 GPU 集合通信的讨论比本书更详尽。
There remains a lot of room for comprehensive writing in this area, so we hope this manuscript encourages more of it! We also believe that this is a fruitful area to study and research. In many cases, it can be done even without having many hardware accelerators on hand.
这个领域还有许多值得系统写下来的内容,希望本书能促成更多这类作品。我们也相信这里有许多值得研究的问题,而且不少问题即使手头没有大量硬件加速器,也能开展研究。
Feedback反馈
Please leave comments or questions so that we can improve this further. You can reach our corresponding author, Jacob Austin, at jacobaustin123 [at] gmail [dot] com, or suggest edits by posting issues, pull requests, or discussions on GitHub.
欢迎留言或提问,帮助我们继续改进。你可以通过 jacobaustin123 [at] gmail [dot] com 联系通讯作者 Jacob Austin,也可以在 GitHub 上提交 issue、pull request 或发起讨论,提出修改意见。