yandex/YaFSDP

YaFSDP: Yet another Fully Sharded Data Parallel

Python

987

68 commits

updated Oct 5, 2026

See the code

README

YaFSDP

 

Overview

YaFSDP is a Sharded Data Parallelism framework, designed to work well with transformer-like neural network architectures. YaFSDP is developed and maintained by Yandex.

You can find more info on YaFSDP internals in our blog posts on Medium and Habr.

Advantages over FSDP

YaFSDP is up to 20% faster for pre-training LLMs and performs better in high memory pressure conditions. It is designed to reduce communications and memory operations overhead.

YaFSDP:

ya_fsdp

FSDP:

fsdp

Benchmarks

We've compared YaFSDP with FSDP on a variety of pre-training setups ranging from:

  • 7B to 70B parameters
  • 64 to 256 devices
  • 2048 to 8192 tokens per sequence
modelgpu-countseq-lennum-ckpt-layersspeedupYaFSDP iteration time (s)FSDP iteration time (s)
Llama 2 7B64204809.92%0.810.90
Llama 2 7B64409603.43%1.161.21
Llama 2 7B64819202.68%2.232.29
Llama 2 7B128204809.57%0.870.97
Llama 2 7B128409602.42%1.191.22
Llama 2 7B128819202.32%2.252.31
Llama 2 13B1282048012.10%1.551.76
Llama 2 13B128409603.49%2.062.14
Llama 2 34B1282048020.70%3.394.27
Llama 2 34B2562048021.99%3.514.50
Llama 2 34B256409658.35%5.335.81
Llama 2 70B25620481021.48%6.978.87
Llama 2 70B2564096507.17%11.0711.93
Llama 3 8B642048011.91%0.971.10
Llama 3 8B64409607.86%1.361.48
Llama 3 70B25620482026.60%7.179.76

Details:

  • In each run per-device batch size is set to 1.
  • speedup represents relative iteration time decrease between YaFSDP and FSDP runs.
  • num-ckpt-layers refers to the number of transformer layers to which activation checkpointing was applied.
  • Performance was measured using a cluster of hosts with A100 80 GB GPUs.

Examples

You can find examples of LLM training using 🤗 stack in the examples folder:

  1. clm.md for causal pre-training
  2. sft.md for supervised fine-tuning

Notice that both examples require a Docker image, which can be built using docker/build.sh script. The image is based on the NVIDIA PyTorch image with some patched 🤗 libraries. Patches for the libraries can be found in the patches folder.

Issues and questions

If you encounter any bugs of have any questions feel free to open a GitHub issue.

Citation

If you use this codebase, please cite it by using the following BibTeX entry:

@misc{YaFSDP2024,
  author =       {Mikhail Khrushchev and Anton Frolov and Ruslan Vasilev},
  title =        {YaFSDP: Yet another Fully Sharded Data Parallel},
  howpublished = {\url{https://github.com/yandex/YaFSDP}},
  year =         {2024}
}

yandex/YaFSDP

YaFSDP: Yet another Fully Sharded Data Parallel

Python

987

68 commits

updated Oct 5, 2026

See the code

README

YaFSDP

 

Overview

YaFSDP is a Sharded Data Parallelism framework, designed to work well with transformer-like neural network architectures. YaFSDP is developed and maintained by Yandex.

You can find more info on YaFSDP internals in our blog posts on Medium and Habr.

Advantages over FSDP

YaFSDP is up to 20% faster for pre-training LLMs and performs better in high memory pressure conditions. It is designed to reduce communications and memory operations overhead.

YaFSDP:

ya_fsdp

FSDP:

fsdp

Benchmarks

We've compared YaFSDP with FSDP on a variety of pre-training setups ranging from:

  • 7B to 70B parameters
  • 64 to 256 devices
  • 2048 to 8192 tokens per sequence
modelgpu-countseq-lennum-ckpt-layersspeedupYaFSDP iteration time (s)FSDP iteration time (s)
Llama 2 7B64204809.92%0.810.90
Llama 2 7B64409603.43%1.161.21
Llama 2 7B64819202.68%2.232.29
Llama 2 7B128204809.57%0.870.97
Llama 2 7B128409602.42%1.191.22
Llama 2 7B128819202.32%2.252.31
Llama 2 13B1282048012.10%1.551.76
Llama 2 13B128409603.49%2.062.14
Llama 2 34B1282048020.70%3.394.27
Llama 2 34B2562048021.99%3.514.50
Llama 2 34B256409658.35%5.335.81
Llama 2 70B25620481021.48%6.978.87
Llama 2 70B2564096507.17%11.0711.93
Llama 3 8B642048011.91%0.971.10
Llama 3 8B64409607.86%1.361.48
Llama 3 70B25620482026.60%7.179.76

Details:

  • In each run per-device batch size is set to 1.
  • speedup represents relative iteration time decrease between YaFSDP and FSDP runs.
  • num-ckpt-layers refers to the number of transformer layers to which activation checkpointing was applied.
  • Performance was measured using a cluster of hosts with A100 80 GB GPUs.

Examples

You can find examples of LLM training using 🤗 stack in the examples folder:

  1. clm.md for causal pre-training
  2. sft.md for supervised fine-tuning

Notice that both examples require a Docker image, which can be built using docker/build.sh script. The image is based on the NVIDIA PyTorch image with some patched 🤗 libraries. Patches for the libraries can be found in the patches folder.

Issues and questions

If you encounter any bugs of have any questions feel free to open a GitHub issue.

Citation

If you use this codebase, please cite it by using the following BibTeX entry:

@misc{YaFSDP2024,
  author =       {Mikhail Khrushchev and Anton Frolov and Ruslan Vasilev},
  title =        {YaFSDP: Yet another Fully Sharded Data Parallel},
  howpublished = {\url{https://github.com/yandex/YaFSDP}},
  year =         {2024}
}

Significant stargazers

Miguel de Icaza

5,294 followers · starred Apr 2025

Stas Bekman

2,623 followers · starred Apr 2025

Lachezar Lechev

215 followers · starred Jun 2024

Vik Paruchuri

4,364 followers · starred Jul 2024