wetliu / energy_ood

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clarification of paper Figure 2

aldipiroli opened this issue · comments

Hello and thanks for sharing this amazing work.
I have a question regarding the Figure 2 of the paper, more specifically on the negative energy score values.
From Equation 4, I understood that given the output logits of the network, the negative score is a single real value derived by summing the exponential of the raw logits and then by applying the logarithm.

I am therefore confused about the bar plot of Figure 2(b), where you plot the logits against the class labels. Is it just a case that the energy score of the in-distribution example appears to have the same value as the logits with larger module (C8)? (Same goes for the out of distribution example.)

Hello. Your observation is correct that the energy score seems to be the same as the maximum logit. But this is not accident. The reason it is this way is that the predictions (of both in and out of distribution samples) are almost the 1.0. As a result, the weighted sum of the logit (the energy score) is basically equivalent to the maximum logit. Therefore, using the maximum probability is not going to derive useful information for OOD detection as the model prediction for both in-and out-of-distribution samples are almost 1.

In other scenario, when the model is less certain about its prediction, it won't be equivalent to maximum logit anymore. Thus, you can imagine the energy score takes the advantage of 1) maximum logit for in-distribution samples (because we assume the model is more certain about its prediction) and 2) weighted sum of logits where the contribution of the classes other than the one with maximum logit will be more noticeable. With that being said, energy score is still applicable when the the probability of 1) and 2) are close to 1 (using maximum logit).

Thank you for your answer!
I understand.. as soon as you have a really high logit score the softmax saturates and what you get is always something near one.

I am wondering however if in a way the free energy function is also losing some information about the network knowledge. In the exponential term, negative logits contribute almost nothing to the final energy score. Wouldn't it make also sense to use the absolute value of the logits or to learn a projection which better separates the values?

You can do so. That makes sense to me.