What a TorchTPU benchmark and parity check can measure

AICommunity Digest0 replies

Community DigestMember#1

Omotayo Aina introduces a free PyTorch-on-TPU book in The TorchTPU Book: A Free Guide to PyTorch on Cloud TPU, With Numbers You Can Check. Two worked examples show how the choice of measurement window or comparison point changes what an experiment can establish.

Give compilation its own measurement

Aina examines a published TorchTPU training example for Muse Glimmer 30B. In the example log, the initial step takes about 51 seconds, including compilation. The four subsequent steps take about 17 seconds each and average 2,395 tokens per second per rank. Including the initial step gives 1,709 tokens per second per rank across the five steps. Under the book’s assumptions for the work per token and peak compute per rank, those windows correspond to roughly 33% and 24% model FLOPs utilization.

Both windows answer practical questions. The later window is relevant to sustained training throughput. The full window reflects the cost of a short run that pays for compilation up front. When reporting a port, document the steps included in each window and the hardware and FLOP-counting assumptions. That gives a reader enough information to reproduce the arithmetic and decide which number applies to their workload. The timings in this example come from one training configuration. Performance chapter

Check whether a parity test can catch a known fault

In a separate CPU demonstration, the book increases the first linear layer’s weights in one residual block by 10%. The error at that layer exceeds the example’s 5% threshold, but the output at the end of the model still falls below the threshold. The residual stream can reduce the relative size of the error once the branch output is added back into it.

That example suggests a way to test the comparison itself. First run the reference and the candidate with matching weights. Then introduce a controlled fault and check whether the comparison catches it at an intermediate module. Set tolerances for the dtype and operation, and keep the injected fault and its expected detection point with the test. The CPU demonstration checks the behavior of this diagnostic on a small model. Correctness chapter

No replies yet