Skip to content
SurogateSurogateDocs
↑↓ to move↵ to openesc to close

Training Metrics & Monitoring

Surogate logs training metrics to a JSON file, to stdout, and to external backends such as Weights & Biases (wandb) or Aim (see Logging & reporting). This page lists what each metric means and where to find it.

CategoryMetricsDescription
Trainingloss, norm, lr, epoch, tpsCore training progress
Evaluationloss, tpsValidation performance
GPUpower, temperature, utilization, memory, PCIeHardware monitoring
MoEaux_loss, z_loss, utilization, imbalanceRouter health (MoE models only)
Distillationkd_lossTeacher-student KL (KD training only)
PerformanceSOL, FLOPsSpeed-of-Light estimates
Memoryallocations by segmentMemory usage breakdown

Logged on every training step by log_step():

MetricTypeDescription
loss#floatCross-entropy loss for the current step
norm#floatGradient norm (L2) after clipping
lr#floatCurrent learning rate
epoch#floatFractional epoch progress (e.g., 1.25 = 25% through epoch 2)
step_tokens#intNumber of tokens processed this step
duration_ms#intStep duration in milliseconds
tokens_per_second#floatThroughput (computed: step_tokens / duration_ms * 1000)

Dense models:

:: step 100 [ 12.5%] \ loss 2.3456 | norm 0.1234 | 125.3k tps | 156 ms | sol 78.2 | eta 02h15m

MoE models also show aux_loss and load_imbalance on the line:

:: step 100 [ 12.5%] \ loss 2.3456 | norm 0.1234 | 125.3k tps | 156 ms | aux 0.0234 | imbal 1.45 | sol 78.2 | eta 02h15m

Knowledge distillation also shows kd_loss on the line:

:: step 100 [ 12.5%] \ loss 2.3456 | norm 0.1234 | 125.3k tps | 156 ms | kd 0.5678 | sol 78.2 | eta 02h15m

Legend:

  • \ / : loss trend (decreasing/increasing)
  • ! before norm: gradient spike detected (>5x the moving average)
  • aux: MoE auxiliary load-balancing loss (MoE models only)
  • imbal: MoE load imbalance ratio (MoE models only)
  • kd: distillation KL term (KD training only, see below)
  • sol: speed-of-light percentage (actual vs theoretical peak)
  • eta: estimated time remaining

Dense models:

json
{
"log": "step",
"time": "2026-01-15T10:30:00.123456",
"step": 100,
"epoch": 1.25,
"step_tokens": 16384,
"duration_ms": 156,
"norm": 0.1234,
"loss": 2.3456,
"lr": 0.0002
}

MoE models add the MoE metrics to the same line:

json
{
"log": "step",
"time": "2026-01-15T10:30:00.123456",
"step": 100,
"epoch": 1.25,
"step_tokens": 16384,
"duration_ms": 156,
"norm": 0.1234,
"loss": 2.3456,
"lr": 0.0002,
"moe_aux_loss": 0.023400,
"moe_z_loss": 0.001200,
"moe_load_imbalance": 1.4500
}

Knowledge distillation adds kd_loss to the step line:

json
{
"log": "step",
"step": 100,
"loss": 2.3456,
"lr": 0.0002,
"kd_loss": 0.5678
}

kd_loss is the mean τ²-scaled KL divergence τ² · KL(teacher_topk ‖ student) per valid token. It is accumulated over the micro-steps of the optimizer step and reported for rank 0 only. loss stays the plain (unweighted) cross-entropy, and the objective being optimized is ce_weight · loss + kd_weight · kd_loss. See the Knowledge Distillation guide. For MoE models the step line carries the MoE metrics instead.

Logged during validation by log_eval():

MetricTypeDescription
loss#floatEvaluation loss
eval_tokens#intNumber of tokens evaluated
duration_ms#intEvaluation duration
tokens_per_second#floatEvaluation throughput
gap#floatDifference between eval loss and average train loss (console only)
>> eval loss 2.1234 | gap +0.0123 | 145.2k tps | 234 ms
json
{
"log": "eval",
"time": "2026-01-15T10:35:00.123456",
"step": 500,
"epoch": 1.5,
"eval_tokens": 32768,
"duration_ms": 234,
"loss": 2.1234
}

