Recommended Model Training Method, System, Computer Device, and Storage Medium

By performing K-means clustering and target client selection methods on clients in the federal recommendation system, the problem of inconsistent recommendation performance between clients is solved, and higher recommendation fairness and robustness are achieved.

CN114912627BActive Publication Date: 2025-05-30PING AN TECH (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210505161.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-10
Publication Date
2025-05-30
Estimated Expiration
2042-05-10

AI Technical Summary

Technical Problem

Inconsistent recommendation performance among clients in existing federal recommendation systems leads to reduced recommendation fairness and robustness.

Method used

All clients are clustered through the server to form multiple client combinations, and the same number of target clients are selected from each combination for training. The global model is updated on each target client and the update parameter data is sent to the server until the global model meets the convergence conditions.

Benefits of technology

It ensures fairness in participating in training between clients of different categories, reduces the negative impact of category imbalance, improves the consistency of recommendation performance of recommendation models on different clients, and thus improves the recommendation fairness and robustness of the federal recommendation system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114912627B_ABST
    Figure CN114912627B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence, and discloses a method, a system, a computer device and a storage medium for training a recommendation model. The method includes: the server performs K-means clustering on all clients to obtain a plurality of client combinations, selects the same number of target clients in each client combination to obtain a plurality of target clients, and sends the global model to each target client; the target client updates the recommendation model of the target client according to the local dataset and the global model, and updates the global model according to the local dataset to obtain updated parameter data; the server updates the global model according to the received plurality of updated parameter data to obtain a new global model, and stops updating the recommendation model until the new global model meets the convergence condition; the present invention improves the model accuracy, ensures the fairness of the participation of different types of clients, enables the recommendation models of each client to have good performance, and thus improves the fairness and robustness of the federated recommendation system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of federated learning, and in particular, to a method, a system, a computer device and a storage medium for training a recommendation model. Background Art

[0002] With the development of technology, users can access a large amount of data. By training based on local data, the user's needs can be predicted, so as to achieve accurate information recommendation. However, these local data are usually large in size and involve privacy sensitivity, and cannot be aggregated on the server to train the model. Therefore, for the recommendation system, a federated recommendation algorithm has been proposed to achieve personalized privacy protection recommendation. The main method of the federated recommendation algorithm is to train local models on multiple local data, and then aggregate the local models to obtain a global model. Repeat the training until the global model converges, and then the global model can be used to perform user recommendation tasks.

[0003] However, the current federated recommendation system still has several major constraints. One important problem is that different local data are different, and multiple rounds of training are carried out locally on the client side, resulting in a large difference in the parameter trends of each local model, that is, a large difference in the updates of each client's local model, which cannot ensure fairness among federated learning participants, resulting in different recommendation effects of the aggregated global model on different clients, and inconsistent recommendation performance among different clients, thus reducing the recommendation fairness and robustness of the federated recommendation system. Summary of the Invention

[0004] The present invention provides a method, a system, a computer device and a storage medium for training a recommendation model, so as to solve the technical problem that the recommendation performance among clients in the existing federated recommendation system is inconsistent, thus reducing the recommendation fairness and robustness of the federated recommendation system.

[0005] A method for training a recommendation model is provided, including:

[0006] The server performs K-means clustering on all clients to obtain multiple client combinations, selects the same number of target clients in each client combination to obtain multiple target clients, and sends the global model to each target client;

[0007] The target client updates the recommendation model of the target client according to the local data set and the global model, updates the global model according to the local data set to obtain the updated parameter data of the global model, and sends the updated parameter data to the server;

[0008] The server updates the global model according to the received multiple updated parameter data to obtain a new global model;

[0009] When the new global model does not meet the convergence condition, the server reclusters all clients to obtain multiple target clients, and sends the new global model to each target client to receive the updated parameter data returned by each target client and update the global model until the latest global model meets the convergence condition, then notifies each client to stop updating the recommendation model.

[0010] Further, before updating the recommendation model of the target client according to the local dataset and the global model, the method further includes:

[0011] The server performs weighted averaging on the recommendation models of all clients in each client combination to obtain a combined representative model corresponding to the client combination;

[0012] The server sends the corresponding combined representative model to the target client corresponding to the client combination, so that the target client updates the recommendation model of the target client according to the local dataset, the received combined representative model and the global model.

[0013] Further, updating the recommendation model of the target client according to the local dataset, the received combined representative model and the global model includes:

[0014] The target client updates the recommendation model of the target client according to the local dataset to obtain an update gradient of the recommendation model;

[0015] The target client updates the current recommendation model of the target client according to the global model, the combined representative model and the update gradient of the recommendation model.

[0016] Further, the update gradient of the recommendation model includes the update gradient of the interaction layer of the recommendation model. Updating the current recommendation model of the target client according to the global model, the combined representative model and the update gradient of the recommendation model includes:

[0017] The target client extracts the interaction layer parameters of the global model and extracts the interaction layer parameters of the combined representative model;

[0018] The target client calculates the target interaction layer parameters according to the update gradient of the interaction layer of the recommendation model, the interaction layer parameters of the global model and the interaction layer parameters of the combined representative model;

[0019] The target client updates the interaction layer parameters of the current recommendation model to the target interaction layer parameters.

[0020] Further, updating the global model according to the local dataset to obtain the updated parameter data of the global model includes:

[0021] The target client uses the gradient descent method to update the global model multiple times according to the local dataset;

[0022] When the number of update rounds of the global model by the target client reaches the preset number of rounds, the target client outputs the model obtained by updating the global model by the target client as the client global model, and records the parameters of the client global model as the updated model parameters;

[0023] The target client uses the loss gradient between the client global model and the global model as the update gradient of the global model, and takes the updated model parameters and the update gradient as the update parameter data.

[0024] Further, the update parameter data includes the update gradient and the updated model parameters. Updating the global model according to the received multiple update parameter data to obtain the latest global model includes:

[0025] The server performs update calculations on the parameters of different network layers of the global model according to multiple updated model parameters and the corresponding multiple update gradients to obtain the target model parameters of the global model. The target model parameters include target user layer parameters, target item layer parameters, and target interaction layer parameters;

[0026] The server updates the target user layer parameters, target item layer parameters, and target item layer parameters to the global model to obtain the latest global model.

[0027] Further, performing update calculations on the parameters of different network layers of the global model according to multiple updated model parameters and the corresponding multiple update gradients to obtain the target model parameters of the global model includes:

[0028] The server extracts the user layer update parameters, item layer update parameters, and interaction layer update parameters in each updated model parameter, and extracts the user layer update gradient and item layer update gradient in the corresponding update gradient;

[0029] According to the user layer update gradient corresponding to the target client, determine the user layer update gradient of the subordinate client corresponding to the target client, and then calculate the target user layer parameters according to the user layer update gradients of all clients. The subordinate client is other clients within the same client group as the target client;

[0030] According to the item layer update parameters and item layer update gradients corresponding to each target client, calculate the target item layer parameters after the global model is updated by all target clients;

[0031] Perform weighted calculation on the interaction layer update parameters of all target clients to obtain the target interaction layer parameters.

[0032] Provide a recommendation model training system, including:

[0033] A server, which is used to perform K-means clustering on all clients to obtain multiple client combinations, select the same number of target clients from each client combination to obtain multiple target clients, and send the global model to each target client;

[0034] The target clients are used to update the recommendation model of the target clients according to the local dataset and the global model, update the global model according to the local dataset to obtain the updated parameter data of the global model, and send the updated parameter data to the server;

[0035] The server is further used for:

[0036] Update the global model according to the received multiple updated parameter data to obtain a new global model;

[0037] When the new global model does not meet the convergence condition, re-cluster all clients to obtain multiple target clients, and send the new global model to each target client to receive the updated parameter data returned by each target client and update the global model until the latest global model meets the convergence condition, then notify each client to stop updating the recommendation model.

[0038] Provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned recommendation model training method when executing the computer program.

[0039] Provide a computer-readable storage medium, the computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the above-mentioned recommendation model training method when executed by the processor.

[0040] In one solution provided by the above-mentioned recommendation model training method, system, computer device, and storage medium, the server performs K-means clustering on all clients to obtain multiple client combinations, selects the same number of target clients from each client combination to obtain multiple target clients, and sends the global model to each target client. Then, the target client updates the recommendation model of the target client according to the local dataset and the global model, updates the global model according to the local dataset to obtain the updated parameter data of the global model, and sends the updated parameter data to the server. The server updates the global model according to the received multiple updated parameter data to obtain a new global model. When the new global model does not meet the convergence condition, the server re-clusters all clients to obtain multiple target clients, and sends the new global model to each target client to receive the updated parameter data returned by each target client and update the global model until the latest global model meets the convergence condition, and then notifies each client to stop updating the recommendation model. In the present invention, the recommendation models corresponding to each client are continuously updated by using the local datasets of each client and the global model aggregated by multiple clients, so that each recommendation model can refer to the data of other clients and fit the local data, improving the model accuracy. On this basis, the server performs K-means clustering on all clients, and then samples the same number of clients from each category to participate in the training, making the participating clients more balanced, ensuring the fairness of different categories of clients participating, reducing the negative impact brought by category imbalance, and making the recommendation performance of the final recommendation model on different clients not vary greatly, all having good performance, thereby improving the recommendation fairness and robustness of the federated recommendation system. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can obtain other drawings without creative efforts.

[0042] Figure 1 It is a schematic diagram of an application environment of the recommendation model training method in an embodiment of the present invention;

[0043] Figure 2 It is a signaling interaction diagram of the recommendation model training method in an embodiment of the present invention;

[0044] Figure 3 It is a flowchart of the recommendation model training method in an embodiment of the present invention;

[0045] Figure 4 is Figure 2Schematic diagram of the implementation process of step S30 in

[0046] Figure 5 Yes Figure 4 Schematic diagram of the implementation process of step S32 in

[0047] Figure 6 Yes Figure 2 Schematic diagram of the implementation process of step S40 in

[0048] Figure 7 Yes Figure 2 Schematic diagram of the implementation process of step S50 in

[0049] Figure 8 Yes Figure 2 Schematic diagram of the implementation process of step S51 in

[0050] Figure 9 Schematic diagram of a structure of a recommendation model training system in an embodiment of the present invention;

[0051] Figure 10 Schematic diagram of a structure of a computer device in an embodiment of the present invention;

[0052] Figure 11 Schematic diagram of another structure of a computer device in an embodiment of the present invention. Detailed implementation manners

[0053] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0054] The recommendation model training method provided by the embodiments of the present invention can be applied in an application environment such as Figure 1 where the client communicates with the server through a network.

