A federated recommendation method and system based on model-independent meta-learning

By introducing model-independent meta-learning and self-attention mechanisms into the federated learning framework, the problem that federated recommendation methods cannot adapt to the personalized needs of different users is solved, achieving high-precision personalized recommendations and privacy protection.

CN115409203BActive Publication Date: 2026-03-03INSTITUTE OF INFORMATION ENGINEERING CHINESE ACADEMY OF SCIENCES
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-25
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing federated recommendation methods cannot adapt to the personalized needs of different users, and lack exploration and application of self-attention mechanisms, resulting in insufficient recommendation accuracy despite privacy protection.

Method used

By employing Model-Independent Meta-Learning (MAML) and self-attention mechanisms, and treating the user's local training process as a training task within a federated learning framework, personalized recommendation models are generated through model training and updates using support sets and query sets.

Benefits of technology

It implements a personalized recommendation model, improves recommendation performance, achieves accuracy matching state-of-the-art models, and protects user privacy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115409203B_ABST
    Figure CN115409203B_ABST
Patent Text Reader

Abstract

The application discloses a kind of federated recommendation method and system based on model-independent meta-learning.The method is:1) server selects multiple clients, and sends selected recommendation model to each client;2) each client divides local data into support set and query set;3) each client trains and updates received recommendation model based on local support set;4) each client verifies and calculates model gradient on query set after updating recommendation model;5) server collects the gradient calculated by each client, updates recommendation model based on average gradient and sends it to each client for next round training;6) repeat steps 3) to 5) until the set condition, each client obtains a common recommendation model;7) each client trains the common recommendation model using local data, and obtains individualized recommendation model;8) client m inputs interaction data in target application scenario into individualized recommendation model, and obtains individualized recommendation result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of recommender systems, specifically to a federated recommender method and system based on model-independent meta-learning. Background Technology

[0002] Recommender systems learn users' tastes and preferences to help them effectively discover the most useful information or services in situations of information overload. Existing deep learning-based recommendation methods typically require centralized storage of all user-item interaction data to learn deep neural networks and representations of users and items. This means uploading and aggregating users' private data. However, user-item interaction data is highly privacy-sensitive, and transmitting it can lead to privacy issues and data breaches. Moreover, under the pressure of strict data protection regulations such as the General Data Protection Regulation (GDPR), user behavior data can no longer be used without the user's explicit permission. Therefore, these centrally trained recommendation models may no longer be applicable in the future.

[0003] Federated learning is a machine learning technique that collaboratively learns intelligent models based on distributed user data. Unlike existing machine learning methods that rely on centralized storage of user data, in federated learning, user data is stored locally on user devices to maximize privacy. Given this characteristic, many research efforts have combined federated learning with recommender systems to achieve privacy-preserving recommendations. Federated recommendation trains a global recommender model in a decentralized manner and distributes it to users' devices for personalized recommendations. For example, in the Joint Collaborative Filtering (FCF) method, each user device locally computes gradients for user and item embeddings based on the personal ratings stored on that device. Then, the gradients of the item embeddings are uploaded and aggregated to update the global item embeddings on a central server, while simultaneously updating the user embeddings locally. Finally, the recommendation result for the user is calculated based on the dot product of the user and item embeddings.

[0004] However, two problems remain unresolved in existing federated recommendation methods. First, typical federated learning only develops a common output for all users, failing to adapt the model to each individual user. This is a significant missing feature, especially considering the heterogeneity of historical interaction data distribution among users. The high heterogeneity of users' historical interaction data manifests in two ways: (i) user interactions with items largely depend on the user's own interests and preferences, which vary greatly among different users, leading to significant differences in the types of items interacted with. (ii) the number of interactive items also varies considerably among users. Therefore, a global recommendation model cannot meet the personalized recommendation needs of different users. Second, existing federated recommendation methods mostly utilize traditional collaborative filtering and matrix factorization methods, lacking exploration and application of more advanced self-attention-based models. In recent years, inspired by the Transformer model used in machine translation, applying self-attention mechanisms to recommendation systems has become a research trend. Self-attention-based recommendation models can emphasize truly relevant and important interactions in a sequence while reducing irrelevant interactions. Therefore, compared to traditional collaborative filtering and matrix factorization models, they possess greater flexibility and expressive power. Existing federated recommendation methods have not explored the implementation and application of self-attention mechanisms in federated architectures. This results in a significant gap in recommendation accuracy compared to state-of-the-art recommendation models, even though they can protect user privacy. Summary of the Invention

