{'fraction_non_alphanumeric': 0.03506751569344714, 'fraction_numerical': 0.008851555796414216, 'mean_word_length': 5.034473361493392, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
AutoOD: Automated Outlier Detection via Curiosity-guided Search and Self-imitation Learning

Outlier detection is an important data mining task with numerous practical applications such as intrusion detection, credit card fraud detection, and video surveillance. However, given a specific complicated task with big data, the process of building a powerful deep learning based system for outlier detection still highly relies on human expertise and laboring trials. Although Neural Architecture Search (NAS) has shown its promise in discovering effective deep architectures in various domains, such as image classification, object detection, and semantic segmentation, contemporary NAS methods are not suitable for outlier detection due to the lack of intrinsic search space, unstable search process, and low sample efficiency. To bridge the gap, in this paper, we propose AutoOD, an automated outlier detection framework, which aims to search for an optimal neural network model within a predefined search space. Specifically, we firstly design a curiosity-guided search strategy to overcome the curse of local optimality. A controller, which acts as a search agent, is encouraged to take actions to maximize the information gain about the controller's internal belief. We further introduce an experience replay mechanism based on self-imitation learning to improve the sample efficiency. Experimental results on various real-world benchmark datasets demonstrate that the deep model identified by AutoOD achieves the best performance, comparing with existing handcrafted models and traditional search methods.


I. INTRODUCTION
With the increasing amount of surveillance data collected from large-scale information systems such as the Web, social networks, and cyber-physical systems, it becomes more and more important for people to understand the underlying regularity of the vast amount of data, and to identify the unusual or abnormal instances [1]- [3]. Centered around this goal, outlier detection plays a very important role in various real-world applications, such as fraud detection [4], [5], cyber security [6]- [8], medical diagnosis [9], and social network analysis [10]- [13].
Driven by the success of deep learning, there has been a surge of interests [14]- [17] in adopting deep neural networks for outlier detection. Deep neural networks can learn to represent the data as a nested hierarchy of concepts to capture the complex structure in the data, and thus significantly surpass traditional outlier detection methods as the scale of data increases [18]. However, building a powerful deep neural network system for a real-world complex application usually still heavily relies on human expertise to fine-tune the hyperparameters and design the neural architectures. These efforts are usually time-consuming and the resulting solutions may still have sub-optimal performance.
Neural Architecture Search (NAS) [19], [20] is one promising means for automating the design of neural networks, where reinforcement learning and evolution have been used to discover optimal model architectures from data [21], [22]. Designing an effective NAS algorithm requires two key components: the search space and the search strategy, which define what architectures can be represented in principles and how to explore the search space, respectively. The discovered neural architectures by NAS have been demonstrated to be on par or outperforms hand-crafted neural architectures.
Although the recent years have witnessed significant progress of NAS techniques in some supervised learning tasks such as image classification and text classification [19], [22], the unsupervised setting and the naturally imbalanced data have introduced new challenges in designing an automated outlier detection framework. (1) Lack of search space. It is non-trivial to determine the search space for an outlier detection task. In particular, since there is no class label information in the training data of an outlier detection task, objective functions play an important role to differentiate between normal and anomalous behaviors. Thus, in contrast to the supervised learning tasks, we often need to find a suitable definition of the outlier and its corresponding objective function for a given real-world data. One typical way to define the outliers is to estimate the relative density of each sample, and declare instances that lie in a neighborhood with low density as anomalies [16]. Yet these density-based techniques perform poorly if the data have regions of varying densities. Another way to define anomalies is through clustering. An instance will be classified as normal data if it is close to the existing clusters, while the anomalies are assumed to be far away from any existing clusters [14]. However, these clustering-based techniques will be less effective if the anomalies form significant clusters among themselves [4]. The proper definition of outliers not only requires domain knowledge from researchers and experience from data scientists, but also needs thorough and detailed raw data analysis efforts. Thus, different from the search spaces defined by the existing NAS, the search space of automated outlier detection needs to cover not only the architecture configurations, but also the outlier definitions with corresponding objective functions.
(2) Unstable search process. The search process may easily become unstable and fragile when outlier detection compounds with architecture search. On the one hand, the imbalanced data distributions make the search process easily fall into the local optima [23]. On the other hand, the internal mechanisms of the traditional NAS may introduce bias in the search process. For instance, the weight sharing mechanism makes the architectures who have better initial performance with similar structures more likely to be sampled [24], [25], which leads to misjudgments of the child model's performance. (3) Low sample efficiency. Existing NAS algorithms usually require training a large number of child models to achieve good performance, which is computationally expensive. While in real-world outlier detection tasks, outliers or abnormal samples are very rare. Thus, it requires the search strategy to exploit samples and historical search experiences more effectively.
To tackle the aforementioned challenges, in this paper, we propose AutoOD, an automated outlier detection algorithm to find an optimal deep neural network model for a given dataset. In particular, we first design a comprehensive search space specifically tailored for outlier detection. It covers architecture settings, outlier definitions, and corresponding loss functions. Given the predefined search space, we further propose a curiosity-guided search strategy to overcome the curse of the local optimality. The search agent is encouraged to seek out regions in the search space that are relatively unexplored. The uncertainty about the dynamics of the search agent is interpreted as the information gain between the agent's new belief over the old one. Moreover, we introduce an experience replay mechanism based on self-imitation learning to enhance sample efficiency. It can benefit the search process through exploiting good experience in the historical episodes. To evaluate the performance of AutoOD, we perform an extensive set of experiments on eight benchmark datasets. When tested on the two important outlier detection tasksinstance-level outlier sample detection and pixel-level defect region segmentation-our algorithm demonstrated the superior performance, comparing with existing handcrafted models and traditional search methods. The experimental results also show that AutoOD has the potential to be applied in more complicated real-world applications.
The contributions of this paper are summarized as follows: • We identify a novel and challenging problem (i.e., automated outlier detection) and propose a generic framework AutoOD. To the best of our knowledge, AutoOD describes the first attempt to incorporate AutoML with an outlier detection task, and one of the first to extend AutoML concepts into applications from data mining fields. • We carefully design a search space specifically tailored to the automated outlier detection problem, covering architecture settings, outlier definitions, and the corresponding objective functions. • We propose a curiosity-guided search strategy to overcome the curse of local optimality and stabilize search process.
• We introduce an experience replay mechanism based on the self-imitation learning to improve the sample efficiency. • We conduct extensive experiments on eight benchmark datasets to demonstrate the effectiveness of AutoOD, and provide insights on how to incorporate AutoOD to the realworld scenarios.

II. PRELIMINARIES AND PROBLEM FORMULATION
In this section, we present the preliminaries and problem definition of our work.

A. Deep AutoEncoder Based Outlier Detection
Classical outlier detection methods, such as Local Outlier Factor [26] and One-Class SVMs [27], suffer from bad computational scalability and the curse of dimensionality in high-dimensional and data-rich scenarios [17]. To tackle these problems, deep structured models have been proposed to process the features in a more efficient way. Among recent deep structured studies, Deep AutoEncoder is one of the most promising approaches for outlier detection. The AutoEncoder learns a representation by minimizing the reconstruction error from normal samples [28]. Therefore, it can be used to extract the common factors of variation from normal samples and reconstruct them easily, and vice versa. Besides directly employing the reconstruction error as the denoter, recent studies [14], [16], [17] demonstrate the effectiveness of collaborating Deep AutoEncoders with classical outlier detection techniques, by introducing regularizers through plugging learned representations into classical outlier definition hypotheses. Specifically, there are three typical outlier assumptions: density, cluster, and centroid. The density based approaches [16] estimate the relative density of each sample, and declare instances that lie in a neighborhood with low density as anomalies. Under the clustering based assumption, normal instances belong to an existing cluster in the dataset, while anomalies are not contained in any existing cluster [14]. The centroid based approaches [17] rely on the assumption that normal data instances lie close to their closest cluster centroid, while anomalies are far away from them. In this work, we illustrate the proposed AutoOD by utilizing Deep AutoEncoder with a variety of regularizers as the basic outlier detection algorithm. The framework of AutoOD could be easily extended to other deep-structured outlier detection approaches.

B. Problem Statement
Different from the traditional Neural Architecture Search, which focuses on optimizing neural network architectures for supervised learning tasks, automated outlier detection has the following two unique characteristics. First, the neural architecture in the Autoencoder needs to be adaptive in the given dataset to achieve competitive performance. The hyperparameter configurations of neural architecture include the number of layers, the size of convolutional kernels and filters, etc.; Second, the outlier detection requires the designs of definitionhypothesis and corresponding objective function. Formally, we where ω denotes the weights well trained on architecture A. J denotes the loss on D valid using the model trained on the D train with definition-hypothesis H and loss function L.

III. PROPOSED METHOD
In this section, we propose an automated outlier detection framework to find the optimal neural network model for a given dataset. A general search space is designed to include the neural architecture hyperparameters, definition-hypothesis, and objective functions. To overcome the curse of local optimality under certain unstable search circumstances, we propose a curiosity-guided search strategy to improve search effectiveness. Moreover, we introduce an experience replay mechanism based on self-imitation learning to better exploit the past good experience and enhance the sample efficiency. An overview of AutoOD is given in Fig. 1.

A. Search Space Design
Because there is a lack of intrinsic search space for outlier detection tasks, here we design the search space for the Deep AutoEncoder based algorithms, which is composed of global settings for the whole model, and local settings in each layer independently. Formally, we have: .., f N (·), g 1 (·), ..., g N (·)}, f i (x; ω i ) = ACT(NORMA(POOL(CONV(x))), g i (x; ω i ) = ACT(NORMA(UPPOOL(DECONV(f (x)))), score = DIST(g(f (x; ω)), x) + DEFINEREG(f (x; ω)), (2) where x denotes the set of instances as input data, and ω denotes the trainable weight matrix. The architecture space A contains N encoder-decoder layers. f (·) and g(·) denote encoder and decoder functions, respectively. ACT(·) is the activation function set. NORMA denotes the normalization functions. POOL(·) and UPPOOL(·) are pooling methods. CONV(·) and DECONV(·) are convolution functions. As we discussed in the Section II (A), the encoder-decoder based outlier score score contains two terms: a reconstruction distance and an outlier regularizer. DIST(·) is the metric to measure the distance between the original inputs and the reconstruction results. DEFINEREG(·) acts as an regularizer to introduce the definition-hypothesis from H. We revisit and extract the outlier detection hypotheses and their mathematical formulas from state-of-the-art approaches as shown in the Table I. We decompose the search space defined in Eq. 2 into the following 8 classes of actions: Definitions H

Regularizer Equations
Density [16] − log Global Settings: • Definition-hypothesis determines the way to define the "outliers", which acts as a regularization term in the objective functions. We consider density-based, cluster-based, centroid-based, and reconstruction-based assumptions, as shown in Table I. • Distance measurement stands for the matrix measuring the distance for the reconstruction purpose, including l 1 , l 2 , l 2,1 norms, and the structural similarity (SSIM).

Local Settings in Each Layer:
• Output channel is the number of channels produced by the convolution operations in each layer, i.e., 3, 8, 16, 32, 64, 128, and 256. • Convolution kernel denotes the size of the kernel produced by the convolution operations in each layer, i.e., 1 × 1, 3 × 3, 5 × 5, and 7 × 7. • Pooling type denotes the type of pooling in each layer, including the max pooling and the average pooling. • Pooling kernel denotes the kernel size of pooling operations in each layer, i.e., 1 × 1, 3 × 3, 5 × 5, and 7 × 7.s • Normalization type denotes the normalization type in each layer, including three options: batch normalization, instance normalization, and no normalization. • Activation function is a set of activation functions in each layer, including Sigmoid, Tanh, ReLU, Linear, Softplus, LeakyReLU, ReLU6, and ELU. Thus, we use a (6N + 2) element tuple to represent the model, where N is the number of layers in the encoderdecoder-wise structure. Our search space includes an exponential number of settings. Specifically, if the encoder-decoder cell has N layers and we allow action classes as above, it provides we have a N = 6, the number of points in our search space is 3.9e+23, which requires an efficient search strategy to find an optimal model out of the large search space. Fig. 2 illustrates an example of the proposed search space in AutoOD.

B. Curiosity-guided Search
We now describe how to search the optimal model within the given search space. Inspired by the recent NAS work, the search strategy is considered as a meta-learning process. A controller is introduced to explore a given search space by training a child model to get an evaluation for guiding exploration [22]. The controller is implemented as a recurrent  Fig. 2: An example of the search space in AutoOD with two layers, which is composed of global settings for the whole model (blue and purple parts), and local settings in each layer (red and green parts), respectively. All building blocks are wired together to form a direct acyclic graph. neural network. We use the controller to generate a sequence of actions for the child model. The whole process can be treated as a reinforcement learning problem with an action a 1:T , and a reward function r. To find the optimal model, we ask our controller to maximize its expected reward r, which is the expected performance in the validation set of the child models.
There are two sets of learnable parameters: one of them is the shared parameters of the child models, denoted by ω, and the other one is from the LSTM controller, denoted by θ. ω is optimized using stochastic gradient descent (SGD) with the gradient ∇ ω as: where child model m is sampled from the controller's actions π(m; θ), L(m, ω) is the loss function composed from the search space above, computed on a minibatch of training data. The gradient is estimated using the Monte Carlo method.
Since the reward signal r is non-differentiable, to maximize the expected reward r, we fix ω and apply the REINFORCE rule [29] to update the controller's parameters θ as: where r is computed as the performance on the validation set, rather than on the label-free training set. We define the reward r as the detection accuracy of the sampled child model. We also adopt different evaluation metrics, including AUROC, AUPR, and RPRO in the experiment section. An empirical approximation of the Eq. 4 is: where n is the number of different child models that the controller samples in one batch and T is the number of tokens. b acts as a baseline function to reduce the estimate variance. 1) Curiosity-driven Exploration: Despite being widely utilized due to search efficiency, weight sharing approaches are roughly built on empirical experiments instead of solid theoretical ground [24]. The unfair bias will make the controller misjudge the child-model performance: those who have better initial performance with similar child models are more likely to be sampled. In the meanwhile, due to the imbalanced label distribution in outlier detection tasks, it is easy to make the controller fall into local optima.
To address these problems, AutoOD builds on the theory of curiosity-driven exploration [30], aiming to encourage the controller to seek out regions in the searching spaces that are relatively unexplored. It brings us a typical explorationexploitation dilemma to guide the controller.
Bayesian reinforcement learning [31], [32] offers us a formal guarantees as coherent probabilistic model for reinforcement learning. It provides a principled framework to express the classic exploration-exploitation dilemma, by keeping an explicit representation of uncertainty, and selecting actions that are optimal with respect to a version of the problem that incorporates this uncertainty [32]. Here, instead of a vanilla RNN, we use a Bayesian LSTM as the structure of the controller to guide the search. The controller's understanding of the search space is represented dynamically over the uncertainty of the parameters of the controller. Assuming a prior p(θ), it maintains a distribution prior over the controller's parameters through a distribution over θ. The controller models the actions via p(a t |a 1:t ; θ), paratetrized by θ. According to curiositydriven exploration [30], the uncertainty about the controller's dynamics can be formalized as maximizing the information: where the KL divergence can be interpreted as information gain, which denotes the mutual information between the controller's new belief over the model to the old one.
Thus, the information gain of the posterior dynamics distribution of the controller can be approximated as an intrinsic reward, which captures the controller's surprise in the form of a reward function. We can also use the REINFORCE rule to approximate planning for maximal mutual information by adding the intrinsic reward along with the external reward (accuracy on the validation set) as a new reward function. It can also be interpreted as a trade-off between exploitation and exploration as: where η ∈ R + is a hyperparameter controlling the urge to explore. However, it is generally intractable to calculate the posterior p(θ|a 1:t−1 ) in Eq. 7.
2) Variational Bayes-by-Backprop: In this subsection, we propose a tractable solution to maximize the information gain objective presented in the previous subsection. To learn a probability distribution over network parameters θ, we propose a practical solution through a back-propagation compatible algorithm, bayes-by-backprop [31], [33].
In Bayesian models, latent variables are drawn from a prior density p(θ). During inference, the posterior distribution p(θ|x) is computed given a new action through Bayes' rule: The denominator can be computed through the integral: As controllers are highly expressive parametrized LSTM networks, which are usually intractable as high-dimensionality. Instead of calculating the posterior p(θ|D train ) for a training dataset D train . We approximate the posterior through an alternative probability densities over the latent variables θ as q(θ), by minimizing the Kullback- We use D instead of D train in the following parts of this subsection for brevity.
q(θ) is given by a Gaussian distribution, with µ as the Gaussian's mean vector and σ as the covariance matrix.
Once minimized the KL divergence, q(·) would be the closest approximation to the true posterior. Let log p(D|θ) be the log-likelihood of the model. Then, the network can be trained by minimizing the variational free energy as the expected lower bound: which can be approximated using N Monte Carlo samples from the variational posterior with N samples drawn according to θ ∼ q(·): 3) Posterior Sharpening: We discuss how to derive a distribution q(θ|D) to improve the gradient estimates of the intractable likelihood function p(D), which is related to Variational AutoEncoders (VAEs) [34]. Inspired from strong empirical evidence and extensive work on VAEs, the "sharpened" posterior yields more stable optimization. We now use posterior sharpening strategy to benefit our search process.
The challenging part of modelling the variational posterior q(θ|D) is the high dimensional θ ∈ R d , which makes the modelling unfeasible. Given the first term of the loss − log p(D|θ) is differentiable with respect to θ, we propose to parameterize q as a linear combination of θ and − log p(D|θ). Thus, we can define the hierarchical posterior of the form in Eq. 10: with µ, σ ∈ R d , and q(φ) = N(φ|µ, σ) as the same setting in the standard variational inference method. η ∈ R d can be treated as a per-parameter learning rate.
Thus, we turn to deriving the training loss function for posterior sharpening. With the discussion above, we assume a hierarchical prior for the parameters such that p(D) = p(D|θ)p(θ|φ)p(φ)dθdφ. Then, the expected lower bound on p(D) is defined as follows: C. Experience Replay via Self-Imitation Learning The goal of this subsection is to exploit the past good experiences for the controller to benefit the search process by enhancing the sample efficiency, especially considering there are only a limited number of negative samples in outlier detection tasks. In this paper, we propose to store rewards from historical episodes into experience replay buffers [35]: B = (a 1:t , r a ), where (a 1:t and r a ) are the actions and the corresponding reward. To exploit good past experiences, we update the experience replay buffer for child models with better rewards, and amplify the contribution from them to the gradient of θ. More specifically, we sample child models from the replay buffer using the clipped advantage (r − b) + , where the rewards r in the past experiences outperform the current baseline b. Comparing with the Eq. 5, the objective to update the controller's parameter θ through the replay buffer is: Then, an empirical approximation of the Eq. 18 is: where n is the number of different child models that the controller samples in one batch and T is the number of tokens.
Overall, the joint optimization process is specified in Algorithm 1, which consists of two phrases: the curiosity-guided search process and the self-imitation learning process. The optimal model with the best performance on the validation set is utilized for the outlier detection tasks.