[0055] When the recommendation model needs to be trained or updated, the server performs K-means clustering on all the participating clients to obtain multiple client combinations. The same number of target clients are selected from each client combination to obtain multiple target clients. Then the global model is sent to each target client. Next, the target client updates the recommendation model of the target client according to the local dataset and the global model, and updates the global model according to the local dataset to obtain the updated parameter data of the global model. The updated parameter data is sent to the server. The server updates the global model according to the received multiple updated parameter data to obtain a new global model. When the new global model does not meet the convergence condition, the server re-clusters all the clients to obtain multiple target clients, and sends the new global model to each target client to receive the updated parameter data returned by each target client and update the global model until the latest global model meets the convergence condition, and then notifies each client to stop updating the recommendation model; In this embodiment, the global model, the updated parameter data returned by the client, and other data are stored in the database of the server, and the local dataset, the recommendation model, and other data of the client are stored in the database of the client, so that when performing the recommendation model training task subsequently, relevant data can be directly obtained from the corresponding database according to the requirements, so as to reduce the model training time and thus improve the efficiency of model training.

[0056] In this embodiment, data such as the global model and the updated parameter data returned by the client are stored in the database of the server, and data such as the local dataset and the recommendation model of the client are stored in the database of the client, so that when performing the recommendation model training task subsequently, relevant data can be directly obtained from the corresponding database according to the requirements, so as to reduce the model training time and thus improve the efficiency of model training.

[0057] The database in this embodiment is stored in a blockchain network and is used to store the data used and generated in the recommendation model method, such as global models, updated parameter data returned by clients, local data sets, recommendation models, and other related data. The blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. Blockchain, essentially a decentralized database, is a string of data blocks generated by using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity (anti-counterfeiting) of the information and generate the next block. The blockchain can include a blockchain underlying platform, a platform product service layer, an application service layer, etc. Deploying the database on the blockchain can improve the security of data storage.

[0058] Among them, the client can be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of multiple servers.

[0059] In one embodiment, as Figure 2 shown, a recommendation model training method is provided. Taking the method applied to the Figure 1 server as an example for illustration, the method includes the following steps:

[0060] S10: The server performs K-means clustering on all clients to obtain multiple client combinations, and selects the same number of target clients in each client combination to obtain multiple target clients.

[0061] When performing the pre-recommendation model training task, the server determines all clients that need to perform recommendation model training, then performs K-means clustering on all clients to obtain multiple client combinations, and each client combination includes multiple clients; then the server randomly selects the same number of clients in each client combination as the target clients participating in the training in this round, and finally selects multiple target clients from multiple client combinations.

[0062] It should be understood that traditional federated learning algorithms only use a random method to select clients for training, but this method cannot ensure the fairness of different types of clients, ultimately resulting in insufficient performance of the trained model. For example, if 20 clients can be divided into 3 categories, with the number of clients in each category being 2, 3, and 15 respectively, then the probabilities of these three types of clients being selected in each round of training are 2 / 20, 3 / 20, and 15 / 20 respectively. The random selection probabilities vary greatly, and the finally trained model will inevitably be overly biased towards the third type of client, making the accuracy of the recommendation results given to users of the third type of client relatively high, while the accuracy of the recommendation results given to users of the other two types of clients is relatively low. Therefore, in each round of training, this application clusters all clients through K-means clustering to make the number of clients in each category the same, and then selects the same number of clients from each category as target clients to participate in training, which can improve the fairness of the participation of other types of clients.

[0063] If the same type of users can be accurately divided into the same cluster in advance, then all three types of users will participate in this round of training, and the weights will not differ much. The finally obtained recommendation model will give recommendation results with roughly the same accuracy to all three types of users.

[0064] S20: The server sends the global model to the target clients.

[0065] After selecting the same number of target clients from each client combination to obtain multiple target clients, the server will send the global model to each target client.

[0066] S30: The target clients update the recommendation models of the target clients according to the local datasets and the global model.

[0067] After the server sends the global model to each target client, the target client receives the global model, obtains the local dataset on the target client, and then updates and saves the recommendation model of the target client according to the local dataset and the global model.

[0068] Among them, the target client can use the gradient descent method to update the recommendation model of the target client according to the local dataset and the global model, specifically including: the target client first updates the recommendation model according to the local dataset to obtain the loss gradient after updating the recommendation model, then calculates the corrected gradient according to the global model, the recommendation model, and the correction coefficient, and then uses the gradient descent method to correct and update the recommendation model according to the corrected gradient and the loss gradient until the number of model update rounds reaches the preset number of rounds.

[0069] Among them, the calculation method of the corrected gradient is:

[0070]

[0071] Among them, represents the corrected gradient of the k-th target client in the r-th training round; represents the latest recommendation model locally saved by the k-th target client, which can be understood as the recommendation model updated by the target client in the previous training round (i.e., the (r - 1)-th training round); μ is the correction coefficient; ||·|| represents the second norm; w r-1 represents the global model sent from the server to the client in the r-th training round, that is, the global model updated by the server in the previous training round (the (r - 1)-th training round); represents the loss function gradient obtained by the target client through updating calculation of the recommendation model of the target client according to the local dataset for the recommendation model of the target client locally.

[0072] In this embodiment, when calculating the corrected gradient, not only the global model, the recommendation model and the correction coefficient are considered, but also the loss gradient after updating the recommendation model according to the local dataset is used as an influencing parameter, further improving the accuracy of the corrected gradient.

[0073] After calculating the corrected gradient based on the global model, the recommendation model and the correction coefficient, the target client uses the gradient descent method to correct and update the recommendation model according to the corrected gradient and the learning rate (the learning rate is a pre-calibrated parameter), and repeats for multiple rounds until the number of model update rounds reaches the preset number of rounds (the preset number of rounds is the number of rounds when the client updates, for example, the preset number of rounds is E, and E is an integer greater than 2), to obtain the recommendation model updated in the current training round (the training round is the total number of rounds of the recommendation model training task). Using the gradient descent method to update the recommendation model can obtain a recommendation model with relatively stable performance and improve the accuracy of the recommendation model. In other embodiments, to improve the training efficiency, after obtaining the corrected gradient, the recommendation model can be updated one or two times only according to the corrected gradient and the loss gradient to obtain a new recommendation model.