[0005] To overcome the shortcomings of existing federated recommendation methods, this invention proposes a federated recommendation method and system based on model-independent meta-learning (MAML). By introducing MAML into the federated learning framework, the personalization of the recommendation model is improved. Simultaneously, a recommendation model based on a self-attention mechanism is implemented within the federated learning framework, effectively enhancing recommendation performance.

[0006] Specifically, this invention treats each user's local training process as a training task, each consisting of a disjoint support set and query set. The recommendation model is trained on the support set and then its loss on the query set is calculated. The gradient of this loss is then uploaded to a central server, where the global model is updated accordingly. The updated global model is then distributed to user devices for a new round of training and updates. The goal of this invention is to find an initial shared model (i.e., a common initial point learned from MAML) that new users can easily adapt to their local datasets by performing one or more gradient descent steps on their own data. Thus, while the initial model is derived in a distributed manner across all users, the final model implemented by each user is highly personalized based on their own data.

[0007] The technical content of this invention includes:

[0008] A federated recommendation method based on model-independent meta-learning includes the following steps:

[0009] The central server randomly selects a portion of user clients for the recommendation model training in this round and sends the global model parameters for this round to these clients; the recommendation model can adopt the industry's classic recommendation model based on the self-attention mechanism: SASRec.

[0010] The clients participating in the training divide their local data into two parts: a support set and a query set, according to a set ratio.

[0011] The client trains and updates the received recommendation model based on the support set;

[0012] The updated recommendation model is validated on the query set, and the loss and gradient of the recommendation model are calculated.

[0013] The server collects the gradients calculated by all participating clients and averages them. Based on the average gradient, it updates the recommendation model and performs the next round of training until all clients obtain a common recommendation model.

[0014] Each client uses local data to train the public recommendation model to obtain a personalized recommendation model for each client.

[0015] Client m inputs the interaction data from the local target application scenario into the personalized recommendation model corresponding to client m, and obtains the corresponding personalized recommendation result; client m is the client corresponding to user m selected by the server.

[0016] Furthermore, the server selects a set of user clients. A subset Then the model parameters of the recommendation model Send to subset Each client in the model; where the local model parameters of client m.

[0017] Furthermore, the client m divides local data into support sets and query sets using the following method:

[0018] 21) Transfer the local interaction sequence data of user m Divide into k interactive sessions, i.e. For the k-th session For the session The total number of time steps (i.e., session length), For the first The items interacted with at each time step;

[0019] 22) Divide the k interactive sessions into two disjoint parts to obtain the support set. and query sets Among them, (x i ,y i ) represents the i-th sample in the support set, x i y represents the sequence of items in an interactive session a, excluding the last item. i This represents the last item in the interactive session a; (x′) i ,y′ i The i-th sample in the query set, x′ i Let y' represent the sequence of items in an interactive session b excluding the last item. i This indicates the last item in this interactive session b. To support the collection The total number of samples in the sample, For query set The total number of samples in the sample.

[0020] Furthermore, the method for training and updating the received recommendation model using a model-independent meta-learning method is as follows:

[0021] 31) The recommendation model includes an embedding layer and an attention layer, wherein the attention layer includes an attention mechanism and two layers of feedforward neural networks; the model parameters of the recommendation model include the parameters θ of the embedding layer. e and the parameters θ of the attention layer a ; where θ e ={M I ,P},θ a ={W Q W K W V W (1) W (2) ,b (1) ,b (2)};M I Let P be the project embedding matrix, and W be the learnable position matrix. Q W K W V These are the weight matrices W for the query, key, and value in the self-attention mechanism. (1) Let b be the weight matrix of the first layer of the feedforward neural network. (1) W is the bias vector of the first layer of the feedforward neural network. (2) Let b be the weight matrix of the second layer of the feedforward neural network. (2) This is the bias vector for the second layer of the feedforward neural network;

