TorchTitan backend configuration reference#
This page lists Primus preset keys and common TorchTitan JobConfig fields used when framework: torchtitan. Defaults are taken from the TorchTitan module preset (pre_trainer.yaml), its extends chain (module_base.yaml, quantize.yaml), and the example model preset llama3_8B.yaml. It is not a complete upstream TorchTitan JobConfig reference.
Where parameters live. Provide overrides under modules.pre_trainer.overrides: in your experiment YAML. TorchTitan’s JobConfig is hierarchical: use dot notation for flat overrides, or nest YAML objects under overrides—both are equivalent when merged.
Example (flat dot paths):
framework: torchtitan
modules:
pre_trainer:
overrides:
training.steps: 20000
training.global_batch_size: 512
optimizer.lr: 0.00015
parallelism.tensor_parallel_degree: 2
Example (nested YAML):
modules:
pre_trainer:
overrides:
training:
steps: 20000
global_batch_size: 512
optimizer:
lr: 0.00015
parallelism:
tensor_parallel_degree: 2
Presets.
Module presets:
primus/configs/modules/torchtitan/(main entry:pre_trainer.yaml).Model presets:
primus/configs/models/torchtitan/(example:llama3_8B.yaml).
Mapping to TorchTitan. Keys are translated into TorchTitan’s JobConfig via TorchTitanJobConfigBuilder (same nested structure as upstream TorchTitan).
Upstream reference. TorchTitan repository and documentation: pytorch/torchtitan (vendored as the third_party/torchtitan submodule).
1. Base module parameters#
Source: primus/configs/modules/module_base.yaml (merged before TorchTitan-specific keys; pre_trainer.yaml does not override trainable).
Parameter |
Default |
Description |
|---|---|---|
|
|
Whether this module is active in training orchestration. (TorchTitan preset inherits |
|
|
Structured logging sink level; |
|
|
Minimum level for file logging. |
|
|
Minimum level for stderr logging. |
2. Training (training.*)#
Source: primus/configs/modules/torchtitan/pre_trainer.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Primus preset extension: use synthetic data instead of reading |
|
|
Primus preset extension/debug helper to force MoE load balancing behavior. |
|
|
Dataset name key for TorchTitan dataset loaders. |
|
|
Filesystem or remote path to dataset assets. |
|
|
Prefer deterministic algorithms (often slower). |
|
|
Offload optimizer or activations to CPU when supported. |
|
|
Extra garbage-collection diagnostics. |
|
|
Run Python GC every N steps when enabled. |
|
|
Global batch size across all ranks ( |
|
|
Per-rank microbatch size before gradient accumulation. |
|
|
Gradient clipping max norm (global). |
|
|
Parameter dtype for mixed precision ( |
|
|
Dtype for reduction / gradient accumulation. |
|
|
RNG seed; |
|
|
Sequence length per sample. |
|
|
Total optimizer steps. |
3. Optimizer (optimizer.*)#
Source: pre_trainer.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Optimizer class ( |
|
|
Base learning rate. |
|
|
First moment decay. |
|
|
Second moment decay. |
|
|
Numerical stability term. |
|
|
Weight decay coefficient. |
|
|
Kernel implementation ( |
|
|
Experimental: step optimizer during backward when supported. |
4. Learning rate scheduler (lr_scheduler.*)#
Source: pre_trainer.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Fraction of training at the end used for decay; |
|
|
LR decay curve ( |
|
|
LR floor as a fraction of base LR after decay. |
|
|
Linear warmup steps before decay. |
5. Parallelism (parallelism.*)#
Source: pre_trainer.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Tensor parallelism (intra-layer) degree. |
|
|
Pipeline parallelism stages. |
|
|
Microbatches per pipeline round. |
|
|
Pipeline schedule name ( |
|
|
Optional CSV schedule definition. |
|
|
Layer indices for manual PP splits. |
|
|
Layers per stage when auto-balanced. |
|
|
Fewer layers on first PP stage (for imbalance). |
|
|
Fewer layers on last PP stage. |
|
|
FSDP / shard degree ( |
|
|
Replicated data-parallel groups. |
|
|
Expert parallelism for MoE models. |
|
|
Tensor parallelism inside experts. |
|
|
Context (sequence) parallelism degree. |
|
|
Communication pattern for context parallel. |
|
|
Disable loss parallel layout when TP is used. |
|
|
Overlap TP collectives with compute. |
|
|
Use |
|
|
FSDP reshard policy ( |
|
|
Map of pipeline stage → module FQNs for multi-part models. |
6. Checkpoint (checkpoint.*)#
Source: pre_trainer.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Master switch for checkpointing. |
|
|
Output directory for checkpoints. |
|
|
Save every N steps. |
|
|
Path to load from at startup. |
|
|
Load weights only (skip optimizer/scheduler). |
|
|
Load initial weights from Hugging Face format. |
|
|
Final save stores weights only. |
|
|
Export final weights in Hugging Face format. |
|
|
Dtype for exported checkpoints. |
|
|
Async checkpoint ( |
|
|
Retain only the newest k checkpoints. |
|
|
Step index to load ( |
|
|
FQNs or keys to skip when loading. |
|
|
Save checkpoint at step 0 for debugging. |
|
|
Save a seed checkpoint before training starts. |
7. Activation checkpoint (activation_checkpoint.*)#
Source: pre_trainer.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Activation checkpointing mode ( |
|
|
Selective AC policy string (TorchTitan-specific). |
|
|
FQNs that always recompute matmuls in selective AC. |
|
|
Stop AC early in certain subgraphs. |
8. Metrics and profiling#
8.1 Metrics (metrics.*)#
Source: pre_trainer.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Disable ANSI colors in logs. |
|
|
Write TensorBoard scalars. |
|
|
Log to Weights & Biases. |
|
|
Steps between metric logs. |
|
|
Save metric files per rank (not just rank 0). |
|
|
TensorBoard subdirectory / name. |
8.2 Profiling (profiling.*)#
Source: pre_trainer.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Enable PyTorch profiler traces. |
|
|
Capture CUDA memory snapshots. |
|
|
Steps between profiler activations. |
|
|
Directory for profiler traces. |
|
|
Directory for memory snapshots. |
9. Quantization (quantize.*)#
Source: primus/configs/modules/torchtitan/quantize.yaml (merged into the module preset).
9.1 Linear FP8 (quantize.linear.float8.*)#
Parameter |
Default |
Description |
|---|---|---|
|
|
FP8 all-gather for FSDP sharded params (recommended for tensorwise scaling). |
|
|
Precompute dynamic scales for FSDP FP8. |
|
|
Recipe ( |
|
|
Module FQNs to skip for FP8 training. |
|
|
Emulate FP8 in FP32 (no FP8 HW); not compatible with |
9.2 Linear MX (quantize.linear.mx.*)#
Parameter |
Default |
Description |
|---|---|---|
|
|
Kernel backend for MXFP8 dim-1 cast ( |
|
|
MX recipe name (see torchao |
|
|
FQNs to skip; output layer skipped by default. |
9.3 Grouped GEMM FP8 (quantize.grouped_mm.float8.*)#
Parameter |
Default |
Description |
|---|---|---|
|
|
MoE layer FQNs for FP8 grouped GEMM (prototype; may require torchao nightly). |
9.4 Grouped GEMM MX (quantize.grouped_mm.mx.*)#
Parameter |
Default |
Description |
|---|---|---|
|
|
MX recipe for grouped GEMMs. |
|
|
MoE module FQNs for MXFP8 grouped GEMM (prototype). |
10. Compile (compile.*)#
Source: pre_trainer.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Enable |
|
|
Which components to compile. |
11. Communication and fault tolerance#
11.1 Communicator (comm.*)#
Source: pre_trainer.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Timeout for initial process-group setup. |
|
|
Timeout for training collectives. |
|
|
Flight recorder buffer size for NCCL traces. |
|
|
Where to dump communication traces. |
11.2 Fault tolerance (fault_tolerance.*)#
Parameter |
Default |
Description |
|---|---|---|
|
|
Enable fault-tolerant training hooks. |
|
|
Backend for control-plane process group. |
|
|
Control-plane timeout. |
|
|
Replica index in elastic setups. |
|
|
Group size (0 = unset / default). |
|
|
Minimum replicas to continue. |
|
|
Optional semi-synchronous strategy name. |
11.3 Memory estimation (memory_estimation.*)#
Parameter |
Default |
Description |
|---|---|---|
|
|
Run memory-estimation fake-mode passes. |
|
|
Disable fake tensor mode inside estimation. |
11.4 Experimental (experimental.*)#
Parameter |
Default |
Description |
|---|---|---|
|
|
Optional Python module import path for custom extensions. |
|
|
Module providing extra |
12. Primus-Turbo (primus_turbo.*)#
Source: pre_trainer.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Master switch for Primus-Turbo integrations in TorchTitan. |
|
|
FP8 attention path inside Turbo attention. |
|
|
Use Turbo attention kernels. |
|
|
Fall back to classic attention implementation. |
|
|
Async tensor-parallel communication in Turbo. |
|
|
MX linear layers via Turbo. |
|
|
FP8 linear layers via Turbo. |
|
|
Turbo grouped GEMM for MoE (off by default). |
|
|
FP8 paths for MoE experts when applicable. |
|
|
Autocast policy around embeddings for Turbo. |
13. Model (model.* and job.*)#
13.1 Model preset (models.* / model.*)#
Example defaults from primus/configs/models/torchtitan/llama3_8B.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Model family key for TorchTitan recipes. |
|
|
Size / variant within the family. |
|
|
Hugging Face Hub repo or local path for weights/tokenizer. |
|
|
Weight converter pipeline stages applied at load. |
13.2 Job metadata (job.*)#
Source: llama3_8B.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Root directory for logs, checkpoints, and exports. |
|
|
Human-readable label for run metadata. |
14. Validation (validation.*)#
Source: pre_trainer.yaml.
Parameter |
Default |
Description |
|---|---|---|
|
|
Run periodic validation loops. |
|
|
Validation dataset key. |
|
|
Filesystem path to validation data. |
|
|
Per-rank validation batch size. |
|
|
Validation sequence length. |
|
|
Run validation every N training steps. |
|
|
Max validation steps ( |