liveBook · Manning

Dataset split

As explained in Transformers in Action

Sharding is the partitioning of model parameters, data, or computation across multiple devices or storage units.

Sharding splits model parameters, gradients, or activations into pieces distributed across GPUs or nodes. This reduces memory pressure on individual devices and enables collaborative execution when a model cannot fit on one device or cannot be altered. section 9.2

Table 9.2 Comparison of sharding strategies
Strategy
Memory savings
Communication cost
Typical use case
Tensor sharding
Moderate
High
Splitting large weight matrices across devices
Pipeline sharding
High
Moderate
Very deep models with many sequential layers
Optimizer sharding (ZeRO, FSDP)
Very high
Moderate to high
Training models with hundreds of billions of parameters
Hybrid sharding
Maximal
Very high
Trillion-parameter scale training with combined strategies

Compare tensor, pipeline, optimizer, and hybrid sharding by memory savings, communication cost, and typical use case. section 9.2

Distributing a 175-billion-parameter model

A model requiring 700 GB in FP16 cannot fit on one device; sharding it across 64 GPUs lets each store around 11 GB. During training, sharding can also distribute optimizer states and gradients; during inference, it can distribute layers or experts. section 9.2

How Transformers in Action covers it

How deep it goes
Defines sharding, explains its training and inference roles, and compares tensor, pipeline, optimizer, and hybrid strategies.
Examples
Uses a 175-billion-parameter model split across 64 GPUs to illustrate per-device memory reduction.
What you can do after
Evaluate sharding strategies by memory savings, communication cost, and intended use case.
How it connects
Connects sharding to database partitioning, model training and inference, and optimizer strategies such as ZeRO and FSDP.

Also explained in

Compare how 21 books explain dataset split →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Transformers in Action. The section links point to the parts of the book it draws on.