IV. EXPERIMENTS
In this section, we conduct extensive experiments to answer the following four research questions.
• Q1: How effective is AutoOD compared with state-of-theart handcrafted algorithms? • Q2: Whether or not the two key components of AutoOD, i.e., curiosity-guided search and experience replay, are effective in the search process? • Q3: Compared with random search, how effective is the proposed search strategy? • Q4: Does AutoOD have the potential to be applied in more complicated real-world applications?

A. Datasets and Tasks
We evaluate AutoOD on seven benchmark datasets for instance-level outlier sample detection and pixel-level defect region segmentation tasks. We also conduct a case study on the CAT [36]  For the instance-level outlier sample detection task, we use four benchmark datasets (i.e., MNIST [37], Fashion-MNIST [38], CIFAR-10 [39], and Tiny-ImageNet [40]), and two synthetic noise datasets (i.e., Gaussian and Uniform). Synthetic noise datasets consist of 1, 000 random 2D images, where the value of each pixel is sampled from an i.i.d Gaussian distribution with mean 0.5 and unit variance. We further clip each pixel into the range [0, 1], or an i.i.d uniform distribution on [0, 1]. Different datasets contain different classes of images. We manually injected outlier samples (a.k.a. outof-distribution samples), which consists of images randomly sampled from other datasets. For all six datasets, we train an outlier detection model on the training set, which only contains in-distribution samples, and use a validation set with out-ofdistribution samples to guide the search, and another test set with out-of-distribution samples to evaluate the performance. The contamination ratio in the validation set and the test set are both 0.05. The train/validation/test split ratio is 6 : 2 : 2. Two state-of-the-art methods including MSP [42] and ODIN [43] are used as baselines.
For the pixel-level defect region segmentation task, we use a real-world dataset MVTec-AD [41]. MVTec-AD contains high-resolution images with different objects and texture categories. Each category comprises a set of defect-free training images and a test set of images with various kinds of defects and images without defects. We train the model on the defectfree training set, and split the whole test set into two halves for validation and testing. Three state-of-the-art methods including AutoEncoder [44], AnoGAN [45], and Feature Dictionary [46] are used as baselines.

