﻿# TraceML: reading training-step and regression evidence

TraceML links training phases, rank delays and memory observations. Learn what its reports measure and what a regression comparison can actually establish.

Author: Retrivium editorial team
Updated: 2026-11-05
Canonical URL: https://retrivium.ai/journal/traceml-pytorch-step-diagnosis-regression-evidence/
Language: en

TraceML is a PyTorch training diagnostic that connects step timing with memory and resource observations. Its useful question is specific: is the next investigation about feeding the model, moving batches, doing computation, or one distributed worker falling behind? A GPU-utilization percentage alone cannot distinguish those cases.

The [current project](https://github.com/traceopt-ai/traceml) has expanded beyond the terminal and notebook summary described in early announcements. It supports saved reports, run comparisons and an experimental performance-regression guard. Those features make it a way to preserve diagnostic evidence; installing instrumentation does not itself accelerate training.

## Instrument the actual training boundary

Standard Hugging Face Trainer, PyTorch Lightning and RF-DETR paths can use the launcher without changing the training script. A custom loop needs explicit initialization and a traced step. Accelerate, DeepSpeed and other integrations have their own setup; the project's automatic-instrumentation claim does not cover arbitrary Python training code.

Before comparing reports, establish whether a step includes gradient accumulation, transfers and optimizer updates in the selected integration. Keep this definition alongside the model, data and precision settings. The existing [PyTorch profiler scheduling guide](/journal/guide-perf-pytorch-profiler-schedule/) explains why an observation boundary must be tied to a known unit of work. A changed boundary can produce a changed duration without a faster training algorithm.

## Read phase evidence without double counting

The [output reference](https://traceopt-ai.github.io/traceml/user_guide/reading-output/) distinguishes input wait, forward, backward, optimizer, host-to-device transfer and residual time. Input wait is waiting for training input on the selected clock, not worker-side preprocessing duration or a direct measurement of GPU idleness. Backward can include distributed synchronization. Residual is unattributed traced work and can include useful activity.

Supplemental CPU DataLoader-fetch timing is not added to step time again. GPU timing is selected only when its required signals are complete; otherwise the report selects CPU timing. Missing values appear as unavailable rather than measured zero. This matters when a configuration seems to remove a transfer phase: absence of an observed event is not proof that data never moved.

Memory also has several scopes. Per-step CUDA allocation peaks differ from sampled process memory and whole-device memory. An increasing allocation series can motivate checking retained tensors, but it does not identify a particular reference as the cause. Follow the finding with a targeted experiment.

## Preserve rank relationships

Distributed summaries align common steps and can identify a straggling worker. The representative timing breakdown comes from the rank whose window-average step time is closest to the cross-rank median. Its phases stay together; it is not a synthetic combination of unrelated phase medians.

The project currently focuses on a single device and same-machine distributed data parallel training. Multinode operation remains experimental, and GPU comparisons assume homogeneous hardware. A large skew on a tiny phase may have little effect on completion. Check the named rank and absolute duration before attributing a distributed slowdown to networking.

## A regression check compares evidence, not model quality

The [Regression Guard documentation](https://traceopt-ai.github.io/traceml/user_guide/regression-guard/) requires matching declared workload and topology, completed runs and comparable positive step timing on a common clock. Its result is driven by step time; other resource observations remain context. An incompatible or incomplete comparison is inconclusive, rather than a passing performance result.

Declarations do not verify what the program actually executed, and one pair of runs does not establish statistical significance or equivalent model quality. Repeat a reference workload to understand ordinary variation before selecting a threshold. Retain both reports and independently verify training outputs. For finer GPU questions, move from TraceML's diagnosis to [targeted profiling](/journal/learn-gpu-profiler-sampling-instrumentation/), then measure the proposed change without heavy instrumentation. That sequence connects a useful diagnostic label to a testable explanation.
