SlowGuess/NAACL_2022_OCR huggingface dataset:
$^{1}$ Ankan Mullick*  $^{2}$ Sukannya Purkayastha*†  $^{1}$ Pawan Goyal  $^{1,3}$ Niloy Ganguly
$^{1}$ Department of Computer Science and Engineering, IIT Kharagpur
$^{2}$ TCS Research, India
$^{3}$ Leibniz University of Hannover, Germany
ankanm@kgpian.iitkgp.ac.in, sukannya.purkayastha@tcs.com
{pawang, niloy}@cse.iitkgp.ac.in
Systems like Voice-command based conversational agents are characterized by a pre-defined set of skills or intents to perform user specified tasks. In the course of time, newer intents may emerge requiring retraining. However, the newer intents may not be explicitly announced and need to be inferred dynamically. Thus, there are two important tasks at hand (a). identifying emerging new intents, (b). annotating data of the new intents so that the underlying classifier can be retrained efficiently. The tasks become specially challenging when a large number of new intents emerge simultaneously and there is a limited budget of manual annotation. In this paper, we propose MNID (Multiple Novel Intent Detection) which is a cluster based framework to detect multiple novel intents with budgeted human annotation cost. Empirical results on various benchmark datasets (of different sizes) demonstrate that MNID, by intelligently using the budget for annotation, outperforms the baseline methods in terms of accuracy and F1-score.
The conversational agents such as Amazon Alexa, Apple Siri are characterised by the skill of understanding intents which help them to efficiently handle a user's query. For example, the query 'Will it be colder in Ohio' requires getting the weather updates for the city 'Ohio' and would be associated to the intent GetWeather. The agents are trained with a pre-defined set of intents such as {GetWeather, RateBook, BookRestaurant} so as to perform the goal-oriented user tasks. But with the passage of time, a user may be interested in performing newer tasks adding hitherto unknown intents. For example, 'Play some music from 1954' would be
associated to the intent PlayMusic that may not be a part of the set of pre-defined intents.
Emergence of novel intent detection has been periodically checked by different models in the last decade. There are works on incremental learning in dynamic environment for evolving new classes (Zhou and Chen, 2002; Kuzborskij et al., 2013; Scheirer et al., 2012). There are also several approaches (Sun et al., 2016; Masud et al., 2010; Haque et al., 2016; Wang et al., 2020; Mu et al., 2017b,a) to detect new classes in the form of outlier detection but they do not distinguish among multiple new class labels so are not effective in novel multi-class detection. Xia et al. (2018); Siddique et al. (2021) detect user intents using zero-shot generalized intent detection framework. However, they assume that the unseen intent class LABELS are already known, while in our case neither the number of unseen intent classes, nor the corresponding class labels are known. The other line of works (Xia et al., 2021; Halder et al., 2020) supply the system with new intents, albeit with a limited amount of tagged data per class and then have an efficient algorithm to incrementally learn new classes. These models work on the assumption that some instances of these new classes would be provided for model building. However, in a realistic setting, the system may not have any knowledge of the number and types of new intents appearing, it may at most understand that some new out-of-domain samples are generated. So, the problem statement is to probe the incoming data wisely and use minimum human intervention to identify all types of novel intents emerging and intelligently tag a limited set of data covering all discovered intents, which can be fed into a model for retraining.
More concretely the system is at first trained with an initial set of known intents; side-by-side an out-of-distribution (OOD) detector classifier is also trained to identify datapoints which do not fit the known intents. When substantial amount of
† Work done while the author was a student at IIT Kharagpur
Findings of the Association for Computational Linguistics: NAACL 2022, pages 282 - 292 July 10-15, 2022 ©2022 Association for Computational Linguistics
such points are detected, the task is to (a) identify whether the points are originating from introduction of a single novel intent or multiple and (b) choose (a limited number of) samples to annotate so that the classifier can be retrained efficiently.
In order to determine the number of novel intents present in the OOD data, we undertake a clustering based approach with the idea that each cluster would represent a novel intent. By increasing the cluster number progressively, we can make a highly accurate estimate of the number of novel intents. If sample points of an intent mainly correspond to a well formed cluster, the implication is that without much probing we can shortlist enough training samples (through silver tagging) for that class. On the other hand, if the sample points of an intent tend to intertwine with other intent points in the feature space, these can be considered as uncertain points and require human intervention for tagging (gold tagging). With this intuition in place, we design a mix of silver and gold tagging to produce high-quality training samples which can be used to retrain the classifier.
Our proposed framework of Multiple Novel Intent Detection (MNID) is compared with competitive baselines and evaluated across several standard public datasets in NLU domain where it performs substantially better. We use datasets with different number of intent classes. SNIPS (Coucke et al., 2018) and ATIS (Tur et al., 2010) are smaller datasets, consisting of less number intent classes - 7 and 21, respectively. HWU (Liu et al., 2019a), BANKING (Casanueva et al., 2020) and CLINC (Larson et al., 2019) consist of large number of intent classes - 64, 77 and 150, respectively.
The paper is organized as follows. We discuss the Problem Setting and solution overview in Section 2. Our algorithmic framework is described in Section 3. We present the datasets with experimental statistics and data pre-processing in Section 4. In Section 5, we discuss the experimental design and baselines. Detail evaluation results with different algorithmic variations are in Section 6. We conclude with a summary in Section  $7^{1}$ .
2 Problem Setting and Solution Overview
Problem Setting: To formally describe the problem setting, let there be a dataset  $W$  containing overall  $N$  classes. However, the value of  $N$  is not
known apriori. Let  $T \in W$  be the test set and  $W - T = D$  be the rest of the dataset, out of which  $|D_{init}|$  ( $<< |D|$ ) labelled data of  $N_{init}$  ( $< N$ )
Codes are in - https://github.com/sukannyapurkayastha/MNID
classes is initially provided, while the rest of the data is unlabelled. The task is to design an algorithm to (a). detect all the remaining  $N - N_{init}$  classes and (b). spent a limited budget  $(B - |D_{init}|)$  to annotate high fidetitious new datapoints, so that the classifier can achieve high accuracy when retraining.
Solution Overview: The solution steps are as follows: (a) Identify the OOD (out of distribution) datapoints which do not belong to the initial  $N_{init}$  classes. This can be considered as a preprocessing step. (b) Use a part of the allotted budget to annotate a portion of these OOD datapoints. These points (for annotation) are selected by repeatedly running a clustering algorithm with increasing num
Figure 1: End-to-end architecture of MNID: Multiple Novel Intent Detection
ber of clusters as input, and choosing cluster centre points to identify the unknown classes. Rationale: The intuition/expectation is that each cluster hosts a separate intent, hence annotating the cluster centres would lead to discovery of maximum number of novel intents. (c) Further identify the classes which are well clustered in feature space and which are not. Use another portion of the budget to increase the annotations of not-so well formed clusters and then build up a classifier with all the classes. Rationale: If a cluster is well-formed, most likely it is hosting a single class, hence there is no need to annotate further points there, rather annotate more points in not-so-well-formed clusters. (d) Use the classifier to classify points from the clusters. Identify low-confidence points from the bad clusters and annotate them. High-confidence points from good clusters are silver annotated. Rationale: The low-confidence points in the bad clusters are the most uncertain points, hence annotating them helps in increasing classifier accuracy. Similarly high-confident points in the good clusters almost surely will belong to that particular cluster, hence silver annotation is pursued. (e). Retrain the classifier.
The overall MNID framework with different algorithmic modules is shown in Fig. 1.
3 MNID: Solution Detail
The proposed framework for Multiple Novel Intent Detection (MNID) is explained through Algorithm 1. As highlighted in the overview, the algorithm consists of data pre-processing step, followed by three stages, each of them are discussed below. The total budget of (gold) annotation is  $B$ . Besides the system can undertake unlimited silver annotation. The advantage of silver strategy is that it is free as no human probing is required. However, it is also likely to bring in noise if used indiscriminately.
Pre-process: OOD Detection (OODD): For the dataset  $(D)$ , this module (Algorithm 2) takes the initial labelled data  $(D_{init})$  as input and predicts the Out-of-Domain (OOD) samples on the remaining data,  $(D - D_{init})$ . We call the set of OOD samples predicted as  $\mathcal{O}\mathcal{S}$ . This is a part of the data preprocessing.
Stage 1. Novel Class detection (NCD): In this sub-module (Algorithm 3), we aim at finding all the new classes,  $N_{new}$ . On the OOD samples  $(\mathcal{OS})$  obtained in the previous sub-module (Algorithm 2), we do clustering using K-Means. We start the algorithm with  $K = 1$  and number of new classes,  $N_{new} = 0$ . We perform - (i) K-Means clustering. (ii) Annotate  $x$  points from each cluster, add those points to  $\mathcal{L}$  and identify  $n'$  new classes. (iii) Increase new class count  $(N_{new} + n')$ . (iv) Double the number of cluster count (we compare  $N_{new}$  with  $K / 2$ ). We execute the above steps until cluster count exceeds the new intent count. The algorithm returns current annotations  $(\mathcal{L})$ , newly discovered class count  $(N_{new})$  and newly formed clusters  $(\mathcal{CL})$ . The budget spent in this step is  $B_1$ .
Stage 2. Cluster Quality Based Annotation (CQBA): In this step (Algorithm 4), we evaluate the quality of each of the clusters obtained by the previous algorithm. We annotate  $p$  points from each of these clusters and if all the  $p$  points belong to the same class, we term it as a good cluster or else a bad cluster. An example of a bad cluster in BANKING would be the one containing data points from multiple classes, which may have high similarity, such as: declined_cash_withdrawal and pending_cash_withdrawal. For the bad clusters, we annotate  $q$  more points. All these annotated points are then added to the labelled data,  $\mathcal{L}$ . The budget spent in this step is  $B_{2}$ . Hence the remaining budget  $B - (B_{1} + B_{2})$  is used in the next step.
Stage 3. Post Processing Annotation Strategy
(PPAS): In this step (Algorithm 5), we add more data to the labelled set,  $\mathcal{L}$ , through gold annotation (gold strategy), as well as silver-annotated data (silver strategy). To select these data points, we first train a classifier  $(\mathcal{M})$  with the labelled set,  $\mathcal{L}$  as obtained in the last step (CBQA), and consider the clusters  $\mathcal{CL}$ . We predict on the remaining points of the clusters to get the confidence of the datapoints. We perform silver strategy based on confidence score (CS) and gold strategy in round-robin way to operate on each cluster one after another.
Gold Strategy: Least confident data-points are annotated from the bad clusters (if present) or else from the good clusters. Gold strategy is performed in a round-robin way to retrieve data points with the least score for each cluster until our budget exhausts.
Silver strategy: If the confidence score (CS) of a datapoint from a cluster is greater than a predefined threshold  $(\mathcal{T}\mathcal{H})$ , we measure the average cosine similarity of points annotated within that cluster with this point. If similarity is above a predefined threshold  $(\tau)$ , we label this point with class label of that cluster. The predefined threshold  $(\tau)$  is required to choose good samples selectively instead of choosing all the points. Silver strategy does not require human intervention therefore there is no extra addition to the annotation cost, but the multiple conditions are checked to prevent noise in the training set.
Final Step: We again train the neural model  $\mathcal{M}$  on  $\mathcal{L}$  and test on  $\mathcal{T}$  to find out Accuracy and F1.
4 Dataset and Pre-Processing
We perform our experiments on a variety of datasets, which are widely used as benchmarks for Natural Language Understanding tasks. The datasets are SNIPS (Coucke et al., 2018), ATIS (Tur et al., 2010), HWU (Liu et al., 2019a), BANKING (Casanueva et al., 2020) and CLINC (Larson et al., 2019). SNIPS (7) and ATIS (21) are smaller datasets consisting of less number of intents (in bracket) where HWU (64), BANKING (77) and CLINC (150) are larger datasets with many intents. ATIS is the most imbalanced, skewed dataset. In BANKING data - several intents are highly similar among themselves. The detailed statistics of these datasets including our experimental framework are shown in Table 1. Since the datasets are already fully labelled, annotation essentially means utilizing the already available labels. Hence, we
Dataset (W)	# Intent Class (|N|)	Dataset Size (|W|)	#Labelled IDinitl	#Unlab (|D| - IDinitl)	#Test (|T|)
#IND	#OOD	#Total
SNIPS	7 (5+2)	14484	50	8601	3449	12050	2384
ATIS	21 (13+8)	5871	130	3155	1586	4741	1000
HWU*	64 (10+54)	11036	100	1408	8452	9860	1076
BANKING*	77 (10+67)	13083	100	1026	8877	9903	3080
CLINC*	150 (10+140)	22500	100	1100	16800	17900	4500
Table 1: Statistics based on our split for five Datasets. * represents pre-defined train-test splits. In # Intent Class,  $(- + -)$  represents (known  $^+$  unknown) intents
do not have to deal with usual issues of annotation accuracy, inter-annotator agreement, etc.
Data Pre-Processing
Dataset	DOC	MSP	LMCL	FS-OOD
A	F1	A	F1	A	F1	A	F1
SNIPS	77.3	72.1	78.2	71.7	74.7	69.3	76.8	72.9
ATIS	55.8	47.2	56.1	44.7	54.5	40.6	74.9	68.6
HWU	61.4	57.2	59.9	29.9	53.1	44.3	68.2	64.1
BANKING	56.3	20.4	52.5	20.2	52.9	51.3	73.7	64.1
CLINC	54.8	18.7	53.4	20.5	54.1	59.9	77.7	65.7
Table 2: Accuracy (A) and F1-Score in  $(\%)$  of various OODD algorithms to detect OOD points from different datasets. Bold denotes the best for each dataset.
In the pre-processing step, we filter the out-of-domain samples. We consider four algorithms for detecting out-of-domain samples. i) Softmax Prediction Probability (MSP) (Hendrycks and Gimpel, 2018) predicts out-of-domain samples based on a threshold on the softmax prediction scores. ii) Deep Open Classification (DOC) (Shu et al., 2017) method builds a multi-class classifier with one vs rest layer of sigmoids. iii) Large Margin Cosine Loss (LMCL) (Lin and Xu, 2019) trains a network with margin loss and predictions are then fed into an algorithm called Local Outlier Factor (LOF) for outlier detection. iv) Few-shot OOD (FS-OOD) (Tan et al., 2019) uses a Proto-Typical Network to detect OOD examples and classifying in-domain examples with few-shot examples from the in-domain class. We fine-tune BERT embeddings using all these out of domain sample detection algorithms. We use bert-base-uncased for these methods. We set the threshold for MSP as 0.5 as in Lin and Xu (2019), Xu et al. (2020). The results of all these algorithms are shown in Table 2. FS-OOD (Tan et al., 2019) provides us the best accuracy and F1 for detecting OOD samples  $(\mathcal{O}S)$ . Only DOC performs better in case of SNIPS but overall FS-OOD outperforms other approaches so we use FS-OOD produced out-of-sample data.
The efficacy of the algorithm needs to be tested on two aspects. (a). The number of unknown intents identified. (b). The accuracy achieved when the data is annotated by our algorithm, MNID. To test the accuracy, we use state-of-the-art several classification algorithms used for intent detection.
Different Neural Models: We explore different neural models to evaluate MNID as discussed next:
1. IFSTC (Xia et al., 2021): This finetunes a trained model on few shot data of new classes using an entailment and hybrid strategy. We use the hybrid strategy (best performing in their case).
2. PolyAI (Casanueva et al., 2020): It performs intent classification task based on dual sentence encoders - Universal Sentence Encoders (USE) (Cer et al., 2018) and ConveRT. Since authors have taken down the ConveRT model, we apply USE only.
Along with the above two, we also consider other standard models, 3. BERT ('bert-base-uncased') (Devlin et al., 2019) and 4. RoBERTa ('roberta-base-uncased') (Liu et al., 2019b) for evaluation on these datasets. We finetune these pre-trained language models for 15 epochs for the smaller datasets (SNIPS, ATIS) 50 epochs for the larger datasets (HWU, BANKING, CLINC) and with a learning rate of 2e-05 and Adam optimizer<sup>4</sup>. Early stopping was employed to stop training. For all methods, we provide the same number of gold annotated data obtained using our pipeline and report its performance.
Baselines: We compare the performance of our method using two annotation techniques for choosing  $B - \| D_{init} \|$  data points: 1)  $Gl_F$ : This is the ideal scenario where we are given  $F$  ( $= 10$ ) data points for each of the new classes -  $Gold_{Few}$ , abbreviated as '  $Gl_F$ '. 2)  $Rn_F$ : Here, we randomly choose  $B - \| D_{init} \|$  data points from the unlabelled data -  $Random_{Few}$ , abbreviated as '  $Rn_F$ '.
**Clustering Algorithms:** One of the building blocks of MNID is to cluster datapoints, so the efficacy of MNID depends on employing an efficient clustering algorithm. We do a detailed study by employing several unsupervised and semi-supervised clustering algorithms and choose the best.
The unsupervised algorithms are: (i) K-Means (KM) (MacQueen et al., 1967) (ii) Agglomerera
$^{2}$  FS-OOD: https://github.com/SLAD-ml/few-shot-ood and other OOD models: https://huggingface.co
<sup>3</sup> We use author's implementation of IFSTC (PyTorch) and re-implement PolyAI (Tensorflow)
4 We use https://huggingface.co/
Method	IFSTC (G1F, RnF, MNID)	PolyAI (G1F, RnF, MNID)	BERT (G1F, RnF, MNID)	RoBERTa (G1F, RnF, MNID)
SNIPS	A	85.4, 78.1, 84.7	93.2, 85.7, 95.1	92.7, 91.6, 93.3	94.9, 92.3, 95.3
F1	84.2, 79.4, 84.2	93.2, 84.3, 94.9	92.6, 91.9, 93.9	94.8, 91.9, 94.8
ATIS	A	88.4, 70.1, 88.8	87.8, 71.8, 88.6	88.1, 70.2, 88.2	87.9, 70.8, 88.6
F1	87.3, 65.8, 87.8	84.3, 74.5, 87.0	86.3, 73.9, 86.9	84.6, 74.1, 85.1
HWU	A	78.2, 72.4, 79.7	83.8, 75.2, 83.8	82.6, 73.6, 82.7	82.5, 75.3, 83.7
F1	76.4, 71.4, 78.4	83.7, 77.3, 84.2	81.7, 74.3, 82.4	81.3, 77.2, 82.4
BANKING	A	78.3, 72.8, 79.0	84.2, 79.0, 84.7	80.1, 75.5, 82.8	83.4, 77.0, 84.5
F1	77.7, 74.1, 80.0	83.1, 79.0, 84.4	80.0, 76.4, 83.7	83.9, 78.7, 83.8
CLINC	A	88.7, 77.1, 88.9	92.1*, 83.2, 94.9	90.8, 77.6, 91.4	91.3, 84.5, 92.3
F1	85.7, 76.4, 88.3	93.5, 83.7, 95.2	90.7, 78.8, 91.0	91.7, 85.3, 92.8
Table 3: Overall Accuracy (A) and Macro F1 in (%) across all datasets for different scenarios - ideal  $(Gl_{F})$ , random  $(Rn_{F})$  and MNID (The best outcomes among three scenarios in Bold). *Casanueva et al. (2020) report accuracy of 90.15 with OOS and 92.14 without OOS.
tive Clustering (AG) (Gowda and Krishna, 1978) (iii) Deep Clustering Network (DCN) (Yang et al., 2017) and (iv) Deep Embedded Clustering (DEC) (Xie et al., 2016) which uses the stacked autoencoder based reconstruction loss. The semi-supervised algorithms are: (i) DeepAligned (DAL) (Zhang et al., 2021) which uses limited data for pre-training and cluster assignments as pseudo labels for cluster refinement. (ii) DTC (Han et al., 2019) develops on the DCN algorithm by scaling it to the transfer learning setting and can estimate the number of known classes in unlabelled data. It is however highly dependent on availability of labelled data (iii) KCL (Hsu et al., 2017) which transfers the knowledge to target dataset considering KL-divergence based distance loss (iv) MCL (Hsu et al., 2019) which uses meta-classification based likelihood criterion for pairwise similarity evaluation (v) CDAC+ (Lin et al., 2020) which uses prior data to refine the clustering process and KL-divergence based loss<sup>5</sup>.
Other than KM and AG, all the other unsupervised methods along with some of the semi-supervised methods such as DTC and CDAC need the information of the ground truth number of clusters for training and we provide them so (it is an extra advantage for them). For semi-supervised methods such as KCL, MCL, DTC and DAL, we start with double the number of ground truth clusters and let the method determine the number of clusters.
Hyper-parameters and Settings: For Post-Processing annotation strategy of MNID, we set the cosine similarity threshold,  $\tau$  as 0.8 and the confidence threshold,  $\mathcal{T}\mathcal{H}$  as  $0.5^6$ . For all datasets,
we use a setting similar to  $\kappa$ -shot with  $\kappa = 10$ . For  $N$  intents, we define our total budget  $B = \kappa \times N$ . We use same budget for all our experiments. We experiment on NVIDIA Tesla K40m GPU with 12 GB RAM, 6 Gbps clock cycle and GDDR5 memory. All the methods took less than 8 GPU hours for training.
In this section, we discuss the experimental outcomes for MNID and competing baselines. We also show results of different clustering algorithms and variations of distinct components of MNID. (A) Class Discovery: MNID is very effective in identifying almost all new intents. For HWU, BANKING and CLINC, 54 out of 54  $(100\%)$ , 66 out of 67  $(98.5\%)$  and 139 out of 140  $(99.3\%)$  new intents from the unknown intent set were discovered, respectively. For SNIPS and ATIS, we could discover 2 out of 2  $(100\%)$  and 7 out of 8  $(87.5\%)$  new intent classes, respectively. Due to data skewness (ATIS) and high intent similarity (BANKING, CLINC) MNID misses one intent. (B) Performance of MNID: Table 3 shows the performance of different models - IFSTC, PolyAI, BERT and RoBERTa when trained with datasets provided by MNID. In order to maintain the fairness, MNID,  $Rn_{F}$  and  $Gl_{F}$  use the (overall) same number of gold-annotated data points. Besides MNID uses silver-annotated data points, while the others do not have any way of creating high quality silver annotated data. Each cell in the table consists of values from  $Gl_{F}$ ,  $Rn_{F}$  and MNID. As expected,  $Rn_{F}$  performs the worst across all settings. However, except two scenarios, we observe that MNID consistently performs better than the  $Gl_{F}$  dataset. For all these four different settings across five datasets, MNID improvements over  $Gl_{F}$  predictions are statistically significant  $(p < 0.05)$  as
5 Code: https://github.com/thuiar/TEXTOIR
This combination of  $\tau$  and  $\mathcal{T}\mathcal{H}$  provides the best results among different experimented results.