[0022] 32) For support sets x in the i-th sample i First, it is converted into a fixed-length sequence. Then, each item in the sequence is converted into a one-hot encoded vector and then coupled with the item embedding matrix M. I Multiply to get x i The corresponding input embedding matrix I; the learnable position matrix P is combined with the input embedding matrix I to obtain the output E = I + P of the embedding layer;

[0023] 33) Input matrix E into the attention mechanism of the attention layer to obtain the interest representation S of user m;

[0024] 34) By concatenating two layers of feedforward neural network with the interest representation S as input and using ReLU as the activation function, the output FFN(S) = ReLU(SW) is obtained. (1) +b (1) W (2) +b (2) ;

[0025] 35) The result obtained in step 34) is processed sequentially by the FFN(S) layer normalization unit, residual connection unit and dropout unit to obtain the user interest representation S′;

[0026] 36) Based on the obtained S′, predict the preference score of user m for item i. in, It is the embedding vector corresponding to item i in the sequence;

[0027] 37) Sort the items based on user m's preference scores for each item; select the K items with the highest preference scores to obtain a recommended item list; calculate the cross-entropy loss based on the recommended item list and the actual item list in the training data.

[0028] 38) Based on cross-entropy loss Calculate the gradient and update the local recommendation model to obtain the updated recommendation model.

[0029] Furthermore, the cross-entropy loss is Where l is the loss function, Let m be the current local recommendation model of the client, and (x, y) be a single training sample in the support set.

[0030] Furthermore, the gradient of the recommendation model is calculated as follows:

[0031] 41) Client m inputs the training samples from the query set into the updated recommendation model. And the cross-entropy loss was calculated.

[0032] 42) Based on cross-entropy loss Calculate gradient

[0033] A federated recommender system based on model-independent meta-learning, characterized by comprising multiple clients and a server; wherein,

[0034] The client is configured to divide the local data used to train the recommendation model into a support set and a query set, then train and update the received recommendation model using a model-independent meta-learning method based on the local support set; validate the updated recommendation model on the query set and calculate the gradient of the recommendation model.

[0035] The server is configured to send the selected recommendation model to each of the clients; collect the gradients calculated by each client and average them, update the recommendation model based on the average gradient, and send the updated recommendation model to each client for the next round of training; stop training when a set condition is met, and each client obtains a common recommendation model.

[0036] The client uses local data to train the public recommendation model to obtain the personalized recommendation model corresponding to the client; and inputs the interaction data in the local target application scenario into the corresponding personalized recommendation model to obtain the personalized recommendation result.

[0037] A storage medium storing a computer program, wherein the computer program is configured to execute the method described above at runtime.

[0038] An electronic device includes a memory and a processor, wherein the memory stores a program for performing the methods described above.

[0039] Compared with the prior art, the beneficial effects of the present invention are:

[0040] 1. This invention proposes a variant of personalized federated learning recommendation based on model-independent meta-learning (MAML). It can find a shared model initial point among all users, which performs well after each user performs one or more gradient descent steps to update their own loss function. This invention first uses MAML to generate a common initial point among different users, and then each user trains their own recommendation model based on this common initial point. The role of federated learning is to provide an external framework for the entire learning process, protecting user privacy data from leakage during training. In other words, this invention uses federated learning as the external framework and MAML as the internal training method.

[0041] 2. This invention explores and implements a recommendation model based on a self-attention mechanism in a federated learning architecture, which significantly improves its recommendation performance compared to methods based on traditional recommendation models.

[0042] 3. Evaluation results on multiple benchmark datasets show that the present invention outperforms existing federated recommendation models, reaches the state-of-the-art level, and the proposed components play important roles. Attached Figure Description

[0043] Figure 1 This is a flowchart illustrating the implementation of the federated recommendation method based on model-independent meta-learning of the present invention.

