distributed-llm-pretraining-torchtitan

Pretrain large language models at scale using PyTorch-native 4D parallelism with torchtitan.

1|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/kaminocorp/hermes-alpha-hunter --skill distributed-llm-pretraining-torchtitan-kaminocorp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: distributed-llm-pretraining-torchtitan
Source: https://github.com/kaminocorp/hermes-alpha-hunter/tree/main/skills/mlops/training/torchtitan
Command: npx skills add https://github.com/kaminocorp/hermes-alpha-hunter --skill distributed-llm-pretraining-torchtitan-kaminocorp

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 requires coordinating complex distributed training strategies across hundreds of GPUs, and misconfiguring parallelism, checkpointing, or precision settings leads to out-of-memory failures, wasted compute, and lost training progress. ## Core Features & Use Cases - 4D Parallelism Configuration: Compose FSDP2, Tensor Parallelism, Pipeline Parallelism, and Context Parallelism to scale 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: Use PyTorch Distributed Checkpoint for fault-tolerant saves, async checkpointing, seed checkpoints for pipeline parallelism, and HuggingFace format conversion. - Use Case: A research team wants to pretrain a Llama 3.1 70B model on a 32-node SLURM cluster. This Skill provides the TOML configuration, SLURM script, parallelism degrees, and checkpoint resume workflow to launch and monitor the run. ## Quick Start Ask the agent to configure and launch a torchtitan pretraining run for Llama 3.1 8B on 8 GPUs with a TOML config 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 Llama 3.1 8B on multiple GPUs with torchtitan?

Download the tokenizer with the download_hf_assets script, create a TOML config specifying the llama3 model and 8B flavor, then launch with torchrun using 8 processes per node. Training logs to TensorBoard and checkpoints save at configured intervals.

Torchtitan vs Megatron-LM vs DeepSpeed for LLM pretraining?

Torchtitan is PyTorch-native with composable 4D parallelism and no third-party dependencies, ideal for pretraining from scratch. Megatron-LM targets maximum NVIDIA-only performance, while DeepSpeed offers a broader ZeRO optimization ecosystem and inference support.

Does torchtitan support Float8 training on H100 GPUs?

Yes, torchtitan supports Float8 training on H100 or newer GPUs via torchao with tensorwise or rowwise scaling. Combined with torch.compile, benchmarks show up to 48% throughput improvement over FSDP baselines on Llama 8B.

How do I fix out of memory errors during torchtitan training?

Enable full activation checkpointing instead of selective mode and reduce local batch size in the TOML config. You can also use gradient accumulation by setting a larger global batch size while keeping local batch size at 1.

Can torchtitan checkpoints be converted to HuggingFace format?

Yes, torchtitan supports saving directly in HuggingFace format during training or offline conversion using the convert_to_hf and convert_from_hf scripts. Checkpoints saved with last_save_model_only also load directly into torchtune for fine-tuning.

Why does pipeline parallelism training fail to initialize in torchtitan?

Pipeline parallelism requires a seed checkpoint created on a single device to ensure consistent initialization across all PP stages. Run one training step with all parallelism degrees set to 1 and create_seed_checkpoint enabled before launching the full job.