torch-pipeline-parallelism

Implement pipeline parallelism for training large transformer models across multiple GPUs.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/bianhaifeng789-hue/openclaw-config --skill torch-pipeline-parallelism-bianhaifeng789-hue
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: torch-pipeline-parallelism
Source: https://github.com/bianhaifeng789-hue/openclaw-config/tree/main/skills/tb2/torch-pipeline-parallelism
Command: npx skills add https://github.com/bianhaifeng789-hue/openclaw-config --skill torch-pipeline-parallelism-bianhaifeng789-hue

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enables training transformer-based language models that are too large for a single GPU by partitioning model layers across ranks and coordinating forward and backward passes without running out of device memory.

Core Features & Use Cases

  • Model partitioning: Guidance for slicing transformer layers into stages and assigning embeddings and output heads to appropriate ranks.
  • AFAB scheduling & microbatching: Procedures for All-Forward-All-Backward schedules, microbatch iteration, activation caching, and correct loss scaling.
  • Inter-rank communication patterns: Shape-first send/recv and dtype/device preservation to avoid deadlocks and mismatched tensors.
  • Use Case: Distribute a LLaMA-style transformer across multiple GPUs to train larger models with correct gradient flow and minimal communication bugs.

Quick Start

Partition your transformer into per-rank stages, run AFAB microbatch training across the available GPUs, and verify loss decreases and gradients propagate correctly.

Frequently Asked Questions about torch-pipeline-parallelism

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I train a transformer model that is too large to fit on a single GPU?

Pipeline parallelism partitions transformer layers across multiple GPUs to train models that exceed single-device memory. It coordinates forward and backward passes across ranks, allowing large distributed training without running out of memory.

What is the AFAB schedule in distributed training and how does microbatching work?

AFAB (All-Forward-All-Backward) scheduling processes microbatches by iterating them sequentially through forward passes before executing backward passes. This method caches activations during the forward phase and applies correct loss scaling for each microbatch to ensure accurate gradient flow.

How do I partition transformer layers across multiple GPUs for pipeline parallelism?

Transformer layer partitioning involves slicing the model into per-rank stages and assigning embeddings and output heads to appropriate ranks. This distributes the computational workload across available GPUs and balances memory usage for distributed training.

Why do my inter-rank send and recv communications fail with mismatched tensors in PyTorch?

Inter-rank communication deadlocks and tensor mismatches occur when dtype and device consistency are not preserved. Using shape-first send and recv communication patterns ensures tensor dimensions match across ranks, preventing communication bugs during distributed training.

Can I use pipeline parallelism to train a LLaMA-style transformer across multiple GPUs?

Pipeline parallelism supports distributing LLaMA-style transformers across multiple GPUs. By partitioning model layers and applying AFAB microbatch training, you can train larger models while maintaining correct gradient flow and minimizing communication bugs.

When do I need activation caching for backward passes in pipeline parallelism?

Activation caching is required during AFAB scheduling to store intermediate tensors during the forward pass. These cached activations are then retrieved during the backward pass to compute gradients correctly for each microbatch in distributed training.