Model or dataset
pytorch/torchtitan avatar
pytorch/torchtitan

torchtitan: a clean-room training platform written in PyTorch idioms

A PyTorch native platform for training generative AI models

5,846 stars1,046 forksPythonBSD-3-Clause

At a glance

What is it?
PyTorch's reference implementation for training large generative models packs FSDP2, tensor, pipeline and context parallelism, Float8 and MXFP8, and a growing model roster into a codebase that aims to stay readable.
Who is it for?
torchtitan earns its place as a reading implementation first and a training platform second. The parallelism options, the activation checkpointing controls and the checkpoint format are the parts worth studying, because they show PyTorch's distributed features assembled without a framework layer in between.
Can I use it commercially?
Yes. BSD-3-Clause is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository received new commits within the last day.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

A reference implementation that admits it is a reference

The project describes itself as a PyTorch native platform for rapid experimentation and large-scale training of generative AI models, and the word that matters is the one after that: a minimal clean-room implementation. That framing sets expectations better than any feature list. The repository is not trying to be a product with a support contract. It is trying to be a codebase you can read end to end and then modify, which is why the stated guiding principles put being easy to understand ahead of being capable.

Those principles are worth quoting because they explain most design decisions you will meet later. One is minimal changes to the model code when applying multi-dimensional parallelism, which is the difference between a parallelism system and a rewrite. The other is a stated bias toward a clean, minimal codebase while still providing basic reusable and swappable components. Extension points live in a separate document at `docs/extension.md`, and the model roster sits behind the same idea.

The repository is licensed BSD-3-Clause, is written in Python, and had 5753 stars with 997 forks and 736 open issues when last pushed on 2026-09-20. It is not archived. The README opens with an honesty note that most projects bury: torchtitan is under extensive development, and to use the latest features you are asked to run the most recent PyTorch nightly. There is also an arXiv paper, 2410.06511, and an ICLR 2025 poster, so the design has been through peer review even though the code moves nightly.

The parallelism list is the actual product

The Llama 3.1 walkthrough in the README enumerates fifteen key features, and the first four are the multi-dimensional composable parallelisms: FSDP2 with per-parameter sharding, tensor parallel including async tensor parallel, pipeline parallel for zero-bubble schedules, and context parallel for long sequences. Each of those links out to a PyTorch discussion rather than to a project document, which tells you where the design authority lives. torchtitan is the assembly layer; the mechanisms themselves are upstream PyTorch.

The rest of the list is where a training platform earns its keep. Meta device initialization avoids materializing full parameters on the host. Per-op selective and full activation checkpointing gives fine-grained control over what gets recomputed. Distributed checkpointing includes async modes, and there are interoperable checkpoints that load directly into `torchtune` for fine-tuning, which is the bridge between pretraining and the rest of a workflow.

Two entries are easy to skim past and matter a lot in practice. Gradient accumulation is derived from `--training.num_tokens_per_train_step`, so batch sizing is expressed in tokens rather than in a device count and a micro-batch count. And BF16 optimizer states exist as a documented option for reduced memory usage. The launch entry point is a shell script at the repository root, and the token-count flag is what you would set first:

bash
./run_train.sh --training.num_tokens_per_train_step

The learning rate scheduler is flexible warmup-stable-decay rather than a cosine default, and the README notes that loss, GPU memory, throughput in tokens per second, TFLOPs and MFU are displayed and logged through either Tensorboard or Weights & Biases.

Reading the model roster as a roadmap

Core models named in the README are Llama 3, Qwen3 / 3.5 / 3.8, DeepSeek V3 / V4, GPT-OSS, Kimi K2.7 / K3, Muse Glimmer and Flux. Read that list chronologically against the release notes and it becomes a record of what the PyTorch distributed stack could express at a given moment, which is more informative than a marketing claim about model support.

The v0.3.0 release, published 2026-09-03, added Qwen3.5 with variable-length attention, Kimi K2.7 with DistributedMuon overlap, Muse Glimmer 30B, DeepSeek V3 with multi-token prediction and fused MLA, and Flux compilation with MXFP8. Every one of those is a specific capability rather than a checkpoint import. Variable-length attention and fused MLA are the kind of change that alters how data flows through the pipeline, not just how weights are read.

Low-precision training is a through-line rather than a single feature. Float8 support is documented with its own how-to under `torchtitan/quantization/float8.md`, MXFP8 training for both dense and mixture-of-experts models is called out for Blackwell GPUs, and v0.2.1 enabled pipeline and expert parallelism overlap for MoE along with DeepEP integration and node-limited routing support. Context parallelism had already been added to Flux training by v0.2.1.

Two smaller signals point the same way. Supervised fine-tuning with chat-formatted datasets is listed among the core features, which means the repository is not pretraining-only, and an August 2026 news item describes `torchtitan/rl` as a hackable reinforcement learning stack that reuses model definitions and kernels across training and vLLM generation, with a batch-invariant mode.

The 0.3.0 configuration refactor is the thing to read first

The most consequential change in v0.3.0 is not a model. Recipes now support Python inheritance and typed CLI overrides, and an opt-in override registry lets external packages replace selected model or training components without modifying torchtitan core. Both landed as specific pull requests, a Python configuration refactor and an external override registry, which suggests they were designed together.

The override registry is the interesting half for anyone who wants to extend the platform without forking it. Replacing a component from outside the tree, gated behind an opt-in switch, is a smaller concession to fork pressure than a plugin API, and it keeps the burden of compatibility on the person registering the override. If you maintain an internal training stack, that is the seam to watch.

