﻿# TTrace: finding distributed-training errors with aligned tensors and a qualified numerical tolerance

TTrace compares intermediate activations and gradients against a reference. Its single-iteration diagnosis depends on matching semantics and distinguishing round-off from bugs.

Author: Retrivium editorial team
Updated: 2026-11-05
Canonical URL: https://retrivium.ai/journal/ttrace-distributed-tensor-differential-testing-tolerance-scope/
Language: en

A training loss curve can look plausible even when a distributed implementation computes the wrong gradient. TTrace addresses this by comparing internal tensors with a reference rather than waiting for loss to visibly diverge. The study first appeared on June 10, 2025 and was revised on January 6, 2026.

## The comparison must align mathematical meaning across ranks

The [publication record](https://arxiv.org/abs/2506.09280) describes differential testing for distributed training. The [full paper](https://arxiv.org/html/2506.09280v2) requires annotations identifying traced tensors and their partitioning. A canonical mapping then relates distributed shards to the corresponding reference objects.

This is more than comparing equal-shaped arrays. A shard, a partial sum and a complete gradient can have similar storage while representing different mathematical quantities. The reference and candidate also need identical generated inputs. Without those controls, discrepancies may reflect an invalid comparison rather than a training-framework bug.

## Tolerance separates numerical differences from implementation errors

Changing operation order or precision can create ordinary floating-point differences. TTrace estimates expected error using reference perturbations and analysis under numerical-stability assumptions, then tests whether observed discrepancies exceed a qualified tolerance.

The approach does not demand bitwise identity between all distributed and reference paths. It also does not certify an arbitrary tolerance selected after seeing a failure. The model, numerical recipe and comparison method belong together. The [mixed-precision guide](/journal/mixed-precision-loss-scaling-gradients/) explains why a precision label alone does not describe the full arithmetic path.

## Input rewrites help identify the first faulty computation

An early error can propagate through later layers, making every downstream tensor look wrong. TTrace additionally supplies matching inputs to individual modules, preventing one upstream discrepancy from contaminating the entire comparison. This lets the investigation distinguish a faulty operation from an operation merely receiving faulty data.

Reported cases include missing synchronization of normalization gradients and incorrect scaling when tensor and context parallelism are combined. Some appear only in particular numerical and parallel configurations. A test of tensor parallelism alone therefore cannot establish correctness of its combination with other execution modes.

## The impressive timing is one matched bug example

The authors reproduce 11 historical bugs at relevant framework commits and find three additional bugs in their sweep. Their default testbed has eight H200 GPUs on an EC2 instance, with specified CUDA, PyTorch and framework versions.

For one embedding bug, waiting for a significant loss difference takes over 4000 iterations and 6 hours 40 minutes, while the traced test identifies it in 54 seconds using one iteration. That is evidence for the demonstrated case, not a universal speedup factor for every defect. Larger references can also require pipeline execution and substantial tracing time.

## Passing a trace is bounded correctness evidence

The paper acknowledges possible misses when a defect causes differences comparable to round-off or cannot be reproduced in a single iteration. A reference implementation can itself be wrong, and an unsuitable annotation or unstable reference can invalidate the interpretation. Downscaling a test model is appropriate only when the relevant code path remains the same.

The [software reproducibility guide](/journal/software-stack-reproducibility/) supports preserving source revisions and execution conditions alongside the trace. TTrace is a targeted implementation diagnostic, rather than a detector of every cause of training divergence or proof of the quality of the eventual learned model. Its useful output is a localized, reproducible discrepancy under declared numerical assumptions.
