The Huber loss is a loss function that behaves like the squared error where the error is small and like the absolute error where it is large. It is used in regression, where a model predicts values, as a loss that keeps training stable even when the data contain outliers.
Here is the difference between the prediction and the target (the error), and is the threshold at which the loss switches from the squared error to the absolute error.
Mean squared error (MSE) squares the error, so a single example that is far off can dominate both the loss and the gradient. The absolute error , on the other hand, is robust to outliers, but it has a kink at zero error and its gradient keeps the same magnitude even near the target, which makes fine adjustment difficult. The Huber loss combines, in a single formula, the smoothness of the squared error near the target and the robustness of the absolute error far from it.
The statistician P. J. Huber proposed this loss in a 1964 paper as a way to estimate a location (a central value such as the mean) from data in which a normal distribution is contaminated by a small fraction of another distribution (outliers). That data model, "a normal distribution with part of it replaced by another distribution," and its estimators are still studied in robust statistics, the field of statistical methods that resist outliers (Donoho and Montanari, 2015).
The figure at the top plots the Huber loss with (solid) alongside half the squared error (dashed) and the absolute error (dotted). For it coincides with the dashed curve, and for it becomes a straight line parallel to the dotted one. At an error of 3, , while the Huber loss stays at .

