A decentralized federated recommendation method, intelligent terminal and storage medium

By constructing the first item set and the second item set, and combining the sharing strategy and update strategy, sending the server an unrated item set containing actual rated and randomly obtained unrated items to the server, the problems of model training deviation, high communication costs and leaked user rating behaviors in the existing technology are solved, and efficient user privacy protection and recommendation accuracy are achieved.

CN114119169BActive Publication Date: 2025-04-04SHENZHEN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111455853.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-01
Publication Date
2025-04-04
Estimated Expiration
2041-12-01

AI Technical Summary

Technical Problem

In the prior art, the federal recommendation algorithm has problems such as large model training deviations, high communication costs, possible leakage of user rating behavior and poor recommendation performance.

Method used

The first item set is constructed by obtaining the actually rated items, and randomly sampling and obtaining the unrated items to build the second item set. Combining the sharing strategy and two update strategies, the unrated item sets containing the actual rated and randomly obtained are sent to the server, and the communication matrix built by the server obtains the co-rated user set for model training.

Benefits of technology

It realizes that while protecting user privacy, it improves recommendation accuracy, avoids the leakage of user rating behavior, and reduces the noise impact in model training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114119169B_ABST
    Figure CN114119169B_ABST
Patent Text Reader

Abstract

The present invention discloses a decentralized federated recommendation method, device, intelligent terminal and storage medium, wherein the decentralized federated recommendation method comprises: obtaining actually rated items to construct a first item set, and randomly sampling unrated items to construct a second item set; merging the first item set and the second item set into a third item set, and sending the third item set to a server; based on the third item set, constructing a communication matrix through the server, wherein the communication matrix is ​​used to record whether each user has rated all items; based on the third item set, obtaining the user set corresponding to each item that has been rated in the communication matrix and using it for model training. This solution can achieve both user privacy protection and good recommendation effect, i.e., recommendation accuracy, through decentralized federated recommendation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of federated recommendation technology, and in particular to a decentralized federated recommendation method, an intelligent terminal and a storage medium. Background Art

[0002] As people's awareness of privacy protection increases, traditional collaborative filtering algorithms, which collect user data on the server side for modeling and information recommendation, are no longer feasible because they will leak user privacy. In order to achieve the goal of both protecting user privacy and completing information recommendation, people try to combine recommendation systems with federated learning, namely federated recommendation.

[0003] In recent years, many centralized federated recommendation algorithms have been proposed, such as the federated collaborative filtering method FCF and the explicit feedback federated recommendation method FedRec. These algorithms require the participation of the server to integrate the calculation results of all clients. Among them, FCF regards all unrated items as negative feedback, resulting in deviations in model training and high communication costs, while each client in FedRec will sample some unrated items to protect the user's rating behavior, but this method will bring noise to the model training, resulting in poor recommendation performance.

[0004] On the other hand, decentralized federated recommendation methods such as the information point recommendation algorithm DMF can effectively reduce the computing and storage pressure of the server and protect the user's rating information, but it will leak the geographical distance between clients, and the PDMFRec algorithm, which uses the cosine similarity between two clients as a weight and uses anonymous technology to send gradients to protect the user's rating behavior, but in fact the server may also leak the user's rating behavior when calculating the rated item set between each client. At the same time, the gradient information in the above two decentralized federated recommendation methods is only propagated between adjacent clients, and the recommendation performance is therefore reduced.

[0005] Therefore, in the existing federated recommendation algorithm, it is still impossible to achieve good recommendation accuracy while protecting user privacy.

[0006] Therefore, the existing technology still needs to be improved and developed. Summary of the invention

[0007] In view of the technical problems in the prior art, such as large deviation in model training, high communication cost, possible leakage of user rating behavior and poor recommendation performance in centralized federated algorithms and decentralized federated algorithms, the present invention provides a decentralized federated recommendation method, intelligent terminal and storage medium, which include a sharing strategy and two corresponding update strategies. Specifically, it includes: obtaining the items that have actually been rated to construct a first item set, and randomly sampling and obtaining the items that have not been rated to construct a second item set; merging the first item set and the second item set into a third item set, and sending the third item set to the server; based on the third item set, constructing a communication matrix through the server, wherein the communication matrix is ​​used to record whether each user has rated all items; based on the third item set, obtaining the user set corresponding to each item that has been rated in the communication matrix and using it for model training. By enabling the client to send the set of items that have actually been rated and the randomly obtained set of items that have not been rated to the server, and combining the update strategy, the confidentiality of user information is improved, and the recommendation accuracy is better.

[0008] In order to achieve the above technical effects, the first aspect of the present invention provides a decentralized federated recommendation method, wherein the method includes:

[0009] Obtaining actually rated items to construct a first item set, and randomly sampling unrated items to construct a second item set;

[0010] Merging the first item set and the second item set into a third item set, and sending the third item set to a server;

[0011] Based on the third set of items, a communication matrix is ​​constructed through the server, wherein the communication matrix is ​​used to record whether each user has rated all items;

[0012] Based on the third item set, a user set corresponding to each item that has been rated together in the communication matrix is ​​obtained and used for model training.

[0013] Optionally, the steps of acquiring actually rated items to construct the first item set, and randomly sampling and acquiring unrated items to construct the second item set include:

