Logging and experiment tracking#
This guide covers how Primus emits training metrics and logs, and how to wire up the supported experiment trackers—TensorBoard, Weights & Biases (WandB), and MLflow (including Databricks-hosted MLflow)—across the Megatron and TorchTitan backends. Parameters are grounded in primus/configs/modules/megatron/trainer_base.yaml, primus_megatron_module.yaml, and primus/configs/modules/torchtitan/pre_trainer.yaml.
For an operations-oriented overview, see Monitoring and logging. For required credentials/keys, see Environment variables.
1. Tracker toggles at a glance (Megatron)#
All three trackers are opt-in and disabled by default (primus/configs/modules/megatron/primus_megatron_module.yaml):
disable_tensorboard: true
disable_wandb: true
disable_mlflow: true
Set the relevant disable_* to false to enable a tracker. Primus performs validation checks at startup—e.g. it warns if WandB is enabled but WANDB_API_KEY is unset (primus/backends/megatron/patches/args/wandb_config_patches.py). MLflow logging is initialized in primus/backends/megatron/training/global_vars.py; Databricks-hosted MLflow additionally requires DATABRICKS_HOST (read by the mlflow client).
2. Console and step logging (Megatron)#
Core logging cadence and content (trainer_base.yaml, overridden by pre_trainer.yaml):
Parameter |
Default |
Purpose |
|---|---|---|
|
|
Steps between log lines. |
|
|
Log tokens/s and TFLOP/s throughput. |
|
|
Log progress/ETA. |
|
|
Log parameter L2 norm. |
|
|
Log gradient sparsity. |
|
|
Warmup iterations excluded from averages. |
|
|
Reset window for running averages. |
|
|
Verbosity of timer breakdowns. |
|
|
Timer aggregation across ranks. |
|
|
Python logging level override. |
3. TensorBoard (Megatron)#
Enable with disable_tensorboard: false and set an output directory:
Parameter |
Default |
Purpose |
|---|---|---|
|
|
Output directory for event files (required when enabled). |
|
|
Steps between TensorBoard writes. |
|
|
Event queue size before flush. |
|
|
Log LR. |
|
|
Log loss scale (mixed precision). |
|
|
Log per-stage timers. |
|
|
Log batch size. |
|
|
Log GPU memory. |
|
|
Log world size. |
|
|
Log validation perplexity. |
4. Weights and biases (Megatron)#
Enable with disable_wandb: false. Configuration:
Parameter |
Default |
Purpose |
|---|---|---|
|
|
WandB project name. |
|
|
Run/experiment name. |
|
|
Local directory for WandB files. |
|
|
Team/entity. |
Credentials (see Environment variables):
export WANDB_API_KEY=... # required when WandB is enabled
export WANDB_PROJECT=... # optional
export WANDB_RUN_NAME=... # optional
export WANDB_TEAM=... # optional (entity)
WANDB_API_KEY is on the container passthrough allowlist (runner/.primus.yaml), so it propagates into the training container.
5. MLflow (Megatron)#
Enable with disable_mlflow: false. Run identification and upload behavior:
Parameter |
Default |
Purpose |
|---|---|---|
|
|
MLflow run name. |
|
|
MLflow experiment name. |
|
|
Upload profiler trace files. |
|
|
Upload training log files. |
|
|
Upload the comprehensive perf/memory/utilization metric set (implicitly enables throughput calc). |
|
|
Generate + upload TraceLens reports (see Profiling & observability). |
Credentials and endpoints:
export MLFLOW_TRACKING_URI=... # tracking server URI
export MLFLOW_REGISTRY_URI=... # optional model registry
# Databricks-hosted MLflow:
export DATABRICKS_HOST=... # checked at startup when MLflow is enabled
export DATABRICKS_TOKEN=...
The
mlflow_upload_*flags are designed so MLflow stays opt-in: they only take effect whendisable_mlflow: false.
6. One-logger (Megatron)#
NVIDIA One-Logger telemetry is enabled by default in trainer_base.yaml:
Parameter |
Default |
Purpose |
|---|---|---|
|
|
Enable One-Logger collection. |
|
|
Project tag. |
|
|
Run name. |
|
|
Async upload. |
|
|
Application tags. |
7. Metrics and logging (TorchTitan)#
Configured under metrics: in primus/configs/modules/torchtitan/pre_trainer.yaml:
Parameter |
Default |
Purpose |
|---|---|---|
|
|
Enable TensorBoard logging. |
|
|
Enable WandB logging. |
|
|
Steps between metric logs. |
|
|
TensorBoard output subfolder. |
|
|
Write metrics from every rank (default: rank 0 only). |
|
|
Disable ANSI colors in console output. |
TorchTitan reads WandB settings from the environment (WANDB_PROJECT, WANDB_RUN_NAME, WANDB_TEAM) via primus/backends/torchtitan/patches/wandb_patches.py and third_party/torchtitan/torchtitan/components/metrics.py.
8. Logging (MaxText)#
MaxText logging cadence is controlled by log_period (primus/configs/modules/maxtext/pre_trainer.yaml, default 100). See MaxText parameters.
9. Recommended setup#
Local-only: enable TensorBoard (
disable_tensorboard: false, settensorboard_dir)—no credentials required.Team tracking: enable WandB (
disable_wandb: false) + exportWANDB_API_KEYandwandb_project/wandb_entity.Enterprise / scaling studies: enable MLflow (
disable_mlflow: false) +MLFLOW_TRACKING_URI(or Databricks host/token), and turn onmlflow_upload_performance_metricsfor throughput/memory/utilization dashboards.Keep
WANDB_API_KEYand tokens out of YAML—pass them as environment variables (allowlisted for container passthrough). See Security.