For Mixture-of-Experts models (such as Qwen3-MoE), extra metrics track router health. The MoE guide explains how to turn them on and read them.

MetricTypeRangeDescription
aux_loss#float≥0Load balancing auxiliary loss (sum across layers)
z_loss#float≥0Router z-loss for logit regularization (sum across layers)
expert_utilization#float0-1Fraction of experts receiving tokens (average across layers)
load_imbalance#float≥1Ratio of max to mean token counts per expert (1.0 = perfect)
MetricHealthy RangeWarning Signs
aux_loss#0.001-0.1>1.0 indicates severe load imbalance
z_loss#0.0001-0.01>0.1 may indicate routing collapse
expert_utilization#0.8-1.0<0.5 means many experts are unused
load_imbalance#1.0-2.0>3.0 indicates poor load distribution
json
{
"log": "moe",
"time": "2026-01-15T10:30:00.123456",
"step": 100,
"aux_loss": 0.0234,
"z_loss": 0.0012,
"expert_utilization": 0.9375,
"load_imbalance": 1.45
}

Weights & Biases:

  • train/aux_loss
  • train/z_loss
  • train/expert_utilization
  • train/load_imbalance

Aim:

  • The same metric names, tracked with run.track()

Hardware telemetry logged by log_gpu_state() (the interval is log_gpu_util, see Logging & reporting):

MetricUnitDescription
clock#MHzCurrent GPU clock speed
max_clock#MHzMaximum GPU clock speed
power#mWCurrent power draw
power_limit#mWConfigured power limit
temperature#°CGPU temperature
temp_slowdown#°CTemperature throttling threshold
gpu_util#%GPU compute utilization
mem_util#%GPU memory utilization
dram_free#bytesFree GPU memory
pcie_rx#bytes/sPCIe receive bandwidth
pcie_tx#bytes/sPCIe transmit bandwidth
fan#%Fan speed (0 if passive cooling)
throttle#stringThrottling reason (if any)
json
{
"log": "gpu",
"time": "2026-01-15T10:30:00.123456",
"step": 100,
"id": 0,
"clock": 1800,
"max_clock": 2100,
"fan": 65,
"power": 350000,
"power_limit": 400000,
"temperature": 72,
"temp_slowdown": 83,
"gpu_util": 98,
"mem_util": 85,
"throttle": "",
"dram_free": 8589934592,
"pcie_rx": 1073741824,
"pcie_tx": 536870912
}

Weights & Biases:

  • gpu/clock, gpu/power, gpu/temperature, etc.
  • dram_free converted to MiB
  • pcie_rx/pcie_tx converted to MiB/s

Aim:

  • gpu/{gpu_id}/{metric_name} (e.g., gpu/0/power)

Theoretical peak performance estimates, logged by log_sol_estimate():

MetricTypeDescription
blocks#FLOPsFloating-point operations in transformer blocks
lm_head#FLOPsFloating-point operations in LM head
attention#FLOPsFloating-point operations in attention
tps#intTheoretical peak tokens/second
tf32_peak#TFLOP/sGPU peak TF32 throughput
bf16_peak#TFLOP/sGPU peak BF16 throughput
fp16_peak#TFLOP/sGPU peak FP16 throughput
fp8_peak#TFLOP/sGPU peak FP8 throughput
[Speed of Light]
Peak BF16: 989.5 TFLOP/s
Blocks: 123.4 GFLOP in bf16
LM-Head: 45.6 GFLOP in bf16
Attention: 78.9 GFLOP in bf16
SOL: 156000 tok/s

Each training step shows the SOL percentage in the console:

:: step 100 [ 12.5%] \ loss 2.3456 | norm 0.1234 | 125.3k tps | 156 ms | sol 78.2

It is (theoretical_time / actual_time) * 100. Higher is better, and 80%+ is excellent. If it stays low, the Performance guide covers what to tune.