[0014] Obtain the items that have actually been rated to construct the first item set;

[0015] According to a preset sampling parameter, unrated items are randomly sampled to construct a second item set, wherein the value of the sampling parameter is greater than one and less than positive infinity.

[0016] Optionally, the step of obtaining, based on the third item set, a user set corresponding to each item that has been rated together in the communication matrix and using the user set for model training includes:

[0017] Based on the third item set, searching the communication matrix for users who have rated an item together;

[0018] A user set is constructed by obtaining users who have rated all items in the third item set and used for model training.

[0019] Optionally, after the step of obtaining the user set corresponding to each commonly rated item in the communication matrix based on the third item set and using it for model training, the following steps are included:

[0020] In each round of iteration, the order of the items in the first item set is first shuffled, and the score data of each item is obtained according to the shuffled order;

[0021] Based on the rating data obtained each time, the gradient of the corresponding user latent feature vector and the gradient of the personalized item latent feature vector are calculated, and the user latent feature vector and the personalized item latent feature vector are further updated for the first time;

[0022] After the first update is completed, it is determined whether the number of iterations is less than a first preset number.

[0023] Optionally, after the first update is completed, the step of determining whether the number of iterations is less than the first preset number includes:

[0024] If yes, the personalized item hidden feature vector obtained by the first update is sent to other clients that claim to have rated the item;

[0025] Waiting for all clients' personalized item hidden feature vectors to be sent, and updating the personalized item hidden feature vector of the corresponding item for the second time based on the personalized item hidden feature vectors sent by other clients;

[0026] If not, the personalized item hidden feature vector obtained by the first update is sent to all other clients;

[0027] Wait for all clients' personalized item latent feature vectors to be sent, and update the personalized item latent feature vectors of all items for the second time based on the personalized item latent feature vectors sent by other clients.

[0028] Optionally, after waiting for all clients to complete sending of personalized item latent feature vectors, and updating personalized item latent feature vectors of all items for the second time based on personalized item latent feature vectors sent by other clients, the following steps may be performed:

[0029] When the number of iterations is greater than or equal to the first preset number, testing whether the model converges based on the personalized item latent feature vectors of all items updated for the second time;

[0030] When the model converges, the model training ends.

[0031] Optionally, after the step of obtaining the user set corresponding to each commonly rated item in the communication matrix based on the third item set and using it for model training, the step further includes:

[0032] Before model training, four queues are set up for each client to store globally unique item hidden feature vectors, including an update queue, a non-update queue, a receiving queue, and a test queue;

[0033] In each round of iteration, the globally unique item hidden feature vector received in the previous round of iteration, i.e., the receiving queue data, is copied to the update queue, and the receiving queue is cleared;

[0034] Wait for all clients to clear the receiving queue;

[0035] When the globally unique item latent feature vector corresponding to the item in the first item set is received in the update queue, the gradient of the user latent feature vector and the gradient of the globally unique item latent feature vector based on the rating data of the item are calculated, and the user latent feature vector and the globally unique item latent feature vector are further updated;

[0036] Send all globally unique item hidden feature vectors in the update queue and the non-update queue to any client that claims to have rated the item with a preset probability;

[0037] When the globally unique item hidden feature vector is not sent, the globally unique item hidden feature vector is put into a non-update queue, and the globally unique item hidden feature vector is not updated in the next round of iteration.

[0038] Optionally, the step of sending all globally unique item hidden feature vectors in the update queue and the non-update queue to any client claiming to have rated the item with a preset probability also includes:

[0039] Determine whether the number of iterations is greater than or equal to a second preset number;

[0040] If yes, the updated globally unique item hidden feature vector is copied and sent to the test queues of other clients;

[0041] Testing whether the model converges by using the item latent feature vectors of all items in the test queue;

[0042] When the model converges, the model training ends.

[0043] A second aspect of the present invention provides an intelligent terminal, which includes a memory, a processor, and a decentralized federal recommendation program stored in the memory and executable on the processor, wherein the decentralized federal recommendation program, when executed by the processor, implements the steps of a decentralized federal recommendation method as described in any one of the above items.

[0044] A third aspect of the present invention provides a non-temporary computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of a decentralized federated recommendation method as described in any one of the above items.

[0045] As can be seen from the above, the scheme of the present invention obtains the items that have actually been rated to construct the first item set, and randomly samples the items that have not been rated to construct the second item set; the first item set and the second item set are combined into a third item set, and the third item set is sent to the server; based on the third item set, a communication matrix is ​​constructed through the server, wherein the communication matrix is ​​used to record whether each user has rated all items; based on the third item set, the user set corresponding to each item that has been rated together in the communication matrix is ​​obtained and used for model training. Since the scheme of the present invention enables the client to send the actually rated and randomly obtained unrated item sets to the server, the server and other clients cannot obtain the actual rating behavior of the user during the data processing process, and combined with the corresponding update strategy, it can achieve both protection of user privacy and good recommendation accuracy, which provides convenience for users. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art 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 labor.

[0047] Figure 1 It is a flowchart of a decentralized federated recommendation method provided by an embodiment of the present invention;

[0048] Figure 2 Embodiment of the present invention Figure 1 Specific flow diagram of step S100;

