The best practices for training deep learning models come down to doing things in the right order. Inspect the data before you write any model code, and validate it before training starts. Define success in numbers. Prove the pipeline on a small model that can overfit a single batch. Then set the learning rate and warmup, watch the gap between training and validation loss, start from a pretrained model when data is thin, and checkpoint everything you need to resume. The order matters more than any single trick. Karpathy’s training recipe makes the same point: its main aim is to avoid adding a lot of unverified complexity at once, since that complexity hides bugs and misconfigurations that can take a very long time to find.
An Ordered Checklist of Best Practices for Training Deep Learning Models
The steps below run in sequence. Each one assumes the previous step passed.
- Define success quantitatively. Choose the evaluation metrics, decide how to weight them, and set the objectives the project has to reach, including how the task compares with human performance.
- Inspect the data by hand. Scan thousands of examples for their distribution and patterns before touching network code.
- Validate the data mechanically. Check each batch against a schema of feature types and presence, and flag anything that deviates.
- Split into training, tuning and test sets, and lock the test set away until the end.
- Build a small baseline on part of the data, using common settings and a common objective.
- Verify the loss at initialisation and overfit a single batch of a few examples.
- Find the learning rate range, then lengthen warmup if loss spikes appear during it.
- Scale the model until it overfits, then regularise it, reading the training/validation gap at every step.
- Start from pretrained weights when labelled data is limited.
- Checkpoint model, optimiser state, epoch and loss so the run can resume.
How Should I Prepare and Check Training Data Before Training?
Read the data before you trust it. That means finding out why and how it was collected, and then checking it both by eye and by machine. The 2021 “Ten Quick Tips for Deep Learning in Biology” paper recommends learning the study design and data specifics before modelling, because assumptions such as randomisation do not always hold. The same paper warns that confounding variables can produce batch effects, and a model will happily learn those correlations even when they mean nothing.
Labels deserve their own check. Northcutt et al. (2021) estimated an average of at least 3.3% label errors across the test sets of 10 widely used vision, language and audio datasets, including at least 6% of the ImageNet validation set. Their advice is to judge models on correctly labelled test sets, especially for noisy real-world data.
Breck et al. (MLSys 2019) describe a validator that compares every batch against a schema and raises an alert on any disagreement, so problems surface before the model trains on bad data. Their reason for not relying on model metrics alone is concrete. Networks tolerate noise well, so a data error that hits only certain slices may cause a small quality drop that the aggregate metrics hide. The same paper points to a quieter failure: training code that applies a logarithm to a feature assumes the feature is always positive, and the schema may not encode that assumption. In their experience, fuzz-testing the training code with a few hundred random examples was enough to trigger such errors, and they packaged it as a unit test.
Two more habits close the gap between the data on disk and the data the network sees. First, visualise the decoded tensors immediately before y_hat = model(x). That is the only reliable source of truth for preprocessing and augmentation bugs. Second, compute normalisation statistics (means, variances, vocabularies) on the training split only, then apply them unchanged to the tuning and test splits. Fitting them on the full dataset leaks information from the evaluation data into training.
The three-way split makes overfitting detectable later. You iterate between learning on the training set and evaluating hyperparameters on the tuning set (also called the validation set), and the final assessment on the test set stays unaffected. The test data should be used exactly once, to evaluate the final model after all training and tuning is finished.
Why Should I Start with a Small Model and a Small Experiment Before Scaling Up?
Starting small keeps bugs from hiding inside unverified complexity. Smith’s 2017 best-practice recipe puts it plainly: start simple, small and easy, with a smaller architecture than you expect to need, common hyperparameter settings and only part of the training data. The biology tips paper adds that growing network size and complexity only as needed avoids spending time and resources on large models that carry unresolved problems.
The first model should be one you could hardly get wrong, such as a linear classifier or a very small ConvNet. Train it inside a full training and evaluation skeleton, and run ablations with explicit hypotheses. Two checks earn their place here:
- Loss at initialisation. With a correctly initialised final layer and softmax, the starting loss should be -log(1/n_classes).
- Overfitting one batch. Take as few as two examples, increase capacity, and confirm the loss reaches its minimum and predictions line up with labels. If they do not, there is a bug, and moving on is pointless.
From there, add complexity one verified step at a time. A 2023 review of efficient large-scale training suggests the same at a larger scale: it calls it relatively feasible to work out a recipe on small, low-budget setups first, then scale up. When you compare the deep model with a simpler method, tune both before claiming either is better.
The small baseline also pays off early. Smith notes that early stages tend to produce wins from low-hanging fruit, and that improvements get harder later. In delivery-oriented work, we treat each training milestone as an intermediate artefact that has to be usable on its own.
How Do I Choose a Learning Rate, and When Should I Use Warmup or a Learning-Rate Finder?
Measure the learning rate rather than guessing it. Run a range test to find where loss starts to diverge, and add warmup if the first steps at the target rate show loss spikes. Smith (2015) calls the learning rate the most important hyperparameter to tune for deep networks. The failure modes run in both directions: too large a rate causes divergence and too small a rate slows convergence.
The Range Test and the Learning-Rate Finder
The range test is simple. Smith estimates reasonable learning-rate bounds by increasing the rate linearly over a few epochs. His later recipe recommends the test as the way to see how a network behaves across a wide range of rates. fastai packages a version of it as lr_find: it trains briefly with exponentially growing rates, stops when the loss diverges, and plots loss against learning rate on a log scale.
The best rate depends on the optimiser and batch size, so choose them together. For a first baseline, Karpathy suggests Adam at 3e-4, because in his experience Adam is much more forgiving of a bad learning rate. He also notes that well-tuned SGD usually edges out Adam on ConvNets, but only inside a narrower, problem-specific band of good rates. A 2025 optimiser survey describes AdamW, which decouples weight decay from the adaptive update, as the standard choice in large-scale deep learning. The same survey reports the critique, from Wilson et al. (2017), that adaptive methods can converge quickly on training loss and still generalise worse than SGD. Choosing between them is its own decision, covered in our guide to choosing a deep learning optimizer.
What Warmup Does and How Long It Should Be
Warmup usually means increasing the learning rate linearly from zero to a target value, after which the rate is commonly decayed, for example with a cosine schedule. The OPT-175B run is a published example: it warmed up from 0 to the maximum learning rate over the first 2,000 steps, then decayed to 10% of the maximum.
A 2024 study of why warmup works (Kalra and Barkeshli) found that its main benefit, by a wide margin, is letting the network tolerate larger learning rates than it otherwise could; any other benefits were marginal. Slightly away from the divergence boundary, final test accuracy depended mainly on the target learning rate and only nominally on warmup duration. So warmup does not replace picking a good target rate. Its job is to let the network tolerate that rate.
Choose the duration from what the loss does. If training loss shows large spikes during warmup at a given target rate, lengthen the warmup until the spikes are small, which moves training away from the failure boundary. The same study found Adam particularly sensitive here: large early instabilities can damage performance without visibly diverging. Initialisations that already start in flat regions, such as µP, may not need warmup at all.
Large Batches Need the Learning Rate Scaled with Them
Batch size and learning rate move together. Goyal et al. (2017) showed no loss of ImageNet accuracy with minibatches of up to 8,192 images, using a linear scaling rule for the learning rate and a warmup scheme for the early optimisation difficulties. With those techniques they trained ResNet-50 on 256 GPUs in one hour while matching small-minibatch accuracy. The ceiling is real, though. The 2023 efficient-training review notes that an excessive batch size can damage stability and even cause divergence, especially on large models, and that growing the batch beyond a critical size stops speeding up convergence.
How Can I Detect and Reduce Overfitting When Training a Deep Neural Network?
Overfitting shows up as a gap. Compare training performance with tuning performance; from training to test, a small drop is normal and a significant drop is a clear sign of overfitting. Smith (2018) describes how the shape of the training and validation loss curves gives subtle clues of both underfitting and overfitting. Read the gap against human-level performance too, and debug the worst problem first, whether it sits in the data, the architecture or the loss function.
The fix depends on which side of the balance you are on. High bias calls for a larger network, while high variance calls for more training data.
| What you see | Likely cause | First thing to try |
|---|---|---|
| Converges on the wrong result | High bias | Larger network |
| Significant drop from training to test | Overfitting | More real data, augmentation, regularisation |
| Cannot overfit even one batch | Bug or misconfiguration | Return to the single-batch test |
When a model overfits, the preferred remedy is more real data. Karpathy calls it close to the only guaranteed way to keep improving a well-configured network, and warns against spending engineering cycles squeezing a small dataset. After that come regularisers. Smith recommends trying data augmentation, dropout and weight decay. Dropout, as Srivastava et al. (2014) introduced it, randomly drops units and their connections during training so they cannot co-adapt too much. Weight decay is not a free dial: Smith (2018) found its optimal value tightly coupled to the learning rate and momentum, and argues that regularisation has to be balanced for each dataset and architecture.
Augmentation has a refinement worth knowing. Gong et al. (“Data Augmentation Revisited”, 2019) trained with intensive augmentation and then switched it off for the final epochs, so the model ends training without a gap between the augmented and clean distributions. In one setting they refined models with standard augmentation for 20 epochs at a learning rate of 1e-4. They reported consistent accuracy gains on CIFAR-10, CIFAR-100, Mini-ImageNet and ImageNet with no change in training or test cost.
Stop on the validation loss, catching the model just before it starts to overfit.
When Does Transfer Learning or Fine-Tuning a Pretrained Model Beat Training from Scratch?
A pretrained starting point helps most when labelled data is limited and the pretraining data resembles your task. With enough training iterations, training from scratch can match it. The biology tips paper recommends transfer learning when data is too scarce to train a well-performing model, and says it helps most when the pretraining and target datasets are similar. It adds that transferred features can beat random initialisation even when no similar dataset exists. Karpathy goes further: it rarely hurts to use a pretrained network, even with plenty of data.
A counterweight comes from He, Girshick and Dollár (2018). They trained standard models from random initialisation on COCO detection and segmentation and got results no worse than ImageNet-pretrained counterparts. The only change was more training iterations so the randomly initialised models could converge. Their conclusion was that pretraining speeds up early convergence but does not necessarily regularise or improve final accuracy. That held with only 10% of the training data and with deeper and wider models.
Kornblith, Shlens and Le (2018) narrow things further. Across 16 networks and 12 datasets, ImageNet accuracy correlated strongly with transfer accuracy, both for fixed feature extraction and for fine-tuning. On two small fine-grained classification datasets, however, ImageNet pretraining gave minimal benefit. They also found that some common regularisers slightly improve ImageNet accuracy while producing penultimate-layer features that transfer much worse.
Our reading of the three studies: fine-tune by default when time to a working model matters, and budget a from-scratch comparison only when the target domain is far from the pretraining data and you have the data and iterations to let it converge. PaLM was fine-tuned at a constant 5×10⁻⁵, 20 times smaller than its pretraining rate, with the optimiser’s accumulators reset.
How Should I Checkpoint and Resume Long Training Runs Without Destabilising Them?
A checkpoint for resuming training must hold more than the weights. Save the optimiser state, the epoch and the latest loss with the model, then reload them and resume the schedule where it stopped. PyTorch’s documentation says a general checkpoint for resuming training must include the optimiser’s state_dict, because that holds buffers and parameters updated during training. It suggests also saving the epoch and latest training loss, and notes that such checkpoints are often 2–3 times the size of the model alone.
Resuming also has to restart the schedule where it stopped. fastai’s documentation describes saving model and optimiser state together, rebuilding the learner with the same parameters, and passing start_epoch so training resumes with a correctly scheduled learning rate.
There is one easy mistake in PyTorch. model.state_dict() returns a reference, not a copy, so a “best model” kept that way keeps updating with later iterations and ends up as the overfitted final state. Serialise it, or take a deepcopy.
Checkpoints also served as the recovery mechanism when large published runs went unstable. When training PaLM’s largest model, the team saw loss spikes roughly 20 times despite gradient clipping. Their fix was to restart from a checkpoint about 100 steps before the spike and skip roughly 200–500 data batches. Their ablations suggested the spikes came from particular batches meeting a particular parameter state, not from bad data alone. The OPT team recovered from loss divergences by lowering the learning rate and restarting from an earlier checkpoint. PaLM’s training was also bitwise reproducible from any checkpoint. Part of how PaLM achieved this was a deterministic data pipeline in which a batch’s contents depended only on the step number. To spot a spike early enough to roll back, you have to log the loss at step granularity. What to track is covered in our piece on TensorBoard logging for training pipelines.
The word has a second meaning. “Checkpointing” in PyTorch also refers to buffer (activation) checkpointing, which has nothing to do with saving state to disk. It stores the inputs of only some layers and recomputes the rest during the backward pass, trading compute for memory so you can afford a larger batch. Whether you need it is a memory-budget question, treated in planning GPU memory for deep learning training.
Keeping the GPU Busy While You Iterate
A few PyTorch defaults slow down the fast iteration small experiments need. PyTorch’s DataLoader loads data synchronously in the main process by default (num_workers=0), so training waits for every batch. Setting num_workers > 0 overlaps loading with compute. pin_memory=True enables faster asynchronous host-to-GPU copies. Running validation inside torch.no_grad() avoids storing intermediate buffers, which saves both time and memory. Once a run is too large for one device, throughput turns into a systems problem, and performance engineering for scalable deep learning systems picks it up from there.
Recipes Transfer, Values Do Not
The specific values above (2,000 warmup steps, 20 refinement epochs, 100 steps of rollback) come from particular published settings. What we would carry over to a new problem is the procedure: measure the learning rate, read the loss curve, let the gap decide the regulariser, and make the run resumable. Smith’s finding that regularisation has to be rebalanced for each dataset and architecture is the honest limit of any checklist like this. When a run goes wrong, the useful question is not which trick to add. Ask which earlier step in the order was never actually verified.