[0074] Among them, when using the gradient descent method to correct and update the recommendation model, the update formula of the recommendation model can be as follows:

[0075]

[0076] According to the foregoing formula, the update method of the recommendation model is specifically:

[0077]

[0078] Among them, represents the recommendation model updated by the k-th target client in the r-th training round; denotes the recommendation model updated by the k-th target client in the previous training round (i.e., the r - 1 training round), which is the latest recommendation model saved locally on the target client; η is the learning rate; μ is the correction coefficient; ||·|| represents the second norm; w r-1 denotes the global model sent by the server to the client in the r-th training round, that is, the global model updated by the server in the previous training round (the r - 1 training round); denotes the recommendation model updated by the client according to the local dataset in the previous training round for the loss function gradient obtained through update calculation.

[0079] According to the above formula, on the basis of updating the recommendation model using local data, that is, on the basis of its own gradient update, an additional correction gradient with the direction towards the global model parameters of the previous training round and the same magnitude as its own gradient is added in the form of a vector sum, so that the recommendation models on each client's local side are updated in the direction that best suits their own needs and also use the information of the overall model aggregated by all clients (i.e., the global model), preventing the performance of the client's recommendation model from deviating significantly and improving the accuracy of the client's recommendation model.

[0080] S40: The target client updates the global model according to the local dataset to obtain the updated parameter data of the global model, and sends the updated parameter data to the server.

[0081] After the server sends the global model to each target client, while the target client updates the recommendation model of the target client according to the local dataset and the global model, it also updates the global model according to the local dataset, thereby obtaining the updated parameter data after updating the global model. After obtaining the updated parameter data of the global model by updating the global model according to the local dataset, the target client will send the updated parameter data obtained by updating the global model to the server.

[0082] S50: The server updates the global model according to the received multiple updated parameter data to obtain a new global model.

[0083] After the target client sends the updated parameter data to the server, the server receives the updated parameter data sent by each target client and updates the global model according to the received multiple updated parameter data to obtain a new global model.

[0084] S60: Determine whether the new global model meets the convergence condition.

[0085] S70: If the new global model does not meet the convergence condition, the server re-clusters all the clients to obtain multiple target clients, and sends the new global model to each target client to receive the updated parameter data returned by each target client and update the global model until the latest global model meets the convergence condition.

[0086] S80: If the new global model meets the convergence condition, notify each client to stop updating the recommendation model.

[0087] After the server updates the global model according to the received multiple updated parameter data to obtain a new global model, the server will also determine whether the updated global model meets the convergence condition. If the new global model does not meet the convergence condition, repeat the steps of S10 - S50 and repeat multiple rounds until the updated global model meets the convergence condition, and notify each client to stop updating the recommendation model when the new global model meets the convergence condition. That is, when the new global model does not meet the convergence condition, the server re-performs K-means clustering on all the clients, and selects the target clients with the number of systems from the multiple client combinations obtained by clustering to participate in the training. Then the server sends the new global model to the multiple target clients, so that the multiple target clients repeat steps S30 - S40, that is, the target clients continue to update the recommendation model on the client side according to the local dataset and the new global model, and update the new global model according to the local dataset to obtain the updated parameter data of the global model. Then the target clients send the updated parameter data to the server, and the server receives the updated parameter data returned by the multiple clients and updates the global model according to the updated parameter data returned by the multiple target clients until the updated global model meets the convergence condition, and then sends a stop update notification to each client to notify each client to stop updating the recommendation model.

[0088] In this embodiment, to ensure that the recommendation models of all clients are updated, the convergence condition can be to ensure that the recommendation models of all clients participate in at least one round of update; on the basis of ensuring the model accuracy, to reduce the number of training rounds and accelerate the model convergence, the convergence condition can be that the total number of training rounds of the pre-recommendation model training task reaches a preset number of training rounds, where the preset number of training rounds can be determined according to the prediction effect of the actual model. In other embodiments, it can also be determined that the global model meets the convergence condition when, after performing K-means clustering on all the clients, it is found that the client members in the client combination do not change, that is, the convergence condition can also be that the client members in the client combination do not change after performing K-means clustering on all the clients.

[0089] In this embodiment, the server performs K-means clustering on all the clients that need to participate to obtain multiple client combinations. The same number of target clients are selected from each client combination to obtain multiple target clients. Then the global model is sent to each target client. Next, the target client updates the recommendation model of the target client according to the local dataset and the global model, and updates the global model according to the local dataset to obtain the updated parameter data of the global model. Then the updated parameter data is sent to the server. The server updates the global model according to the received multiple pieces of updated parameter data to obtain a new global model. When the new global model does not meet the convergence condition, the server re-clusters all the clients to obtain multiple target clients, and sends the new global model to each target client to receive the updated parameter data returned by each target client and update the global model until the latest global model meets the convergence condition, and then notifies each client to stop updating the recommendation model. In this embodiment, the local datasets of each client and the global model aggregated from multiple clients are used to continuously update the recommendation models corresponding to each client, so that each recommendation model not only refers to the data of other clients but also fits the local data, improving the model accuracy. On this basis, the server performs K-means clustering on all the clients, and then samples the same number of clients from each category to participate in the training, making the participating clients more balanced, ensuring the fairness of the participation of different categories of clients, reducing the negative impact brought by category imbalance, and making the recommendation performance of the final recommendation model on different clients not vary too much, all having good performance, thereby improving the recommendation fairness and robustness of the federated recommendation system.

[0090] In addition, since the server performs K-means clustering on all the clients and then samples the same number of target clients from each category to participate in the training, only the recommendation models of the target clients need to be updated in each round of update, reducing the data processing volume, accelerating the update iteration of the global model parameters, effectively accelerating the model convergence speed, thereby reducing the total computational overhead of the entire system, reducing the requirements for the computing capabilities of the participating clients, and improving the enthusiasm of each client to participate.

[0091] After the server notifies each client to stop updating the recommendation model, that is, after the client receives the stop update notification from the server, the client can use the recommendation model that is newly updated locally at the client as the target recommendation model of the client itself for subsequent information recommendation by the client.

[0092] In other embodiments, to reduce the situation where the recommendation models of some clients are not updated because they do not participate in the update round, after the server notifies each client to stop updating the recommendation model, that is, after the client receives the stop update notification from the server, the server can use the recommendation model updated by the target client in the last round as the target recommendation model for all clients within the same client group. That is, the recommendation model updated by the target client in the last round is shared with other clients of the same type. Since the clients of the same type are not very different, sharing the updated model does not cause much difference in their own recommendation effects. Wherein, without further improving the recommendation effects of each client, after the server notifies each client to stop updating the recommendation model, that is, after the client receives the stop update notification from the server, the server can perform a weighted average on the recommendation models of all clients within the same client group, and then use the combined representative model obtained by the weighted average as the target recommendation model for all clients within the same client group. In this embodiment, a model update strategy of sharing updates within the same client group is proposed. Only by calculating the model update of the representative user can it be shared with its subordinate users (that is, other clients in the same client group as the target client). Even if other clients are not updated or fully updated, they can still obtain an updated recommendation model, improving the performance of the recommendation model.

[0093] In one embodiment, after performing K-means clustering on all clients to obtain multiple client groups, selecting the same number of target clients in each client group to obtain multiple target clients, before sending the global model to the target clients, it is also necessary to perform a weighted average on the recommendation models of all clients in each client group, and use the model obtained by the weighted average as the combined representative model of the client group, so that when the global model is sent to all target clients subsequently, the combined representative model is sent to the corresponding target client.

[0094] As Figure 3 shown, before step S30, that is, before updating the recommendation model of the target client according to the local dataset and the global model, the method specifically includes the following steps:

[0095] S01: The server performs a weighted average on the recommendation models of all clients in each client group to obtain the combined representative model corresponding to the client group.

