ROBUST ANOMALY DETECTION AND BACKDOOR ATTACK DETECTION VIA DIFFERENTIAL PRIVACY
A BSTRACT
Outlier detection and novelty detection are two important topics for anomaly detection.
Suppose the majority of a dataset are drawn from a certain distribution, outlier detection and novelty detection both aim to detect data samples that do not ﬁt the distribution.
Outliers refer to data samples within this dataset, while novelties refer to new samples.
In the meantime, backdoor poisoning attacks for machine learning models are achieved through injecting poisoning samples into the training dataset, which could be regarded as “outliers” that are intentionally added by attackers.
Differential privacy has been proposed to avoid leaking any individual’s information, when aggregated analysis is performed on a given dataset.
It is typically achieved by adding random noise, either directly to the input dataset, or to intermediate results of the aggregation mechanism.
In this paper, we demonstrate that applying differential privacy can improve the utility of outlier detection and novelty detection, with an extension to detect poisoning samples in backdoor attacks.
We ﬁrst present a theoretical analysis on how differential privacy helps with the detection, and then conduct extensive experiments to validate the effectiveness of differential privacy in improving outlier detection, novelty detection, and backdoor attack detection.
I NTRODUCTION
Given a dataset where most of the samples are from a certain distribution, outlier detection aims to detect the minorities in the dataset that are far from the distribution, while the goal of novelty detection is to detect newly observed data samples that do not ﬁt the distribution.
On the other hand, poisoning examples that are intentionally added by attackers to achieve backdoor attacks could be treated as one type of “outliers” in the training dataset.
Using machine learning for outlier/novelty detection is typically to train a model that learns the distribution where the training data samples are drawn from, and the ﬁnal trained model could give a high anomaly score for the outliers/novelties that deviate from the same distribution.
In both cases, the machine learning model is not supposed to learn from the outliers in the training dataset.
Unfortunately, deep learning models that contain millions of parameters tend to remember too much ((1)), and can easily overﬁt to rare training samples ((2)).
Protecting data privacy has been a major concern in many applications, because sensitive data are being collected and analyzed.
Differential privacy has been proposed to “hide” certain input data from the output; that is, by looking at the statistical results calculated from input data, one cannot tell whether the input data contain a certain record or not.
The way of applying differential privacy is to add random noise to the input data or the data analysis procedure, such that the output difference caused by the input difference can be hidden by the noise.
A known fact is that differential privacy implies stability ((3)).
Particularly, a differentially private learning algorithm is stable in the sense that the model learned by the algorithm is insensitive to the removal or replacement of an arbitrary point in the training dataset (4).
When the training dataset contains a handful of outliers, the output model of a stable learning algorithm should be close to the one trained on the clean portion of the training set.
Intuitively, compared with the model trained on contaminated dataset, the one trained on clean data could be better at distinguishing outliers from normal data.
Therefore, differential privacy can potentially be leveraged to improve the identiﬁcation of outliers.
This motivates us to apply differential privacy to anomaly detection and defense against backdoor attacks.
Our contribution.
First, we present a theoretical explanation on why differential privacy can help to detect outliers from a training and testing dataset, as well as an analysis on the relationship between the number of outliers to detect and the amount of random noise to apply.
Second, to demonstrate the effectiveness, we apply differential privacy to an autoencoder network trained on a constructed
MNIST dataset with injected outliers, for both outlier detection and novelty detection, to show how much the utility could be improved with different amount of outliers and noise.
Third, we apply differential privacy to a real-world task - Hadoop ﬁle system log anomaly detection.
System log anomaly detection is an important topic in computer security.
Our proposed method greatly improves upon the state-of-the-art system in this ﬁeld.
The results indicate that differential privacy is able to eliminate almost all the false negatives, and achieve signiﬁcantly improved overall utility, compared with the current state-of-the-art work DeepLog ((5)).
Finally, via a proof-of-concept experiment using MNIST dataset with injected poisoning samples, we show that the idea of outlier detection could be extended to backdoor attack detection, and that differential privacy is able to further improve the performance.
P RELIMINARY
Given an input dataset and an aggregation mechanism, differential privacy ((6)) aims to output the requested aggregation results, which are guaranteed not to reveal the participation of any individual data record.
Formally, differential privacy is deﬁned as below:
Deﬁnition 1 (Differential privacy) .
A randomized mechanism M applied to data domain D is said to be ( (cid:15) , δ ) -differentially private if for any adjacent datasets d , d (cid:48) in D , and any subset of outputs
S ⊆
Range ( M ) , it holds that
[Equation]
where (cid:15) stands for the privacy bound, and δ stands for the probability to break this bound.
The adjacent datasets d , d (cid:48) could be understood as two databases, where only one record differs, i.e., (cid:107) d − d (cid:48) (cid:107) 1 = 1 .
Differential privacy guarantees that the difference between d and d (cid:48) are not revealed through inspecting the outputs M ( d ) and M ( d (cid:48) ) .
Clearly, the closer (cid:15) is to 0 , the more indistinguishable M ( d ) and M ( d (cid:48) ) are, and hence the stronger the privacy guarantee is.
A common approach to enforcing differential privacy for a function f : D → R , is to add random
Gaussian noise N (0 , σ 2 ) to perturb the output in R .
The intuition is that, for given adjacent datasets d and d (cid:48) , one cannot tell whether the difference between f ( d ) and f ( d (cid:48) ) is incurred by the single record that differs in d and d (cid:48) , or by the random noise being applied.
The magnitude of Gaussian noise needs to be tailored to the maximum difference between f ( d ) and f ( d (cid:48) ) , which is formally deﬁned as L 2 -sensitivity.
Deﬁnition 2 ( L 2 -sensitivity) .
The L 2 -sensitivity for a function f : D → R is:
[Equation]
The noise scale σ to apply can be calculated as below ((7)).
Theorem 1.
To perturb a function with sensitivity ∆ under ( (cid:15), δ ) - differential privacy, the minimum noise scale σ of Gaussian mechanism is given by: σ = ∆ (cid:15) · (cid:113) 2 ln 1 .
25 δ , where (cid:15) ∈ (0 , 1) .
Deep learning with differential privacy ((8))
The procedure of deep learning model training is to minimize the output of a loss function, through numerous stochastic gradient descent (SGD) steps.
(8) proposed a differentially private SGD algorithm that works as follows.
At each SGD step, a ﬁxed number of randomly selected training samples are used as a mini batch.
For each mini batch training, the following two operations are performed to enforce differential privacy: 1) clip the norm of the gradient for each example, with a clipping bound C , to limit the sensitivity of gradient; 2) sum the clipped per-example gradients and add Gaussian noise N (0 , σ 2 ) , before updating the model parameters.
(8) further proposed a moment accounting mechanism which calculates the aggregate privacy bound when performing SGD for multiple steps.
Differential privacy is immune to post-processing.
Therefore, the output of the trained model for any queries enjoys the same privacy guarantee as the above SGD-based training process.
T HE CONNECTION BETWEEN DIFFERENTIAL PRIVACY AND OUTLIER DETECTION
By deﬁnition, random noise added into model training for differential privacy hides the inﬂuence of a single record on the learned model.
Intuitively, if applying differential privacy to the training process, the contribution of rare training examples will be hidden by random noise, resulting in a model that underﬁts the outliers.
Such model will facilitate novelty and outlier detection because it will be less conﬁdent in predicting the atypical examples.
In this section, we ﬁrst present a theorem to precisely characterize the above intuition, and then analyze the relationship between the number of outliers in the training dataset and the amount of noise to apply.
Notations Let Z be the sample space and H be the hypothesis space.
The loss function l : H×Z → R measures how well the hypothesis h ∈ H explains a data instance z ∈ Z .
A learning algorithm
A : Z n → H learns some hypothesis A ( S ) given a set S of n samples.
For instance, in supervised learning problems, Z = X × Y , where X is the feature space and Y is the label space; H is a collection of models h : X → Y ; and l ( h, z ) measures how well h predicts the feature-label relationship z
= ( x, y ) .
Let S =
{ z 1 , . . .
, z n } be a set of independent samples drawn from an unknown distribution D on Z .
For a given distribution D , an oracle hypothesis is the one that minimizes the expected loss:
[Equation]
We deﬁne an outlier as a data instance that has signiﬁcantly different loss from the population under the oracle hypothesis.
Deﬁnition 3.
We say ˜ z is an outlier with regard to distribution D if
[Equation]
where T is a constant that depends only on D .
We will prove the usefulness of differential privacy to detect outliers for the classes of learning algorithms that produce hypotheses converging to the optimal hypothesis asymptotically pointwise.
We deﬁne such learning algorithms to be uniformly asymptotic empirical risk minimization (UAERM).
Deﬁnition 4.
A (possibly randomized) learning algorithm
A is UAERM with rate ξ ( n, A ) if for any distribution D deﬁned on the domain Z , it holds that
[Equation]
In the deﬁnition, we make it explicit that the rate ξ ( n, A ) depends on the learning algorithm A .
For instance, if A is a differentially private learning algorithm, the rate will depend on the privacy parameters.
In that case, with slight abuse of notation, we will denote the rate for a ( (cid:15), δ ) -differentially private learning algorithm trained on n data instances by ξ ( n, (cid:15), δ ) .
Due to the nonconvexity of their loss functions, neural networks may not enjoy a useful, tight characterization of the learning rate.
Thus, we will empirically verify that using noisy SGD to learn differentially private neural networks is UAERM.
Moreover, as we will show in the experiment, ξ ( n, (cid:15), δ ) grows as privacy parameters (cid:15) and δ become smaller.
Intuitively, this is because larger noise is required to ensure stronger privacy guarantees, which, on the other hand, slows down the convergence of the learning algorithm.
Without loss of generality, we assume that 0 ≤ l ( h, z ) ≤ 1 .
The following theorem exhibits how the prediction performance of differentially private models on normal data will differ from outliers and connects the difference to the privacy parameters of the learning algorithm and the amount of outliers in the training data.
Theorem 2.
Suppose that a learning algorithm
A is ( (cid:15), δ ) -differentially private and UAERM with the rate ξ ( n, (cid:15), δ ) .
Let S (cid:48)
=
S ∪ U , where S ∼ D n and U contains c arbitrary outliers.
Then
[Equation]
with probability at least 1 − γ .
The two terms in the left-hand side of (4) represent the model’s prediction loss on outliers and normal test data drawn from D , respectively.
Due to the stochasticity of differentially private learning algorithms, the difference is characterized by the expectation taken over the randomness of the learned models.
The theorem establishes a lower bound on the prediction performance difference between normal and outlier data.
A larger difference indicates that identifying outliers will be easier.
The impact of privacy parameters on the lower bound manifests itself in two aspects.
On one hand, stronger privacy guarantees (i.e., smaller (cid:15) and δ ) will require higher noise to be added into the training process, which increases the learning rate ξ ( n, (cid:15), δ ) .
On the other hand, increasing privacy level will improve the stability of the learning algorithm; the resulting models tend to ignore the outliers in the training set and become closer to the ones trained on completely clean data, thus making the outlier detection more effective.
The second aspect is embodied by the fact that the terms except ξ ( n, (cid:15), δ ) in the parenthesis of the lower bound grow with (cid:15) and δ .
Therefore, the privacy parameters cannot be too large or too small in order to ensure optimal anomaly detection performance.
Moreover, the relationship between the right-hand side of (4) and c indicates that the anomaly detection problem will be more difﬁcult with more outliers in the training set.
Dissecting the righthand side of (4), we further observe that c appears always in tandem with (cid:15) .
This implies that for larger number of outliers in the training set (i.e., c is larger), we will need to tune down (cid:15) and δ to maintain the same novelty detection performance.
Last but not least, the deﬁnition of outliers in our paper is quite general—it does not make any assumptions about how the outliers are generated.
Also, we do not make assumptions about whether these outliers are in training or test data.
Therefore, our analysis can shed light on detecting various types of anomalies, including but not limited to outlier/novelty detection, backdoor detection, and noisy label detection.
In the following experimental section, we will focus our evaluation on outlier/novelty detection and defense against backdoor attacks.
E XPERIMENTS
This section empirically evaluates the effectiveness of differential privacy in improving anomaly detection and backdoor attack detection.
We call an outlier/novelty or a poisoning example as a positive , and other normal data samples as negatives .
The metrics measured by each experiment include: false positive (FP), false negative (FN), Precision = TP / (TP+FP), Recall = TP / (TP+FN),
Area under the receiver operating characteristic curve (AUROC) which is the area under the TPRFPR curve, Area under the Precision - Recall curve (AUPR) which summarizes the PrecisionRecall curve, as well as F-measure =2 ×
Precision × Recall / ( Precision + Recall ).
The detailed explanations of all these measures could be found in (9; 10; 11; 12).
4. O UTLIER DETECTION AND NOVELTY DETECTION WITH AUTOENCODERS
Autoencoder is a type of neural network that has been widely used for outlier detection and novelty detection.
It contains an encoder network which reduces the dimension of the input data, and a decoder network which aims to reconstruct the input.
Hence, the learning goal of autoencoders is to minimize the reconstruction error, which is consequently the loss function.
Because the dimensionality reduction brings information loss, and the learning goal encourages to preserve the information that is common to most training samples, outliers that contain rare information could be identiﬁed by measuring model loss.
In this section, with a varying amount of outliers and noise scale, we show how differential privacy would improve the utility of anomaly detection with autoencoders.
Datasets.
We utilize MNIST dataset composed by handwritten digits 0-9, and notMNIST dataset ((13)), which contains letters A-J with different fonts.
The original MNIST data contain 60 ,training images, and 10 , 000 test images, which we refer to as MNIST-train and MNIST-test respectively.
The notMNIST data contain 10 , 000 training images and 1 , 000 test images, denoted as notMNIST-train and notMNIST-test .
Based on these datasets, we intentionally construct training datasets with varying amount of injected outliers.
Speciﬁcally, each training dataset is constructed with a particular outlier ratio r o , such that the resulted dataset MNIST-OD-train( r o ) contains 60 ,images in total, where a percentage of 1 − r o are from MNIST-train, and r o are from notMNIST-train.
For each training dataset MNIST-OD-train( r o ), a set of autoencoder models are trained with varying noise scale σ applied for differential privacy.
For an autoencoder model trained on dataset MNISTOD-train( r o ), outlier detection is thus to detect the r o × 60 , 000 outliers from MNIST-OD-train( r o ).
For novelty detection, we further construct a test dataset MNIST-ND-test, which is composed by the entire MNIST-test dataset and notMNIST-test dataset, a total of 11 , 000 images.
The goal of novelty detection is to identify the 1 , 000 notMNIST-test images as novelties.
Evaluation metrics.
To check whether a data sample is an outlier/novelty using autoencoders, the standard practice is to set a loss threshold based on training statistics, and any sample having a loss above this threshold is an outlier/novelty.
To measure the performance under different thresholds, we use the AUPR score which is a threshold-independent metric.
Compared with other metrics such as the AUROC score, the AUPR score is more informative when the positive/negative classes are highly unbalanced, e.g., for outlier detection where the ratio of outliers is extremely low.
More experiment settings with both AUPR and AUROC metrics are in appendix which present similar observations.
Set-up.
For autoencoders, the encoder network contains 3 convolutional layers with max pooling, while the decoder network contains 3 corresponding upsampling layers.
For differential privacy, we use a clipping bound C = 1 and δ = 10 − 5 , and vary the noise scale σ as in (8).
All models are trained with a learning rate of 0.15, a mini-batch size of 200 and for a total of 60 epochs.
[Figure]
[Table]
Validation of UAERM for Noisy SGD.
To begin with, we ﬁrst conduct experiments to empirically validate our assumption in Theorem 2.
While a rigorous veriﬁcation of the assumption is intractable as it requires the knowledge of underlying data distribution and computing expected loss over randomness of both data distribution and differentially private algorithms, our experiments provide a sanity check of the assumption by replacing the expectation by the empirical average of a large number of data samples.
For this set of experiments, we only utilize MNIST data for training, while the test dataset contains all available MNIST and notMNIST test samples.
The oracle hypothesis is trained on all available training data, while each differentially private model is trained with varying privacy level (cid:15) , and training data size.
For a ﬁxed training set and (cid:15) , we perform training for multiple times to accommodate the randomness of differentially private training.
Further, we train on multiple randomly selected training sets of the same size.
We measure the loss of each resulting model on the test set, and calculate the average testing loss across different runs of differentially private training and different randomly selected training sets of the same size.
We then compute the largest difference between the averaged test loss and the test loss associated with the oracle hypothesis.
The results are shown in Figure 1.
Each data point in the ﬁgure is an average of 9 differentially private models trained on 3 randomly sampled subsets of the training data, and 3 random training processes for each sampled subset.
As in Figure 1, the larger the training data size, and the larger (cid:15) is, the closer of the randomized model to the oracle hypothesis, validating our assumption in Theorem 2 that noisy SGD is UAERM.
Detection results Table 1 shows the outlier detection (OD) results on dataset MNIST-OD-train, as well as the novelty detection (ND) results on dataset MNIST-ND-test.
OD mimics the unsupervised anomaly detection case.
ND mimics the case where the autoencoder model is supposed to be trained on normal data, to detect unforeseen anomalies, while the training dataset is noisy.
The ﬁrst row where σ = N/A is for the baseline model without differential privacy applied.
It performs well when r o = 0 .
1% , but drops signiﬁcantly when r o reaches 0.5%.
That’s because for a mini-batch size of 200 that we use, an outlier ratio of 0 .
5% in training data results in an average of one outlier in each mini-batch, which could be learned by the baseline model.
Note that the clipping bound C = 1 also restricts the contribution of outliers in SGD steps.
We conduct an ablation study which only clips the per-example gradients with C without adding any noise in each gradient descent step.
The results are shown as σ = 0 in Table 1.
As an intermediate step to bound the sensitivity in differential privacy, clipping itself is able to slightly improve the anomaly detection results in most cases.
Still, we show that increasing the noise scale could further improve the utility.
We highlight one of the best results in each column, and ﬁnd that the trend follows our analysis in Theorem 2.
Speciﬁcally, the more outliers in the training dataset, the larger noise scale is needed for the best improvement.
As explained for (4), our theory shows that the privacy parameters cannot be too large or too small to ensure optimal anomaly detection performance, which coincides with the experimental results in Table 1.
Although it could be challenging to select the desired noise level for training, we note that as shown in
Table 1, applying differential privacy effectively improves the anomaly detection performance in most cases, except when σ is too big to ruin the model parameters completely (e.g., σ = 50 ) .
Therefore, it is generally safe and almost always helpful to apply a small amount of differential privacy noise for anomaly detection.
The noise scale could be increased further as long as the model converges.
However, it should be noted that applying differential privacy makes the model training much slower than the baseline.
In our experience utilizing NVIDIA Tesla V100 SXM2 GPU cards, the training time for each epoch could be up to 80 times longer.
Finally, a training data portion as high as 10% might not be “outliers”, but could be part of the input pattern that should be learned by the model.
We show in this case, a relatively large noise scale could effectively improve the anomaly detection results (e.g., σ = 10 ), but it’s up to the requirement of the application whether to apply this.
4. H ADOOP FILE SYSTEM LOG ANOMALY DETECTION WITH LSTM
In this section, we use a real-world example for Hadoop ﬁle system log anomaly detection, to show how anomaly detection with differential privacy outperforms the current state-of-the-art results.
Dataset The Hadoop ﬁle system (HDFS) log dataset ((14)) is generated through running Hadoop map-reduce jobs for 48 hours on 203 Amazon EC2 nodes.
This dataset contains over 11 million log entries, which could be further grouped into 575 , 059 block sessions by the block identiﬁer each log has.
Each block is associated with a normal/abnormal label provided by domain experts.
Over the past decade this log dataset has been extensively used for research in system log anomaly detection ((15; 16; 5)).
The state-of-the-art results are achieved by DeepLog ((5)), which we use as the baseline model.
As in DeepLog, our training dataset contains 4 , 855 normal block sessions, while the test dataset includes 553 , 366 normal sessions and 16 , 838 abnormal sessions.
Baseline model and metrics DeepLog utilizes LSTM neural networks to learn system log sequences.
Note that system log messages are textual logs, e.g., “Transaction A ﬁnished on server B.” .
Before applying LSTM, a log parsing step ﬁrst maps each log message into its corresponding log printing statement in the source code, e.g., “print(’Transaction %s ﬁnished on server %s.”%(x,y))" .
Since there are only a constant number (e.g., N ) of log printing statements in the source code, each one could be mapped to a discrete value from a ﬁxed vocabulary set (e.g., having size N ).
With that, a block session of log messages could be parsed to a sequence of discrete values, e.g. “22 5 511 9 11 9 11 9 26 26 26” .
Leveraging the fact that hidden execution paths written in source code restrict the possibilities of how one system log follows another, DeepLog trains an LSTM model on normal discrete sequences, which learns to predict the next discrete value given its history.
In detection, the LSTM model predicts a probability distribution on all possible values that may appear at a given time step.
The real executed value is detected as abnormal if it’s unlikely to happen based on LSTM prediction.
The criteria presented in DeepLog is to ﬁrst sort the predicted values based on the assigned probabilities, e.g., for a prediction “ {5: 0.2, 9: 0.08, 11: 0.01, 26: 0.7, ...} ”, the order would be 26, 5, 9, 11, ... .
The given value to detect is checked against the sorted top k predictions, and is detected as abnormal if it’s not one of them.
For anomaly detection metrics, we want to highlight that applying differential privacy signiﬁcantly reduces false negatives, without introducing many false positives.
Therefore, we’ll focus on the comparison over the number of false positives and false negatives, while also presenting measurements that indicate the overall detection performance.
[Figure]
Set up For the baseline model DeepLog, we train an LSTM model for 100 epochs, and use the ﬁnal model as the anomaly detection model.
The model related parameters are: 2 layers, 256 units per layer, 10 time steps, and a batch size of 256.
We call the DeepLog model with differential privacy as DeepLog+DP .
For differential privacy, we use a clipping bound C = 1 , δ = 10 − 5 , and vary the noise scale σ .
All other model related settings for DeepLog+DP are the same as DeepLog.
Results Figure 2a shows the comparison of FP and FN under different thresholds k , with the increase of noise scale σ .
For clarity, we only show the following two cases for baseline model
DeepLog: k = 10 which has the maximum FP and the minimum FN , and k = 18 which has the minimum FP and the maximum FN .
Note that y axis is plotted as log scale.
It is clear that applying
DP noise signiﬁcantly reduces FN in all cases, from over a thousand in DeepLog, to hundreds or even zero in DeepLog+DP.
Also, the larger noise being added, the more FN are reduced.
Although more
FP could be introduced in some cases, we note that in system anomaly detection, the merit of fewer false negatives in fact worth the cost of more false positives.
Reported false positives could be further checked by system admin, and then fed into the model for incremental learning.
However, a false negative may never be found out, until a more disastrous event occurs due to the un-discovery of it.
The F-measure measurements are plotted in Figure 2b.
For DeepLog model, F-measure ranges from 90.38% ( k = 20 ) to 93.81% ( k = 10 ).
For DeepLog+DP, the best F-measure scores include 96.29% ( σ = 0 .
25 , k = 15 ) and 96.28% ( σ = 1 , k = 18 ), which show clear improvements over DeepLog model.
Note that the best FN and FP measurements reported in DeepLog ((5)) areand 833 respectively, while DeepLog+DP achieves FN =383, FP =762 at the F-measure of 96.28% ( σ = 1 , k = 18 ); and FN =123, FP =1040 at the F-measure of 96.29% ( σ = 0 .
25 , k = 15 ), showing its ability to signiﬁcantly reduce false negatives without introducing many false positives.
As shown in the ﬁgure, DeepLog performs better when k is smaller, while DeepLog+DP beneﬁts from larger k s. This scenario could also be explained by the addition of differential privacy noise.
Since the trained model does not overﬁt to outliers, it assigns to anomalies much lower probabilities, so that anomalies are ranked much lower than that in the DeepLog model.
Meanwhile, normal execution logs are also possibly predicted with lower probabilities because of the uncertainty brought by the noise.
As a result, the ideal threshold k for DeepLog+DP is higher than that of DeepLog.
We also note that a large noise scale could hurt the overall performance, as shown by the downward trend when σ increases from 1 .
75 to 2 . 0 .
4. B ACKDOOR ATTACK DETECTION
Since poisoning examples for backdoor attacks are essentially “outlier” training samples injected by attackers, this section conducts proof-of-concept experiments to examine whether measuring model loss as for outliers works to detect poisoning examples, and whether differential privacy is able to further improve the performance.
This detection scenario is particularly useful for backdoor attacks injected in the crowdsourcing scenario, where the model trainer gathers training data from untrusted individuals.
In this case, the model trainer does not have control over the data quality but does have control over the model training process.
Our proposal of adding DP noise is useful for detecting backdoor attacks and training more robust models in such a scenario.
Dataset and set up MNIST dataset as described in Section 4.1 is used in this set of experiments.
We refer the original 60,000 training images as CLEAN-train and the 10,000 test images as CLEANtest .
We construct the backdoor attacks as described in (17), Section 3.1.2.
Speciﬁcally, each poisoning example is generated by reversing 4 pixel values in the bottom right corner of a clean image having label i , and assigning backdoor label ( i + 1)%10 .
From CLEAN-train, we randomly sample a poisoning ratio of r p images to be poisoning examples, resulting in a poisoned training dataset POISONED-train( r p ) .
To demonstrate the effectiveness of the poisoning attacks, we use the CLEAN-test dataset, as well as POISONED-test dataset which is constructed by poisoning all images in CLEAN-test.
For image classiﬁcation model, we use convolutional neural network (CNN) containing 2 convolutional layers with max pooling, and a softmax layer to output desired labels.
The differentially private models are trained with the same conﬁgurations as in Section 4.1 unless otherwise noted.
Metrics We ﬁrst evaluate the effectiveness of the constructed backdoor attack.
A successful backdoor attack should have high image classiﬁcation accuracy on CLEAN-test, which we refer to as benign accuracy , as well as high accuracy on POISONED-test with poisoned labels, which indicates the success rate .
To investigate whether measuring the classiﬁcation model loss is able to detect poisoning examples, and whether differential privacy is able to improve the detection performance, we leverage metrics AUPR and AUROC as described at the beginning of Section 4.
[Table]
Results We ﬁrst evaluate the backdoor attack effectiveness and the detection performance with varying poisoning ratio r p , under different noise scale σ , and ﬁxed clipping bound C = 1 .
The results are summarized in Table 2.
σ = N/A indicates classiﬁcation models trained without differential privacy.
Benign accuracy remains high on clean data.
Backdoor success rate is only around half at a poisoning ratio of 0.5%, and shows successful (97.12% success rate) at a poisoning ratio of 1%.
Detecting poisoning examples by measuring model loss shows some level of effectiveness when the poisoning ratio is low (e.g., 0.5%).
Furthermore, applying differential privacy to the model training process is able to signiﬁcantly improve the detection performance.
Similar as in Table 1, the higher the poisoning ratio, the larger the noise level (smaller (cid:15) ) to achieve the best improvement.
Another interesting observation is that, a differentially private model is naturally robust to backdoor attacks.
As indicated in Table 2, differential privacy effectively limits the success of backdoor attacks, reducing the success rate below 0.5% in all cases.
In comparison, the utility downgrade on benign accuracy is little.
To further evaluate the applicability of using the same CNN model for both anomaly detection and image classiﬁcation, seeking to co-optimize the performance of the model for both tasks, we collect measurements with varying clipping bound C , and ﬁxed noise scale σ = 0 .
5 , as a complement to
Table 2.
The results are summarized in Table 3.
Note that a small C may hurt model performance as more model parameters are clipped.
When C is greater than most parameter values, the effect of increasing C is similar to that of increasing σ (8).
From Table 3, we can observe that the best model for anomaly detection could have a similar set of parameters with the best model for image classiﬁcation.
However, in general, as shown in Table 2, classiﬁcation accuracy and robustness are often two conﬂicting desiderata; model trainers can tune the privacy parameter in order to meet the task-speciﬁc requirements for accuracy and robustness. [Table]
R ELATED WORK
To the best of our knowledge [Table] this paper is the ﬁrst one that proposes to improve outlier/novelty detection with differential privacy, and further extends it to backdoor attack detection.
Note that this is not the ﬁrst work that combines outlier detection and differential privacy together.
(18) aim to preserve input data privacy while detecting outliers.
The two tasks are contradicting in this case as the identiﬁcation of outliers (part of input data) implies certain privacy leakage, so (18) try to ﬁnd a balance.
In contrast, we focus on improving anomaly detection performance with differential privacy, which is only applied to the model training stage
[Table]
but no privacy protection is provided for the input data in detection stage when the outliers are actually being detected.
Outlier detection and novelty detection are closely related to each other and often addressed together ((19; 20; 21)).
Outlier detection is the process of identifying rare items in a dataset that signiﬁcantly differ from the majority ((22)), while novelty detection is to detect new observations that lie in the low density area of the existing dataset ((23; 24)).
Previous work mostly achieves outlier detection using unsupervised learning methods ((25; 26; 27)), while novelty detection typically assumes a normal dataset is available for training, and is realized by semi-supervised learning ((28; 29)).
In both cases, it involves summarizing a distribution that the majority of training data are drawn from.
Traditional methods such as clustering ((30)) and principal component analysis (PCA) ((31; 32)) have been frequently used.
In this paper, we leverage deep learning based detection methods including autoencoders ((33)) and LSTM ((5)) as the baselines, and further extend the idea of measuring model loss to backdoor attack detection.
Proposed by (34), differential privacy has been a powerful tool to protect input data privacy.
(3) shows that differential privacy implies stability on the output statistical results.
Further, (35) points out that the empirical average of the output of a differentially private algorithm on a random dataset is close to the true expectation with high probability.
Differential privacy has been utilized to train machine learning models that are robust to adversarial examples ((36; 37)), and to bound the success of inference attacks ((38)).
In this paper, we utilize the property of differential privacy to improve anomaly detection and privacy is ensured via the technique proposed in (8).
Lastly, we note that a recent paper by (39) showed that accuracy of differentially private models drops much more for the underrepresented classes and subgroups.
Intrinsically, our paper exploited the same phenomenon to improve anomaly detection.
(39) studied the phenomenon empirically, while our work provides a theoretical analysis, which, for the ﬁrst time, precisely characterizes the dependence of the performance gap between the majority and the underrepresented group on the privacy parameters.
Moreover, (39) mainly considered the implication of differential privacy to the fairness of machine learning models; by contrast, our paper focuses on anomaly detection and backdoor attacks and exhibits strong empirical evidence for the efﬁcacy of differential privacy in these two application domains.
C ONCLUSION
In this paper, inspired by the fact that differential privacy implies stability, we apply DP noise to improve the performance of outlier detection and novelty detection, with an extension to backdoor attack detection.
We ﬁrst provide the theoretical basis for the efﬁcacy of differential privacy for identifying anomalies, connecting the hardness of the identiﬁcation problem to privacy parameters.
Our theoretical results are useful to explain various experimental ﬁndings, including how the anomaly detection performance varies with privacy parameters and the number of outliers in the training set.
We perform extensive experiments to demonstrate the effectiveness of differential privacy for anomaly detection.
To fully evaluate the effectiveness of DP in anomaly detection with different amount of outliers and noisee, we ﬁrst construct a contaminated dataset based on MNIST and train autoencoder anomaly detection models with varying noise scale applied.
We then evaluate the performance using a real-world task, Hadoop ﬁle system log anomaly detection, by applying DP noise to DeepLog, the current state-of-the-art detection model.
The evaluation results show that DP noise is effective towards reducing the number of false negatives, and further improving the overall utility.
Finally, we generalize the idea of measuring model loss for outlier detection to backdoor attack detection and further improve the performance via differential privacy.
A A PPENDIX A. P ROOF OF T HEOREM
The following result will be used for reasoning about the performance gap of the differentially private learned models between regular data points and outliers.
Theorem 3 (McDiarmid, 1989) .
Let S be a set of n points and S i be the set with the i th element in S replaced by z (cid:48)
i , let F : Z n → R be any measurable function for which there exits constants
c
i ( i = 1 , . . . , n ) such that
[Equation]
then
[Equation]
Moreover, we will need the following lemma on group differential privacy.
Lemma 1.
If A is ( (cid:15), δ ) -differentially private with respect to one change in the database, then A is ( c(cid:15), ce c(cid:15) δ ) -differentially private with respect to c changes in the database.
Now, we are ready to present the proof of Theorem 2.
Theorem 2.
Suppose that a learning algorithm
A is ( (cid:15), δ ) -differentially private and UAERM with the rate ξ ( n, (cid:15), δ ) .
Let S (cid:48)
=
S ∪ U , where S ∼ D n and U contains c arbitrary outliers.
Then
[Equation]
with probability at least 1 − γ .
Proof.
Let the probability density/mass deﬁned by A ( S (cid:48) ) and A ( S ) be p ( h ) and p (cid:48)
( h ) , respectively.
Using Lemma
[Equation]
for any z ∈ Z we have
[Equation]
It follows that
[Equation]
By symmetry
[Equation]
it also holds that
[Equation]
Thus
[Equation]
we have the following bound:
[Equation]
Moreover, let S i be the set with the i th element in S replaced by z (cid:48)
i .
Then, by the same argument above, we have
[Equation]
[Equation]
for all i = 1 , . . .
, n .
Then, using Theorem 3 that relates the ﬁrst order differences of random functions to their variance, we obtain
[Equation]
Hence,
P
[Equation]
Combining (14) with (17), we have
[Equation]
Since A is UAERM, the following inequality holds with probability at least 1 − γ :
[Equation]
for all z ∈ Z .
For a given outlier ˜ z , it satisﬁes l ( h ∗ , ˜ z ) − E z
∼D
[ l ( h ∗ , z )] ≥ T by deﬁnition.
Combining it with (19), we get
[Equation]
ξ ( n, (cid:15), δ ) + (cid:115) n ( e
[Table]
1 + δ ) logγ + e c(cid:15) − 1 + ce
[Table]
δ (cid:19) (20)
A. A DDITIONAL EXPERIMENT RESULTS
We list additional experimental results in this section.
With more parameters being tested and more metrics being collected, these extensive results further validate our observations presented in the main paper body: differential privacy could improve anomaly detection and backdoor attack detection; and the higher ratio of outliers in the training data, the more noise (smaller privacy bound (cid:15) ) is needed to achieve the best improvement.
A.2. A UTOENCODER ANOMALY DETECTION
Besides the AUPR scores presented in Table 1 for outlier detection and novelty detection using autoencoders, we present additional results with more parameters being tested in Table 4.
The observations are similar.
As an intermediate step in differential privacy to bound the sensitivity, clipping itself without adding any noise is able to improve the performance of outlier detection and novelty detection.
Adding various amounts of random Gaussian noise is able to further improve the utility, except when the amount of noise is too big (e.g., σ = 50 and 100 ) to ruin the model.
We also indicate the privacy bound (cid:15) as accumulated by the moments accountant mechanism in (8).
Interestingly, many (cid:15) values are too big to provide any meaningful privacy guarantee, but they are still able to improve the anomaly detection performance.
Besides AUPR scores, we further present AUROC scores in Table 5 for the same set of experiments.
Autoencoders, as validated by many previous works (( ? 33)), present great effectiveness in detecting outliers and novelties, especially when the outlier ratio in training dataset is slow (e.g., below 1% ).
Although not as obvious as AUPR scores, the improvements brought by differential privacy follow a similar trend, where the improvement is more signiﬁcant with larger noise (smaller (cid:15) ) being applied to models trained with more outliers.
[Table]
Below σ value is too big such that the model does not converge well in training
[Table] [Table]
A.2. I MPROVEMENTS OVER D EEP L OG
To compare the differentially private models with DeepLog, we utilize the same anomaly detection criteria, i.e., Top- k based anomaly detection as what’s presented in (5).
Nevertheless, as a direct extension of the idea in measuring model loss for anomaly detection, we also tested the classiﬁcation probability as one type of threshold for anomaly detection.
In particular, if an actual system log entry is predicted with a probability lower than some threshold T p , we treat this log entry as a detected anomaly.
While the baseline DeepLog results are not as good as the Top- k based detection, we show that similarly, differential privacy is able to signiﬁcantly reduce the number of false negatives, without introducing too many new false positives.
Probability-based detection.
As a preliminary result, we use probability-based anomaly detection to demonstrate the effectiveness of differential privacy noise in reducing FN .
Table 6 shows FN and
FP for DeepLog and DeepLog+DP with increasing noise levels, under different probability thresholds
T p .
It is clear that differential privacy noise could effectively reduce FN , and the larger noise being added, the more false negatives are reduced.
We also note that when σ = 0 .
25 , the privacy bound (cid:15) = 90 .
It is often thought that a privacy bound (cid:15) > 20 is completely useless in terms of protecting privacy.
Here we indicate that a small amount of noise may be enough to reduce FN .
Although more false positives are incurred because of differential privacy noise, the drop in TPR is negligible, considering the large volume of normal data.
For example, when T p = 2 × 10 − 6 and σ = 1 , the
FN drop from 1261 to 183 indicates a TNR increase of 8% ( 91 .
7% → 98 . 8% ), while the FP increase from 2291 to 3734 only shows a TPR decrease of 0.3% ( 99 .
59% → 99 .
[Table]
[Table]
AUROC score To evaluate the overall performance of DeepLog+DP compared with DeepLog under different thresholds, we further compute the AUROC score of DeepLog and DeepLog+DP with different noise scale σ .
As shown in Table
[Table]
DeepLog already achieves excellent AUROC score, considering the large amount of normal data and the signiﬁcantly fewer anomalies.
However, an adequate amount of differential privacy noise is still able to improve the performance.
Privacy bound (cid:15)
Table 7 also indicates the privacy bound (cid:15) .
Note that (cid:15) < 10 is often considered as usable and (cid:15) < 1 is a tight bound that well protects privacy.
Considering all the cases
[Table]
σ = 1 gives the best anomaly detection utility as well as a tight privacy bound to protect training data privacy.
A.2. B ACKDOOR ATTACK DETECTION
In this section
[Table]
we evaluate more parameters for the experiment set up described in Section 4.
BACKDOOR ATTACK DETECTION, and measure benign accuracy , success rate , AUPR score and
AUROC score as explained in Section 4.3 for each experiment setting.
Similar as the observations in Section 4.3, a differentially private trained machine learning model is naturally more robust to backdoor attacks.
The evidence is that the benign accuracy (Table 8) is affected little by differential privacy except when the noise scale is too big to ruin the model parameters, compared with the signiﬁcant downgrade (e.g., 98.1% to 0.3%) in backdoor success rate (Table 9).
Also, as shown in
Table 10 and Table 11, measuring model loss to detect poisoning examples could be useful when the poisoning ratio is low.
Nevertheless, applying differential privacy is able to signiﬁcantly improve the detection performance for a poisoning ratio as high as 45% .
[Table]
Below noise level σ could be too high.
[Table] [Table]
[Table] [Table]