B. Baselines
We compare AutoOD with five state-of-the-art handcrafted algorithms and the random search strategy.
• MSP [42]: The softmax probability distribution is used to detect the anomalies in tasks of computer vision, natural language processing, and automatic speech. The outlier detection is performed based on the following assumption: the correctly classified examples have greater maximum softmax probabilities than those of erroneously classified and out-of-distribution examples. • ODIN [43]: The pre-trained neural networks is reused to detect the out-of-distribution images. ODIN separates the softmax probability distributions between in-and outof-distribution instance, by using temperature scaling and adding small perturbations on the image data. • AutoEncoder [44]: The structure of convolutional AutoEncoders is applied for unsupervised defect segmentation on image data. More specifically, it utilizes the loss function based on structural similarity, and successfully examines inter-dependencies between local image regions to reveal the defective regions. • AnoGAN [45]: It is a deep convolutional generative adversarial network used to identify the anomalous image data. It learns a manifold of normal anatomical variability, and maps images to a latent space to estimate the anomaly scores. • Feature Dictionary [46]: It applies the convolutional neural networks and self-similarity to detect and localize anomalies in image data. More specifically, the abnormality degree of each image region is obtained by estimating its similarity to a dictionary of anomaly-free subregions in a training set. • Random Search [47], [48]: Instead of learning a policy to optimize the search progress, random search generates a neural architecture randomly at each step. It has been widely demonstrated that random search is a strong baseline hard to be surpassed in NAS.