[0096] After performing K-means clustering on all clients to obtain multiple client groups, selecting the same number of target clients in each client group to obtain multiple target clients, before sending the global model to the target clients, the server performs a weighted average on the recommendation models of all clients in each client group to obtain the weighted average model, which is used as the combined representative model corresponding to the client group.

[0097] Among them, the recommendation models of all clients in each client combination are weighted and averaged to obtain a combined representative model corresponding to the client combination, including: determining the weights of all clients in the client combination and determining the model parameters corresponding to the recommendation models of each client; then performing a weighted average calculation on the weights of each client and the model parameters corresponding to each client to obtain combined representative model parameters, that is, the combined representative model.

[0098] Among them, the weight of a client is determined according to the data volume of the local dataset of each client in the client combination. The weight of each client is the proportion of the local data volume corresponding to the local dataset of each client in the total local data volume of the client combination (that is, the local data volume after summarizing the total local datasets of all clients in the client combination). Determining the weight according to the data volume of the local dataset of each client is more accurate.

[0099] Among them, the combined representative model is calculated by the following formula:

[0100]

[0101] Among them, represents the combined representative model parameters (combined representative model) of the p-th client combination in the r-th training round; represents the model parameters (recommendation model) of the n-th client in the p-th client combination in the r-th training round, δ is the total local data volume after summarizing the local datasets of all clients in the p-th client combination; δ n is the weight of the n-th client in the p-th client combination, that is, the proportion of the local data volume corresponding to the local dataset of the n-th client in the total local data volume of the client combination, and m is the total number of clients in the p-th client combination.

[0102] S02: The server sends the corresponding combined representative model to the target client corresponding to the client combination, so that the target client updates the recommendation model of the target client according to the local dataset, the received combined representative model, and the global model.

[0103] After obtaining the combined representative model corresponding to the client combination, the server sends the corresponding combined representative model to the target client corresponding to the client combination, so that the target client updates the recommendation model of the target client according to the local dataset, the received combined representative model, and the global model.

[0104] In this embodiment, before updating the recommendation model of the target client according to the local data set and the global model, the server also performs weighted averaging on the recommendation models of all clients in each client combination to obtain a combined representative model corresponding to the client combination, and then sends the corresponding combined representative model to the target client corresponding to the client combination, so that the target client updates the recommendation model of the target client according to the local data set, the received combined representative model, and the global model. By updating the recommendation model of the target client through the local data set, the combined representative model, and the global model, the recommendation model not only considers local data, but also considers the influence of this type of client on itself and the influence of other different types of clients on itself, thereby improving the accuracy of the recommendation model.

[0105] In one embodiment, as Figure 4 shown, in step S30 or step S02, that is, updating the recommendation model of the target client according to the local data set and the global model, or updating the recommendation model of the target client according to the local data set, the received combined representative model, and the global model, specifically includes the following steps:

[0106] S31: The target client updates the recommendation model of the target client according to the local data set to obtain the update gradient of the recommendation model.

[0107] After receiving the global model sent by the server and the combined representative model sent by the server, the target client will grab local data through the data scraping device to generate a local data set, and then update the recommendation model of the target client according to the local data set to obtain the update gradient of the recommendation model.

[0108] S32: The target client updates the current recommendation model of the target client according to the global model, the combined representative model, and the update gradient of the recommendation model.

[0109] After updating the recommendation model of the target client according to the local data set to obtain the update gradient of the recommendation model, the target client updates the current recommendation model of the target client according to the global model, the combined representative model, and the update gradient of the recommendation model to obtain a new recommendation model.

[0110] Among them, updating the current recommendation model of the target client according to the global model, the combined representative model, and the update gradient of the recommendation model can update once or twice to obtain a new recommendation model, or the gradient descent method can be used to perform multiple rounds of updates on the current recommendation model of the target client according to the global model, the combined representative model, and the update gradient of the recommendation model to obtain a new recommendation model, thereby improving the accuracy of the recommendation model.

[0111] Among them, the gradient descent method is adopted to perform multiple rounds of updates on the current recommendation model of the target client according to the update gradients of the global model, the combined representative model, and the recommendation model, including:

[0112] S301: The client calculates the corrected gradient according to the global model, the combined representative model, and the correction coefficient.

[0113] After obtaining the update gradient of the recommendation model by updating the recommendation model of the target client according to the local dataset, the client calculates the corrected gradient according to the global model, the recommendation model, and the correction coefficient.

[0114] Among them, the calculation method of the corrected gradient is:

[0115]

[0116] Among them, represents the corrected gradient of the k-th target client in the r-th training round; represents the combined representative model corresponding to the p-th client combination, that is, the combined representative model obtained by weighted averaging the recommendation models of the k-th target client and its subordinate clients in the previous training round (i.e., the r-1-th training round), where the subordinate clients of the target client are other clients in the same client combination as the target client; μ is the correction coefficient; ||·|| represents the second norm; w r-1 represents the global model sent by the server to the target client at the r-th training round, that is, the global model updated by the server in the previous training round (the r-1-th training round); represents the gradient of the loss function obtained by the client updating the recommendation model of the target client locally according to the local dataset, that is, the update gradient of the recommendation model.

[0117] In this embodiment, when calculating the corrected gradient, not only the global model is considered, but also the combined representative model and the loss gradient after updating the recommendation model according to the local dataset are used as influencing parameters, which further improves the accuracy of the corrected gradient.

[0118] In other embodiments, the calculation method of the corrected gradient can also be:

[0119]

[0120] Among them, the meanings of the parameters in the formula are as shown above and will not be elaborated here.

[0121] S302: The client uses the gradient descent method to correct and update the recommendation model according to the corrected gradient and the loss gradient until the number of model update rounds reaches the preset number of rounds.

[0122] After calculating the correction gradient based on the global model, the combined representative model, and the correction coefficient, the client uses the gradient descent method to correct and update the recommendation model according to the correction gradient and the learning rate (which is a pre-calibrated parameter), and repeats this process for multiple rounds until the number of model update rounds reaches the preset number of rounds (the preset number of rounds is the number of rounds during the client update. For example, the preset number of rounds is E, and E is an integer greater than 2), to obtain the recommendation model updated in the current training round (the total number of rounds of the recommendation model training task). Using the gradient descent method to update the recommendation model can obtain a recommendation model with relatively stable performance and improve the accuracy of the recommendation model. In other embodiments, to improve the training efficiency, after obtaining the correction gradient, the recommendation model can be updated one or two times only based on the correction gradient and the loss gradient to obtain a new recommendation model.

[0123] Among them, when using the gradient descent method to correct and update the recommendation model, the update formula of the recommendation model can be as follows:

[0124]

[0125] Among them, represents the recommendation model updated by the k-th target client at the r-th training round; represents the latest recommendation model saved locally on the client; η is the learning rate; μ is the correction coefficient; ||·|| represents the two-norm; represents the correction gradient of the k-th target client at the r-th training round; represents the combined representative model corresponding to the p-th client combination, that is, the combined representative model obtained by weighted averaging the recommendation models of the k-th target client and its subordinate clients in the previous training round (i.e., the (r - 1)-th training round), where the subordinate clients of the target client are other clients in the same client combination as the target client; w r-1 represents the global model sent by the server to the target client at the r-th training round, that is, the global model updated by the server in the previous training round (the (r - 1)-th training round); represents the loss function gradient (i.e., the update gradient of the recommendation model) calculated by the client according to the local dataset for the recommendation model on the target client's local side.

[0126] In this embodiment, on the basis of updating the recommendation model using local data, that is, on the basis of self-gradient update, an additional correction gradient with the direction towards the global model parameters of the previous training round and the same magnitude as the self-gradient is added in the form of a vector sum, so that the recommendation models on each client side are updated not only in the direction that best meets their own needs but also use the information of the overall model aggregated by all clients (i.e., the global model), preventing the performance of the recommendation models on the client side from deviating significantly. In addition, the correction gradient is based on the weighted average model (combined representative model) of the same client combination in the previous training round, further ensuring the accuracy of the correction gradient, and thus further improving the accuracy of the recommendation model updated by the target client.

[0127] In this embodiment, the target client updates the recommendation model of the target client according to the local data set to obtain the update gradient of the recommendation model, and then updates the current recommendation model of the target client according to the global model, the combined representative model, and the update gradient of the recommendation model, refining the steps of updating the recommendation model of the target client according to the local data set and the global model, so that the recommendation model not only considers local data but also takes into account the influence of this type of client on itself and the influence of other different types of clients on itself, thereby improving the accuracy of the recommendation model.

