Method and system for assisting recommendation system to resist shilling attack based on comparative learning
By adopting a comparative learning method in the recommendation system, building a variety of models for joint training, and using confident values as a weight generation recommendation list, solving the problem of low recommendation of false user testing and poor recommendation effects under attack attacks, significantly improved the recommendation system Resistance attack ability.
Patent Information
- Application Number
- CN202411476650.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2044-10-22
AI Technical Summary
The existing recommendation system has low accuracy and poor recommendation results for detecting false users and hosting attacks, especially in scenarios where the data volume is large and the number of false users is large, the detection accuracy is low, and the recommendation results are poor.
Using a method based on a comparison learning, by establishing the interactive matrix of user items, a positive and negative sample sampling and data increase, the comparative learning model, user detection model, and defense attack recommendation model are constructed, and joint training and trust value are used as the weight to generate users to generate users to generate users Recommended list.
Effectively improved the ability to detect false users and the ability to resist attacks, and solves the problem of poor recommendation under the incoming rate of false users and poor recommendation under the attack attack.
Smart Images

Figure CN119377497A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of recommendation system security, and in particular to a method and system for resisting shill attacks based on contrastive learning-assisted recommendation systems. Background Art
[0002] With the rapid development of Internet technology, the benefits brought by the Internet have made people interact with the Internet more and more frequently. At the same time, there is more and more information on the Internet. People can easily obtain massive information, but due to the limited information processing ability of people, it has become increasingly difficult to filter out useful information from a large amount of data. In order to solve the problem of information overload, recommendation systems have emerged, aiming to help users push information that may be of interest to users more quickly, efficiently and personalized. Recommendation systems have developed rapidly and have been applied in many fields, such as shopping, takeout, news and music, providing customers with more comfortable and accurate services and attracting huge user traffic to merchants. However, with the rapid development of recommendation systems, the security issues of recommendation systems have become increasingly prominent. Among them, shill attacks are an important research direction in the security of recommendation systems. For some purpose, attackers generate false user interaction records and inject them into the data set, thereby manipulating the recommendation list of the recommendation system, bringing benefits to the attackers, but reducing the accuracy and personalization of the recommendation system, and causing huge losses to the recommendation platform.
[0003] Collaborative filtering technology is a widely used technology in recommendation systems. Collaborative filtering technology analyzes user preferences based on user historical behavior data. Specifically, it recommends items to target users based on the interest preferences of similar users or similar items. Recently, the graph neural network recommendation system in collaborative filtering technology has been widely used because it aggregates high-order neighbor information, making recommendations more accurate and efficient. However, at the same time, the aggregation of high-order neighbor information makes the recommendation system more affected by shill attacks, resulting in greater losses. The current recommendation system method for resisting shill attacks can alleviate the impact of shill attacks to a certain extent, but the accuracy of detecting fake users is low, resulting in weak defense against shill attacks and poor recommendation effect. Using traditional machine learning methods as detectors has poor generalization ability, so it is not effective when the amount of data is large. The method of using a graph neural network model to generate feature vectors and then passing them through a neural network for detection, in the scenario with a large number of fake users, the detection accuracy is low due to the cross-propagation of fake users and normal users' information, and thus the recommendation effect is poor. Summary of the invention
[0004] In order to solve the above problems, the purpose of the present invention is to provide a technology based on contrastive learning to enhance the recommendation system to resist shill attacks, aiming to overcome the difficulties of low accuracy in detecting false users in different scenarios and poor recommendation effect under shill attacks, and to enhance the ability of the recommendation system to resist shill attacks.
[0005] In order to achieve the above technical objectives, the present application provides a method for resisting shill attacks based on contrastive learning-assisted recommendation systems, comprising the following steps:
[0006] Based on the open source recommendation system dataset with fake users, a user-item interaction matrix is established, and the user-item nodes are embedded in the layer to generate user feature vectors.
[0007] Based on the user-item interaction matrix, data augmentation is performed through positive and negative sample sampling to obtain augmented data;
[0008] Based on weighted dot product and binary cross entropy, a contrastive learning model is constructed by training with augmented data.
[0009] Based on a three-layer neural network and focal loss function, the model is trained through user feature vectors to build a user detection model and obtain user confidence values;
[0010] Based on a weighted three-layer graph neural network and a Bayesian personalized loss function, the positive and negative sample pairs are obtained through the user-item interaction matrix and used together with the user confidence value as input data for model training to build a recommendation model that defends against shill attacks.
[0011] The contrastive learning model, user detection model and anti-shill attack recommendation model are jointly trained, and the feature vectors of each user and all items are multiplied to obtain the score and generate the user's recommendation list.
[0012] Preferably, in the process of data augmentation, each user is taken as a target user, and the set of items with which the target user interacts is sampled proportionally to obtain a set of positive sample subgraph feature vectors; any non-target user node is selected, and the set of items with which the non-target user interacts is sampled proportionally to obtain a set of negative sample subgraph feature vectors; augmented data is generated based on the set of positive sample subgraph feature vectors and the set of negative sample subgraph feature vectors.
[0013] Preferably, in the process of constructing the contrastive learning model, the positive and negative sample sub-graph feature vector sets are stacked and average pooled respectively to obtain the sub-graph feature vectors;
[0014] Then perform weighted dot multiplication with the target user’s feature vector to get the score;
[0015] Use the BCE loss function for learning and training to build a contrastive learning model.
[0016] Preferably, in the process of building the user detection model, the first two layers of the three-layer neural network are ReLu, and the last layer is sigmoid.
[0017] Preferably, in the process of sampling negative sample pairs, Bayesian positive and negative sample pair sampling is performed on the user-item interaction matrix.
[0018] Preferably, in the process of constructing a recommendation model for defending against shill attacks, the confidence value is used as the weight in the convolution operation, wherein the confidence value includes: a user confidence value and an item confidence value; the item confidence value is obtained by performing a graph convolution operation on the interaction matrix using the user confidence value.
[0019] Preferably, in the process of generating the recommendation list, the user's top 20 interactive items with the highest scores are taken as the user's recommendation list.
[0020] The present invention discloses a system for resisting shill attacks based on a contrastive learning-assisted recommendation system. The system is used to implement the above-mentioned method for resisting shill attacks based on a contrastive learning-assisted recommendation system. The system comprises:
[0021] The matrix building module is used to build a user-item interaction matrix based on an open source network recommendation system dataset with fake users, and generate a user feature vector by embedding the user-item nodes;
[0022] The data augmentation module is used to perform data augmentation through positive and negative sample sampling based on the user-item interaction matrix to obtain augmented data;
[0023] The first model building module is used to build a contrastive learning model based on weighted dot products and binary cross entropy by training with augmented data;
[0024] The second model building module is used to perform model training through user feature vectors based on a three-layer neural network and a focal loss function, build a user detection model, and obtain a user confidence value;
[0025] The third model building module is used to obtain positive and negative sample pair data through the user-item interaction matrix based on a weighted three-layer graph neural network and a Bayesian personalized loss function, and use the data together with the user confidence value as input data for model training to build a recommendation model that defends against shill attacks;
[0026] The auxiliary module is used to jointly train the contrastive learning model, user detection model and anti-shill attack recommendation model, perform dot multiplication operation on the feature vectors of each user and all items to obtain the score, and generate the user's recommendation list.
[0027] The present invention discloses the following technical effects:
[0028] The present invention solves the problems of low accuracy in detecting false users and poor recommendation effect under shill attacks, and effectively improves the accuracy in detecting false users and the ability of the recommendation system to resist shill attacks. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0030] Figure 1 It is a logical framework diagram of the method described in the present invention. DETAILED DESCRIPTION
[0031] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0032] like Figure 1 As shown, the present invention provides a method for improving a recommendation system to resist shill attacks based on contrastive learning, which specifically includes the following aspects:
[0033] 1. The present invention uses interaction data to establish an interaction matrix, taking the neighbor nodes of the target user as positive samples and the neighbor nodes of the non-target user as negative samples to achieve data augmentation;
[0034] 2. The present invention generates feature vectors for all users and items through the embedding layer, uses weighted dot product and binary cross entropy loss function to establish a contrastive learning model, and uses the augmented data as the input data of the model;
[0035] 3. The present invention uses a three-layer neural network and a focal loss function to establish a user detection model, and uses the user feature vector as the input data of the model to obtain the user confidence value. The user confidence value is used to perform a graph convolution operation on the interaction matrix to obtain the item confidence value;
[0036] 4. The present invention uses a three-layer graph neural network, pooling operation and Bayesian personalized loss function to establish a recommendation model, uses the confidence value as the weight of the graph neural network convolution operation, and uses the user feature vector and the item feature vector as the input data of the model.
[0037] 5. The present invention jointly trains the three models. After the training is completed, the interaction scores of user items are calculated, and the top 20 interactive items are selected to form a user recommendation list.
[0038] The present invention provides a method for improving a recommendation system against shill attacks based on contrastive learning, which specifically includes the following steps:
[0039] Step S1: Establish a user-item interaction matrix. Generate feature vectors for user-item nodes through the embedding layer.
[0040] Step S2: Perform positive and negative sample sampling to achieve data augmentation, and obtain a positive sample feature vector set and a negative sample feature vector set.
[0041] Step S3, using weighted dot product and binary cross entropy loss to establish a contrastive learning model, and using augmented data to train the contrastive learning model to increase the difference between the feature vectors of fake users and normal users.
[0042] Step S4, using a three-layer neural network and a focal loss function to establish a user detection model, using the user feature vector as input data to train the model and obtain a user confidence value.
[0043] Step S5: Use a weighted three-layer graph neural network and a personalized Bayesian personalized loss function to establish a recommendation model that resists shill attacks. Perform Bayesian positive and negative sample pair sampling on the interaction matrix. Use the positive and negative sample pair data and user confidence values as input data for model training.
[0044] Step S6: Jointly train the comparative learning model, the user detection model, and the recommendation model for resisting shill attacks. After the training is completed, the dot product of each user's feature vector and the feature vectors of all items is calculated to obtain a score, and the 20 interactive items with the highest scores for the user are taken as the user's recommendation list.
[0045] Specifically, S1. Establish a user-item interaction matrix:
[0046] The user set U and the item set I are as follows: edges are built based on whether user u and item i interact.
[0047]
[0048] Generate user feature matrix E for all users and items u and item feature matrix E i , the feature vector of user u is e u , the feature vector of item i is e i .
[0049] S2. Implement data augmentation:
[0050] Each user is taken as the target user, and a positive sample subgraph feature vector set is obtained by sampling proportionally from the set of items with which the target user interacts. Any non-target user node is selected, and a negative sample subgraph feature vector set is obtained by sampling proportionally from the set of items with which the non-target user interacts.
[0051] S3. Establish contrastive learning model:
[0052] The positive and negative sample sub-image feature vector sets are stacked and average pooled respectively to obtain the sub-image feature vector, which is calculated as follows:
[0053] e j =mean(concat(e j1 , e j2 , ...));
[0054] In the formula, e j represents the subgraph feature vector, e ji It represents the feature vector of the i-th item in the subgraph feature vector set, concat represents the concatenation operation, and mean represents the averaging operation. Then, the weighted dot multiplication operation is performed with the target user feature vector to obtain the score.
[0055]
[0056] In the formula, e u represents the target user feature vector, e j Represents the feature vector of positive sample sub-graph or negative sample sub-graph, s i Indicates the score. The BCE loss function is used to learn and train the comparison model. The positive subgraph feature vector label is 1, and the negative subgraph feature vector label is 0. The calculation is as follows:
[0057]
[0058] Among them, s is the subgraph score and l is the label of the subgraph.
[0059] S4. Establish user detection model:
[0060] The user features are used as input to extract features through a three-layer neural network and obtain classification scores:
[0061] p u =σ(e u W):
[0062] Among them, e u is the user feature vector, W is the weight matrix, σ represents the activation function, the first two layers are ReLu, the last layer is sigmod, and pu represents the confidence value of user u. At the same time, the FocalLoss loss function is calculated to train the user detection model, which is calculated as follows:
[0063] L FocalLooss =-α t (1-p u ) γ log(p u );
[0064] Among them, α t , γ represents the weight.
[0065] S5. Establish a recommended model for defending against shill attacks:
[0066] Sampling positive and negative sample pairs on the S1 interaction matrix yields (u, i + , j_), i + indicates item i that has interaction with user u, and j- indicates item j that has no interaction with user u.
[0067] The user confidence value is convolved on the graph to get the item confidence value, which is calculated as follows:
[0068]
[0069] Among them, |N v | represents the number of neighbors of the item node, p u represents the user confidence value, p v Represents the confidence value of the item. The confidence value is used as the weight in the convolution operation to calculate the feature vector after the convolution of the item node. and From E u and E v Matrix acquisition, calculation is as follows:
[0070]
[0071] Among them, p u represents the user confidence value, is the k+1th layer feature vector of item node v, is the k-th layer feature vector of user node u, |N v | represents the number of neighbors of the item node, |N u | represents the number of neighbors of the user node. Similarly, the convolved feature vector of the user node is calculated.
[0072]
[0073] Among them, p v Represents the confidence value of the item. After three layers of graph convolution, three layers of feature vectors are obtained and average pooling is performed. The feature vector of each node is obtained by combining the positive and negative sample pairs (u, i, j) with the Bayesian personalized loss function LBPR Perform model training:
[0074]
[0075] S6. Joint training:
[0076] The loss function of the contrast learning model, the loss function of the user detection model, and the loss function of the defense against shill attacks recommendation model are jointly trained:
[0077] L=L BPR +αL BCELoss +βL FocalLoss :
[0078] After training is completed, the dot product of each user's feature vector and the feature vectors of all items is calculated to obtain the score, and the user's top 20 highest-scoring interactive items are taken as the user's recommendation list:
[0079]
[0080] Among them, e u represents the feature vector of user u, e j Represents the feature vector of item j.
[0081] Based on the recommendation system, the present invention combines contrastive learning and multi-layer perceptron to detect false users and use confidence values as weights to implement a recommendation system method that resists shill attacks. This technology solves the problems of low accuracy in detecting false users and poor recommendation effect under shill attacks, and effectively improves the accuracy in detecting false users and the ability of the recommendation system to resist shill attacks.
[0082] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0083] In the description of the present invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0084] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for resisting shill attacks based on contrastive learning-assisted recommendation system, characterized in that: The following steps are involved: Based on the open source recommendation system dataset with fake users, a user-item interaction matrix is established, and the user-item nodes are embedded in the layer to generate user feature vectors. Based on the user-item interaction matrix, data augmentation is performed by sampling positive and negative samples to obtain augmented data; Based on weighted dot product and binary cross entropy, a contrastive learning model is constructed by training with the augmented data; Based on a three-layer neural network and a focal loss function, a model is trained through the user feature vector to build a user detection model and obtain a user confidence value; Based on a weighted three-layer graph neural network and a Bayesian personalized loss function, the positive and negative sample pair data are obtained through the user-item interaction matrix, and the data is used together with the user confidence value as input data for model training to build a recommendation model to defend against shill attacks; The contrastive learning model, the user detection model and the anti-shill attack recommendation model are jointly trained, and a dot product operation is performed on the feature vectors of each user and all items to obtain a score, and a recommendation list for the user is generated.
2. According to claim 1, a method for resisting shill attacks based on contrastive learning-assisted recommendation system, characterized in that: In the process of data augmentation, each user is taken as a target user, and a set of items with which the target user has interacted is sampled proportionally to obtain a set of positive sample subgraph feature vectors. Any non-target user node is selected, and a set of items with which the non-target user has interacted is sampled proportionally to obtain a set of negative sample subgraph feature vectors. The augmented data is generated based on the positive sample subgraph feature vector set and the negative sample subgraph feature vector set.
3. According to claim 2, a method for resisting shill attacks based on contrastive learning-assisted recommendation system, characterized in that: In the process of building the contrastive learning model, the positive and negative sample sub-image feature vector sets are stacked and average pooled respectively to obtain the sub-image feature vectors; Then perform weighted dot multiplication with the target user’s feature vector to get the score; The BCE loss function is used for learning and training to construct the contrastive learning model.
4. According to claim 3, a method for resisting shill attacks based on contrastive learning-assisted recommendation system, characterized in that: In the process of building the user detection model, the first two layers of the three-layer neural network are ReLu, and the last layer is sigmoid.
5. According to claim 4, a method for resisting shill attacks based on contrastive learning-assisted recommendation system, characterized in that: In the process of sampling negative sample pairs, Bayesian positive and negative sample pair sampling is performed on the user-item interaction matrix.
6. The method for resisting shill attacks based on contrastive learning-assisted recommendation system according to claim 5, characterized in that: In the process of building a recommendation model to defend against shill attacks, the confidence value is used as the weight in the convolution operation, wherein the confidence value includes: a user confidence value and an item confidence value; the item confidence value is obtained by performing a graph convolution operation on the interaction matrix by applying the user confidence value.
7. The method for resisting shill attacks based on contrastive learning-assisted recommendation system according to claim 6, characterized in that: In the process of generating the recommendation list, the user's top 20 interactive items with the highest scores are taken as the user's recommendation list.
8. A system for resisting shill attacks based on contrastive learning-assisted recommendation system, characterized in that: The system is used to implement a method for resisting shill attacks based on a contrastive learning-assisted recommendation system as claimed in any one of claims 1 to 7, and the system comprises: The matrix building module is used to build a user-item interaction matrix based on an open source network recommendation system dataset with fake users, and generate a user feature vector by embedding the user-item nodes; A data augmentation module, configured to perform data augmentation by sampling positive and negative samples based on the user-item interaction matrix to obtain augmented data; A first model building module, for building a contrastive learning model through training with the augmented data based on weighted dot product and binary cross entropy; A second model building module is used to perform model training through the user feature vector based on a three-layer neural network and a focal loss function, build a user detection model, and obtain a user confidence value; A third model building module is used to obtain positive and negative sample pair data through the user-item interaction matrix based on a weighted three-layer graph neural network and a Bayesian personalized loss function, and use the data together with the user confidence value as input data for model training to build a recommendation model for defense against shill attacks; The auxiliary module is used to jointly train the contrastive learning model, the user detection model and the anti-shill attack recommendation model, perform a dot product operation on the feature vectors of each user and all items to obtain a score, and generate a recommendation list for the user.
Citation Information
Patent Citations
Shilling attack detection method based on convolutional neural network
CN111967909A
Recommendation system shilling attack detection method and device, equipment and storage medium
CN112231570A
Systems and methods for recommendation of items and controlling an associated bias thereof
US20230169569A1
Cross-domain recommendation via contrastive learning of user behaviors in attentive sequence models
US20240161165A1
Cited By
Shilling attack-oriented recommendation method, device and equipment
CN121301647A