<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Megatron-LM - 标签 - 集合通信博客</title><link>https://hccl.club/tags/megatron-lm/</link><description>Megatron-LM - 标签 - 集合通信博客</description><generator>Hugo -- gohugo.io</generator><language>zh-CN</language><lastBuildDate>Fri, 06 Nov 2026 10:00:00 +0800</lastBuildDate><atom:link href="https://hccl.club/tags/megatron-lm/" rel="self" type="application/rss+xml"/><item><title>张量并行：每层两次 AllReduce</title><link>https://hccl.club/docs/training/tensor-parallel-communication/</link><pubDate>Fri, 06 Nov 2026 10:00:00 +0800</pubDate><author><name>Innoecho</name></author><guid>https://hccl.club/docs/training/tensor-parallel-communication/</guid><description>&lt;p>数据并行切数据，张量并行 (Tensor Parallelism, TP) 直接切权重：把一个线性层的矩阵按行列切开摊到多张卡上，每张卡算部分结果再归并。Megatron-LM 证明了这种切法与 transformer 结构严丝合缝——注意力按头切、MLP 按中间维切，一个 transformer 层只需要极少的通信点就能完整并行。&lt;/p>
&lt;p>TP 的通信特征与 DDP 完全不同：DDP 每步一次大 AllReduce，TP 则是每层前向两次、反向两次的小 AllReduce，消息是激活值而非梯度。通信次数随层数线性增长，这一特征决定了 TP 必须住在 NVLink/超节点这样的高带宽域内。本文给出这套通信的完整口径，并延伸到序列并行与异步张量并行。&lt;/p></description></item></channel></rss>