[0049] Figure 3 is a schematic diagram of a communication matrix constructed by a server provided in an embodiment of the present invention;

[0050] Figure 4 Embodiment of the present invention Figure 1Specific flow diagram of step S400;

[0051] Figure 5 is a flow chart of DFedRec(b) provided in an embodiment of the present invention;

[0052] Figure 6 is a flow chart of DFedRec(s) provided in an embodiment of the present invention;

[0053] Figure 7 It is a block diagram of the internal structure principle of an intelligent terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0054] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.

[0055] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof.

[0056] It should also be understood that the terms used in the present specification are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the present specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0057] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0058] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0059] As people gradually pay more attention to personal privacy and relevant laws and regulations are introduced and improved, the issue of privacy protection in recommendation systems has attracted more and more attention. In order to design a recommendation system that can protect user privacy, people try to combine the recommendation system with federated learning. Federated learning is a machine learning paradigm proposed by Google in 2016. It can train machine learning models using data from multiple different participants while protecting user privacy. The resulting cross-disciplinary discipline is called federated recommendation.

[0060] Federated recommendation is generally divided into centralized federated recommendation and decentralized federated recommendation. Among them, centralized federated recommendation includes FCF, FedRec, etc. In FCF, all unrated items are regarded as negative feedback, which will lead to deviations in model training and high communication costs; in FedRec, each client will sample some unrated items to protect the user's rating behavior, but it will bring noise to the model training, resulting in poor recommendation performance. Decentralized federated recommendation includes the DMF algorithm and PDMFRec algorithm commonly used for electronic map landmarks. The disadvantage of the DMF algorithm is that it will leak the geographical distance between clients, and during the training process, the client needs to know who sent the gradient in order to determine the weight between the sender of the gradient and the client. PDMFRec uses the cosine similarity between two clients as the weight and sends the gradient to the neighbor, but the server already knows the rating behavior of each user when calculating the cosine similarity between each client. In addition to the possibility of leaking users' rating behaviors, the above two decentralized federated recommendation algorithms also have unsatisfactory recommendation performance because their gradients are only sent to neighbors. Therefore, there is no federated recommendation algorithm in the prior art that can simultaneously protect user privacy and have good recommendation performance.

[0061] In order to solve the problems existing in the prior art, the present invention provides a decentralized federated recommendation method. In an embodiment of the present invention, the first item set is constructed by obtaining the items that have actually been rated, and the second item set is constructed by randomly sampling the items that have not been rated; the first item set and the second item set are combined into a third item set, and the third item set is sent to the server; based on the third item set, a communication matrix is ​​constructed through the server, wherein the communication matrix is ​​used to record whether each user has rated all items; based on the third item set, the user set corresponding to each item that has been rated together in the communication matrix is ​​obtained and used for model training. Therefore, compared with the solution of directly sending the rated items to the server in the prior art, the solution of randomly obtaining the items that have not been rated and sending them to the server in the present invention can obviously avoid the leakage of the actual rating behavior of the user, and at the same time, combined with the corresponding update strategy, the rating data of each user can be beneficial to the model training of all clients, so as to obtain better training model recommendation performance.

[0062] Exemplary Methods

[0063] like Figure 1 As shown, the embodiment of the present invention provides a decentralized federated recommendation method, which includes the following steps:

[0064] Step S100: Acquire actually rated items to construct a first item set, and randomly sample unrated items to construct a second item set.

[0065] In this embodiment, the client obtains items actually rated by the user to construct a first item set, and randomly samples items not rated by the user to construct a second item set, wherein the client performs sampling in accordance with sampling parameters preset by the user during random sampling.

[0066] Step S200: merge the first item set and the second item set into a third item set, and send the third item set to a server.

[0067] In this embodiment, the client merges the first item set and the second item set into a third item set, and sends the third item set to the server. The third item set only records whether the user has rated an item. For example, if the user has rated item a, it is recorded as 1, and if the user has not rated item b, it is recorded as 0. Among them, whether the items actually rated by the user or the randomly sampled items are all recorded as rated data, that is, they are all recorded as 1. Through this step, the server cannot obtain the user's actual rating behavior, effectively protecting the user's privacy.

[0068] Step S300: Based on the third item set, a communication matrix is ​​constructed through the server, wherein the communication matrix is ​​used to record whether each user has rated all items.

[0069] In this embodiment, a communication matrix is ​​constructed in the server based on the third set of items sent by the client. The communication matrix includes rows or columns consisting of all users and all items, and the intersection of the two records data on whether the user has rated the corresponding item. The communication matrix constructed in this step allows each client to obtain the ratings of all other clients to obtain a better recommendation effect.

[0070] Step S400: Based on the third item set, a user set corresponding to each item that has been rated together in the communication matrix is ​​obtained and used for model training.

[0071] In this embodiment, the client searches the communication matrix for all users who have rated an item in the third item set together with the client according to the third item set, and constructs a user set based on all the obtained users, and uses the user set for model training. Through this step, information about other users with similar rating behaviors can be obtained.

[0072] The above model training specifically includes model training using a batch update strategy and model training using a random update strategy.

