Your Finetuned Large Language Model is Already a Powerful Out-of-distribution Detector
Not on the map. Why?
Abstract (arXiv)
We revisit the likelihood ratio between a pretrained large language model (LLM) and its finetuned variant as a criterion for out-of-distribution (OOD) detection. The intuition behind such a criterion is that, the pretrained LLM has the prior knowledge about OOD data due to its large amount of training data, and once finetuned with the in-distribution data, the LLM has sufficient knowledge to distinguish their difference. Leveraging the power of LLMs, we show that, the likelihood ratio can serve as an effective OOD detection criterion. Moreover, we apply the proposed LLM-based likelihood ratio to detect OOD questions in question-answering (QA) systems, which can be used to improve the performance of specialized LLMs for general questions. Given that likelihood can be easily obtained by the loss functions within contemporary neural network frameworks, it is straightforward to implement this approach in practice. Since both the pretrained LLMs and its various finetuned models are widely available from online platforms such as Hugging Face, our proposed criterion can be effortlessly incorporated for OOD detection without the need for further training. We conduct comprehensive evaluation across on multiple settings, including far OOD, near OOD, spam detection, and QA scenarios, to demonstrate the effectiveness of the method. Code can be found at https://github.com/andiac/LLMOODratio
Key facts. Cited by 11 papers in the map (data through 7 Oct 2026). Builds on 38 of its 49 references that are in the map. First posted on arXiv 7 Apr 2024.
Builds on
38 of 49 references.
References · 38
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2021Training Verifiers to Solve Math Word Problemscited by 9,743
- 2021Measuring Mathematical Problem Solving With the MATH Datasetcited by 5,203
- 2021On the Opportunities and Risks of Foundation Modelscited by 3,961
- 2023Mistral 7Bcited by 3,065
- 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,818
- 2020Supervised Contrastive Learningcited by 2,803
- 2016A Baseline for Detecting Misclassified and Out-of-Distribution Examples in Neural Networkscited by 2,362
- 2019BoolQ: Exploring the Surprising Difficulty of Natural Yes/No Questionscited by 2,140
- 2020Don't Stop Pretraining: Adapt Language Models to Domains and Taskscited by 1,548
26 more
- 2018Know What You Don't Know: Unanswerable Questions for SQuADcited by 1,538
- 2018A Simple Unified Framework for Detecting Out-of-Distribution Samples and Adversarial Attackscited by 1,472
- 2020Energy-based Out-of-distribution Detectioncited by 1,296
- 2019PubMedQA: A Dataset for Biomedical Research Question Answeringcited by 1,271
- 2023MetaMath: Bootstrap Your Own Mathematical Questions for Large Language Modelscited by 724
- 2022Out-of-Distribution Detection with Deep Nearest Neighborscited by 596
- 2019Likelihood Ratios for Out-of-Distribution Detectioncited by 451
- 2018Do Deep Generative Models Know What They Don't Know?cited by 443
- 2022ViM: Out-Of-Distribution with Virtual-logit Matchingcited by 404
- 2019An Evaluation Dataset for Intent Classification and Out-of-Scope Predictioncited by 378
- 2018Snips Voice Platform: an embedded Spoken Language Understanding system for private-by-design voice interfacescited by 376
- 2022OpenOOD: Benchmarking Generalized Out-of-Distribution Detectioncited by 267
- 2021When Does Pretraining Help? Assessing Self-Supervised Learning for Law and the CaseHOLD Datasetcited by 199
- 2019Input complexity and out-of-distribution detection with likelihood-based generative modelscited by 186
- 2021Contrastive Out-of-Distribution Detection for Pretrained Transformerscited by 70
- 2021Revisiting Mahalanobis Distance for Transformer-Based Out-of-Domain Detectioncited by 67
- 2020Understanding Anomaly Detection with Deep Invertible Networks through Hierarchies of Distributions and Featurescited by 64
- 2022Boosting Out-of-distribution Detection with Typical Featurescited by 48
- 2019Likelihood Ratios and Generative Classifiers for Unsupervised Out-of-Domain Detection In Task Oriented Dialogcited by 33
- 2021On the Out-of-distribution Generalization of Probabilistic Image Modellingcited by 32
- 2020Wat zei je? Detecting Out-of-Distribution Translations with Variational Transformerscited by 31
- 2023Is Fine-tuning Needed? Pre-trained Language Models Are Near Perfect for Out-of-Domain Detectioncited by 29
- 2021Entropic Issues in Likelihood-Based OOD Detectioncited by 16
- 2022Towards Textual Out-of-Domain Detection without In-Domain Labelscited by 14
- 2023Spam-T5: Benchmarking Large Language Models for Few-Shot Email Spam Detectioncited by 12
- 2022Falsehoods that ML researchers believe about OOD detectioncited by 8
Built on by
Citing papers per year: 2024: 3; 2025: 4; 2026: 4.
11 papers.
- 2024Large Language Models for Anomaly and Out-of-Distribution Detection: A Surveycited by 24
- 2024Out-of-Distribution Detection: A Task-Oriented Survey of Recent Advancescited by 24
- 2024Rethinking Uncertainty Estimation in LLMs: A Principled Single-Sequence Measurecited by 18
- 2025Shh, don't say that! Domain Certification in LLMscited by 7
- 2025Neuroplasticity and Corruption in Model Mechanisms: A Case Study Of Indirect Object Identificationcited by 3
- 2026Trust The Typicalcited by 3
- 2025Concept-based Adversarial Attack: a Probabilistic Perspectivecited by 2
- 2025GLIP-OOD: Zero-Shot Graph OOD Detection with Graph Foundation Modelcited by 1
- 2026Position: A Three-Layer Probabilistic Assume-Guarantee Architecture Is Structurally Required for Safe LLM Agent Deploymentcited by 1
- 2026Domain Restriction via Multi SAE Layer Transitionscited by 0
- 2026Toward Robust In-Context Learning: Leveraging Out-of-distribution Proxies for Target Inaccessible Demonstration Retrievalcited by 0
- 2026Position: A Three-Layer Probabilistic Assume-Guarantee Architecture Is Structurally Required for Safe LLM Agent Deployment18 May 2026
- 2026Domain Restriction via Multi SAE Layer Transitions12 May 2026
- 2026Toward Robust In-Context Learning: Leveraging Out-of-distribution Proxies for Target Inaccessible Demonstration Retrieval13 Apr 2026
- 2026Trust The Typical4 Feb 2026
- 2025Concept-based Adversarial Attack: a Probabilistic Perspective30 Jun 2025
- 2025GLIP-OOD: Zero-Shot Graph OOD Detection with Graph Foundation Model29 Apr 2025
- 2025Neuroplasticity and Corruption in Model Mechanisms: A Case Study Of Indirect Object Identification27 Feb 2025
- 2025Shh, don't say that! Domain Certification in LLMs26 Feb 2025
- 2024Rethinking Uncertainty Estimation in LLMs: A Principled Single-Sequence Measure19 Dec 2024
- 2024Out-of-Distribution Detection: A Task-Oriented Survey of Recent Advances18 Sep 2024
- 2024Large Language Models for Anomaly and Out-of-Distribution Detection: A Survey3 Sep 2024