Memory allocations, logged by log_allocator(). For a more detailed breakdown, see debug_memory_breakdown under Debugging options.

FieldTypeDescription
name#stringAllocator segment name
device#bytesGPU device memory
managed#bytesCUDA managed memory
pinned#bytesPinned host memory
pageable#bytesPageable host memory
SegmentDescription
weights#Model weights
gradients#Gradient buffers
optimizer#Optimizer state (momentum, variance)
activations#Forward pass activations
lora#LoRA adapter weights
qlora#QLoRA quantized weights and scales
json
{
"log": "allocator",
"time": "2026-01-15T10:30:00.123456",
"step": 0,
"stats": [
{"name": "weights", "device": 4294967296, "managed": 0, "pinned": 0, "pageable": 0},
{"name": "gradients", "device": 1073741824, "managed": 0, "pinned": 0, "pageable": 0},
{"name": "optimizer", "device": 2147483648, "managed": 0, "pinned": 8589934592, "pageable": 0}
]
}

Weights & Biases:

  • A pie chart of GPU allocations by segment

Aim:

  • allocator/{segment_name}_mib for each segment

Dataset information logged at startup by log_dataset():

FieldTypeDescription
split#string“train” or “eval”
files#intNumber of data files
tokens#intTotal tokens in split
file_index#intCurrent file index
chunk_index#intCurrent chunk index
seed#intRandom seed for shuffling

Hardware information logged at startup by log_gpu_model():

FieldTypeDescription
name#stringGPU model name (e.g., “NVIDIA H100 80GB HBM3”)
sm_count#intNumber of streaming multiprocessors
major/minorintCUDA compute capability
memory#bytesTotal GPU memory
free#bytesFree GPU memory at startup
l2_size#bytesL2 cache size
uuid#stringGPU UUID
ecc#boolECC memory enabled
cuda_driver#intCUDA driver version
cuda_runtime#intCUDA runtime version
yaml
# config.yaml
report_to: wandb # Single backend
report_to: [wandb, aim] # Multiple backends
# Weights & Biases options
wandb_project: my-project
wandb_name: my-run
# Aim options
aim_experiment: my-experiment
aim_repo: /path/to/aim/repo
aim_name: my-run
yaml
log_file: ./output/training.json # Default: {output_dir}/training.json

These levels control how much the console shows:

LevelDescription
-1Minimal (eval only)
0Normal (default)
1Verbose (includes GPU telemetry, per-file dataset info)
python
from surogate import _surogate
# Create logger
logger = _surogate.TrainingRunLogger(
"/path/to/log.json",
callback=my_callback, # Optional: receives JSON lines
verbosity=_surogate.LogVerbosity.DEFAULT
)
# Log metrics
logger.log_step(step, epoch, tokens, duration_ms, norm, loss, lr)
logger.log_eval(step, epoch, tokens, duration_ms, loss)
logger.log_moe_stats(step, aux_loss, z_loss, utilization, imbalance)
# Get MoE stats from trainer
moe_stats = trainer.get_moe_stats()
# Returns: {'aux_loss': float, 'z_loss': float,
# 'expert_utilization': float, 'load_imbalance': float, 'valid': bool}

The log file is a JSON array, so you can load it directly:

python
import json
with open("training.json") as f:
logs = json.load(f)
# Filter by log type
train_steps = [l for l in logs if l.get("log") == "step"]
eval_steps = [l for l in logs if l.get("log") == "eval"]
moe_logs = [l for l in logs if l.get("log") == "moe"]
  1. Watch the loss trend. The \ / indicators help you spot divergence early.
  2. Watch gradient norms. The ! indicator flags possible instability.
  3. Track the SOL percentage. If it stays below 60%, something is probably a bottleneck.
  4. For MoE models, keep expert_utilization > 0.7 and load_imbalance < 2.5.
  5. Use an external backend for long runs. wandb and Aim plot the metrics better than the console.

Next: the MoE guide shows how to read the router metrics and spot collapse, and Debugging helps when a metric looks wrong.