distributed-llm-pretraining-torchtitan

Pretrain large language models from scratch using PyTorch-native 4D parallelism.

11.5k|842|Updated Nov 3, 2025
One-click install
npx skills add https://github.com/Orchestra-Research/AI-Research-SKILLs --skill distributed-llm-pretraining-torchtitan-orchestra-research
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: distributed-llm-pretraining-torchtitan
Source: https://github.com/Orchestra-Research/AI-Research-SKILLs/tree/main/01-model-architecture/torchtitan
Command: npx skills add https://github.com/Orchestra-Research/AI-Research-SKILLs --skill distributed-llm-pretraining-torchtitan-orchestra-research

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the immense computational challenge of pretraining large language models (LLMs) from scratch, enabling researchers and engineers to train models from 8 billion to over 400 billion parameters efficiently.

Core Features & Use Cases

  • 4D Parallelism: Leverages Tensor Parallelism (TP), Pipeline Parallelism (PP), Context Parallelism (CP), and Fully Sharded Data Parallelism (FSDP2) for massive scalability.
  • Optimized Performance: Supports Float8 precision for significant speedups on H100 GPUs and integrates torch.compile for fused kernels.
  • Use Case: Pretraining a Llama 3.1 70B model across 256 GPUs using a combination of FSDP and Tensor Parallelism, achieving high throughput and efficient resource utilization.

Quick Start

Launch Llama 3.1 8B pretraining on 8 GPUs using the default configuration file.

Frequently Asked Questions about distributed-llm-pretraining-torchtitan

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I pretrain a large language model from scratch using PyTorch distributed training?

Pretraining LLMs from scratch is enabled by PyTorch-native distributed training with composable 4D parallelism including FSDP2, Tensor Parallelism, Pipeline Parallelism, and Context Parallelism. It scales efficiently for models ranging from 8B to over 405B parameters.

What is 4D parallelism and how does it scale LLM pretraining?

4D parallelism combines Tensor Parallelism, Pipeline Parallelism, Context Parallelism, and FSDP2 to scale LLM pretraining across massive GPU clusters. This composable PyTorch-native approach enables high throughput and efficient resource utilization for models up to 405B+ parameters.

Can I use Float8 precision for LLM pretraining on H100 GPUs?

Yes, Float8 precision is supported to achieve significant speedups on NVIDIA H100+ GPUs during distributed LLM pretraining. The framework also integrates torch.compile for fused kernels to maximize training throughput.

Does this distributed training approach work with HuggingFace checkpoints?

Yes, the distributed training framework provides interoperable checkpoints with HuggingFace and torchtune. This allows seamless integration and checkpoint conversion for models pretraining from scratch using 4D parallelism.

What's the best way to start pretraining a Llama 3.1 8B model on 8 GPUs?

You can start Llama 3.1 8B pretraining on 8 GPUs using the provided default configuration file. This leverages composable 4D parallelism and FSDP2 to efficiently launch distributed training from scratch.

When do I need to use Pipeline Parallelism and Context Parallelism for distributed training?

Pipeline Parallelism and Context Parallelism are needed when scaling LLM pretraining to massive models like 405B+ parameters. They work alongside Tensor Parallelism and FSDP2 to partition model layers and long sequences across GPUs for maximum throughput.