C. Experiment Setup
We train the child models on the training set under the outlier-free settings, and update the controller on the validation set via the reward signal. The controller RNN is a two-layer LSTM with 50 hidden units on each layer. It is trained with the ADAM optimizer with a learning rate of 3.5e − 4. Weights are initialized uniformly in [−0.1, 0.1]. The search process is conducted for a total of 500 epochs. The size of the selfimitation buffer is 10. We use a Tanh constant of 2.5 and a sample temperature of 5 to the hidden output of the RNN controller. We train the child models by utilizing a batch size of 64 and a momentum of 0.9 with the ADAM optimizer. The learning rate starts at 0.1, and is dropped by a factor of 10 at 50% and 75% of the training progress, respectively.

D. Evaluation Metrics
We adopt the following metrics to measure the effectiveness: • AUROC [49] is the Area Under the Receiver Operating Characteristic curve, which is a threshold-independent metric [49]. The ROC curve depicts the relationship between TPR and FPR. The AUROC can be interpreted as the probability that a positive example is assigned a higher detection score than a negative example [50]. • AUPR [51] is the Area under the Precision-Recall curve, which is another threshold-independent metric [51], [52].

1) Performance on Out-of-distribution Sample Detection:
To answer the research question Q1, we compare Au-toOD with the state-of-the-art handcrafted algorithms for the instance-level outlier sample detection task using metrics AU-ROC, AUPR-In and AUPR-Out. Considering the automated search framework of AutoOD, we represent its performance by the best model found during the search process. In these experiments, we follow the setting in [42], [53]: Each model is trained on individual dataset D in , which is taken from MNIST, Fashion-MNIST, CIFAR-10, and Tiny-ImageNet, respectively. At test time, the test images from D in dataset can be viewed as the in-distribution (positive) samples. We sample outof-distribution (negative) images from another real-world or synthetic noise dataset, after down-sampling/up-sampling and reshaping their sizes as the same as D in .
As can be seen from Table II, in most of the test cases, the models discovered by AutoOD consistently outperform the handcrafted out-of-distribution detection methods with pretrained models (ODIN [43]) and without pre-trained models (MSP [42]). It indicates that AutoOD could achieve higher performance in accuracy, precision, and recall simultaneously, with a more precise detection rate and fewer nuisance alarms.
2) Performance on Defect Sample Detection: To further answer question Q1, we test AutoOD on the pixel-level defect region segmentation task. The results from Table III show that AutoOD consistently outperforms the baseline methods by a large margin in terms of AUROC and RPRO. The higher AUROC demonstrates that the model found by AutoOD precisely detects images with defect sections out of the positive samples. The results also show that AutoOD has a better performance in RPRO. This indicates the search process of AutoOD helps the model to locate and represent the outlier regions in negative images. Table IV illustrates the best architectures discovered by AutoOD on both instance-level outlier sample detection and pixel-level defect region segmentation tasks.
3) Effectiveness of Curiosity-guided Search: To qualitatively evaluate the effectiveness of the curiosity-guided search for research question Q2, we perform ablation and hyperparameter analysis on Fashion-MNIST dataset with samples Actions MNIST Fashion-MNIST CIFAR-10 Tiny-ImageNet MVTec-AD Definition hypothesis reconstruction cluster centroid reconstruction reconstruction Distance measurement l 1 l 2,1 l 2,1 l 2,1 l 2,1 + SSIM Layer-1 Output-channel 32 16   (2) The curiosity guided explorations help the controller find the optimal model faster. The better performance could be achieved in the 20-th, 100-th epochs when the controller has a larger weight η on explorations. This indicates that curiosity-guided search is a promising way for exploring more unseen spaces.
(3) Comparing AUROC between η = 0.01 and η = 0.1, we observe that there is no significant increase in the final performance after 200 epochs. This indicates that a higher rate of explorations can not always guarantee a higher performance. (4) If we treat the performance of the searched result as Gaussian distributions, the standard deviations of the AutoOD's performance keep increasing when η increases. This validates that the curiosity-guided search strategy increases the opportunity for the controller to generate child models in a more diverse way.

