← all repositories
huggingface/nanotron

Pretrain massive LLMs without hiding the 3D parallelism wiring

Nanotron exposes the wiring of 3D LLM training so you can debug your multi-node runs without reverse-engineering a black box.

2.7k stars Python ML FrameworksLanguage Models
nanotron
Not currently ranked — collecting fresh signals.
star history

What it does

Nanotron is a Python library for pretraining transformer models on custom datasets at scale. It orchestrates data, tensor, and pipeline parallelism—3D parallelism—across GPU clusters, and includes support for Mixture-of-Experts routing, spectral µTransfer for scaling widths and depths, and CUDA event-based timing to measure actual GPU performance.

The interesting bit

Most large-scale trainers bury their distributed logic inside deeply nested abstractions. Nanotron keeps the tensor- and pipeline-parallel APIs surface-level, which means you can step through a multi-node training run in a debugger without the framework swallowing the stack trace. It is essentially a reaction to the opacity of Megatron-LM and DeepSpeed.

Key highlights

  • Supports 3D parallelism (DP, TP, PP) plus expert parallelism for MoEs.
  • Exposes explicit APIs for tensor and pipeline parallelism to simplify debugging.
  • Includes AFAB and 1F1B pipeline schedules, ZeRO-1, and FP32 gradient accumulation.
  • Ships with reference implementations for Mamba, µTransfer scaling, and custom checkpoint sharding.
  • Publishes an open benchmark playbook mapping model sizes and node counts to optimal MFU configurations.

Caveats

  • No FP8 training, ZeRO-3/FSDP, or torch.compile support yet; all are on the roadmap.
  • Ring attention and interleaved pipeline schedules are also listed as future work.

Verdict

Reach for Nanotron if you are pretraining or continually pretraining LLMs from scratch on a cluster and need to tweak the distributed strategy without fighting a monolithic framework. Skip it if you are fine-tuning smaller models on a single GPU or need production features like FP8 and FSDP today.

Frequently asked

What is huggingface/nanotron?
Nanotron exposes the wiring of 3D LLM training so you can debug your multi-node runs without reverse-engineering a black box.
Is nanotron open source?
Yes — huggingface/nanotron is open source, released under the Apache-2.0 license.
What language is nanotron written in?
huggingface/nanotron is primarily written in Python.
How popular is nanotron?
huggingface/nanotron has 2.7k stars on GitHub.
Where can I find nanotron?
huggingface/nanotron is on GitHub at https://github.com/huggingface/nanotron.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.