How does target scale affect the magnitude of the loss and its gradients?
Role: Machine Learning Engineer
Category: Machine Learning
Difficulty: medium
Interview Round: Other
How does target scale affect the magnitude of the loss and its gradients?
Consider a regression model trained with gradient descent, and suppose every target is multiplied by a constant $c$, for example by switching the unit from thousands of dollars to dollars.
```hint Start with squared error
Write the gradient of squared error with respect to the prediction, then see how it changes when the target and the residual are both multiplied by $c$.
```
```hint Look past the learning rate
Think about which other parts of a training setup were chosen with a particular output scale in mind.
```
### What a Strong Answer Covers
- How the loss value and its gradient scale with $c$ for squared error, and how absolute error, Huber loss and cross-entropy differ.
- What the change in gradient size does to training with a fixed learning rate, for both very large and very small targets.
- Side effects beyond step size, such as initialization, the balance against regularization, and the balance between terms in a multi-task loss.
- What adaptive optimizers fix and what they leave in place.
- Practical fixes and how predictions get back to the original units.
### Follow-up Questions
- You train on standardized targets. How do you report RMSE in the original units?
- For a heavy-tailed positive target such as revenue, what does training on the log of the target change about what the model predicts?
- In a multi-task model with one regression head in dollars and one classification head, how would you set the loss weights?
- Why does Adam handle a constant rescaling of the loss better than plain SGD, and where does its epsilon term start to matter?
Overview: A machine learning question on what happens to a regression loss and its gradients when the targets are rescaled. It tests how squared, absolute, Huber and cross-entropy losses respond, how target scale interacts with learning rate, initialization, regularization and multi-task weighting, and how to correct for it.