[0128] In one embodiment, when the target client updates the recommendation model of the target client according to the local data set, the obtained update gradient of the recommendation model includes the update gradient of the interaction layer of the recommendation model. As Figure 5 shown, in step S32, that is, updating the current recommendation model of the target client according to the global model, the combined representative model, and the update gradient of the recommendation model specifically includes the following steps:

[0129] S321: The target client extracts the interaction layer parameters of the global model and extracts the interaction layer parameters of the combined representative model.

[0130] The recommendation model is a two-tower model. The two-tower model includes a user layer (user embedding), an item layer (item embedding), and an interaction layer (non-embedding component). The two-tower model constructs two independent sub-networks for users and items. The user layer and the item layer in the two trained "towers" are cached in the local database respectively. When in use, only the interaction calculation score of the user information output by the user layer and the item information output by the item layer needs to be calculated online in the interaction layer. Therefore, when updating the recommendation model, the network parameters of the interaction layer can be mainly updated, that is, when the target client updates the recommendation model of the target client according to the local data set, the obtained update gradient of the recommendation model mainly includes the update gradient of the interaction layer of the recommendation model.

[0131] After obtaining the global model sent by the server and the combined representative model corresponding to the client group where the target client is located, and updating to obtain the update gradient of the recommendation model, the target client needs to extract the interaction layer parameters of the global model and the interaction layer parameters of the combined representative model.

[0132] S322: The target client calculates the target interaction layer parameters according to the interaction layer update gradient of the recommendation model, the interaction layer parameters of the global model, and the interaction layer parameters of the combined representative model.

[0133] After obtaining the interaction layer parameters of the global model and the interaction layer parameters of the combined representative model, the target client calculates the target interaction layer parameters according to the interaction layer update gradient of the recommendation model, the interaction layer parameters of the global model, and the interaction layer parameters of the combined representative model.

[0134] Among them, the target interaction layer parameters can be obtained by the gradient descent method, and the update formula of the target interaction layer parameters is as follows:

[0135]

[0136] Among them, represents the interaction layer parameters updated by the k-th target client in the r-th training round, that is, the target interaction layer parameters; represents the interaction layer parameters of the recommendation model saved locally on the client; η is the learning rate; μ is the correction coefficient; ||·|| represents the second norm; represents the interaction layer correction gradient of the k-th target client in the r-th training round; represents the interaction layer parameters of the combined representative model corresponding to the p-th client group, where, can also be obtained by weighted averaging the interaction layer parameters of the k-th target client and its subordinate clients in the previous training round (i.e., the r-1 training round); w r-1 [N] represents the interaction layer parameters of the global model sent by the server to the target client in the r-th training round, that is, the interaction layer parameters of the global model updated by the server in the previous training round (the r-1 training round); represents the gradient of the interaction layer loss function calculated by the client according to the local dataset for the recommendation model on the target client locally (i.e., the interaction layer update gradient of the recommendation model).

[0137] S323: The target client updates the interaction layer parameters of the current recommendation model to the target interaction layer parameters.

[0138] After calculating the target interaction layer parameters, the target client updates the interaction layer parameters of the current recommendation model (i.e., the recommendation model saved locally without being updated in the current training round) to the target interaction layer parameters.

[0139] In this embodiment, on the basis of updating the recommendation model using local data, that is, on the basis of its own gradient update, a correction gradient with the same magnitude as its own gradient and in the direction of the global model and the combined representative model parameters of the previous training round is additionally added in the form of a vector sum, so that the recommendation models on each client side are updated in the direction that best meets their own needs and also use the information of the overall model (i.e., the global model) aggregated by all clients, preventing the performance of the recommendation models on the client side from deviating significantly, improving the accuracy of the target interaction layer parameters, and thus improving the accuracy of the recommendation model updated by the target client.

[0140] Among them, the update methods of the item layer parameters and user layer parameters in the recommendation model of the target client can remain unchanged. That is, there is no need for personalized update like the interaction layer parameters. Only the local dataset of the target client is needed to update the local recommendation model. That is, in this embodiment, the target client needs to first update the recommendation model of the target client according to the local dataset, record the updated recommendation model as the first recommendation model, and determine the update gradient of the recommendation model based on the change in the interaction layer parameters between the first recommendation model and the recommendation model. Then the target client extracts the interaction layer parameters of the global model and the interaction layer parameters of the combined representative model, calculates the target interaction layer parameters based on the interaction layer update gradient of the recommendation model, the interaction layer parameters of the global model, and the interaction layer parameters of the combined representative model, and then updates the interaction layer parameters of the current recommendation model (the current recommendation model at this time is the first recommendation model) to the target interaction layer parameters. After updating the recommendation model of the target client according to the local dataset, only the interaction layer parameters of the recommendation model need to be personalized updated according to the update gradients of the global model, the combined representative model, and the recommendation model, without the need to update the item layer parameters and user layer parameters again, reducing the data calculation amount and improving the model update efficiency on the basis of ensuring the model accuracy.

[0141] In this embodiment, the target client extracts the interaction layer parameters of the global model and extracts the interaction layer parameters of the combined representative model, then calculates the target interaction layer parameters based on the interaction layer update gradient of the recommendation model, the interaction layer parameters of the global model, and the interaction layer parameters of the combined representative model, and then updates the interaction layer parameters of the current recommendation model to the target interaction layer parameters, clarifying the steps of updating the current recommendation model of the target client according to the update gradients of the global model, the combined representative model, and the recommendation model, and updating the interaction layer parameters in a personalized manner, improving the accuracy of the recommendation model updated by the target client.

[0142] In one embodiment, as Figure 6As shown in the figure, in step S40, that is, updating the global model according to the local data set to obtain the updated parameter data of the global model, specifically including the following steps:

[0143] S41: The target client uses the gradient descent method to update the global model multiple times according to the local data set.

[0144] After receiving the global model sent by the server, while updating the local recommendation model according to the local data set and the global model, the target client also needs to use the gradient descent method to update the global model multiple times according to the local data set, and in the current training round (the training round is the total number of training rounds of the recommendation model training task), determine whether the update round of the global model by the target client (the update round is the number of rounds of update using the gradient descent method in each training round) is the preset number of rounds.

[0145] S42: When the update round of the global model by the target client is the preset number of rounds, the target client outputs the model obtained by updating the global model by the target client as the client global model, and records the parameters of the client global model as the updated model parameters.

[0146] After determining whether the update round of the global model by the target client is the preset number of rounds, if the update round of the global model by the target client is less than the preset number of rounds, indicating that the gradient descent is not completed, continue to update until the update round of the global model by the target client is the preset number of rounds; if the update round of the global model by the target client is the preset number of rounds, indicating that the gradient descent is completed, the target client outputs the model obtained by updating the global model by the target client as the client global model, and records the parameters of the client global model as the updated model parameters.

[0147] Among them, the update method of the global model by the target client can be as follows:

[0148]

[0149] Among them, represents the global model updated by the k-th target client for the global model in the r-th training round; w r-1 represents the global model sent by the server to the target client in the r-th training round, that is, the global model updated by the server in the previous training round (the r - 1 training round); η is the learning rate; represents the gradient of the loss function obtained by the target client updating the global model w in the server in the r - 1 training round according to the local data set r-1 , for update calculation.

[0150] S43: The target client uses the loss gradient between the client global model and the global model as the update gradient of the global model, and uses the updated model parameters and the update gradient as the update parameter data of the global model.

[0151] After the target client outputs the model obtained by updating the global model of the target client as the client global model, the target client uses the loss gradient between the client global model and the global model as the update gradient of the global model, and uses the updated model parameters and the update gradient as the update parameter data of the global model.

[0152] In this embodiment, the target client uses the gradient descent method to update the global model multiple times according to the local dataset. When the number of update rounds of the global model by the target client reaches the preset number of rounds, the model obtained by the target client updating the global model is output as the client global model, and the parameters of the client global model are recorded as the updated model parameters. Then, the target client uses the loss gradient between the client global model and the global model as the update gradient of the global model, and uses the updated model parameters and the update gradient as the update parameter data of the global model, which clarifies the specific steps for obtaining the update parameter data of the global model by updating the global model according to the local dataset. Each client uses the gradient descent method to update the global model multiple times, which can obtain a global model with relatively stable performance, improve the accuracy of the update gradient of the global model, and perform multiple updates locally on the client side, which can reduce the total number of training rounds of the recommendation model training task and reduce the amount of server data update, thereby reducing the load.