[0044] Figure 2 This is a schematic diagram illustrating the specific architecture of the federated recommendation method based on model-independent meta-learning of the present invention.

[0045] Figure 3 This is a schematic diagram illustrating the influence of different components on experimental results in one embodiment of the present invention;

[0046] (a) shows the impact of different components on experimental results in an ML-1m dataset according to one embodiment of the present invention;

[0047] (b) shows the impact of different components on experimental results in a Beauty dataset according to one embodiment of the present invention. Detailed Implementation

[0048] The technical solutions in the embodiments of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are merely specific embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are also described.

[0049] The goal of this invention is to develop an algorithm for meta-training. This algorithm can quickly train a high-performance recommendation model after deployment to new user clients. It is parameterized, where its parameters are... During meta-training, updates are performed using a set of training tasks. The training process for each user client is considered a training task; for example, user m training the model using their local data is training task m.

[0050] like Figure 1 As shown, the present invention can be divided into 5 steps in total:

[0051] S1: The central server randomly selects a portion of user clients for the recommendation model training in this round, and sends the global model parameters of the recommendation model for this round to these clients.

[0052] The specific construction steps are as follows:

[0053] S1.1: In each iteration, the central server selects the set of user clients. A subset Come and participate in the training.

[0054] S1.2: The central server will send the model parameters for the current round. Send to collection For each client in the model, the local model parameters are...

[0055] S2: The clients participating in the training divide their local dataset into a support set and a query set according to a set ratio.

[0056] The specific steps for constructing the dataset partition are as follows:

[0057] S2.1: For each user m, their interaction sequence is represented as: in This represents the items (i.e., interactive items) that user m interacts with at time step j, such as movies in a movie recommendation scenario or products in a product recommendation scenario. This invention manually divides the user interaction sequence into multiple interaction sessions based on a specific idle time threshold. Therefore, user m's interaction sequence is divided into k interaction sessions, such as... These sessions are considered the basic units for model training. For a session... It contains the interactive items within the session: in, Representing user m at time step The projects that are interacted with This represents the length of the session.

[0058] S2.2: These sessions are divided into two disjoint parts: the support set. and query sets Among them, (x i ,y i ) represents the i-th sample in the support set, x i y represents the sequence of items in the interactive session excluding the last item. i This represents the last item in the interactive session. (x′) i ,y′ i The meaning is the same. That is, the recommendation model takes the last item of the input session as the target and uses the remaining item sequence as input for training and prediction.

[0059] S3: The client trains and updates the received recommendation model based on the support set.

[0060] The specific steps for training based on the support set are as follows:

[0061] S3.1: The recommendation model used in this invention includes an embedding layer and an attention layer, wherein the attention layer includes an attention mechanism and two layers of feedforward neural networks; the model parameters distributed from the central server to the user client in step S1.2 can be divided into parameters θ of the embedding layer. e and the parameters θ of the attention layer a Each of them contains several different parameters: θ e ={M I ,P} and θ a ={W Q W K W V W (1) W (2) ,b (1) ,b (2)}. Among them, M I Let P be the project embedding matrix, and W be the learnable position matrix. Q W K W V These are the weight matrices W for the query, key, and value in the self-attention mechanism. (1) Let b be the weight matrix of the first layer of the feedforward neural network. (1) W is the bias vector of the first layer of the feedforward neural network. (2) Let b be the weight matrix of the second layer of the feedforward neural network. (2) This is the bias vector for the second layer of the feedforward neural network.

[0062] S3.2: First, generate the input embedding based on the embedding layer parameters. For the support set... x in the i-th sample i Corresponding training session data First, convert it into a fixed-length sequence: (s1, s2, ..., s l Then, each item is converted into a one-hot encoded vector and then coupled with the item embedding matrix M. I Multiply to obtain the input embedding matrix: Finally, the learnable position matrix P is combined with the input embedding matrix to obtain the output of the embedding layer: E = I + P.

[0063] S3.3: Based on the input embedding E in S3.2 and the parameters of the attention layer, a self-attention mechanism is used to compute the user interest representation:

[0064] S = SA(E) = Attention(EW) Q EW K EW V)

