ForkTogether AITogether AIpublished Jun 24, 2025seen 5d

togethercomputer/torchtitan

forked from pytorch/torchtitan

Open original ↗

Captured source

source ↗
published Jun 24, 2025seen 5dcaptured 9hhttp 200method plain

togethercomputer/torchtitan

Description: A PyTorch native platform for training generative AI models

License: BSD-3-Clause

Stars: 0

Forks: 0

Open issues: 0

Created: 2025-06-24T09:06:34Z

Pushed: 2025-07-21T10:35:47Z

Default branch: main

Fork: yes

Parent repository: pytorch/torchtitan

Archived: no

README:

torchtitan is currently in a pre-release state and under extensive development. We showcase training Llama 3.1 LLMs at scale, and are working on other types of generative AI models, including LLMs with MoE architectures, multimodal LLMs, and diffusion models, in the [experiments](torchtitan/experiments) folder. To use the latest features of torchtitan, we recommend using the most recent PyTorch nightly.

Latest News

  • [2025/04] Our paper was accepted by ICLR 2025.
  • [2025/04] [Llama 4](torchtitan/experiments/llama4/) initial support is available as an experiment.
  • [2025/04] Training the diffusion model [FLUX](torchtitan/experiments/flux/) with FSDP/HSDP is available as an experiment.
  • [2025/04] The frontend implementation of [SimpleFSDP](torchtitan/experiments/simple_fsdp/), a compiler-based FSDP framework, is available as an experiment.
  • [2024/12] GPU MODE lecture on torchtitan.
  • [2024/11] Presentation at an AI/ML Infra Meetup.
  • [2024/07] Presentation at PyTorch Conference 2024.
  • [2024/04] Intro video - learn more about torchtitan in under 4 minutes.

Overview

torchtitan is a PyTorch native platform designed for rapid experimentation and large-scale training of generative AI models. As a minimal clean-room implementation of PyTorch native scaling techniques, torchtitan provides a flexible foundation for developers to build upon. With torchtitan [extension points](docs/extension.md), one can easily create custom extensions tailored to specific needs.

Our mission is to accelerate innovation in the field of generative AI by empowering researchers and developers to explore new modeling architectures and infrastructure techniques.

The guiding principles when building torchtitan

  • Designed to be easy to understand, use and extend for different training purposes.
  • Minimal changes to the model code when applying multi-dimensional parallelism.
  • Bias towards a clean, minimal codebase while providing basic reusable / swappable components.

torchtitan has been showcasing PyTorch's latest distributed training features, via pretraining Llama 3.1 LLMs of various sizes. To accelerate contributions to and innovations around torchtitan, we are hosting a new [experiments](torchtitan/experiments) folder. We look forward to your contributions!

Llama 3.1 pretraining

Key features available

1. Multi-dimensional composable parallelisms

2. Meta device initialization 3. Selective (layer or operator) and full activation checkpointing 4. Distributed checkpointing (including async checkpointing)

  • [Interoperable checkpoints](docs/checkpoint.md) which can be loaded directly into `torchtune` for fine-tuning

5. torch.compile support 6. Float8 support ([how-to](docs/float8.md)) 7. DDP and HSDP 8. TorchFT integration 9. Checkpointable data-loading, with the C4 dataset pre-configured (144M entries) and support for [custom datasets](docs/datasets.md) 10. Gradient accumulation, enabled by giving an additional --training.global_batch_size argument in configuration 11. Flexible learning rate scheduler (warmup-stable-decay) 12. Loss, GPU memory, throughput (tokens/sec), TFLOPs, and MFU displayed and logged via [Tensorboard or Weights & Biases](/docs/metrics.md) 13. [Debugging tools](docs/debugging.md) including CPU/GPU profiling, memory profiling, Flight Recorder, etc. 14. All options easily configured via [toml files](torchtitan/models/llama3/train_configs/) 15. [Helper scripts](scripts/) to

  • download tokenizers from Hugging Face
  • convert original Llama 3 checkpoints into the expected DCP format
  • estimate FSDP/HSDP memory usage without materializing the model
  • run distributed inference with Tensor Parallel

We report [performance](benchmarks/llama3_h100_202412_torchtitan.md) on up to 512 GPUs, and verify [loss converging](docs/converging.md) correctness of various techniques.

Dive into the code

You may want to see how the model is defined or how parallelism techniques are applied. For a guided tour, see these files first:

  • [torchtitan/train.py](torchtitan/train.py) - the main training loop and high-level setup code
  • [torchtitan/models/llama3/model/model.py](torchtitan/models/llama3/model/model.py) - the Llama 3.1 model definition
  • [torchtitan/models/llama3/infra/parallelize.py](torchtitan/models/llama3/infra/parallelize.py) - helpers for applying Data Parallel, Tensor Parallel, activation checkpointing, and torch.compile to the model
  • [torchtitan/models/llama3/infra/pipeline.py](torchtitan/models/llama3/infra/pipeline.py) - helpers for applying Pipeline Parallel to the model
  • [torchtitan/components/checkpoint.py](torchtitan/components/checkpoint.py) - utils for saving/loading distributed checkpoints
  • [torchtitan/components/quantization/float8.py](torchtitan/components/quantization/float8.py) - utils for applying Float8 techniques

Installation

git clone…

Excerpt shown — open the source for the full document.

Notability

notability 2.0/10

Routine fork by company