4) Effectiveness of Experience Replay
: To further answer the question Q2, we evaluate the effectiveness of the experience replay buffers, by altering the size of the replay buffers B in Eq. 19. Corresponding results are reported in Table V (b). The results indicate that the increase of the buffer size could enhance model performance after 200 epochs. We also observe that the size of the buffer is sensitive to the final performance, as better performance would be achieved in the 20th, 100th epoch with a larger buffer size. This indicates that self-imitation learning based experience replay is useful in the search process. Larger buffer size brings benefits to exploit past good experiences.

5) Comparison Against Traditional NAS:
Instead of applying the policy gradient based search strategy, one can use random search to find the best model. Although this baseline seems simple, it is often hard to surpass [47], [48]. We compare AutoOD with random search to answer the research question Q3. The quality of the search strategy can be quantified by the following three metrics: (1) the average performance of the top-5 models found so far, (2) the mean performance of the searched models in every 20 epochs, (3) the standard deviation of the model performance in every 20 epochs. From Fig. 3, we can observe that: Firstly, our proposed search strategy is more efficient to find the wellperformed models during the search process. As shown in the first row of Fig. 3, the performance of the top-5 models found by AutoOD consistently outperform the random search. The results also show that not only the best model of our search strategy is better than that of random search, but also the improvement of average top models is much more significant. This indicates that AutoOD explores better models faster than the random search. Secondly, there is a clear increasing tendency in the mean performance of AutoOD, which can not be observed in random search. It indicates that our search controller can gradually find better strategies from the past search experiences along the learning process, while the random search's controller has a relatively low chance to find a good child model. Thirdly, compared with the random search, there is a clear dropping of standard deviation along the search process. It verifies that our search strategy provides a more stable search process.