[0153] In one embodiment, the update parameter data of the global model includes the update gradient and the updated model parameters. As Figure 7 shown, in step S50, that is, according to the update gradients of the global model, the combined representative model, and the recommendation model, the current recommendation model of the target client is updated, which specifically includes the following steps:

[0154] S51: The server updates and calculates the parameters of different network layers of the global model according to multiple updated model parameters and the corresponding multiple update gradients to obtain the target model parameters of the global model.

[0155] After receiving the updated parameter data of the global model sent by the target client, the server updates and calculates the parameters of different network layers of the global model according to the updated parameter data sent by multiple target clients to obtain the target model parameters of the global model. Among them, the global model has the same structure as the recommendation model, both of which are two-tower models, that is, the global model also includes a user layer, an item layer, and an interaction layer. Therefore, according to multiple updated model parameters and corresponding multiple updated gradients, the parameters of different network layers (including the user layer, the item layer, and the interaction layer) of the global model are updated and calculated, that is, according to multiple updated model parameters and corresponding multiple updated gradients, the parameters of different network layers of the global model are updated and calculated to obtain the target model parameters of the global model. The target model parameters include target user layer parameters, target item layer parameters, and target interaction layer parameters.

[0156] S52: The server updates the target user layer parameters, target item layer parameters, and target item layer parameters to the global model to obtain the latest global model.

[0157] After updating and calculating the parameters of different network layers of the global model according to multiple updated model parameters and corresponding multiple updated gradients to obtain the target model parameters of the global model, the server updates the target user layer parameters, target item layer parameters, and target item layer parameters to the global model to obtain the latest global model.

[0158] In this embodiment, the server updates and calculates the parameters of different network layers of the global model according to multiple updated model parameters and corresponding multiple updated gradients to obtain the target model parameters of the global model. The target model parameters include target user layer parameters, target item layer parameters, and target interaction layer parameters. Then, the server updates the target user layer parameters, target item layer parameters, and target item layer parameters to the global model to obtain the latest global model, which refines the steps of updating the global model according to the received multiple updated parameter data to obtain the latest global model. According to the updated gradients and updated model parameters obtained by multiple target clients for updating the global model, the parameters of different network layers of the global model are calculated to obtain the target user layer parameters, target item layer parameters, and target item layer parameters, ensuring the accuracy of the global model.

[0159] In one embodiment, as Figure 8 shown, in step S51, that is, according to multiple updated model parameters and corresponding multiple updated gradients, the parameters of different network layers of the global model are updated and calculated to obtain the target model parameters of the global model, which specifically includes the following steps:

[0160] S511: The server extracts the user layer update parameters, item layer update parameters, and interaction layer update parameters in each updated model parameter, and extracts the user layer update gradient and item layer update gradient in the corresponding update gradient.

[0161] After receiving the updated parameter data (updated gradients and updated model parameters) of the global model sent by the target client, the server extracts the user layer updated parameters, item layer updated parameters, and interaction layer updated parameters in each updated model parameter, and extracts the user layer updated gradient and item layer updated gradient in the corresponding updated gradient.

[0162] S512: Determine the user layer updated gradient of the subordinate clients corresponding to the target client according to the user layer updated gradient corresponding to the target client, and then calculate the target user layer parameters according to the user layer updated gradients of all clients.

[0163] In this embodiment, the subordinate clients corresponding to the target client are other clients within the same client group as the target client.

[0164] After the server extracts the user layer updated parameters, item layer updated parameters, and interaction layer updated parameters in each updated model parameter, and extracts the user layer updated gradient and item layer updated gradient in the corresponding updated gradient, the server will determine the user layer updated gradient of the subordinate clients corresponding to the target client according to the user layer updated gradient corresponding to the target client, and then calculate the target user layer parameters according to the user layer updated gradients of all clients.

[0165] Among them, determining the user layer updated gradient of the subordinate clients corresponding to the target client according to the user layer updated gradient corresponding to the target client, and then calculating the target user layer parameters according to the user layer updated gradients of all clients includes: calculating the subordinate updated gradient of the corresponding subordinate client according to the discount factor and the user layer updated gradient corresponding to the target client; then updating the user layer parameters of the global model according to the subordinate updated gradient of the subordinate client to obtain the user layer updated parameters after the subordinate client updates the global model, and finally summarizing the user layer updated parameters after all clients update the global model to obtain the target user layer parameters.

[0166] After determining the user layer updated gradient corresponding to the target client, the server needs to obtain the pre-calibrated discount factor, then calculate the subordinate updated gradient of the subordinate client corresponding to the target client according to the discount factor and the user layer updated gradient corresponding to the target client, then update the user layer parameters of the global model according to the subordinate updated gradient of the subordinate client to obtain the user layer updated parameters after the subordinate client updates the global model, and finally summarize the user layer updated parameters after all clients update the global model to obtain the target user layer parameters.

[0167] Among them, the target client is d, the target client set is D, the other clients in the same client group as the target client are subordinate users s, and the subordinate user set is S (Note: the target client and subordinate clients will be continuously updated by re-clustering sampling in each training round). The target user layer parameters are determined as follows:

[0168] First, extract the user layer update parameters in each updated model parameter (i.e., the updated model parameters sent by each client), and then calculate the user layer update parameters after the slave client updates the global model based on the discount coefficient and the user layer update gradient corresponding to the target client, and then summarize the user layer update parameters of all clients (including the target client and the slave clients) to obtain the target user layer parameters:

[0169]

[0170] Among them, w r [U d ] represents the user layer parameter corresponding to the d-th target client in the global model at the r-th training round, that is, the user layer update parameter corresponding to the d-th target client at the r-th training round; It means that after the d-th target client updates the global model according to the local data set in the r-th training round, the user layer parameters of the new global model are obtained, that is, the user update parameters of the d-th target client in the r-th training round; Indicates that directly Assigned to the user layer of the global model in the server.

[0171] w r [U s ]←w r-1 [U s ]+exp (-r) *△w[U d ]fareachs∈S p ,d∈D p ;