[0073] In the model training of the batch update strategy, the client first performs local training to obtain an updated personalized item latent feature vector, and sends the updated personalized item latent feature vector only to users who have rated the same item before the preset number of iterations, performs an average operation to unify the personalized item latent feature vectors of each client, and continues to perform iterative calculations; and after the preset number of iterations, the personalized item latent feature vector is sent to all users for an average operation and a test of whether the model converges to complete the training of the model. The personalized item latent feature vector refers to the item latent feature vector saved locally by each user.

[0074] In the model training of the random update strategy, there is only one copy of the item latent feature vector of each item, and it is transmitted and updated between different clients, so in the following embodiments, the item latent feature vector is called the global unique item latent feature vector. After exceeding the preset number of iterations, the model training copies all the global unique item latent feature vectors to all clients and tests whether the model converges to complete the model training.

[0075] Through the above two updating strategies, the rating data of each client can play a role in the model training of all clients, so as to achieve better recommendation performance.

[0076] As can be seen from the above, the decentralized federated recommendation method provided by the embodiment of the present invention obtains the items that have actually been rated to construct the first item set, and randomly samples the items that have not been rated to construct the second item set; the first item set and the second item set are combined into a third item set, and the third item set is sent to the server; based on the third item set, a communication matrix is ​​constructed through the server, wherein the communication matrix is ​​used to record whether each user has rated all items; based on the third item set, the user set corresponding to each item that has been rated together in the communication matrix is ​​obtained and used for model training. Compared with the prior art solution that requires the client to provide the server with the user's real rating behavior and only sends gradient information to neighboring clients, which cannot obtain better recommendation performance, this solution can achieve more effective protection of user rating behavior and obtain better recommendation accuracy.

[0077] Specifically, in a further embodiment, the user participates in the training process of the recommendation model in the form of a smart terminal, the smart terminal held by the user is recorded as client u, and it is assumed that one smart terminal is used by only one user, ignoring the situation where multiple users share one smart terminal, and a user using multiple smart terminals is regarded as multiple users.

[0078] Specifically, Figure 2 As shown, the above step S100 includes:

[0079] Step S101, obtaining actually rated items to construct a first item set;

[0080] Step S102: randomly sample unrated items to construct a second item set according to a preset sampling parameter, wherein the value of the sampling parameter is greater than one and less than positive infinity.

[0081] For example, each client u stores the user's historical rating data. Where u is the user identifier, i is the item identifier, and r ui is the rating of item i by user u, is the set of items rated by user u, that is, the first set of items.

[0082] Furthermore, each client u randomly samples unrated items to construct the second item set, denoted as Among them, users need to pre-set the sampling parameter ρ according to their personal needs u , so that When users have higher requirements for privacy protection, a higher ρ is set accordingly. u The value must be greater than 1 and less than +∞.

[0083] Specifically, in the above step S200, the client u obtains the first item set And the second item set Then, merge them to get the third item set And the third item set Send to the server, and claim the third item set to the server All of them are actually rated items, so this step makes it difficult for the server to infer the first set of items that the client u actually rated. It achieves the effect of avoiding the leakage of user privacy, rating behavior, etc.

[0084] Specifically, in the above step S300, the server obtains the third item set of all users. Then, construct Figure 3The communication matrix shown in the figure, where a row represents a user and a column represents an item, ★ indicates that the user represented by the row has rated the item represented by the column, and ▲ indicates that the user represented by the row has falsely rated the item represented by the column. If the grid is left blank, it means that the user represented by the row has not rated the item represented by the column. It should be noted that the server itself cannot distinguish between ★ and ▲. This distinction is made here for the convenience of subsequent explanations. It can be considered that the communication matrix constructed by the actual server only contains 1 and 0, 1 represents a rating, and 0 represents no rating.

[0085] Specifically, Figure 4 As shown, the above step S400 includes:

[0086] Step S401: based on the third item set, searching the communication matrix for users who have rated an item together;

[0087] Step S402: Acquire users who have rated all items in the third item set to construct a user set, and use it for model training.

[0088] For an example, see Figure 3 After the server builds the communication matrix, each client u searches the server communication matrix for users who have rated an item together. For example, when client u corresponds to user 1, the users who have rated item 1 together with user 1 are user 2 and user 4; the users who have rated item 2 together with user 1 are user 2, user 3 and user 4; the users who have rated item 3 together with user 1 are user 2 and user 4.

[0089] Finally, client u downloads the server communication matrix That is, according to the third item set The corresponding columns in the item download communication matrix in , from which the set of users who claim to have rated item i is obtained in, is the set of users who have truly rated item i, is the set of users who falsely claim to have rated item i.

[0090] Among them, each client u only downloads Rather than the entire communication matrix, because it is not If the user in the training set and the client u have not rated the same items, the two will not affect each other. This download method can save the client's storage space. Furthermore, it can be set that each client u does not store the same items during the training process. Said is the personalized item hidden feature vector stored locally on the client, because client u will not update these personalized item hidden feature vectors during the training process. It is only necessary for each client u to send to all clients in the last round of iteration. This can be achieved by sending to all clients in each round The same recommended performance. Represents a real number matrix set with 1 row and d columns. After that, it is used for model training. The model training includes a model training DFedRec(b) based on batch update and a model training DFedRec(s) based on random update.