[0065] The standard self-attention model takes the following form:

[0066]

[0067] Where Q, K, and V represent query, key, and value, respectively, and their respective dimensions are as follows: The recommended model used in this invention employs a structure with two attention layers connected in series.

[0068] S3.4: After each attention layer, a two-layer feedforward neural network is used, connected in series, with ReLU as the activation function. This gives the model non-linearity and considers the interaction between different latent dimensions.

[0069] FFN(S)=ReLU(SW (1) +b (1) W (2) +b (2)

[0070] Where S is the attention matrix obtained in step S3.3, and W (1) W is the weight matrix of the first layer of the feedforward neural network; (2) These are the weights of the second layer of the feedforward neural network, with all dimensions being... b (1) Let b be the bias vector of the first layer of the feedforward neural network. (2) This is the bias vector of the second-layer feedforward neural network, with dimensions of 1.

[0071] S3.5: With the stacking of self-attention and feedforward layers and the deepening of the network, some problems become more severe, including overfitting, vanishing gradients, and a slower training process. This invention introduces layer normalization, residual connections, and dropout techniques to address these problems, obtaining the user interest representation S′.

[0072] S'=S+Dropout(FFN(LayerNorm(S)))

[0073] S3.6: To predict the next item, this invention uses a latent factor model to calculate the user's preference score for item i:

[0074]

[0075] Where R i It is the user's preference score for item i. S is the embedding vector of item i obtained in step S3.2, and S′ is the user interest representation obtained in step 3.5.

[0076] S3.7: Rank the candidate items based on the user preference scores calculated in S3.6. Select the K items with the highest scores as the model's recommendation list. Calculate the cross-entropy loss based on the recommendation list and the actual item list in the training data. Aggregate all losses calculated in the support set to obtain the loss of the current model parameters in the support set.

[0077]

[0078] Where l is the loss function This is the current local recommendation model, and (x,y) is a single training sample in the support set.

[0079] S3.8: Calculate the gradient based on the loss calculated in S3.7 and update the local model:

[0080]

[0081] Where, θ m These are the parameters before the local recommendation model is updated. These are the updated parameters for the local recommendation model. The gradient of the loss calculated in step S3.7, where α is the local model learning rate.

[0082] S4: Validate the updated recommendation model on the query set and calculate the model loss and gradient.

[0083] The specific steps for training based on the query set are as follows:

[0084] S4.1: Update the local model after S3 Obtain the loss of the current model in the query set using the same steps as in S3:

[0085]

[0086] S4.2: Loss calculation gradient based on S4.2:

[0087]

[0088] S5: The server collects the gradients calculated by all participating clients and averages them. Based on the average gradient, it updates the global model and performs the next round of training.

[0089] The specific steps for the server to update the global model are as follows:

[0090] S5.1: The server collects the gradients calculated in step S4.3 from the local models of all user clients participating in the training;

[0091] S5.2: The server will transfer global model parameters Updated to

[0092]

[0093] Where β is the learning rate of the global model.

[0094] S5.3: Proceed to the next training round, resample the client, and update the global model. Stop training when the global model converges or the number of iterations reaches a set threshold.

[0095] The recommendation model training method proposed in this invention obtains a common initial point for the model based on the MAML training mode. Different users, using their own local data and a small number of samples, can quickly approach the optimal point of their respective models by performing one or several gradient descent steps, thus achieving rapid learning and adaptation. The introduction of federated learning ensures that the entire training process does not involve the uploading and aggregation of users' local data, thereby protecting user privacy. Compared to traditional federated recommendation systems that provide all users with a common recommendation model, this invention provides each user with an initial point that can quickly approach their own optimal model, enabling each user's final recommendation model to be maximally adapted to that user's local data, achieving personalized enhancement of the recommendation model.

[0096] In practical applications, based on the common initial point described in this invention, user m randomly selects a small number of samples based on their local data and performs one or more steps of gradient descent to update the model in accordance with step S3.8. This allows them to quickly obtain a recommendation model that approximates their optimal point and thus obtain personalized recommendation results.

[0097] In this embodiment of the invention, the effectiveness and feasibility of the proposed federated recommendation system based on model-independent meta-learning are verified through experiments, and the performance of the system is verified through two experiments.

[0098] First, the effectiveness of the proposed method was verified by comparing its recommendation performance with existing methods. As shown in Table 1, experimental results on six public datasets in different domains demonstrate that the proposed method consistently outperforms other baseline models. In particular, compared to other methods based on federated learning architectures, the proposed method achieves a significant improvement.

[0099] Table 1 shows the comparison of effects.

[0100]

[0101] Secondly, the impact of the two components included in this invention is verified. The method proposed in this invention comprises a joint meta-learning framework (denoted by FML) and a recommendation model based on a self-attention mechanism (denoted by SA). To verify the effectiveness of each component, multiple experiments were conducted on the Beauty and ML-1m datasets, and the contribution of each component was analyzed. For the overall framework, this invention considers the standard federated learning framework FedAvg. Given that this invention aims to conduct a more in-depth framework analysis, it also considers a meta-learning variant of FedAvg, namely FedAvg(Meta). Before testing, FedAvg(Meta) uses the support set of the test client to update the model initialization received from the server through a one-step stochastic gradient descent, which reflects the essence of meta-learning—"learning fine-tuning". Both FedAvg and FedAvg(Meta) use all the data from the training client during training. For the recommendation model, this invention considers the traditional matrix factorization-based recommendation model—BPR—as a comparison. Figure 3 As shown, the joint meta-learning framework and self-attention model of this invention play important roles in the final recommendation performance.

[0102] Finally, it should be noted that the described embodiments are only some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.

Claims

1. A federated recommendation method based on model-agnostic meta-learning, comprising the steps of: 1) the server selects a plurality of clients and sends the selected recommendation model to each of the clients; wherein the server selects a subset of the set of user clients Then the model parameters of the recommendation model are sent to each of the clients in the subset The local model parameters of client m ​​ 2) Each of the clients divides the local data for training the recommendation model into a support set and a query set; the method for client m to divide the local data into a support set and a query set is: 21) the local interaction sequence data of user m is divided into k interaction sessions, i.e. wherein, for the kth session wherein, for the kth session represents the item interacted by user m at time step , represents the length of the session; 22) the k interaction sessions are cut into two mutually disjoint parts, obtaining a support set and a query set wherein, (x i , y i ) represents the ith sample in the support set, x i represents the item sequence in an interaction session a except the last item, y i represents the last item in the interaction session a; (x′ i , y′ i ) represents the ith sample in the query set, x′ i represents the item sequence in an interaction session b except the last item, y′ i represents the last item in the interaction session b, is the total number of samples in the support set , is the total number of samples in the query set ; 3) Each of the clients trains and updates the received recommendation model based on the local support set using a model-agnostic meta-learning method; 4) Each of the clients verifies the updated recommendation model on the query set and calculates the gradient of the recommendation model; 5) The server collects and averages the gradients calculated by each of the clients, updates the recommendation model based on the average gradient, and sends the updated recommendation model to each of the clients for the next round of training; 6) Steps 3) to 5) are repeated until a set condition is met, and each of the clients obtains a common recommendation model; 7) Each of the clients trains the common recommendation model using local data to obtain a personalized recommendation model for each of the clients; 8) The client m inputs the interaction data in the local target application scenario into the personalized recommendation model corresponding to the client m to obtain the corresponding personalized recommendation result; the client m is the client corresponding to the user m selected by the server.