F. Case Study
To answer the research question Q4, we provide further analysis for the pixel-level defect region segmentation task, to get some insights about how to further improve the detection performance in more complicated real-world settings. To make the outlier sections and the rest sections more distinguishable in the latent space, we use the reconstruction error to learn intrinsic representation for positive samples to extract common patterns. Yet, it is hard to directly apply AutoOD into more complicated, real-world settings. Due to the pure data-driven strategy, the reconstruction based denoters might be misled by background noises, other objects, or irrelevance features. We hereby introduce two strategies into AutoOD for regularization without increasing the model complexity. Saliency refinement via target object recognition. We introduce a mask map s into the reconstruction based denoters from pre-trained models. It is used for localizing and identifying target salient object, in order to eliminate the negative effect caused by background noises and other objects in the same image. In our experiment, we introduce s from DeepLabV3 [54], which is pre-trained on PASCAL VOC 2012 [55]. Feature augmentation via gradient-based localization. In order to amplify the contribution of the irrelevance features from the salient object, we introduce the feature augmentation map to re-weight the reconstruction result. We also introduce a coarse localization map to highlight the irrelevance regions in the image from an interpretability perspective. Feature importance is reflected as gradients signal via backpropagation. Here, we follow the interpretation method from Grad-CAM [56], which designed to highlight important features, and pre-trained on VGG-16 [57]. The feature augmentation map is defined as opposite to the Grad-CAM: 1 mn m n 1 − ∂yi ∂Amn . After the two steps above, we reweight the reconstructions: where x i ∈ R m×n is a training sample and y i is its target object class. f (·), g(·) denotes encoder-decoder structures produced by AutoOD, A denotes the feature map activation of a latent layer. We use a real-world dataset CAT [36] for illustration. We find the optimal model via AutoOD and get the pixel-level reconstruction map. Then, we further refine the map via saliency recognition and feature localization strategies. As can be seen from Fig. 4, AutoOD achieves better visualization results after applying the reweighting tricks discussed above. We also observe that the model can successfully identify the  Fig. 4: A case study of outlier segmentation. The pixel-level reconstruction is regularized by conducting pixel-level collaboratively with the results of feature localization and saliency recognition. AutoOD accurately identifies the outlier regions (cola bin and collar) of the target object (cat) in the first two images, and treats the third target object (cat) as outlier-region-free.
outlier regions (cola bins, collars) within the salient objects (kitties). In the meanwhile, it reduces the effect caused by the background noises and irrelevant objects.

