2
$\begingroup$

As the subject says. On one hand, the answer should be yes because label smoothing is a regularization feature and how can you know if it improves performance without turning it off? On the other hand, I haven't seen any authoritative source claiming that it should be turned off during validation, not even the article that introduced the technique mentions it. And afaict, as the feature is implemented in Keras it is not turned off during validation.

$\endgroup$
4
$\begingroup$

The way most people gain an initial understanding of label smoothing (and what most common explanations have to say on the subject) plays a great role in how one would approach this question.

At first glance, label smoothing is exactly what the name suggests: we modify the labels or some portion of them in order to get a better, more general, more robust model. It makes sense that we don't want the model to learn from (and later predict with) extreme confidence levels, especially when we know that some of the labels are wrong, since this hurts the model's abilities to perform on unseen data. The intuitive explanation of LS mechanics, then, is that we are not feeding the model with pure 1's and 0's, but with less confident values instead, resulting in a more reserved decision function that doesn't extrapolate in an extreme manner. Now, we know that smoothed labels are not the true labels, so at this point the main concern pops up - once we have trained on smoothed labels, do we also use smoothed labels for validation?

If you think about LS purely as a data manipulation technique, the answer to the question above is not obvious, as it may go both ways depending on the argument. However, one must remember that LS is almost always regarded as a regularization technique -- you mention this in the question yourself -- and there is a good reason for that. Regularization, by definition, is when the loss function is extended with an additional regularization term, which usually has to do with penalization. In LS, this penalty term is responsible for punishing high confidence predictions. Even though it may not appear as such, LS, once applied, becomes an essential part of the loss function, which should persist between training and validation if we aim to take advantage of the technique. When we apply LS during training, we are effectively trying to minimize a loss function with the regularization term added in. Throwing it out during validation would defeat the very purpose of including it in the first place: if we decide not to apply LS to the validation set as well, we are making the mistake of expecting extreme confidence (1/0 labels) from a learner that was just a moment ago specifically trained against making overly confident predictions on previously unseen data. The correct thing to do would be to validate that the predictions are of moderate confidence, just as desired. This is why the validation set should also have the regularizer present in the loss function, i.e. have smoothed labels as well.

$\endgroup$
4
  • $\begingroup$ Makes sense but then how would I know if label smoothing improved my model? With LS turned on I'm likely to get different and perhaps even worse values for validation loss and accuracy. I don't want to use LS if I can't say that it makes my model better. $\endgroup$ Jun 23 '20 at 20:55
  • $\begingroup$ I would suggest comparing two models (one with LS, another without it) by testing their accuracy/precision/recall/AUC/whatever on a holdout set. That way you'd be looking at an objective performance metric. $\endgroup$
    – Vlad_Z
    Jun 23 '20 at 23:10
  • $\begingroup$ Isn't that more or less what is done with the validation dataset? $\endgroup$ Jun 24 '20 at 5:26
  • $\begingroup$ Not quite. In the beginning, we use training and validation sets to first teach the model and then make sure that it learned in the right way. We usually build multiple models over training+validation data, as we try different techniques, tune parameters, etc. The test dataset (also called holdout) is used only at the very end to assess unbiased performance of the final model(s) -- this is the data than never affected the models being tested nor (and this is equally important) our previous decisions which lead to having these models as final candidates. $\endgroup$
    – Vlad_Z
    Jun 24 '20 at 6:32
0
$\begingroup$

AFAIK label smoothing comes into picture while calculating the loss while training. There is no loss computation during validation.

$\endgroup$
1
  • $\begingroup$ Sure there is. You're thinking about testing perhaps. $\endgroup$ Jun 23 '20 at 2:19
0
$\begingroup$

Label Smoothing is a regularizer technique that is applied to target value so that the model can learn the data well without overfitting. There is no need to do label smoothing for validation.But even if you do it, it won't be problem.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.