Reducing Training Time
This lesson explains how early stopping, distributed training and other techniques shorten training, which lowers cost, shortens experiment cycles and makes frequent retraining practical.
Learning outcomes
After completing this lesson, you will be able to:
- Apply early stopping with a patience setting.
- Speed up data loading and compute.
- Profile training jobs to find bottlenecks before adding hardware.
Early stopping
Early stopping ends training when the validation metric has not improved for a set number of epochs or boosting rounds, called the patience, and keeps the best model seen so far. It saves compute, because training does not continue after the model stops improving, and it also reduces overfitting, because training stops before the model starts memorising the training data.
XGBoost supports early_stopping_rounds, and deep learning frameworks offer early stopping callbacks. At a higher level, SageMaker automatic model tuning can stop whole training jobs that are unlikely to beat the best result so far.
Early stopping
Faster data and compute
Training is often limited by data loading rather than computation. FastFile and Pipe modes start training without copying the dataset; FSx for Lustre delivers high throughput; sharded files and parallel data loaders keep GPUs busy. On the compute side, mixed precision (16-bit floating point with 32-bit master weights) speeds up training on modern GPUs; larger batches use accelerators more fully; and newer instance types such as p5 or Trainium (trn1) may finish faster and cheaper overall.
Data or compute bottleneck?
Profiling to find bottlenecks
Before adding hardware to a slow training job, it is worth finding out what limits it. SageMaker Profiler and SageMaker Debugger system monitoring show GPU, CPU, memory and I/O utilisation throughout training. Low GPU utilisation with high I/O wait indicates a data bottleneck: the GPUs wait for data, and faster input, such as Pipe mode, FSx for Lustre or more data-loading workers, is the fix.
High CPU usage in data loading suggests moving augmentation onto the GPUs or adding loader workers. Profiling should come before scaling out, because adding instances to a job limited by I/O adds cost without making it faster. The following table summarises the techniques.
| Technique | Reduces time by |
|---|---|
| Early stopping | Ending training when validation stops improving |
| FastFile / Pipe mode | Removing dataset download before training |
| FSx for Lustre, sharded files | Faster data reads |
| Mixed precision | Faster math on GPUs |
| Distributed training | Spreading work across GPUs and instances |
| Warm pools | Removing instance start-up between jobs |
| Profiling | Finding the real bottleneck first |
The following diagram compares the duration of a computer vision training job before and after changes to stopping, data loading and precision.

A 30-hour job
A vision model trains for 30 hours on one ml.p4d.24xlarge (8 GPUs). Profiling shows GPU utilisation at 35% and validation accuracy stops improving after epoch 40 of 100.
- Add early stopping with patience 5: training ends near epoch 45, saving more than half the epochs.
- Move data to FSx for Lustre and use more data loader workers: GPU utilisation rises to 85%.
- Enable mixed precision for further speed.
The job now takes about 6 hours. Adding a second p4d instance first would have doubled cost while the GPUs still waited on data.
What does low GPU utilisation during training often indicate?
Show answer
An input bottleneck: the GPU waits for data. Profiling confirms it.
Exam Tips
Remember for the exam
- Stop when validation stops improving: early stopping.
- Profile first; low GPU utilisation often means an I/O bottleneck.
- FastFile, Pipe mode and FSx for Lustre speed up data loading.
- Mixed precision speeds up GPU training.
- Scaling out does not fix an I/O-bound job.