Abstract
Chatbots and virtual assistants often struggle to identify out-of-domain (OOD) inputs when training data is scarce. This paper introduces an OOD-resistant Prototypical Network (O-Proto) that utilizes meta-learning to detect OOD queries in low-resource settings, even when no OOD examples are available during training. By simulating OOD samples from disparate tasks and optimizing a triple loss function, the model establishes a robust distance-based boundary for classification.
Introduction
In real-world text classification, such as intent recognition for a new chatbot, developers face two primary hurdles: Few-Shot Learning (limited examples per category) and Zero-Shot OOD Detection (the need to reject irrelevant queries without prior examples of "irrelevant" data). Traditional deep learning models tend to be overconfident, force-fitting random queries into known categories. Existing OOD detection methods typically require massive datasets, which is impractical for low-resource tasks where data is expensive to label.
Methodology
The proposed O-Proto framework builds upon Prototypical Networks, where inputs are mapped into a vector space and clustered around class "prototypes." The innovation lies in a specialized meta-training strategy and a triple loss function.
Simulated OOD Training
During meta-training, the model is exposed to multiple tasks. To teach the model the concept of "out-of-domain," examples from a different task are treated as "fake" OOD samples for the current task. This allows the model to learn a generalizable ability to distinguish "none of the above."
Triple Loss Function
The model optimizes three distinct losses to refine the embedding space:
- $L_{in}$: Standard cross-entropy to ensure In-Domain (ID) samples are correctly classified.
- $L_{ood}$: A hinge loss that pushes "fake" OOD samples away from all ID prototypes.
- $L_{gt}$: A confidence loss that keeps ID samples close to their prototypes, preventing the OOD-pushing logic from making ID classifications "fuzzy."
Datasets and Evaluation
The model was evaluated on two datasets representing different challenges:
- Amazon Review Dataset: Sentiment classification across 21 product categories. 13 categories were used for training, with others reserved for testing few-shot performance.
- Conversation Dataset: A real-world intent classification dataset with 539 categories. This dataset is highly imbalanced and includes human-labeled OOD instances, providing a rigorous test for the system.
Key Results
The O-Proto model significantly outperformed baselines like One-Class SVMs and standard Prototypical Networks:
- OOD Detection: On the Amazon dataset, the Equal Error Rate (EER) dropped from 46.5% (standard Proto) to 24.0% (O-Proto).
- ID Classification: On the Conversation dataset, O-Proto achieved a Class Error Rate (CER) of 29.6%, vastly superior to the Vanilla CNN baseline (76.8%) in the few-shot setting.
- Robustness: Performance remained consistent across various "K-shot" scenarios (1 to 100 examples), proving effectiveness in data-poor environments.
Conclusion
The O-Proto approach demonstrates that explicit OOD data is not required if a diverse set of "other" tasks is available for meta-learning. While the method relies on a diverse source dataset and requires threshold tuning, it provides a powerful solution for OOD detection in low-resource settings. Future work includes exploring more complex sentence encoders and applying the framework to non-textual domains.
Summary updated