There is also a top-level `torchtitan_recipes/` directory sitting next to `torchtitan/`, plus `benchmarks/`, `scripts/`, `tests/` and `docs/`. Two repository-root files describe the ground rules: `CONTRIBUTING.md` for fixes to core, and a guidelines document under `torchtitan/experiments/` for new ideas, which the README says should start in that experiments folder. A `CITATION.cff` and an `AGENTS.md` are both present, and linting is set up through `.flake8` and `.pre-commit-config.yaml`.

One inconsistency is worth naming rather than resolving. The news log's most recent release mention is v0.2.0 from October 2025, while the published releases list also contains v0.2.1 in December 2025 and v0.2.2 in February 2026. Both facts are true; the news section simply lags the release feed, so treat the tags as authoritative over the changelog prose in the README.

Dependency pins and test coverage reveal the real constraints

`pyproject.toml` requires Python 3.11 or newer and takes its version from `assets/version.txt` through setuptools dynamic versioning rather than hard-coding it. That indirection is why the package metadata does not tell you which torchtitan you have without looking at the file or the release tag.

The dependency list is short and unusually opinionated about pinning. Statefulness for the data loader comes from `grain==0.2.18`, checkpointing from `torch_checkpointing`, Hugging Face integrations from `datasets>=3.6.0,<4.8.0` with `tokenizers>=0.15.0` and `renderers==0.1.11`, and there are `tyro`, `tensorboard`, `wandb`, `einops`, `pillow`, `spmd_types==0.2.5` and `attn-gym[linear]==0.0.10`. One entry is a commit pin rather than a version:

toml
requires-python = ">=3.11"
dependencies = [
    "grain==0.2.18",
    "datasets>=3.6.0,<4.8.0",
    "tokenizers>=0.15.0",
]

`torch_remat` is not pinned to a released version at all. It is installed straight from a git commit hash in the meta-pytorch remat repository, and both `pyproject.toml` and `requirements.txt` carry a comment asking that the pin be kept in sync between them. Pinning to a commit rather than a release is the kind of choice that tells you the project tracks upstream work that has not been published.

Test coverage is broad and asymmetric in an instructive way. The status table lists CPU unit tests, NVIDIA integration tests plus dedicated H100 and B200 workflows and GPU unit tests, and AMD ROCm integration tests with no ROCm unit row. The v0.2.2 notes pin the PyTorch version the release was built against, and the same notes mention ROCm mxfp8 support on gfx950 and peak-FLOP tables for NVIDIA H20. Meanwhile a `multinode_trainer.slurm` file at the root means multi-node scheduling has a committed starting point rather than living in a wiki.

Where the documentation stops and the ecosystem takes over

It is worth being clear about what this repository settles and what it does not. It settles the parallelism vocabulary, the feature list per model, the extension seams, and the launch entry point. It does not settle how to get a specific cluster to run, and it is candid that the newest features require a nightly PyTorch rather than a release.

Around that core sits a small but real ecosystem. AMD published an optimized fork for AMD GPUs in November 2025, and SkyPilot added torchtitan support in October 2025 with its own tutorial. Both are downstream adaptations of this code rather than features of it, and either may lag main. That pattern is normal for a platform that moves at the speed of the framework under it.

Data loading is configured rather than left to you. The README notes checkpointable data loading with the C4 dataset pre-configured at 144M entries, plus support for custom datasets. TorchFT integration is listed among the features, and v0.2.2 separated out training specifically for fault tolerance, which is the sort of change that only appears after someone lost a long run.

For a reader deciding whether to adopt it, the order that makes sense is the repository's own structure. Read the README feature list against the model you care about, then the FSDP document at `docs/fsdp.md` for the sharding model, then the recipes directory for how configuration is expected to be written, and only then the release notes for the 0.3.0 refactor. The paper and the ICLR poster are there if you want the design rationale behind the parallelism choices.

Editorial conclusion

torchtitan earns its place as a reading implementation first and a training platform second. The parallelism options, the activation checkpointing controls and the checkpoint format are the parts worth studying, because they show PyTorch's distributed features assembled without a framework layer in between. The version pinning is what a would-be adopter has to accept: the README asks for a PyTorch nightly, the 0.2.2 release notes pin one exact nightly build, and 0.3.0 replaced the Python configuration system outright. Start with `run_train.sh` on a single node using the C4 loader that is already configured, read `docs/fsdp.md` next, and only then decide whether the recipe system or the override registry fits the way your organization already runs training jobs.

Frequently asked questions

What is TorchTitan?

It is a PyTorch native platform and minimal clean-room implementation for training generative AI models at scale. The repository exists to assemble PyTorch's own distributed training features, such as FSDP2, tensor, pipeline and context parallelism, into readable reference code with extension points.

What are the key differences between TorchTitan and Megatron-LM?

The repository does not make that comparison anywhere in its own documentation, so treat third-party comparisons with care. What the README does state is its own position: a minimal PyTorch native codebase, minimal changes to model code when parallelism is applied, and basic swappable components rather than a broad framework surface.

Does torchtitan support mixture-of-experts models?

Yes. MXFP8 training is documented for both dense and MoE models, and the v0.2.1 release enabled pipeline and expert parallelism overlap for MoE, integrated DeepEP, and added node-limited routing support. DeepSeek V3 is one of the named core models.

Official sources

  1. Issues
  2. License: BSD-3-Clause
  3. pytorch/torchtitan on GitHub
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/pytorch-torchtitan.svg)](https://hysenlabs.com/projects/pytorch-torchtitan)

Was this useful?