如何扩展你的模型(11):结论与延伸阅读
中英对照第 11 篇:收尾与延伸阅读清单。左栏原文,右栏译文。
本篇属于系列 如何扩展你的模型(How To Scale Your Model) · 第 11 篇
原文:How To Scale Your Model(Google DeepMind,作者 Jacob Austin、Sholto Douglas、Roy Frostig、Anselm Levskaya、Charlie Chen、Sharad Vikram、Federico Lebron、Peter Choy、Vinay Ramasesh、Albert Webson、Reiner Pope)。
本站是中英对照排版:左栏是英文原文,右栏是对应的中文译文。不好直译的术语(roofline、strong scaling、ICI、MXU、KV cache、FSDP、TP 等)保留英文写法;原文配图全部保留。
本文是系列《如何扩展你的模型(How To Scale Your Model)》的第 11 篇,共 13 篇。系列目录。
原文以 MIT 许可证发布,版权归 Google LLC;本译文仅作学习交流之用,如有错漏以原文为准。
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!
谢谢大家!
Before you go, you might also enjoy reading the new Part 12 on NVIDIA GPUs!
在离开之前,你可能也会喜欢读一读新加的第 12 部分,讲 NVIDIA GPU!
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 Deep Dive:一篇很棒的深度文章,以本书的精神深入剖析 TPU 架构。
- Domain specific architectures for AI inference:一篇以本书精神撰写的硬件与模型深度文章。
- A Domain-Specific Supercomputer for Training Deep Neural Networks:OG TPU 论文之一,里面有大量本书未涉及、关于 Google TPU 计划的精彩细节。
- Making Deep Learning Go Brrrr From First Principles:一篇更偏向 GPU 与 PyTorch 的教程,讲 LLM roofline 与性能工程。
- Writing TPU Kernels with Pallas:越来越多的 TPU 编程都涉及用 Pallas 编写自定义 kernel。这个系列讨论了如何写 kernel,以及许多本书没有提到的底层 TPU 细节。
- How to Optimize a CUDA Matmul Kernel for cuBLAS-like Performance: a Worklog:虽然偏 GPU 和 CUDA,但这是一篇极好的博客,展示了如何在 CUDA 里优化一个矩阵乘法 kernel。这可能是深入理解 TPU 与 GPU 差异的好材料。
- Distributed arrays and automatic parallelization:一份非常好的 JAX 并行 API 指南,也是学习如何真正落地本书一些想法的好途径。
- Rafi Witten’s High Performance LLMs 2024 Class:我们的前同事 Rafi 开了一门很棒的 TPU 性能工程课程,幻灯片都在 GitHub 上。它比本书更深入地讲了许多内容。
- [2211.05102] Efficiently Scaling Transformer Inference:一篇关于 Transformer 推理数学的详细论文,是本书许多内容的灵感来源。
- Huggingface Ultra-Scale Playbook:可以算是本书在 GPU 上的对应物,更深入地讨论了 PyTorch 如何在训练中实现各种并行技术与省显存技术。
- Transformer Inference Arithmetic:一篇博客,包含许多与本书相同的想法,以及一些出色的插图。
- Stanford CS336 Slides and Videos:一门很棒的斯坦福课程,覆盖 LLM 训练与服务的许多细节,并配有有用的练习。作业 1 和 2 尤其相关。
- Stas Bekman’s ML Engineering Handbook:一份非常实用的 ML 基础设施指南,涵盖本书未涉及的主题,比如如何与云厂商谈价、集群管理,以及 GPU 吞吐的实测数据。
- ezyang’s blog:一位 PyTorch 负责人的博客,讲分片 + PyTorch 的方方面面,包括一份 PyTorch 内部机制指南 和一篇 分片矩阵乘法的文章。这里还有很多其他好东西。
- The Anatomy of Collective Communication:以本书精神对 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.
请留下评论或问题,以便我们进一步改进。你可以联系我们的通讯作者 Jacob Austin,邮箱是 jacobaustin123 [at] gmail [dot] com,或者通过在 GitHub 上提交 issue、pull request 或 discussion 来建议修改。
讨论
用 GitHub 账号留言;评论保存在公开仓库chengshu-blog-discussions的 Discussions 里。也可通过 RSS 订阅后续文章。