[0091] Specifically, in this embodiment, the recommendation model of the present invention adopts matrix decomposition, and its prediction formula (1) and loss function (2) are respectively as follows:

[0092]

[0093]

[0094] In formula (1), is the rating of item i by user u, is the personalized item hidden feature vector stored locally on the client. is the user latent feature vector, and the symbol T represents the transpose of the matrix. represents a set of real matrices with 1 row and d columns, that is, a set of d-dimensional row vectors, which shows that and U u· are all d-dimensional row vectors, where d is the model hyperparameter preset by the platform and is a positive integer. In formula (2), λ is the trade-off parameter of the regularization term, and ‖·‖ means taking the two-norm.

[0095] Furthermore, for a training sample (u,i,r ui ), the gradients of the model parameters are:

[0096]

[0097]

[0098] The following first describes DFedRec(b), including:

[0099] In each round of iteration, the order of the items in the first item set is first shuffled, and the score data of each item is obtained according to the shuffled order;

[0100] Based on the rating data obtained each time, the gradient of the corresponding user latent feature vector and the gradient of the personalized item latent feature vector are calculated, and the user latent feature vector and the personalized item latent feature vector are further updated for the first time;

[0101] After the first update is completed, it is determined whether the number of iterations is less than a first preset number.

[0102] Wherein, after the first update is completed, the step of determining whether the number of iterations is less than the first preset number includes:

[0103] If yes, the personalized item hidden feature vector obtained by the first update is sent to other clients that claim to have rated the item;

[0104] Waiting for all clients' personalized item hidden feature vectors to be sent, and updating the personalized item hidden feature vector of the corresponding item for the second time based on the personalized item hidden feature vectors sent by other clients;

[0105] If not, the personalized item hidden feature vector obtained by the first update is sent to all other clients;

[0106] Wait for all clients' personalized item latent feature vectors to be sent, and update the personalized item latent feature vectors of all items for the second time based on the personalized item latent feature vectors sent by other clients.

[0107] Wherein, after the step of waiting for all clients to complete sending of personalized item latent feature vectors, and updating the personalized item latent feature vectors of all items for the second time based on the personalized item latent feature vectors sent by other clients, the following steps are included:

[0108] When the number of iterations is greater than or equal to the first preset number, testing whether the model converges based on the personalized item latent feature vectors of all items updated for the second time;

[0109] When the model converges, the model training ends.

[0110] For specific implementation, please refer to Figure 5 , the number of iterations is recorded as t, and a maximum number of iterations T is set, which is used to stop the iteration when the number of iterations t reaches the maximum number of iterations T;

[0111] Get rating records: In each iteration, client u will first upload its own rating records, i.e., the first item set The order of the items in the shuffled, and then each of them (u,i,r ui ) to train the model until all the scoring records have been trained in this iteration.

[0112] Local training parameters: For the extracted rating data, client u will first calculate the model parameter gradient using the model gradient calculation formulas (3) and (4) and Then the model parameters U are updated for the first time by the following formulas (5) and (6): u· and

[0113]

[0114]

[0115] Among them, γ is the learning rate, which is a pre-set hyperparameter.

[0116] Sharing parameters: In this embodiment, a first preset number of times T' is set. When the number of iterations t is less than T', each client u only sends its own updated parameters. Give That is, other clients that claim to have rated item i. When the number of iterations is greater than or equal to T′, each client u will send its updated parameters To all other clients, in order to test whether the recommendation model converges. In this step, anonymous technology is used to send parameters. Since the receiver only receives the parameters sent by client u, Without knowing the sender, the privacy of client u cannot be known.

[0117] Synchronization: All clients wait in this step until all clients complete the above three steps, that is, wait for all clients' personalized item hidden feature vectors to be sent.

[0118] Update parameters (t is less than T′): When the number of iterations t is less than T′, the client u first updates the corresponding score record of the currently retrieved score. For the second update,

[0119]

[0120] Then, use the received parameters when sharing renew

[0121]

[0122] Among them, j is not the first item set taken out in this training The items in the second set of items that the client claims to have rated Therefore, other clients u′ that have actually rated these items will update After that, Sent to client u; Another possibility is that the item is a real rated item, but it is not an item taken out in this model training.

