Interactive recommendation systems capture dynamic personalized user preferences by improving their strategies continuously (Mahmood and Ricci, 2007; Thompson et al., 2004; Taghipour and Kardan, 2008)
. They have attracted enormous attention and been applied in leading companies like Amazon, Netflix, and Youtube. The traditional methods to model user-system interactions include Multi-Armed Bandit (MAB) or Reinforcement Learning (RL). The former views action choices as a repeated single process, while the latter considers immediate and future rewards to model behavors’ long-term benefits. RL-based systems employ a Markov Decision Process (MDP) agent that estimates the value based on both actions and states, rather than merely on actions as done by MAB.
However, reinforcement learning-based models can be fooled by small disturbances on the input data (Szegedy et al., 2013; Goodfellow et al., 2014). Small imperceptible noises, such as adversarial examples, may increase prediction error or reduce reward in supervised and RL tasks—the input noise can be transferred to attack different parameters even different models, including recurrent network and RL (Gao et al., 2018; Huang et al., 2017)
. Besides, the embedding vectors of users, items and relations are piped into RL-based recommendation models, making it challenging for humans to tell the true value or to dig out the real issues in the models. Attackers can easily leverage such characteristics to disrupt recommendation systems silently, making defending adversarial attacks a non-trivial task for RL-based recommendation systems.
In this work, we aim to develop a general detection model to detect attacks and increase the defence ability, which provides a practical strategy to overcome the dynamic ‘arm-race’ of attacks and to defend in the long run. We make the following contributions:
We systematically investigate adversarial attacks and detection approaches with a focus on reinforcement learning-based recommendation systems and demonstrate the effectiveness of the designed adversarial examples and strategically-timed attack.
We propose an encoder-classification detection model for attack-agnostic detection. The encoder captures the temporal relationship among sequence actions in reinforcement learning. We further use an attention-based classifier to highlight the critical time steps out of ample interactive space.
We empirically show that even small perturbations can reduce the performance of most attack methods significantly. Our statistical validation shows that multiple attack methods generate similar actions of the attacked system, providing insights into improving the detection performance.
2.1. RL-based Interactive Recommendation
Interactive recommendation systems suggest items to users and receives feedback. Given a user , a set of items , and the user feedback history , the recommendation system suggests a new item . This problem represents a Markov Decision Process as follows:
State (): a historical interaction between a user and the recommendation system computed by an embedding or encoder module.
Action (): an item or a set of items recommended by the RL agent.
Reward (): a variable related to a user’s feedback to guide the reinforcement model towards true user preference.
): a conditional probability distribution of items which the agent might recommend to a usergiven the state of last time step . The learning process aims to get an optimal policy.
Value function (): the agent’s estimation of reward of current states and recommended item
. We define the reward as the cosine similarity between user and item embedding vectors.
The reinforcement agent could follow REINFORCE with baseline or Actor-Critic algorithm that both consist of a value network and a policy network (Xian et al., 2019). The attack model may generate adversarial examples using either the value network (Huang et al., 2017) or the policy network(Pattanaik et al., 2017).
2.2. Attack Model
FGSM-based attack. We define an adversarial attack as an additional small perturbation on benign examples , which can be a composition of embedding vectors of users, relations and items (Xian et al., 2019). Unlike perturbations on images or texts, can be large due to the enormous manual work to check the embedding vectors. We define an adversarial example as
Attack with smaller frequency. The strategically-timed attack (Lin et al., 2017) aims to decreases the attack frequency without sacrificing the performance of the un-targeted reinforcement attack. We formally present it below:
is a binary variable that controls when to attack;is the frequency of adversarial examples. There are two approaches to generate the binary sequence
optimizing a hard integer programming problem and generating sequences via heuristic methods. Letbe the two maximum probability of an policy , be the attack mask on time step, which is different from (Lin et al., 2017):
We pick out actions that have the max distance between the highest two probabilities, which means we attack on the most confident actions of the agent. Experiments show that this strategy works. In contrast, Jacobian-based Saliency Map Attack (JSMA) (Papernot et al., 2016) and Deepfool (Moosavi-Dezfooli et al., 2016) are based on the gradient of actions rather than the gradient of value. One key component of JSMA is saliency map computation, which decides which dimension of vectors (in Image classification is pixels) are modified. Deepfool pinpoints the attack dimension by comparison of affine distances between some class and temporal class.
2.3. Detection Model
The detection model is a supervised classifier detects adversarial examples with actions of the reinforcement agent. Suppose the action distributions of an agent are shifted by adversarial examples (Section 3 shows statistical evidence of the drift). Given an abnormal action sequence
, the detection model aims to establish separating hyperplane between adversarial examples and normal examples, thereby measuring the probabilityor , where is a binary variable indicating whether the input data are attacked.
To detect the adversarial examples presented in the last section, we employ an attention-based classifier. The detection model consists of two parts. The first is a GRU encoder, to encode the action methods into a low dimensional feature vector. The second is an attention based decoder with classifier to separate different data. This encoder-decoder model has a bottleneck structure that filters out noisy information. The formulation of GRU is as follows:
We use to denote action sequence, which is a series of user relation vectors or item embedding vectors. is the output of encoder.
The attention-based decoder is formulated below.
where is the combined vector of action embedding, hidden states
and encoder output, the combination method is a linear unit with ReLU activation. GRU is reused to generate multiple hidden states at each time steps. Loss is computed at each time step. After processed through the attention model and GRU, the vector is then piped into a linear unit with sigmoid function to predict if the agent is polluted. The loss function is the cross entropy between the true label and corresponding probability,
In this section, we report our experiments to evaluate attack methods and our detection model.
3.1. Dataset and Experiment Setup
We conduct experiments following (Chen et al., 2019) and (Xian et al., 2019) over a Amazon dataset (He and McAuley, 2016). This public dataset contains user reviews and metadata of the Amazon e-commerce platform from 1996 to 2014. We utilize three subsets, namely Beauty, Cellphones, and Clothing, which are originally provided by (Xian et al., 2019) on Github . Details about Amazon dataset analysis can be found in (Xian et al., 2019).
Our experiments are based on (Xian et al., 2019). During dataset preprocessing,feature words with higher TF-IDF scores than 0.1 are filtered out. 70% of data in each dataset comprises the training set (the rest are the test set). We take actions of reinforcement agent as the detection data. We define the actions of PGPR (Xian et al., 2019) as heterogeneous graph paths that start from users and have a length of 4. The three Amazon sub-datasets (Beauty, Cellphones, and Clothing) contain 22,363, 27,879, and 39387 users, respectively. To accelerate experiments, we use the first 10,000 users of each dataset to produce adversarial examples. Users in Beauty get, on average, 127.51 paths. The counterparts for Cellphones and Clothing are 121.92 and 122.71. As the number of paths is large, we utilize the first 100,000 paths for train and validation with split ratio 80/20. We randomly sampled 100,000 paths from each action file to form the test set.
We attack trained RL agent with methods in section 2.2. We slightly modify JSMA and Deepfool for our experiments—we create the saliency map by calculating the product of the target label and temporal label and achieve both effectiveness and higher efficiency (by 0.32 seconds per iteration) of JSMA; we decrease the computation load on a group of gradients on Deepfool by sampling. Besides, we set the hidden size of the GRU to 32 for the encoder, the drop rate of the attention-based classifier to 0.5, the maximum length of a user-item path to 4, the learning rate and weight decay of the optimization solver, Adam, to 5e-4 and 0.01, respectively.
3.2. Attack Experiments
Adversarial attack results.
We are interested in how vulnerable the agent is to perturbation in semantic embedding space. An attack will be effective if a small perturbation leads to a notable performance reduction. We reuse the evaluation metrics of(Xian et al., 2019), namely Normalized Discounted Cumulative Gain (NDCG), Recall, Hit Ratio (HR), and Precision for evaluation. All metrics are computed based on the top 10 sorted predictions for each user, and they are presented in percentage without specific notion.
Table 1 shows the performance of different attack methods. Attack results share the same trend with the distribution discrepancy. Most attack methods significantly reduce the performance of the reinforcement system. FGSM achieves the best performance. It reveals that single dimension attack can change the agent’s action drastically. While FGSM is less effective, where the metrics just fluctuates around the original baseline (Table 1), partly because of small disturbance created by method. Specifically, JSMA achieves comparable results as with a small attack region. Attacks on Clothing and Cellphones sub-datasets show similar effects.
Impact of attack frequency. We conduct two experiments on attack frequency, random attack and strategically attack. The difference is if adversarial examples are crafted with a frequency parameter , or generated by the method shown in Section 2.2. The NDCG metric is presented in Figure 2; other metrics have a similar trend. It can be seen from 2 that the random attack performs worse than the strategically-timed attack. With strategically timed method, attacking time steps achieves a significant reduction in all metrics.
Analysis of adversarial examples. We use Maximum Mean Discrepancy as statistical measures to capture distribution distance. This divergence is defined as:
is the kernel function, i.e., a radial basis function,are benign and adversarial examples.
MMD-org reveals the discrepancy between the original and adversarial datasets. And MMD- presents the discrepancy among different attack methods. The results (Table 1) show that the adversarial distribution is different from the original distribution. Also, the disturbed distributions are closed to each other regardless of the attack type. This insight makes it clear that we can use a classifier to separate benign data and adversarial data and it can detect several attacks at the same time, which might be transferred to other reinforcement learning attack detection tasks.
3.3. Detection Experiments
From a statistical perspective, the above analysis shows that one classifier can detect multiple types of attacks. We evaluate the detection performance using Precision, Recall and F1 score.
Our attention-based detection model is trained on FGSM attack with at 0.1 and detects all attack types. The results (Table 2) show that the attack are stronger, the model achieves better performance. attack validates this trend, which shows that our model can detect weak attacks as well. The result of detection on attack can be reasoned with MMD analysis shown above, high precision and low recall show that most adversarial examples are close to benign data which confuses the detector. The attack with validates that our detector performs well yet achieves worse performance on other tests of Cellphones dataset.
Our results on factor analysis (Table 2) show that the detection model can detect attacks even under low attack frequencies. But the detection accuracy decreases as the attack frequency drops—the recall reduces significantly to 40.1% when 11.8% examples represent attacks.
Adversarial attacks on reinforcement learning-based recommendation system can degrade user experience. In this paper, we systematically study adversarial attacks and their factor impacts. We conduct statistical analysis to show classifiers, especially an attention-based detector, can well separate the detection data. Our extensive experiments show both our attack and detection models achieve satisfactory performance.
Large-scale interactive recommendation with tree-structured policy gradient.
Proceedings of the AAAI Conference on Artificial Intelligence, Vol. 33, pp. 3312–3320. Cited by: §3.1.
- Black-box generation of adversarial text sequences to evade deep learning classifiers. In 2018 IEEE Security and Privacy Workshops (SPW), pp. 50–56. Cited by: §1.
- Explaining and Harnessing Adversarial Examples. External Links: Cited by: §1.
- Ups and downs: modeling the visual evolution of fashion trends with one-class collaborative filtering. In proceedings of the 25th international conference on world wide web, pp. 507–517. Cited by: §3.1.
Adversarial Attacks on Neural Network Policies. External Links: Cited by: §1, §2.1.
- Tactics of Adversarial Attack on Deep Reinforcement Learning Agents. External Links: Cited by: §2.2.
- Learning and adaptivity in interactive recommender systems. In Proceedings of the ninth international conference on Electronic commerce, pp. 75–84. Cited by: §1.
- Deepfool: a simple and accurate method to fool deep neural networks. In , pp. 2574–2582. Cited by: §2.2.
- The limitations of deep learning in adversarial settings. In 2016 IEEE European Symposium on Security and Privacy (EuroS&P), pp. 372–387. Cited by: §2.2.
- Robust Deep Reinforcement Learning with Adversarial Attacks. External Links: Cited by: §2.1.
- Intriguing properties of neural networks. External Links: Cited by: §1.
- A hybrid web recommender system based on q-learning. In Proceedings of the 2008 ACM symposium on Applied computing, pp. 1164–1168. Cited by: §1.
- A personalized system for conversational recommendations. Journal of Artificial Intelligence Research 21, pp. 393–428. Cited by: §1.
Reinforcement knowledge graph reasoning for explainable recommendation. arXiv preprint arXiv:1906.05237. Cited by: §2.1, §2.2, §3.1, §3.1, §3.2.