Context并行

最初是Sequence并行+Tensor并行;

但是,Tensor并行加多GPU parition数目后,每个GPU上的计算量减小,无法和通信overlap,变慢;

CP can better address the issues. With CP, each GPU only computes on a part of the sequence, which reduces both computation and communication by CP times. Therefore, there are no concerns about the overlapping between them. The activation memory footprint per GPU is also CP times smaller, hence no OOM issue any more.

可以将原先Sequence并行+Tensor并行时,AllGather和Reduce-Scatter的包含所有token的激活矩阵,变小。即减小了通信量。Context并行的通信量,几乎可以完全被计算所overlap。

Context并行的动图:

[并行训练]Context Parallelism的原理与代码浅析 - 知乎 (zhihu.com)

3个要点:

1. 使用了RingAttention;(Overlap: Q和当前K、V计算时,下一份K、V在通信过来的路上了)

2. 因为有casual mask,每个token只和前面token的K、V进行计算

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值