torch-tensor-parallelism

Implement tensor-parallel linear layers in PyTorch with sharded weights and bias handling.

127|27|Updated Mar 27, 2026
One-click install
npx skills add https://github.com/lazyFrogLOL/Harness_Engineering --skill torch-tensor-parallelism-lazyfroglol
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: torch-tensor-parallelism
Source: https://github.com/lazyFrogLOL/Harness_Engineering/tree/main/skills/torch-tensor-parallelism
Command: npx skills add https://github.com/lazyFrogLOL/Harness_Engineering --skill torch-tensor-parallelism-lazyfroglol

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers often struggle to correctly implement tensor‑parallel linear layers, needing to shard weights, manage biases, and coordinate communication across ranks without breaking gradient flow or output shapes.

Core Features & Use Cases

  • Guides the creation of ColumnParallelLinear and RowParallelLinear classes that split weight matrices along the appropriate dimensions.
  • Details bias handling strategies for both column and row parallelism to avoid duplication or missing gradients.
  • Provides verification checklists, concrete numeric examples, and common pitfalls to ensure reliable distributed training of large models on multi‑GPU or multi‑node setups.

Quick Start

Use the torch‑tensor‑parallelism skill to generate a correct ColumnParallelLinear implementation for a 2‑GPU configuration.

Frequently Asked Questions about torch-tensor-parallelism

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

FAQPage Schema
How do I implement tensor parallelism in PyTorch for multi-GPU training?

Tensor parallelism in PyTorch requires sharding weight matrices and managing biases across distributed ranks. You create column-parallel and row-parallel linear layers to split weights along appropriate dimensions for multi-GPU training.

What is the difference between column-parallel and row-parallel linear layers?

Column-parallel and row-parallel linear layers differ by the weight dimension they split. Column-parallel shards the output dimension requiring all-gather, while row-parallel shards the input dimension using all-reduce to maintain output shape consistency.

How do I handle bias in column-parallel and row-parallel configurations?

Bias handling in tensor parallelism requires specific strategies for column and row configurations to avoid duplication or missing gradients. Proper bias management maintains gradient flow and output shape consistency across distributed ranks during multi-GPU training.

Do I need torch.distributed to run tensor-parallel linear layers?

Yes, tensor-parallel linear layers require a torch.distributed environment to function. This environment handles the all-gather and all-reduce communication needed to coordinate weight splitting and gradient flow across multi-GPU or multi-node ranks.

Why does my tensor parallelism output shape break during distributed training?

Tensor parallelism output shapes break when dimension chunking is incorrect or communication operations are misapplied. Ensuring proper weight splitting and correct all-gather or all-reduce operations maintains output shape consistency across distributed ranks.