[0172] Among them, w r [U s ] represents the user layer parameter corresponding to the slave client s in the global model at the rth training round, that is, the user layer update parameter corresponding to the sth slave client at the rth training round; w r-1 [U s ] represents the user layer parameter corresponding to the slave client s in the global model in the last training round (the r-1th training round); exp (-r) represents the discount coefficient at the rth training round; △w[U drepresents the user layer update gradient in the corresponding updated gradient, that is, the user layer update gradient obtained after the target client updates the global model; exp (-r) *△w[U d represents the user layer update gradient of the subordinate client corresponding to the target client; S p represents the subordinate client in the pth client combination, D p represents the target client in the pth client combination.

[0173] w r [U]=∑ d∈D w r [U d +∑ d∈S w r [U s ;

[0174] Among them, w r [U] represents the target user layer parameters calculated in the rth training round; w r [U d represents the user layer parameters corresponding to the dth target client in the global model at the rth training round, that is, the user layer update parameters corresponding to the dth target client in the rth training round; w r [U s represents the user layer parameters corresponding to the subordinate client s in the global model at the rth training round, that is, the user layer update parameters corresponding to the subordinate client s in the rth training round.

[0175] In this embodiment, the discount systems for different training rounds can be the same for subsequent calculations; in other embodiments, to ensure accuracy, the discount coefficients for each training round can also be different, and as the training rounds increase, the discount coefficients decay accordingly.

[0176] In this embodiment, a fast aggregation update strategy for inter-cluster sharing (i.e., the same client combination) update is proposed. Only by calculating the parameter update of the target client can its update be shared with its subordinate clients, and then the parameters of the global model can be calculated based on the update parameters of all clients, accelerating the update iteration of the global model parameters. On the basis of ensuring that all clients participate in the global model update and improving the accuracy of the global model, the update efficiency and convergence speed of the global model are effectively accelerated.

[0177] S513: Calculate the target item layer parameters after all target clients update the global model according to the item layer update parameters and item layer update gradients corresponding to each target client.

[0178] After the server extracts the item layer update parameters in each updated model parameter and extracts the item layer update gradients in the corresponding update gradients, the server calculates the target item layer parameters after all target clients update the global model according to the item layer update parameters and item layer update gradients corresponding to each target client.

[0179] Different from the situation where a user on a certain client will not appear in more than two client combinations, the same item may have interacted with multiple types of users, that is, the same item information may appear in the client data of different client combinations. When training, multiple selected target clients may also contain this item information, and it will be updated repeatedly when updating the global model. However, if the updated item vectors are simply averaged, the update step size will become very small. Therefore, to ensure the accuracy of item layer parameter update, it is necessary to collect all items interacted by users in each target client and use the item set to jointly update the item layer parameters.

[0180] First, let the item set be I. For the d-th target client, use i to represent the item interacted with the user on the d-th target client. Then, the magnitude of the change of item i on the d-th target client, that is, the item layer update gradient is:

[0181]

[0182] where, θ d [i] represents the magnitude of the change of item i on the d-th target client, that is, the item layer update gradient obtained by the d-th target client updating the global model according to the local dataset in the r-th training round; represents the item layer parameters of the global model updated by the d-th target client according to the local dataset in the r-th training round, that is, the item layer update parameters of the d-th target client in the r-th training round; w r-1 [i] represents the item layer parameters of the global model updated by the server in the (r - 1)-th training round, that is, the global model received by the d-th target client in the r-th training round.

[0183] Then, according to the above θ d [i], the weighted average of the magnitudes of the changes of this item i on all target clients is calculated, and the weighted average result is used as the item layer update parameter of item i for the global model:

[0184]

[0185] where, represents the item parameters of the new global model obtained after the d-th target client updates the global model according to the local dataset in the r-th training round, that is, the item layer update parameters corresponding to the target client; θ d[i] represents the item layer update gradient obtained by the target client d updating the global model according to the local dataset at the r-th training round; w r [i] represents the item layer parameter corresponding to item i after the server updates the global model at the r-th training round, that is, the item layer update parameter of item i for the global model.

[0186] At the r-th training round, all w r [i] are aggregated to obtain the target item layer parameter, that is, the calculation formula for the target item layer parameter is as follows:

[0187] w r [I] = ∑ i∈I w r [i];

[0188] Among them, w r [I] represents the target item layer parameter, and w r [i] represents the item layer parameter corresponding to item i after the server updates the global model at the r-th training round.

[0189] In this embodiment, the problem of repeated superposition of the same item in multiple client data during update is avoided. The update amount (item layer update gradient) of any item for the target client is weighted and averaged as the item layer update parameter of item i for the global model, so as to obtain the update result of the interactive items of all target clients for the global model, improve the accuracy of the item layer parameters in the global model, and provide a basis for obtaining a better-performing recommendation model by updating according to the global model later.

[0190] S514: Perform weighted calculation on the interactive layer update parameters of all target clients to obtain the target interactive layer parameter.

[0191] After the server extracts the interactive layer update parameters in each updated model parameter, perform weighted calculation on the interactive layer update parameters of all target clients to obtain the target interactive layer parameter.

[0192] Among them, the target interactive layer parameter is calculated in the following way:

[0193]

[0194] Among them, D represents the set of target clients, and w r [N] represents the interactive layer parameter after the server updates the global model at the r-th training round, that is, the target interactive layer parameter at the r-th training round; represents the interactive layer parameter obtained by the d-th target client updating the global model according to the local dataset at the r-th training round, that is, the interactive layer update parameter of the d-th target client at the r-th training round; δ dRepresents the data volume size (number of user interaction records) of the local dataset of the d-th target client; δ represents the total data volume size of all target clients at the r-th training round, that is, the data volume size after aggregating the local datasets of all target clients at the r-th training round.

[0195] In this embodiment, the server extracts the user layer update parameters, item layer update parameters, and interaction layer update parameters in each updated model parameter, and extracts the user layer update gradient and item layer update gradient in the corresponding update gradient. Then, according to the user layer update gradient corresponding to the target client, the user layer update gradient of the subordinate client corresponding to the target client is determined. Then, based on the user layer update gradients of all clients, the target user layer parameters are calculated. The subordinate client is other clients within the same client group as the target client. At the same time, according to the item layer update parameters and item layer update gradients corresponding to each target client, the target item layer parameters after the global model is updated by all target clients are calculated. At the same time, the interaction layer update parameters of all target clients are weighted and calculated to obtain the target interaction layer parameters, which clarifies the steps of updating and calculating the parameters of different network layers of the global model according to multiple updated model parameters and corresponding multiple update gradients to obtain the target model parameters of the global model, providing a basis for subsequently updating the comprehensive model according to the target user layer parameters, target item layer parameters, and target interaction layer parameters.

[0196] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The order of execution of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.

[0197] In one embodiment, a recommendation model training system is provided, and this recommendation model training system corresponds one-to-one with the recommendation model training method in the above embodiment. As Figure 9 shown, this recommendation model training system includes a server and n clients, where n is an integer greater than 1. The detailed description of each functional module is as follows:

[0198] The server is used to perform K-means clustering on all clients to obtain multiple client groups, select the same number of target clients in each client group to obtain multiple target clients, and send the global model to each target client;

[0199] The target client is used to update the recommendation model of the target client according to the local dataset and the global model, update the global model according to the local dataset to obtain the updated parameter data of the global model, and send the updated parameter data to the server;

[0200] The server is also used for:

[0201] Update the global model according to the received multiple update parameter data to obtain a new global model;

[0202] When the new global model does not meet the convergence condition, re-cluster all clients to obtain multiple target clients, and send the new global model to each target client to receive the update parameter data returned by each target client and update the global model until the latest global model meets the convergence condition, then notify each client to stop updating the recommendation model.

[0203] Further, before updating the recommendation model of the target client according to the local dataset and the global model, the server is also used to:

[0204] Perform weighted averaging on the recommendation models of all clients in each client combination to obtain a combined representative model corresponding to the client combination;

[0205] Send the corresponding combined representative model to the target client corresponding to the client combination, so that the target client updates the recommendation model of the target client according to the local dataset, the received combined representative model and the global model.

[0206] Further, the target client is specifically used to update the recommendation model of the target client in the following way:

[0207] Update the recommendation model of the target client according to the local dataset to obtain the update gradient of the recommendation model;

[0208] Update the current recommendation model of the target client according to the global model, the combined representative model and the update gradient of the recommendation model.

[0209] Further, the target client is specifically also used to update the current recommendation model of the target client in the following way:

[0210] Extract the interaction layer parameters of the global model and extract the interaction layer parameters of the combined representative model;

[0211] Calculate the target interaction layer parameters according to the interaction layer update gradient of the recommendation model, the interaction layer parameters of the global model and the interaction layer parameters of the combined representative model;

[0212] Update the interaction layer parameters of the current recommendation model to the target interaction layer parameters.

[0213] Further, the target client is specifically also used to update the update parameter data of the global model in the following way:

[0214] The target client uses the gradient descent method to update the global model multiple times according to the local dataset;

[0215] When the number of update rounds of the global model by the target client reaches the preset number of rounds, the target client outputs the model obtained by updating the global model by the target client as the client global model, and records the parameters of the client global model as the updated model parameters;

[0216] The target client uses the loss gradient between the client global model and the global model as the update gradient of the global model, and uses the updated model parameters and the update gradient as the updated parameter data.

[0217] Further, the updated parameter data includes the update gradient and the updated model parameters. Specifically, the server is used to update to obtain the latest global model in the following way:

[0218] According to multiple updated model parameters and the corresponding multiple update gradients, update calculations are performed on the parameters of different network layers of the global model to obtain the target model parameters of the global model. The target model parameters include the target user layer parameters, the target item layer parameters, and the target interaction layer parameters;

[0219] Update the target user layer parameters, the target item layer parameters, and the target item layer parameters to the global model to obtain the latest global model.

[0220] Further, specifically, the server is used to obtain the target model parameters of the global model in the following way, including:

[0221] The server extracts the user layer update parameters, the item layer update parameters, and the interaction layer update parameters in each updated model parameter, and extracts the user layer update gradient and the item layer update gradient in the corresponding update gradient;

[0222] According to the user layer update gradient corresponding to the target client, determine the user layer update gradient of the subordinate client corresponding to the target client, and then calculate the target user layer parameters according to the user layer update gradients of all clients. The subordinate client is other clients within the same client group as the target client;

[0223] According to the item layer update parameters and the item layer update gradients corresponding to each target client, calculate the target item layer parameters after the global model is updated by all target clients;

[0224] Perform weighted calculation on the interaction layer update parameters of all target clients to obtain the target interaction layer parameters.

[0225] For the specific limitations of the recommendation model training system, reference can be made to the limitations on the recommendation model training method in the above text, which will not be elaborated here. Each function of the server and the client in the above recommendation model training system can be implemented in whole or in part by software, hardware, and their combination.

[0226] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structural diagram may be as shown in Figure 10 Figure 1. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a storage medium and an internal memory. The storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the storage medium. The database of the computer device is used to store the data used and generated in the above-mentioned recommended model training method, such as data such as the global model and the updated parameter data sent by the client. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a recommended model training method.

[0227] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structural diagram may be as shown in Figure 11 Figure 2. The computer device includes a processor, a memory, and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a storage medium and an internal memory. The 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 storage medium. The network interface of the computer device is used to communicate with an external server through a network connection. When the computer program is executed by the processor, it implements a recommended model training method.

[0228] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the functions of the server or the client in the above-mentioned recommended model training method.

[0229] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by the processor, it implements the functions of the server or the client in the above-mentioned recommended model training method.

[0230] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.

[0231] Those skilled in the art can clearly understand that for the convenience and brevity of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0232] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for training a recommendation model, characterized in that, it includes: The server performs K-means clustering on all clients to obtain multiple client combinations, selects the same number of target clients in each client combination to obtain multiple target clients, and sends the global model to each target client; The target client updates the recommendation model of the target client according to the local dataset and the global model, updates the global model according to the local dataset to obtain the updated parameter data of the global model, and sends the updated parameter data to the server; The server updates the global model according to the received multiple pieces of updated parameter data to obtain a new global model; When the new global model does not meet the convergence condition, the server re-clusters all the clients to obtain multiple target clients, and sends the new global model to each target client to receive the updated parameter data returned by each target client and update the global model until the latest global model meets the convergence condition, and then notifies each client to stop updating the recommendation model; Among them, the updating of the recommendation model of the target client according to the local dataset and the global model includes: Updating the recommendation model according to the local dataset to obtain the loss gradient after updating the recommendation model; Calculating a correction gradient according to the global model, the recommendation model and a correction coefficient; Performing correction update on the recommendation model by using the gradient descent method according to the correction gradient and the loss gradient until the number of model update rounds reaches a preset number of rounds; The correction gradient is calculated by the following method: Among them, represents the corrected gradient of the th target client in the th training round; represents the latest recommended model locally saved by the th target client, which is the recommended model updated by the target client in the previous training round (i.e., the th training round); is the correction coefficient; represents the two-norm; represents the global model sent from the server to the client at the th training round, that is, the global model updated by the server in the previous training round (the th training round); represents the gradient of the loss function obtained by the target client through updating and calculating the recommended model on the local dataset of the target client.

2. The recommendation model training method according to claim 1, characterized in that, Before updating the recommendation model of the target client according to the local dataset and the global model, the method further includes: The server performs weighted averaging on the recommendation models of all clients in each client combination to obtain a combined representative model corresponding to the client combination; The server sends the corresponding combined representative model to the target client corresponding to the client combination, so that the target client updates the recommendation model of the target client according to the local dataset, the received combined representative model and the global model.

3. The recommendation model training method according to claim 2, characterized in that, The updating of the recommendation model of the target client according to the local dataset, the received combined representative model and the global model includes: The target client updates the recommendation model of the target client according to the local dataset to obtain the update gradient of the recommendation model; The target client updates the current recommendation model of the target client according to the global model, the combined representative model and the update gradient of the recommendation model.

4. The recommendation model training method according to claim 3, characterized in that, The update gradient of the recommendation model includes the update gradient of the interaction layer of the recommendation model. Updating the current recommendation model of the target client according to the global model, the combined representative model, and the update gradient of the recommendation model includes: The target client extracts the interaction layer parameters of the global model and extracts the interaction layer parameters of the combined representative model; The target client calculates target interaction layer parameters according to the update gradient of the interaction layer of the recommendation model, the interaction layer parameters of the global model, and the interaction layer parameters of the combined representative model; The target client updates the interaction layer parameters of the current recommendation model to the target interaction layer parameters.

5. The recommendation model training method according to claim 1, wherein, Updating the global model according to the local dataset to obtain the updated parameter data of the global model includes: The target client uses the gradient descent method to perform multiple rounds of updates on the global model according to the local dataset; When the number of update rounds of the global model by the target client is the preset number of rounds, the target client outputs the model obtained by the target client updating the global model as the client global model, and records the parameters of the client global model as the updated model parameters; The target client uses the loss gradient between the client global model and the global model as the update gradient of the global model, and uses the updated model parameters and the update gradient as the updated parameter data.

6. The recommendation model training method according to any one of claims 1-5, wherein, The updated parameter data includes an update gradient and updated model parameters. Updating the global model according to the received multiple pieces of updated parameter data to obtain the latest global model includes: The server performs update calculations on the different network layer parameters of the global model according to the multiple updated model parameters and the corresponding multiple update gradients to obtain the target model parameters of the global model. The target model parameters include target user layer parameters, target item layer parameters, and target interaction layer parameters; The server updates the target user layer parameters, the target item layer parameters, and the target item layer parameters to the global model to obtain the latest global model.

7. The recommendation model training method according to claim 6, wherein, Performing update calculations on the different network layer parameters of the global model according to the multiple updated model parameters and the corresponding multiple update gradients to obtain the target model parameters of the global model includes: The server extracts the user layer update parameters, item layer update parameters, and interaction layer update parameters in each updated model parameter, and extracts the user layer update gradient and item layer update gradient in the corresponding update gradient; Determine the user layer update gradient of the subordinate clients corresponding to the target client according to the user layer update gradient corresponding to the target client, and then calculate the target user layer parameter based on the user layer update gradients of all the clients. The subordinate clients are other clients within the same client group as the target client; Calculate the target item layer parameter after updating the global model by all the target clients according to the item layer update parameter and the item layer update gradient corresponding to each target client; Perform weighted calculation on the interaction layer update parameters of all the target clients to obtain the target interaction layer parameter.

8. A recommendation model training system, characterized in that, it includes: A server, configured to perform K-means clustering on all clients to obtain multiple client groups, select the same number of target clients in each client group to obtain multiple target clients, and send the global model to each target client; The target client is configured to update the recommendation model of the target client according to the local dataset and the global model, update the global model according to the local dataset to obtain the update parameter data of the global model, and send the update parameter data to the server; The server is further configured to: Update the global model according to the received multiple update parameter data to obtain a new global model; When the new global model does not meet the convergence condition, re-cluster all the clients to obtain multiple target clients, and send the new global model to each target client to receive the update parameter data returned by each target client and update the global model until the latest global model meets the convergence condition, and then notify each client to stop updating the recommendation model; Wherein, the updating the recommendation model of the target client according to the local dataset and the global model includes: Update the recommendation model according to the local dataset to obtain the loss gradient after updating the recommendation model; Calculate the correction gradient according to the global model, the recommendation model and the correction coefficient; Perform correction update on the recommendation model by using the gradient descent method according to the correction gradient and the loss gradient until the number of model update rounds reaches the preset number of rounds; The correction gradient is calculated by the following method: Among them, represents the corrected gradient of the th target client in the th training round; represents the latest recommendation model locally saved by the th target client, which is the recommendation model updated by the target client in the previous training round (i.e., the th training round); is the correction coefficient; represents the two-norm; represents the global model sent from the server to the client at the th training round, that is, the global model updated by the server in the previous training round (the th training round); represents the loss function gradient obtained by the target client through update calculation of the recommendation model locally stored by the target client according to the local dataset.

9. A computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, the steps of the recommendation model training method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, the steps of the recommendation model training method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Federal learning algorithm based on model obsolessness and user participation perception

    CN114169543A