[0123] Update parameters (t greater than or equal to T'): When the number of iterations t is greater than or equal to T', the client u first updates the corresponding score record retrieved this time. The second update is performed using formula (7), and then the received parameters are updated using formula (8). renew Here, j is all items except the items taken out in this training. At the same time, after the second parameter update is completed, the model is tested to see whether it has converged. If the model has converged, the model training is terminated in advance.

[0124] When the model does not converge, model training is automatically stopped when the number of iterations reaches T.

[0125] In another model training DFedRec(s) based on random updates, including:

[0126] Before model training, four queues are set up for each client to store globally unique item hidden feature vectors, including an update queue, a non-update queue, a receiving queue, and a test queue;

[0127] In each round of iteration, the globally unique item hidden feature vector received in the previous round of iteration, i.e., the receiving queue data, is copied to the update queue, and the receiving queue is cleared;

[0128] Wait for all clients to clear the receiving queue;

[0129] When the globally unique item latent feature vector corresponding to the item in the first item set is received in the update queue, the gradient of the user latent feature vector and the gradient of the globally unique item latent feature vector based on the rating data of the item are calculated, and the user latent feature vector and the globally unique item latent feature vector are further updated;

[0130] Send all globally unique item hidden feature vectors in the update queue and the non-update queue to any client that claims to have rated the item with a preset probability;

[0131] When the globally unique item hidden feature vector is not sent, the globally unique item hidden feature vector is put into a non-update queue, and the globally unique item hidden feature vector is not updated in the next round of iteration.

[0132] Wherein, the step of sending all globally unique hidden feature vectors of items in the update queue and the non-update queue to any client claiming to have rated the item with a preset probability also includes:

[0133] Determine whether the number of iterations is greater than or equal to a second preset number;

[0134] If yes, the updated globally unique item hidden feature vector is copied and sent to the test queues of other clients;

[0135] Testing whether the model converges by using the item latent feature vectors of all items in the test queue;

[0136] When the model converges, the model training ends.

[0137] Specific:

[0138] In the random update-based model training DFedRec(s), each item has only one latent feature vector and is recorded as V i· , and only hold V during training i· Only clients with V i· ,This training method avoids the operation steps of sharing and updating parameters in DFedRec(b),,which can effectively save communication costs.

[0139] Pre-set each client to maintain four globally unique item hidden feature vectors V i· The queues are Q u , Q′ u , and Among them, Q u It is the V to be updated. i· The update queue Q′ u Is the V that will not be updated i· The queue is not updated. It is used to store the received V i· The receive queue. It is the V received after T′ rounds of iterations to test whether the recommendation model has converged. i. The test queue.

[0140] Before training, the server needs to complete the following two preparations:

[0141] (1) To make the model converge quickly, pre-calculate

[0142]

[0143] (2) For each V i· , the server randomly selects a The client u in the i· Sent to the client u for initialization V i· , that is

[0144] For further specific implementation, please refer to Figure 6Here, the number of iterations is also recorded as t, and the maximum number of iterations T is set. In the above round of iterations, there are s rounds of internal iterations, and the number of internal iterations is recorded as t 2 ;

[0145] Receive parameters: In each internal iteration, the parameter V received in the previous internal iteration is i· Copy to Q u Then clear Prepare for receiving parameters for this round, that is

[0146] Synchronous: All clients will wait here until all other clients have cleared their

[0147] Local training parameters: For Each V i· , client u first calculates and

[0148]

[0149]

[0150] Then update U u· and V i· ,

[0151]

[0152]

[0153] Sharing parameters: For Q u ∪Q′ u Each V i· , the client u will The probability of sending A client u′ is randomly selected from the , where client u′ may also be itself, that is, If it is not sent, the V i· Put in Q′ u , which means that the next internal iteration will not update the V i· .

[0154] Shared parameters (t is greater than or equal to T′ and t 2 =s): DFedRec(s) also sets a second preset number T′. When the number of iterations t is greater than or equal to T′ and the number of internal iterations t 2 When it is equal to s, in addition to the above-mentioned parameter sharing steps, each client u will also send its updated parameter Vi· For all other clients, that is Client u receives all updated V i· , and use it to test whether the model has converged. If the test results show that the model has not converged, continue training and clear When the test results show that the model has converged, the training is terminated and the

[0155] When the model does not converge, model training is automatically stopped when the number of iterations reaches T.

[0156] In this embodiment, DFedRec(s) can be viewed as a parallel version of matrix factorization using stochastic gradient descent for two reasons. First, in matrix factorization using stochastic gradient descent, the probability of each sample being sampled is equal. In DFedRec(s), the probability of each sample being sampled is also equal, which is equal to the probability of sending multiplied by the probability of each sample being selected. Second, in matrix factorization using stochastic gradient descent, each iteration randomly samples samples, of which is the training set. DFedRec(s) sets s rounds of internal iterations. In one round of internal iterations, for item i, the number of users who have sampled training samples about item i, that is, the expected number of users who have actually rated item i, is The number of users in the internal iteration of round s conforms to the binomial distribution. Therefore, the expected number of training samples in one external iteration is Same as matrix factorization for stochastic gradient descent.

[0157] Based on the above-mentioned sharing strategy and two update strategies, the decentralized federation recommendation method provided in this embodiment is further tested for performance:

[0158] Privacy protection:

[0159] First, the user's original rating data is stored locally on the client and will not be sent to other clients to ensure the security of the original data. Second, in the process of building the communication matrix, each client u uploads to the server, it is difficult for the server to infer Similarly, it is difficult for each client u to download Inferred from

[0160] Then, the privacy protection of the two update strategies is analyzed. In DFedRec (b), when the client sends the model parameters, it uses the same anonymity technology as PDMFRec. Therefore, although each client u only sends However, the user’s privacy will not be leaked because the receiver does not know who the sender is. In DFedRec(s), the client does not need to use anonymity technology when sending model parameters because the receiver cannot obtain the information from the received V i· Determine whether the sender has actually rated item i or falsely rated it. Moreover, the receiver cannot i· It is inferred that the sender has V i· How much is the modification of V i· It is likely that it has already been updated by multiple clients.

[0161] In summary, both DFedRec(b) and DFedRec(s) can protect user privacy.

[0162] Communication cost:

[0163] Because the amount of data shared between clients at one time in the present invention |V i· |The amount of data shared at one time in the prior art PDMFRec So we only need to compare the number of shares to compare the communication cost.

[0164] In DFedRec(b), the number of communications is

[0165]

[0166] The number of PDMFRec communications is

[0167]

[0168] Where T is the maximum number of iterations, represents the number of neighbors of client u. Obviously, when ρ u = 0 and T′ = T, because Generally speaking Small, so the communication cost of DFedRec(b) is smaller than that of PDMFRec in the prior art. u As ρ increases and T′ decreases, the communication cost of DFedRec(b) will increase. However, experiments show that u When an appropriate value is taken, user privacy can be protected and the communication cost is still smaller than PDMFRec.

[0169] In DFedRec(s), for each V i· , in one round of internal iteration, Therefore, in s rounds of internal iterations (that is, one round of external iterations), V i· Number of communications Y i It conforms to the binomial distribution. Therefore, the expected number of communications in one external iteration is

[0170]

[0171] Therefore, the number of communications of DFedRec(s) is

[0172]

[0173] Where m is the number of items and n is the number of users. u , when T and T′ are equal, the communication cost of DFedRec(s) is smaller than that of DFedRec(b).

[0174] The present invention also compares the communication costs of DFedRec(b) and PDMFRec. The results are shown in Table 1, and the unit is GB. Among them, DFedRec(b,all) represents the parameters that will be updated in each round. DFedRec(b) sent to all other clients, “before T” represents the communication cost required for each iteration before the Tth iteration, “Tth round” represents the communication cost required for the Tth iteration, and “all” represents the communication cost required for the entire training process. As shown in Table 1, it can be seen that when ρ u When the appropriate value is 3, the communication cost of DFedRec(b) is still smaller than that of PDMFRec.

[0175] Table 1

[0176]

[0177] Recommended performance aspects:

[0178] The present invention is verified on three commonly used datasets in the field of recommendation systems, MovieLens 100K (ML100K), MovieLens1M (ML1M), and Netflix dataset (NF5K5K) sampling 5000 users and 5000 items, and the two standard indicators of the rating prediction task, Mean Absolute Error (MAE) and Root Mean Square Error (RMSE), are evaluated, and compared with the most relevant PDMFRec in the prior art and the traditional matrix decomposition algorithm. The experimental results are shown in Table 2. Among them, PMF(t) represents the matrix decomposition trained by traversing the training set, and PMF(s) represents the matrix decomposition trained by randomly sampling the training set. As shown in Table 2, the recommendation performance comparison of PDMFRec, PMF and DFedRec is shown. It can be seen that DFedRec(b,all), DFedRec(b,ρu =0), DFedRec(b,ρ u =3) The recommended performance in ML100K and ML1M is very close to PMF(t), and even better than PMF(t) in NF5K5K. u =0),