2. The method of claim 1, wherein, The method for training and updating the received recommendation model using a model-agnostic meta-learning method is: 31) the recommendation model comprises an embedding layer and an attention layer, wherein the attention layer comprises an attention mechanism and two layers of feedforward neural networks; model parameters of the recommendation model comprise parameters θ e of the embedding layer and parameters θ a of the attention layer; wherein θ e ={M I ,P} and θ a ={W Q ,W K ,W V ,W (1) ,W (2) ,b (1) ,b (2)}; M I is an item embedding matrix, P is a learnable position matrix, W Q , W K , W V are weight matrices corresponding to queries, keys and values in the self-attention mechanism respectively, W (1) is a weight matrix of the first layer of feedforward neural networks, b (1) is a bias vector of the first layer of feedforward neural networks, W (2) is a weight matrix of the second layer of feedforward neural networks, and b (2) is a bias vector of the second layer of feedforward neural networks; 32) for the support set x in the i-th sample in the middle i , first convert it into a fixed-length sequence, then convert each item in the sequence into a one-hot encoding vector and multiply it with the item embedding matrix M I x i corresponding input embedding matrix I; combine the learnable position matrix P with the input embedding matrix I to obtain the output E of the embedding layer E = I + P; 33) Input the matrix E into the attention mechanism of the attention layer to obtain the interest representation S of the user m; 34) Input the interest representation S into the two-layer feedforward neural network in series and use Relu as the activation function to obtain the output FFN(S) = ReLU(S W (1) +b (1) )W (2) +b (2) ; 35) Process the result FFN(S) obtained in step 34) through a layer normalization unit, a residual connection unit, and a dropout unit in sequence to obtain the user interest representation S'; 36) Predicting the preference score of user m for item i from the resulting S' where, is the embedding vector corresponding to item i in the sequence; 37) rank the items based on the preference scores of user m; select the top K items with the highest preference scores to get a recommended item list; calculate the cross-entropy loss based on the recommended item list and the actual item list in the training data 38) based on cross-entropy loss compute the gradient and update the local recommendation model, obtaining an updated recommendation model 3. The method of claim 2, wherein, The cross-entropy loss is where l is the loss function, is the current local recommendation model of the client m, and (x, y) is a training sample in the support set.

