Training speed: measure where the bottleneck is, then decide what to do
I have measured training speed twice. In 2022 I analyzed communication in multi-GPU training and found that much of the time recorded as communication was spent waiting for the slowest GPU; compressing gradients gained about 3%. In 2024 I moved the parking occupancy model to Torch 2.x; time per iteration on one GPU fell by 54%, but on 24 GPUs the reduction was under 20%. In 2026 I made training time a team campaign, which is in progress.
On this page
Three stages
The cost of training is mostly GPU time. Shortening it starts with knowing where the time goes. The three parts below are in order of time: the 2022 communication analysis, the 2024 move to Torch 2.x, and the 2026 team campaign.
2022: how much of multi-GPU training is communication
The idea at the time was that as models grow, gradient synchronization would become the bottleneck in multi-node training, so compressing gradients would save time. Before building anything I measured the share of communication with a profiler.
| Experiment | Communication per iteration | Share of the iteration |
|---|---|---|
| Small model, 16 GPUs | about 93 ms | about 9.8% |
| Large model, 16 GPUs | about 106 ms | about 8.4% |
| A larger BEV model training job | — | about 22% |
| Large model, 32 GPUs (an experiment with INT8 compression on) | — | about 30% |
Communication time in the table counts only the part that does not overlap with computation. I then tried three ways to compress:
| Method | Speed | Accuracy |
|---|---|---|
| fp16 gradient compression | 1.369 s → 1.330 s per iteration, about 3% faster | F1 scores moved by about 1 point or less (the largest change was a rise of 1.2 points) |
| PowerSGD (low-rank compression) | 1.369 s → 1.423 s per iteration, slower: in another measurement the data sent fell to about 20%, but the compression's own computation and memory allocation held up the pipeline | every F1 score fell, the worst by 4.3 points |
| Compressing to 1 bit (as a test only) | communication time stayed high | — |
With the data cut to one bit, communication time was still high. So, in these experiments at least, most of the time was not going into sending data. I plotted when the communication step started and ended on each GPU, and the cause became clear. GPUs that finish early wait for the slowest one before synchronization can start, and that wait was being recorded as communication. The more GPUs, the longer the wait; once the data was compressed, waiting became the main part of the communication time.
The analysis also turned up some waste. To print the loss averaged over GPUs in the log, the training framework ran an extra round of synchronization every iteration. In one count, 30 of the 65 synchronizations in five iterations were for logging; dropping that round removes almost half of the calls.
2024: moving parking occupancy to Torch 2.x
Colleagues moved the training framework itself to Torch 2.x in 2023. I did two things: in January 2024, adapting the quantization flow of the BEV detection model; and in June and July 2024, moving float training of the parking occupancy model. This section is about the second.
Align first, compare speed second
- Forward: fed the same input directly, the losses of the old and new frameworks agree; with preprocessing included and the random numbers of data augmentation fixed, the total loss differed by about 1e-4.
- Backward: the difference in a single step is about 1e-7 and accumulates, so bit-exact agreement is out of reach; over 100 steps the loss followed the same trend.
- Evaluation: for the same weights, evaluation during training and offline evaluation disagreed at first, because part of the evaluator's state was not reset after an evaluation. After the fix, metrics on a small dataset were broadly comparable with the old framework.
- Full data: most metrics rose, but the mIoU of BEV segmentation fell noticeably, and freespace stayed about level. The two runs trained for different numbers of epochs (23 on the old framework, 36 on the new), so not all of the difference can be put down to the migration.
Time on one GPU
| Setup (one V100) | Torch 1.x | Torch 2.x | Torch 2.x with compile |
|---|---|---|---|
| batch 8, no AMP | 1.360 s | 0.828 s | 0.829 s |
| batch 8, AMP | 1.124 s | 0.564 s | 0.502 s |
| batch 16, AMP | 1.559 s | 0.802 s | 0.714 s |
| batch 18, AMP | 1.837 s | — | 0.835 s |
The table shows time per iteration. With batch 16 and AMP it fell from 1.559 s to 0.714 s, a 54% reduction. Counting start-up overhead and evaluation, the estimate at the time was about 40% for a whole training run.
Time on many GPUs
Real training uses many GPUs. For the same model at batch 18 per GPU, time per iteration changed with the number of GPUs as follows (Torch 2.x):
| GPUs | 1 | 2 | 4 | 8 | 16 | 24 | 112 |
|---|---|---|---|---|---|---|---|
| Time per iteration | 0.84 s | 0.88 s | 1.18 s | 2.0–2.2 s | 2.14 s | 2.10 s | 2.33 s |
From 1 to 8 GPUs the time per iteration more than doubled, and then stayed about the same. Torch 1.x took 2.528 s on 24 GPUs, so on 24 GPUs the time per iteration fell by only 5% to 17% (two measurements, 2.39 s and 2.10 s). The 54% on one GPU did not carry over.
2026: a team campaign
In September 2026 I made training time a team campaign and assigned it to three engineers. It is still in progress, and there is no result to report here yet. I also run the weekly meeting on backbone pretraining.
Lessons
- Measure before building. Compressing communication looked reasonable; measurement showed the bottleneck was not the amount of data.
- Single-GPU numbers do not extrapolate. On one GPU the time per iteration fell by more than half; on 24 GPUs it fell by less than a fifth.
- Write down negative results too. “This path is not worth taking” also saves time for whoever comes next.