distributed-llm-pretraining-torchtitan

Pretrains large language models at scale using TorchTitan with 4D parallelism on PyTorch.

Updated Mar 23, 2026
One-click install
npx skills add https://github.com/hanasho744/codex --skill distributed-llm-pretraining-torchtitan-hanasho744
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: distributed-llm-pretraining-torchtitan
Source: https://github.com/hanasho744/codex/tree/main/.agents/skills/orchestra-torchtitan
Command: npx skills add https://github.com/hanasho744/codex --skill distributed-llm-pretraining-torchtitan-hanasho744

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch>=2.6.0, torchtitan>=0.2.0, torchao>=0.5.0, and includes references (resource) components.

What problem does it solve? Pretraining large language models from scratch across hundreds of GPUs requires coordinating complex parallelism strategies, memory optimization, and fault-tolerant checkpointing, which is difficult to configure correctly without deep distributed systems expertise. ## Core Features & Use Cases - 4D Parallelism Configuration: Compose FSDP2, Tensor Parallel, Pipeline Parallel, and Context Parallel strategies for models from 8B to 405B+ parameters across 8 to 512+ GPUs. - Float8 and torch.compile Optimization: Enable Float8 training with torchao and torch.compile for up to 48% throughput gains on H100 GPUs. - Distributed Checkpointing: Save, resume, reshard, and convert checkpoints between TorchTitan, HuggingFace, and torchtune formats using PyTorch Distributed Checkpoint. - Use Case: A research team wants to pretrain a Llama 3.1 70B model on 256 GPUs across 32 SLURM-managed nodes. This Skill provides the TOML configuration, SLURM script, parallelism degrees, and checkpoint resume workflow to launch and monitor the run. ## Quick Start Ask the AI to configure and launch a TorchTitan pretraining run for Llama 3.1 8B on 8 GPUs with a TOML config and checkpointing enabled.

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 Llama 3.1 model on multiple GPUs with PyTorch?▼

Use TorchTitan with a TOML config specifying the model flavor, dataset, and parallelism degrees, then launch with torchrun or the run_train.sh script. FSDP2 shards the model across all GPUs by default when data_parallel_shard_degree is set to -1.

TorchTitan vs Megatron-LM for LLM pretraining?▼

TorchTitan is PyTorch-native with composable 4D parallelism and no third-party dependencies, making it easier to modify and integrate with torchtune and HuggingFace. Megatron-LM may offer maximum performance for NVIDIA-only deployments but with a heavier framework.

Does TorchTitan support Float8 training on H100 GPUs?▼

Yes, TorchTitan supports Float8 training on H100 GPUs via torchao with tensorwise or rowwise scaling. Benchmarks show up to 48% throughput improvement when combined with torch.compile, though small layers should be filtered out.

How do I resume TorchTitan training from a checkpoint?▼

Training auto-resumes from the latest checkpoint in the configured folder when checkpointing is enabled. To resume from a specific step, set load_step in the checkpoint config section of your TOML file.

Why does TorchTitan run out of memory on large models?▼

Out-of-memory errors occur when activation memory exceeds GPU capacity. Enable full activation checkpointing, reduce local_batch_size, use gradient accumulation, or increase parallelism degrees to shard the model across more GPUs.

Can I convert TorchTitan checkpoints to HuggingFace format?▼

Yes, TorchTitan supports saving directly in HuggingFace format during training or offline conversion using the convert_to_hf.py and convert_from_hf.py scripts. Checkpoints also interoperate with torchtune for fine-tuning.