Adversarial Self-Supervised Learning for Out-of-Domain Detection (2021)

Abstract: Detecting out-of-domain (OOD) intents is crucial for the deployed task-oriented dialogue system. Previous unsupervised OOD detection methods only extract discriminative features of different in-domain intents while supervised counterparts can directly distinguish OOD and in-domain intents but require extensive labeled OOD data. To combine the benefits of both types, we propose a self-supervised contrastive learning framework to model discriminative semantic features of both in-domain intents and OOD intents from unlabeled data. Besides, we introduce an adversarial augmentation neural module to improve the efficiency and robustness of contrastive learning. Experiments on two public benchmark datasets show that our method can consistently outperform the baselines with a statistically significant margin.

## introduction task-oriented dialog systems @xcite @xcite @xcite such as google's dialogflow or amazon's lex have become ubiquitous to make people interact with machines using natural language. in the architecture of a dialogue system, detecting unknown or ood (out-of-domain) intents from user queries is an essential component that aims to know when a user query falls outside their range of predefined supported intents. different from traditional intent detection tasks, we do not know the exact number of unknown intents in practical scenarios and can barely annotate extensive ood samples. lack of real ood examples always leads to poor prior knowledge about these unknown intents, making it challenging to identify ood samples in the taskoriented dialog system. previous methods of detecting ood intents can be generally classified into two types: unsupervised and supervised ood detection. unsupervised ood detection @xcite @xcite @xcite @xcite @xcite means no labeled ood samples except for labeled in-domain data. by contrast, supervised ood detection @xcite @xcite @xcite represents that there are extensive labeled ood samples in the training data. most of unsupervised ood detection methods follow a two-stage framework: training and detecting. they first train an in-domain intent classifier to extract intent representations, then detect whether the test query belongs to ood by estimating its probability density. for example, @xcite ; @xcite simply use a threshold on the in-domain classifier's probability estimate. @xcite employs an unsupervised density-based novelty detection algorithm, local outlier factor (lof) to detect unseen intents. however, such neural models can only extract discriminative features of different in-domain intents since they are trained on the in-domain data without access to ood data. therefore, these methods are known to produce highly overconfident posterior distributions even for such abnormal ood samples @xcite @xcite . for supervised ood detection, classical methods such as @xcite , form a (n + 1)-class classification problem where the (n + 1)-th class represents the unseen intents. further, @xcite uses labeled ood data to generate an entropy regularization term to enforce the predicted distribution of ood inputs closer we first train an intent representation extractor using two kinds of objectives: supervised cross-entropy loss on the in-domain data and self-supervised contrastive loss on the unlabeled data. then we extract the representation of the test query to detect ood using msp (maximum softmax probability) @xcite , lof @xcite or gda @xcite . to the uniform distribution. however, collecting large-scale labeled ood data is usually difficult and expensive. these drawbacks limit the broad application of supervised ood detection. in this paper, we aim to capitalize on the benefits of both self-supervised and supervised ood detection: (1) simultaneously modeling semantic features of both in-domain and ood data; in this paper, we propose a self-supervised contrastive learning framework to model discriminative semantic features of both in-domain intents and ood intents from unlabeled data. without access to labeled ood data, our method aims to learn representations that discriminate between all unlabeled intents in the instance level. when combined with supervised in-domain training, our method learns features that are both rich and semantically discriminative. besides, to replace the stochastic data augmentation mechanisms like random cropping, random color distortions in the image processing field @xcite , we propose an adversarial augmentation neural module to improve the diversity and complexity of pre-defined transformation functions. specifically, we compute modelagnostic adversarial worst-case perturbations to the inputs in the direction that significantly increases the original contrastive loss. intuitively, adversarial learning can generate pseudo hard positive pairs thus improve the efficiency and robustness of contrastive learning. our contributions are three-fold: ## approach overall architecture fig 1 (a) shows the overall architecture of our proposed two-stage framework. we first train an in-domain intent classifier to extract intent representations using two objectives then use the detection algorithms msp @xcite , lof @xcite or gda @xcite to detect ood. in the training stage, we first train a bilstm in-domain intent classifier similar to @xcite using labeled in-domain data. then we apply an adversarial contrastive objective to continue training on the unlabeled data. self-supervised contrastive learning to simultaneously model semantic features of both in-domain and ood data, we propose a selfsupervised contrastive learning framework to utilize unlabeled data. following @xcite @xcite @xcite , we formulate the contrastive loss for a positive pair of examples (i, j) as: adversarial neural augmentation to improve the diversity of data augmentation and avoid handcrafted engineering, we apply adversarial attack @xcite @xcite @xcite to generate pseudo positive samples. it should be noted that samples obtained by adversarial attack is in the form of embedding to ensure end-to-end training. specifically, we need to compute the worst-case perturbation δ that maximizes the original contrastive loss l: δ = arg max δ ≤ l θ, x + δ , where θ represents the parameters of a model and x denotes a given sample. is the norm bound of the perturbation δ. in practical implementation, we apply fast gradient value (fgv) @xcite to approximate the perturbation δ: ## conclusion in this paper, we focus on combining the benefits of both unsupervised and supervised ood detection: simultaneously modeling semantic features of both in-domain and ood data without requiring labor-intensive ood annotation. we propose a self-supervised contrastive learning framework to learn rich and semantically discriminative representations from unlabeled data. besides, we propose an adaptive end-to-end adversarial augmentation neural module to improve the diversity and complexity of pre-defined transformation functions. experiments show that our method achieves better performance than unsupervised ood baselines, even close to supervised ood oracles.