[Paper Review] Fine-Tuning Deteriorates General Textual Out-of-Distribution Detection by Distorting Task-Agnostic Features
This paper identifies a critical trade-off in textual out-of-distribution (OOD) detection: fine-tuning pre-trained language models (PLMs) improves detection of semantic shifts but severely degrades performance on non-semantic shifts due to distortion of task-agnostic features. To address this, the authors propose GNOME, a general OOD detection score that combines confidence from both pre-trained and fine-tuned features, achieving state-of-the-art average performance across diverse shift scenarios, with a 4.88-point reduction in FAR95 on cross-task benchmarks.
Detecting out-of-distribution (OOD) inputs is crucial for the safe deployment of natural language processing (NLP) models. Though existing methods, especially those based on the statistics in the feature space of fine-tuned pre-trained language models (PLMs), are claimed to be effective, their effectiveness on different types of distribution shifts remains underexplored. In this work, we take the first step to comprehensively evaluate the mainstream textual OOD detection methods for detecting semantic and non-semantic shifts. We find that: (1) no existing method behaves well in both settings; (2) fine-tuning PLMs on in-distribution data benefits detecting semantic shifts but severely deteriorates detecting non-semantic shifts, which can be attributed to the distortion of task-agnostic features. To alleviate the issue, we present a simple yet effective general OOD score named GNOME that integrates the confidence scores derived from the task-agnostic and task-specific representations. Experiments show that GNOME works well in both semantic and non-semantic shift scenarios, and further brings significant improvement on two cross-task benchmarks where both kinds of shifts simultaneously take place. Our code is available at https://github.com/lancopku/GNOME.
Motivation & Objective
- To systematically evaluate existing textual OOD detection methods across both semantic and non-semantic distribution shifts, which are often treated separately.
- To investigate why fine-tuning PLMs improves detection of semantic shifts but deteriorates detection of non-semantic shifts.
- To develop a general-purpose OOD detection method that performs well under diverse, unknown distribution shifts.
- To provide empirical and analytical insights into how fine-tuning distorts task-agnostic features, impairing OOD detection on non-semantic shifts.
- To propose and validate a unified OOD detection framework that leverages both pre-trained and fine-tuned representations for robustness across shift types.
Proposed method
- Propose GNOME, a general OOD detection score that integrates confidence scores derived from both task-agnostic (pre-trained) and task-specific (fine-tuned) representations.
- Compute distance-based confidence scores using feature statistics from both pre-trained and fine-tuned model layers, particularly focusing on the last and first layer representations.
- Combine the distance scores from pre-trained and fine-tuned features via a weighted average to form the final GNOME score, balancing performance across shift types.
- Use Mahalanobis distance (MD) as the core distance metric in the feature space for both pre-trained and fine-tuned models to estimate uncertainty.
- Evaluate GNOME on a comprehensive benchmark suite covering both non-semantic and semantic shift scenarios, including cross-task settings with mixed shifts.
- Conduct ablation studies to verify the contribution of each component, especially the fusion of pre-trained and fine-tuned features, and validate generalization across different PLM backbones.

Experimental results
Research questions
- RQ1Why does fine-tuning degrade the performance of OOD detection methods on non-semantic shifts, despite improving it on semantic shifts?
- RQ2To what extent do task-agnostic features—learned during pre-training—contribute to detecting non-semantic distribution shifts?
- RQ3Can a unified OOD detection method be designed that performs robustly across both semantic and non-semantic distribution shifts?
- RQ4How does the fusion of pre-trained and fine-tuned features improve generalization in OOD detection under unknown shift types?
- RQ5Does the proposed GNOME method generalize across different pre-trained language model architectures and datasets?
Key findings
- Fine-tuning PLMs significantly improves detection performance on semantic shifts but causes a severe drop in performance on non-semantic shifts, revealing a critical trade-off.
- The degradation in non-semantic shift detection is caused by the distortion of task-agnostic linguistic features during fine-tuning, which are essential for detecting distribution shifts unrelated to task semantics.
- GNOME achieves an average FAR95 of 35.88 across 11 benchmarks, outperforming all baselines by 8.13 points on average, demonstrating strong generalization.
- On two cross-task benchmarks where both semantic and non-semantic shifts co-occur, GNOME reduces the average FAR95 by 4.88 points compared to the previous SOTA.
- The trade-off between non-semantic and semantic shift detection is consistent across different PLM backbones, including BERT, RoBERTa-base, and RoBERTa-large.
- GNOME consistently improves over baselines across all tested models and shift types, confirming its robustness and generalization capability.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.