V. RELATED WORK
In this section, we review the related work on Neural Architecture Search (NAS). Recently, NAS has attracted increasing research interests. Its goal is to find the optimal neural architecture in a predefined search space to maximize the model performance on a given task. Designing a NAS algorithm requires two key components: the search space and the search strategy (optimization algorithm) [58].
The search space defines which architectures can be represented in principles. The existing work of search space follows two trends: the macro and micro search [22], [59], [60]. The macro search provides an exhaustive-architecture search space to encourage the controller to explore the space and discover novel architectures, while the micro search inductively limits the search space to accelerate the search process. The choice and the size of the search space determine the difficulty of the optimization problem. Yet, even for the case of the search space based on a single cell, it is still a challenging problem due to the discrete search space and the curse of high-dimensionality (since more complex models tend to perform better, resulting in more design choices) [58]. Thereby, incorporating prior knowledge about the typical properties of architectures well-suited for a task can significantly reduce the size of the search space and simplify the search process. [48] has validated the importance of the search space in the search process. With extensive experimental reproducibility studies, a task-tailored, carefully-designed search space plays a more important role than the other search strategies. Recent works have proposed tailored search spaces with their applications, including image segmentation [61], adversarial training [62], and augmentation strategies [21]. To the best of our knowledge, our proposed AutoOD describes the first attempt to design the search space specifically customized to the outlier detection task. AutoOD uses the micro search space to keep consistent with previous works. Yet the contribution of AutoOD in search space is to design a hierarchical, general-purpose search space, including global settings for the whole model, and local settings in each layer independently. Moreover, our proposed search space not only covers the hyperparameters as architecture configurations, such as the size of convolutional kernels and filters in each layer, but also incorporates the definition-hypothesis and its corresponding objective function.
The search strategy focuses on how to explore the search space. Recent approaches include reinforcement learning (RL) [19], [22], [63], Bayesian optimization [64], and gradient-based methods [65]- [67]. Although these methods have improved upon human-designed architectures, directly borrowing existing NAS ideas from image classification to outlier detection will not work. Due to the imbalanced data, the search process becomes more unstable in outlier detection tasks [23]. As an internal mechanism in the traditional NAS, weight sharing, also introduces the inductive bias in the search process which intensifies the tendency [24]. Weight sharing [22] is proposed to transfer the well-trained weight before to a sampled architecture, to avoid training the offspring architecture from scratch. Recent research has validated that the weight sharing mechanism makes the architectures who have better initial performance with similar structures more likely to be sampled [24], which leads to misjudgments of the child model's performance. Our work builds upon RL-based method, which uses a recurrent neural network controller to choose blocks from its search space. Beyond that, we propose a curiosity-guided search strategy to stabilize the search process via encouraging the controller to seek out unexplored regions in the search space. Our search strategy formulates the search process as a classical exploration-exploitation trade-off. On one hand, it is encouraged to find the optimal child model more efficiently; on the other hand, it avoids the premature convergence to a sub-optimal region due to the inductive bias or insufficient search.

VI. CONCLUSIONS
In this paper, we investigated a novel and challenging problem of automated deep model search for outlier detection. Different from the existing Neural Architecture Search methods that focus on discovering effective deep architectures for supervised learning tasks, we proposed AutoOD, an automated unsupervised outlier detection framework, which aims to find an optimal neural network model within a predefined search space for a given dataset. AutoOD builds on the theory of curiosity-driven exploration and self-imitation learning. It overcomes the curse of local optimality, the unfair bias, and inefficient sample exploitation problems in the traditional search methods. We evaluated the proposed framework using extensive experiments on eight benchmark datasets for instance-level outlier sample detection and pixel-level defect region segmentation. The experimental results demonstrated the effectiveness of our approach.