[0179] DFedRec(s,ρ u =3) The recommendation performance on the three datasets is almost equal to PMF(s).

[0180] Table 2

[0181]

[0182] Exemplary Devices

[0183] Based on the above embodiments, the present invention provides an intelligent terminal, whose principle block diagram can be shown as follows: Figure 7 As shown. The above-mentioned intelligent terminal includes a processor, a memory, a network interface and a display screen connected through a system bus. Among them, the processor of the intelligent terminal is used to provide computing and control capabilities. The memory of the intelligent terminal includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the intelligent terminal is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps of any one of the above-mentioned decentralized federal recommendation methods are implemented. The display screen of the intelligent terminal can be a liquid crystal display screen or an electronic ink display screen.

[0184] Those skilled in the art will understand that Figure 7 The principle block diagram shown in the figure is only a block diagram of a partial structure related to the scheme of the present invention, and does not constitute a limitation on the smart terminal to which the scheme of the present invention is applied. The specific smart terminal may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0185] In one embodiment, a smart terminal is provided, comprising a memory, a processor, and a program stored in the memory and executable on the processor, wherein the program performs the following operation instructions when executed by the processor:

[0186] Obtaining actually rated items to construct a first item set, and randomly sampling unrated items to construct a second item set;

[0187] Merging the first item set and the second item set into a third item set, and sending the third item set to a server;

[0188] Based on the third set of items, a communication matrix is ​​constructed through the server, wherein the communication matrix is ​​used to record whether each user has rated all items;

[0189] Based on the third item set, a user set corresponding to each item that has been rated together in the communication matrix is ​​obtained and used for model training.

[0190] It should be understood that the serial numbers of the steps in the above embodiments do not imply a sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0191] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the above-mentioned device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0192] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments. For quantities with the same expression form in various formulas, unless otherwise specified, they represent the same quantity, and various formulas can refer to each other.

[0193] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0194] In the embodiments provided by the present invention, it should be understood that the disclosed apparatus / terminal equipment and method can be implemented in other ways. For example, the apparatus / terminal equipment embodiments described above are only illustrative, for example, the division of the above modules or units is only a logical function division, and in actual implementation, other division methods can be used, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0195] If the above-mentioned integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The above-mentioned computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the above-mentioned computer program includes computer program code, and the above-mentioned computer program code can be in source code form, object code form, executable file or some intermediate form. The above-mentioned computer-readable medium may include: any entity or device capable of carrying the above-mentioned computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the above-mentioned computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.

