  Detecting Out-of-Domain (OOD) or unknown intents from user queries is
essential in a task-oriented dialog system. Traditional softmax-based
confidence scores are susceptible to the overconfidence issue. In this paper,
we propose a simple but strong energy-based score function to detect OOD where
the energy scores of OOD samples are higher than IND samples. Further, given a
small set of labeled OOD samples, we introduce an energy-based margin objective
for supervised OOD detection to explicitly distinguish OOD samples from INDs.
Comprehensive experiments and analysis prove our method helps disentangle
confidence score distributions of IND and OOD data.\footnote{Our code is
available at \url{https://github.com/pris-nlp/EMNLP2022-energy_for_OOD/}.}
