FLatS: Principled Out-of-Distribution Detection with Feature-Based Likelihood Ratio Score

Haowei Lin, Yuntian Gu
10/8/2023
cs.LGcs.AIcs.CL

Official code: linhaowei1/FLatS (4 stars, last commit 2023-10-10).

Abstract

Detecting out-of-distribution (OOD) instances is crucial for NLP models in practical applications. Although numerous OOD detection methods exist, most of them are empirical. Backed by theoretical analysis, this paper advocates for the measurement of the "OOD-ness" of a test case $\boldsymbol{x}$ through the likelihood ratio between out-distribution $\mathcal P_{\textit{out}}$ and in-distribution $\mathcal P_{\textit{in}}$. We argue that the state-of-the-art (SOTA) feature-based OOD detection methods, such as Maha and KNN, are suboptimal since they only estimate in-distribution density $p_{\textit{in}}(\boldsymbol{x})$. To address this issue, we propose FLatS, a principled solution for OOD detection based on likelihood ratio. Moreover, we demonstrate that FLatS can serve as a general framework capable of enhancing other OOD detection methods by incorporating out-distribution density $p_{\textit{out}}(\boldsymbol{x})$ estimation. Experiments show that FLatS establishes a new SOTA on popular benchmarks. Our code is publicly available at https://github.com/linhaowei1/FLatS.

View on arXivView PDF

Code Implementations(1)

linhaowei1/FLatSOfficial100%

[EMNLP 2023] FLatS: Principled Out-of-Distribution Detection with Feature-Based Likelihood Ratio Score

40Shell, PythonAug 24, 20233 years ago
language-modellikelihood-ratio-testllmmachine-learningnlp+2 more

Similar Papers

Cite this paper

@article{lin2023flats,
  title  = {FLatS: Principled Out-of-Distribution Detection with Feature-Based Likelihood Ratio Score},
  author = {Haowei Lin and Yuntian Gu},
  year   = {2023},
  eprint = {2310.05083},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2310.05083v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2310.05083.svg)](https://codeofpaper.com/paper/2310.05083)

Discussion