[0196] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, it should be understood by those skilled in the art that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features therein may be replaced by equivalents. However, these modifications or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.

Claims

1. A decentralized federated recommendation method, characterized in that: The method comprises: Obtaining actually rated items to construct a first item set, and randomly sampling unrated items to construct a second item set; Merging the first item set and the second item set into a third item set, and sending the third item set to a server; Based on the third set of items, a communication matrix is ​​constructed through the server, wherein the communication matrix is ​​used to record whether each user has rated all items; Based on the third item set, obtaining a user set corresponding to each item that has been rated together in the communication matrix and using it for model training; After the step of obtaining the user sets corresponding to the items that have been rated together in the communication matrix based on the third item set and using them for model training, the following steps are included: In each round of iteration, the order of the items in the first item set is first shuffled, and the score data of each item is obtained according to the shuffled order; Based on the rating data obtained each time, the gradient of the corresponding user latent feature vector and the gradient of the personalized item latent feature vector are calculated, and the user latent feature vector and the personalized item latent feature vector are further updated for the first time; After the first update is completed, determine whether the number of iterations is less than a first preset number; After the first update is completed, the step of determining whether the number of iterations is less than the first preset number includes: If yes, the personalized item hidden feature vector obtained by the first update is sent to other clients that claim to have rated the item; Waiting for all clients' personalized item hidden feature vectors to be sent, and updating the personalized item hidden feature vector of the corresponding item for the second time based on the personalized item hidden feature vectors sent by other clients; If not, the personalized item hidden feature vector obtained by the first update is sent to all other clients; Wait for all clients' personalized item hidden feature vectors to be sent, and update the personalized item hidden feature vectors of all items for the second time based on the personalized item hidden feature vectors sent by other clients; After the step of waiting for all clients to complete sending of personalized item latent feature vectors and updating personalized item latent feature vectors of all items for the second time based on personalized item latent feature vectors sent by other clients, the following steps are included: When the number of iterations is greater than or equal to the first preset number, testing whether the model converges based on the personalized item latent feature vectors of all items updated for the second time; When the model converges, the model training ends.

2. A decentralized federated recommendation method according to claim 1, characterized in that: The steps of acquiring actually rated items to construct a first item set, and randomly sampling and acquiring unrated items to construct a second item set include: Obtain the items that have actually been rated to construct the first item set; According to a preset sampling parameter, unrated items are randomly sampled to construct a second item set, wherein the value of the sampling parameter is greater than one and less than positive infinity.

3. A decentralized federated recommendation method according to claim 1, characterized in that: The step of obtaining, based on the third item set, a user set corresponding to each item that has been rated together in the communication matrix and using the user set for model training comprises: Based on the third item set, searching the communication matrix for users who have rated an item together; A user set is constructed by obtaining users who have rated all items in the third item set and used for model training.

4. A decentralized federated recommendation method, characterized in that: The method comprises: Obtaining actually rated items to construct a first item set, and randomly sampling unrated items to construct a second item set; Merging the first item set and the second item set into a third item set, and sending the third item set to a server; Based on the third set of items, a communication matrix is ​​constructed through the server, wherein the communication matrix is ​​used to record whether each user has rated all items; Based on the third item set, obtaining a user set corresponding to each item that has been rated together in the communication matrix and using it for model training; After the step of obtaining, based on the third item set, a user set corresponding to each item that has been rated together in the communication matrix and using it for model training, the following step further comprises: Before model training, four queues are set up for each client to store globally unique item hidden feature vectors, including an update queue, a non-update queue, a receiving queue, and a test queue; In each round of iteration, the globally unique item hidden feature vector received in the previous round of iteration, i.e., the receiving queue data, is copied to the update queue, and the receiving queue is cleared; Wait for all clients to clear the receiving queue; When the globally unique item latent feature vector corresponding to the item in the first item set is received in the update queue, the gradient of the user latent feature vector and the gradient of the globally unique item latent feature vector based on the rating data of the item are calculated, and the user latent feature vector and the globally unique item latent feature vector are further updated; Send all globally unique item hidden feature vectors in the update queue and the non-update queue to any client that claims to have rated the item with a preset probability; When the globally unique item hidden feature vector is not sent, the globally unique item hidden feature vector is placed in a non-update queue, and the globally unique item hidden feature vector is not updated in the next round of iteration; The step of sending all globally unique hidden feature vectors of items in the update queue and the non-update queue to any client claiming to have rated the item with a preset probability also includes: Determine whether the number of iterations is greater than or equal to a second preset number; If yes, the updated globally unique item hidden feature vector is copied and sent to the test queues of other clients; Testing whether the model converges by using the item latent feature vectors of all items in the test queue; When the model converges, the model training ends.

5. An intelligent terminal, characterized in that: The intelligent terminal includes a memory, a processor, and a decentralized federal recommendation program stored in the memory and executable on the processor. When the decentralized federal recommendation program is executed by the processor, the steps of a decentralized federal recommendation method as described in any one of claims 1 to 4 are implemented.

6. A non-temporary computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of a decentralized federated recommendation method as described in any one of claims 1-4 are implemented.