流水线并行是把模型按层切成若干段、让不同卡各自承担一段并以微批次在段间流转的并行技术,核心是把一次批量计算拆成多段接力以提升设备利用率,能力包括多种流水线调度策略、按算力与通信均衡的不均匀切分、激活重计算与激活卸载。它解决的是模型层数过多导致单卡放不下的问题,并不解决流水线空泡带来的效率损失问题。
流水线并行的核心是把层切成接力段,它可以帮助企业实现以下目标:
让超大模型按层装得下。模型被拆到多张卡上,每张卡只承担一部分层,层数规模不再受单卡容量限制,训练任务可以按集群规模横向铺开。
让段间通信保持轻量。相邻段之间只传递激活数据而非梯度集合,通信量比整网同步要小得多。
让设备空转被压到最低。通过前向与反向交错的调度方式填充流水线气泡,昂贵的加速卡时间被更充分地利用。
让显存与算力可以交换。必要时可选择重算或卸载激活来腾出显存,用可接受的额外计算换取更大的切分规模。
总之,流水线并行可以帮助企业把超大模型按层接力训练与部署落地,配合张量并行形成完整的并行体系,在显存与算力之间灵活取舍提升设备利用率,同时需要对微批大小与段数比例做精细调优,并在故障恢复时处理段间状态不一致的问题。
翻译
Pipeline parallelism cuts a model into stages by layer, gives each card a stage and lets micro-batches flow between the stages. Its core is breaking one batch computation into a relay of segments to raise device utilization, with capabilities covering multiple pipeline scheduling strategies, uneven splits balanced between compute and communication, activation recomputation and activation offloading. It solves the problem of a model with too many layers to fit on one card, but it does not solve the efficiency loss caused by pipeline bubbles.
At the heart of pipeline parallelism is cutting layers into relay segments, which can help companies achieve the following:
Let very large models fit layer by layer. The model is spread over several cards, each holding only part of the layers, and depth is no longer limited by the capacity of a single card.
Keep inter-stage communication light. Only activations travel between adjacent stages instead of full gradient sets, so the volume moved is far smaller than a whole-network synchronization.
Let idle devices be pushed down. Interleaving forward and backward passes fills the pipeline bubbles, and expensive accelerator time is used more fully.
Let memory and compute be traded. Activation recomputation or offloading can be chosen to free memory, accepting extra computation in exchange for a larger split.
In short, pipeline parallelism can help enterprises train and serve very large models with a layer-by-layer relay, combine with tensor parallelism to form a complete parallelism system, trade memory against compute flexibly to improve device utilization, and still require careful tuning of micro-batch size and the stage-to-card ratio, together with handling stage inconsistency when recovering from failure.