CED: Comparing Embedding Differences for Detecting Out-of-Distribution and Hallucinated Text

Hakyung Lee, Keon-Hee Park, Hoyoon Byun, Jeyoon Yeom, Jihee Kim, Gyeong-Moon Park, Kyungwoo Song · 2024

Detecting out-of-distribution (OOD) samples is crucial for ensuring safety and robustness of models deployed in real-world scenarios.While most OOD detection studies focus on fine-tuned models trained on in-distribution (ID) data, detecting OOD in pre-trained models is also important due to computational limits and the widespread use of open-source models.However, pre-trained models often underperform in same domain shift scenarios, as both ID and OOD samples originate from the same domain, leading to high overlap in their embeddings.To address this issue, we propose CED, a training-free OOD detection method that enhances the distinction between ID and OOD samples.We theoretically validate that strategically selected auxiliary and oracle samples improve this separation.On the basis of our theoretical analysis, CED utilizes these specially designed samples to significantly improve the ability of pre-trained models to differentiate ID from OOD samples in text classification and hallucination detection tasks.We verify that CED is a plug-and-play method compatible with various backbone networks like RoBERTa, Llama, and OpenAI Embedding.

Read the paper · More papers on PaperTik