Key takeaways
- A healthy training loss drops quickly at first, then flattens, with some noise from batch to batch.
- There is no universal target value; compare against validation loss and task metrics.
- Rising validation loss while training loss keeps falling signals overfitting.
- Spikes usually come from high learning rates, bad batches, mixed precision issues or too-small batches.
- Hugging Face Trainer uses the loss returned by the model, usually cross-entropy, unless you override compute_loss.
Training loss measures how wrong a model's predictions are on the training data, computed after each batch or step. A healthy curve drops quickly at first, then flattens with some noise; what matters most is how it compares with validation loss and real task metrics. FineTune Studio streams loss live over WebSockets during QLoRA fine-tuning, because watching the curve catches problems early. This page covers healthy loss curves, targets, direction, negative values, overfitting, spikes, accuracy versus loss, Hugging Face Trainer, and loss in FCNs.
What should training loss look like?
A typical healthy training loss curve falls steeply in the first steps, then decreases more slowly and flattens, with small up-and-down noise between batches. Smoothed curves make the trend easier to read.
Warning signs: loss that does not decrease at all suggests a bug, a learning rate far too low, or labels not matching inputs; loss that explodes or becomes NaN suggests a learning rate too high or numerical instability; and loss that drops to almost zero very quickly on a small dataset often means memorisation. Always plot validation loss alongside training loss, ideally evaluated at regular intervals, to judge generalisation.
How low should training loss be?
There is no universal target. The right level depends on the loss function, task difficulty, label noise and data. Cross-entropy loss for language model fine-tuning might settle around 1 or lower, while other tasks have completely different scales.
Judge by comparison instead: does validation loss track training loss, and do task metrics such as accuracy, F1 or human ratings improve? Pushing training loss extremely low usually means overfitting, especially on small datasets. For fine-tuning language models, a modest drop from the starting loss, with improving outputs on held-out prompts, is often what you want. In FineTune Studio, I compare base and tuned outputs side by side rather than chasing a number.
Why does training loss always decrease?
Training loss usually decreases because the optimiser adjusts weights specifically to reduce it on the training data. With enough capacity, a model can keep reducing training loss by fitting the training examples ever more closely, even memorising them.
It does not always decrease smoothly: batch noise, learning rate schedules, regularisation and data augmentation cause fluctuations. That steady fall is why training loss alone is misleading: it measures fit to data the model has already seen. Validation loss on unseen data tells you whether learning generalises. When training loss falls but validation loss rises, the model is overfitting.
Should training loss increase or decrease?
Training loss should generally decrease over time. Short-term increases are normal noise, and learning rate warm-up or restarts can cause temporary rises. A sustained increase signals a problem, such as an unstable learning rate, corrupted data or a bug.
If loss increases steadily, lower the learning rate, check for exploding gradients and enable gradient clipping, inspect recent batches for bad data, and verify mixed precision settings. If loss plateaus early at a high value, the learning rate may be too low, the model too small, or the data or labels flawed. Change one thing at a time so you know what fixed it.
Can training loss be negative?
Most standard losses, such as cross-entropy and mean squared error, cannot be negative, so a negative value usually indicates a bug: probabilities outside 0 to 1, a wrong sign, or an incorrect custom loss. Some losses legitimately go negative, such as certain log-likelihood formulations and some contrastive or reward-based objectives.
If you see unexpected negative loss, check that model outputs are passed in the form the loss expects, such as logits versus probabilities, that labels are correctly encoded, and that custom loss code has the right sign. For losses that can be negative by design, judge progress by trends and validation metrics, not by the value crossing zero.
How do training and validation loss show overfitting?
Overfitting appears when training loss keeps falling while validation loss stops improving and starts rising. The model is learning patterns specific to the training data that do not generalise to new examples.
Also asked as: training vs validation loss overfitting
Remedies:
- Stop training at the best validation checkpoint, known as early stopping.
- Add more or more varied training data.
- Use regularisation, such as dropout or weight decay.
- Reduce model size or trainable parameters, as LoRA does.
- Use data augmentation where appropriate.
- Train for fewer epochs with a lower learning rate.
For language model fine-tuning, one to three epochs on good data is often enough; more frequently causes overfitting.
Why do I get spikes in loss during training?
Spikes usually come from a learning rate that is too high, a batch containing unusual or corrupted examples, very small batch sizes, numerical issues in mixed precision, or exploding gradients. Occasional small spikes that recover are normal.
Also asked as: why am i getting spikes in the values of the loss function during training
Fixes:
- Lower the learning rate or add warm-up.
- Enable gradient clipping to cap update sizes.
- Inspect data around spike steps for bad examples.
- Increase batch size or use gradient accumulation.
- Use bfloat16 instead of float16 if supported, or enable loss scaling.
- Shuffle data properly so batches are representative.
Log which samples were in spiking batches; the cause is often in the data.
What is the difference between training accuracy and training loss?
Training loss measures how wrong predictions are in a continuous, differentiable way, including how confident the model is. Training accuracy measures the fraction of correct predictions, ignoring confidence. The optimiser minimises loss; accuracy is what humans usually care about.
Also asked as: training accuracy vs training loss
They can move differently: loss can fall while accuracy stays flat, when the model becomes more confident in already-correct answers, or accuracy can rise while loss rises, when a few predictions become very confidently wrong. Track both, plus validation versions of each. For imbalanced data, also track precision, recall and F1, since accuracy can be misleading.
What loss function does the Hugging Face Trainer use?
The Hugging Face Trainer uses the loss returned by the model's forward pass when labels are provided. For classification and language modelling models, that is usually cross-entropy loss, computed inside the model class.
Also asked as: what is the loss function used in trainer from the transformers library of hugging face
To use a different loss, such as weighted cross-entropy for imbalanced classes, subclass Trainer and override compute_loss, returning your custom loss. TRL's trainers, such as the SFT trainer used for instruction tuning, build on the same idea, with options such as computing loss only on assistant responses. Check the model's documentation to see exactly which loss its forward pass computes.
What is training loss in an FCN?
In a fully convolutional network for semantic segmentation, training loss is usually pixel-wise cross-entropy: each pixel is classified, and the loss averages errors across all pixels and images. FCNs, introduced in 2014, made dense pixel prediction efficient.
Also asked as: what is training loss in fcn
Because some classes cover far fewer pixels, such as thin roads or small lesions, plain cross-entropy can favour large classes. Common fixes include class-weighted cross-entropy, Dice loss, focal loss or combinations. Monitor validation metrics such as mean intersection over union alongside loss, since a falling loss may not reflect better segmentation of small but important classes.
Sources
- Goodfellow, Bengio & Courville, Deep Learningdeeplearningbook.org
- Hugging Face Transformers, Trainer documentationhuggingface.co
- PyTorch, CrossEntropyLosspytorch.org
- Long, Shelhamer & Darrell, Fully Convolutional Networks for Semantic Segmentation (2014)arxiv.org
- Google, Machine Learning Crash Course: Overfittingdevelopers.google.com





