MPS in PyTorch 2.15
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
Back to Articles MPS in PyTorch 2.15 Published October 20, 2026 Update on GitHub Upvote 10 +4 Irakli Salia Isalia20 Follow Khushi Agrawal khushi-411 Follow If you run models on your Mac or use MPS as your primary acceleration tool for computing, there’s plenty to look forward to in PyTorch 2.15! FP8 arrives on MPS, language-model decoding gets faster paths through linear layers and softmax and new Metal kernels tackle some surprisingly expensive parts of audio, video and training workloads.
回到文章:PyTorch 2.15 中的 MPS,发布于 2026 年 10 月 20 日。如果您在 Mac 上运行模型,或将 MPS 作为主要的计算加速工具,那么 PyTorch 2.15 将有许多值得期待的内容!FP8 现已登陆 MPS,语言模型解码通过线性层和 Softmax 获得了更快的路径,新的 Metal 内核也解决了音频、视频和训练工作负载中一些开销惊人的部分。
A quick word about who we are: we’re the PyTorch team at Hugging Face. We contribute across PyTorch, and one of our focus areas is the MPS backend, where the goal is to make your Mac a first-class place to run and train PyTorch models. At the start of 2026, running even small models on MPS often meant working around unsupported operations, performance cliffs and unexpected memory growth. So we run real models from the Hugging Face Hub across language, image and video, find where MPS falls short and fix it upstream in PyTorch, more and more often by replacing MPSGraph with dedicated Metal kernels. Much of this post is the result of that work, done together with the PyTorch maintainers and community contributors.
简单介绍一下我们:我们是 Hugging Face 的 PyTorch 团队。我们为整个 PyTorch 做出贡献,其中一个重点领域是 MPS 后端,我们的目标是让 Mac 成为运行和训练 PyTorch 模型的一流平台。在 2026 年初,即使在 MPS 上运行小型模型,也往往意味着需要绕过不支持的操作、性能瓶颈和意外的内存增长。因此,我们在 Hugging Face Hub 上运行真实的语言、图像和视频模型,找出 MPS 的不足之处,并在 PyTorch 上游进行修复,越来越多地通过使用专用 Metal 内核替换 MPSGraph 来实现。本文的大部分内容都是这项工作的成果,由 PyTorch 维护者和社区贡献者共同完成。
TL;DR FP8 comes to the Mac: store float8_e4m3fn values in half the space of BF16 and use scaled matrix multiplication and all other ops which are supported on CUDA/CPU! MoE models decode 5–6.5× faster than in 2.14: Qwen3.6-35B-A3B goes from 9.4 to 61.3 tokens/s on an M3 Ultra, thanks to a native grouped matmul with a dedicated decoding path, fewer GPU-CPU syncs and faster top-k routing. Less time per token for every LLM: single-row linear layers use specialized matrix-vector kernels, and softmax over the vocabulary is about 8× faster. More linear algebra on the GPU: complex LU and triangular solves, faster small-matrix inverses, and faster QR decomposition. Audio, video, and training get attention too: faster paths for convolutions, padding, dropout, interpolation backward and reductions. Wan2.2’s video VAE decode now peaks at 8 GiB of memory instead of 270 GiB. More control from Python: public MPS streams and more reliable event timing. Updated requirements: MPS now requires macOS 15 or later; PyTorch 2.15 requires Python 3.11 or later. A peek at 2.16: attention fully on Metal, more MPSGraph-to-Metal migrations and faster LLM decoding.
简而言之:FP8 登陆 Mac:以 BF16 一半的空间存储 float8_e4m3fn 值,并使用 CUDA/CPU 上支持的缩放矩阵乘法及所有其他操作!MoE 模型解码速度比 2.14 版本快 5–6.5 倍:得益于带有专用解码路径的原生分组矩阵乘法、更少的 GPU-CPU 同步以及更快的 top-k 路由,Qwen3.6-35B-A3B 在 M3 Ultra 上的速度从 9.4 tokens/s 提升至 61.3 tokens/s。每个 LLM 的单 token 时间更短:单行线性层使用专门的矩阵向量内核,词汇表上的 Softmax 速度提升约 8 倍。GPU 上更多的线性代数运算:复数 LU 和三角求解、更快的矩阵求逆以及更快的 QR 分解。音频、视频和训练也得到了关注:卷积、填充、Dropout、插值反向传播和归约运算有了更快的路径。Wan2.2 的视频 VAE 解码现在内存峰值仅为 8 GiB,而不是 270 GiB。来自 Python 的更多控制:公共 MPS 流和更可靠的事件计时。更新要求:MPS 现在需要 macOS 15 或更高版本;PyTorch 2.15 需要 Python 3.11 或更高版本。2.16 版本前瞻:完全基于 Metal 的注意力机制、更多的 MPSGraph 到 Metal 迁移以及更快的 LLM 解码。