Skip to content

Training, adaptation, compression, and systems techniques · Training, fine-tuning, adaptation, compression, and systems techniques · TRN034 · Algorithm

ZeRO and fully sharded data parallel training

Shard training state across devices to reduce redundant per-device storage.

Explained here Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

Documented in the Academy only. There's no Set up button.

Availability
Explained here
Code example
Component demo, not a trained model
Who ran it
CodeSplash's run and the reference's record
CodeSplash's run
The reference's example ran in Python and R here, and they agree.
The reference's record
Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.

Purpose

Shard training state across devices to reduce redundant per-device storage.

Question / hypotheses

Does this intervention improve the intended quality, adaptation, resource, or reliability objective under a controlled comparison? It defines a method, not an intrinsic null-hypothesis test.

Architecture / computational structure

Depending on the method/stage, optimizer states, gradients, and parameters are partitioned, with all-gather/reduce-scatter communication around computation.

Assumptions

Network bandwidth, communication topology, precision, checkpointing, and uneven tensor sizes influence performance. All workers must follow consistent collective operations.

Formula / computational definition

Mdevice≈Mshardable/N+Mreplicated+Mtemporary.M_{device}\approx M_{shardable}/N+M_{replicated}+M_{temporary}.

Parameters and notation

Learned: the same model weights. Configuration: world size N, sharding stage, wrapping granularity, prefetch, offload, accumulation, precision, checkpoint format.

Fitting, fine-tuning, and adaptation

Configure the trainable subset before wrapping, test saving/restoring on a small job, and verify effective global batch size. FSDP and ZeRO are related systems, not identical APIs.

How to use and calibrate

Measure peak memory, step time, network utilization, and scaling efficiency. Example: full fine-tuning when adapter-only updates are insufficient.

Example application

full fine-tuning when adapter-only updates are insufficient.

Interpretation / pitfalls

Watch out

The ideal 1/N memory term excludes transient gathered parameters and activation storage. Adding devices can slow a communication-bound workload; sharding is not a learning objective.

Python and R code examples

Scope: numerical mechanism demonstration. Validation: Python executed successfully on the supplied synthetic inputs; R reviewed but not executed (Rscript unavailable).

Python and R

The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.

Python

Component demo, not a trained model — numerical mechanism demonstration.

shardable=48.; replicated=2.; temporary=4.; devices=8
print("illustrative GiB/device",shardable/devices+replicated+temporary)
R

Component demo, not a trained model — numerical mechanism demonstration.

shardable <- 48; replicated <- 2; temporary <- 4; devices <- 8
print(shardable/devices+replicated+temporary)

Sources

From the CodeSplash reference, entry TRN034.