What are the Huber loss for residual with threshold and its derivative ? For , what are and at and , and why does Huber loss combine the benefits of MSE and MAE?
Deep learning, Loss functions
Level L2 Elementary. Length Medium. Nature Th+Mat Both.
What's being asked
Whether you know the piecewise definition of Huber loss, can compute its value and gradient, and understand its behaviour near zero versus on outliers.
Key idea
Huber loss is quadratic for and linear for , with continuous derivative . Near its gradient shrinks linearly like MSE for smooth convergence, while for large residuals its gradient is capped at like MAE so outliers cannot dominate.
Steps
- Write the definition: if , and if . Notice both pieces equal and have derivative at , so is -smooth.
- Derivative: for , and for .
- Evaluate at (): , and .
- Evaluate at (): , and .
- Contrast with MSE and MAE: pure MSE has (growing linearly with outliers, destabilising gradients), while pure MAE has everywhere except a non-differentiable kink at (causing oscillation near unless learning rate decays).
Common mistakes
- Writing instead of for the linear branch, which makes the loss discontinuous at .
- Thinking Huber loss is twice differentiable at ; its second derivative jumps from to .
How long your answer should be
Half a page; 4 minutes.
Last checked on 4 December 2026.
Read this
Previous in Deep learning: Is it true that an additive bias term in a linear or convolutional layer immediately followed by batch normalisation is redundant, and why?
Next in Deep learning: How does clipping gradients by global L2 norm differ from clipping element-wise by value? Given a gradient vector and threshold , what is the clipped gradient under each method, and which preserves the steepest-descent direction?