4. The method of claim 2, wherein, In step 4), the method for calculating the gradient of the recommendation model is: 41) Client m inputs the training samples in the query set into the updated recommendation model and the cross-entropy loss is calculated 42) based on cross-entropy loss computing gradients 5. A model-agnostic meta-learning based federated recommendation system, characterized in that, The federated recommendation method based on model-agnostic meta-learning comprises a plurality of clients and a server; wherein, The client is configured to divide the local data for training the recommendation model into a support set and a query set, then train and update the received recommendation model based on the local support set using a model-agnostic meta-learning method, and verify the updated recommendation model on the query set and calculate the gradient of the recommendation model; The server is configured to send the selected recommendation model to each of the clients, collect and average the gradients calculated by each of the clients, update the recommendation model based on the average gradient, and send the updated recommendation model to each of the clients for the next round of training; stop training when a set condition is met, and each of the clients obtains a common recommendation model; Each of the clients trains the common recommendation model using local data to obtain a personalized recommendation model corresponding to the client, and inputs interaction data in a local target application scenario into the corresponding personalized recommendation model to obtain a personalized recommendation result; The server selects a set of user clients. A subset Then the model parameters of the recommendation model Send to subset Each client in the model; local model parameters of client m. The method by which client m divides local data into support sets and query sets is as follows: 21) The local interaction sequence data of user m. Divide into k interactive sessions, i.e. For the k-th session Representing user m at time step The projects that are interacted with 22) Divide the k interactive sessions into two disjoint parts to obtain the support set. and query sets Among them, (x i ,y i ) represents the i-th sample in the support set, x i y represents the sequence of items in an interactive session a, excluding the last item. i This represents the last item in the interactive session a; (x′) i ,y′ i The i-th sample in the query set, x′ i Let y' represent the sequence of items in an interactive session b excluding the last item. i This indicates the last item in this interactive session b. To support the collection The total number of samples in the sample, For query set The total number of samples in the sample.

6. A server, characterized by The computer program is configured to be executed by the processor, and the computer program comprises instructions for executing each step of the method of any one of claims 1 to 4.

7. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method of any one of claims 1 to 4.

Citation Information

Patent Citations

  • Federated learning-based recommendation model training method, terminal and storage medium

    CN110297848A