Recommendation method and device based on federal learning, equipment and storage medium
By grouping target objects in the federal recommendation system and sending a model parameter set, the problem of existing systems ignoring personalized needs when ensuring group fairness is solved, achieving fairer and more accurate recommendation results.
Patent Information
- Application Number
- CN202510068033.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2045-01-16
AI Technical Summary
The existing federal recommendation system ignores the user's personalized needs when ensuring group fairness, resulting in unfair recommendation performance.
By receiving the target attributes uploaded by the target object on the server side, grouping them to form groups and subgroups, and sending the corresponding model parameter set to the target object, so that its local model is trained to improve the fairness of the recommendation system.
It achieves the implementation of providing more accurate and personalized recommendation results while ensuring group and individual fairness, and improves the credibility of the system.
Smart Images

Figure CN119474489A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a recommendation method, device, equipment and storage medium based on federated learning. Background Art
[0002] Recommendation systems can identify users' preferences for different items from a large amount of data, thereby providing accurate and satisfactory recommendation results. The federated recommendation system integrates federated learning into the recommendation scenario, providing users with potential and valuable services, while protecting user privacy by keeping sensitive data locally.
[0003] Fairness can ensure that the federated recommendation system provides fair recommendation performance to users, thereby improving the credibility of the system. Fairness is divided into two concepts, namely individual fairness and group fairness. Specifically, individual fairness requires that similar individuals be treated equally. Group fairness, as the most widely studied fairness concept, aims to ensure that the recommendation performance is fair among various groups defined by sensitive attributes.
[0004] Most of the federated recommendation systems in the related art usually only focus on group fairness, that is, the federated recommendation systems usually only focus on a single sensitive attribute in the recommendation task and ignore the personalized needs of users. Summary of the invention
[0005] In view of this, the present application provides a recommendation method, apparatus, device and storage medium based on federated learning to help improve the fairness of the recommendation system.
[0006] In a first aspect, an embodiment of the present application provides a recommendation method based on federated learning, which is applied to a server, and the method includes: Receive target attributes uploaded by the target object; Grouping the target objects based on the target attributes to obtain at least one group; For each group: grouping the target objects based on the attribute value of the target attribute to obtain at least one subgroup; For each subgroup, a model parameter set corresponding to the subgroup is sent to each target object in the subgroup; so that the target object trains a local model according to the received model parameter set; and the local model is used to perform a recommendation operation.
[0007] In some possible embodiments, the model parameter set includes: global model update parameters of the previous round, and the method further includes: Receive the first local parameter uploaded by each target object; Receive the model difference sent by each target object; Obtaining a second local parameter based on the first local parameter corresponding to each target object; Aggregating the second local parameter, the first local parameter corresponding to each of the target objects, and the model difference corresponding to each of the target objects to obtain a global model update parameter; The global model update parameters are used to update the stored global model update parameters of the previous round.
[0008] In some possible embodiments, the model parameter set includes: the subgroup model update parameters of the previous round, and after receiving the model difference sent by each target object, the method further includes: For each subgroup; constructing subgroup parameters based on the local data corresponding to each target object in the subgroup; Aggregating the second local parameter, the subpopulation parameter, and the model difference to obtain a subpopulation model update parameter; The sub-group model update parameters are used to update the stored sub-group model update parameters of the previous round.
[0009] In some possible embodiments, the model parameter set includes: the regularization term strength of the previous round, and after constructing the subgroup parameters based on the local data corresponding to each target object in the subgroup, the method further includes: Receiving a local prediction error sent by each of the target objects; Aggregating the second local parameter, the subgroup parameter, and the local prediction error to obtain a target regularization term strength; The target regularization term strength is used to update the stored regularization term strength of the previous round.
[0010] In some possible embodiments, the model parameter set includes: the last round of update weights, and the method further includes: Receive the fairness metric sent by each target object; Obtaining a fairness metric mean based on the fairness metric value sent by each target object; For each subgroup: obtaining a group measurement value based on the fairness measurement value sent by each target object in the subgroup; obtaining a target update weight corresponding to the subgroup based on the group measurement value and the fairness measurement mean; and updating the previous round update weight using the target update weight.
[0011] In a second aspect, an embodiment of the present application provides a recommendation method based on federated learning, which is applied to a target object, and the method includes: Acquire a model parameter set from a server; the model parameter set is a model parameter set corresponding to the subgroup to which the target object belongs; the subgroup to which the target object belongs is determined according to the target attribute uploaded by the target object; Determining an optimization target value according to the model parameter set; Training the local model according to the optimization target value to obtain a trained local model; The trained local model is used to perform a recommendation operation.
[0012] In some possible embodiments, the model parameter set includes: global model update parameters of the previous round, and subgroup model update parameters of the previous round, and determining the optimization target value according to the model parameter set includes: Get the initial model parameters of the previous round; Based on the initial model parameters of the previous round and the subpopulation model update parameters of the previous round, obtaining local model parameters of the local model; Based on the initial model parameters of the previous round and the global model update parameters of the previous round, obtaining global model parameters of the global model of the target object; An optimization target value is obtained based on the training data set corresponding to the target object, the local model parameters, and the global model parameters.
[0013] In some possible embodiments, the model parameter set includes: the regularization term strength of the previous round, and the optimization target value is obtained based on the training data set corresponding to the target object, the local model parameters, and the global model parameters, including: Determine the interaction record and the amount of interaction data corresponding to the target object based on the training data set; The optimization target value is obtained based on the interaction record, the amount of interaction data, the regularization term strength of the previous round, the local model parameters, the global model parameters and a preset loss function.
[0014] In some possible embodiments, after obtaining the optimization target value, the method further includes: Determining the interaction record corresponding to the target object based on the training data set; Obtaining a local loss value based on the interaction record, the loss function, and the local model parameters; Obtaining a global loss value based on the interaction record, the loss function, and the global model parameters; Get the validation dataset; Obtaining a local prediction error based on the local loss value, the global loss value, and the validation data set; The local prediction error is uploaded to the server, so that the server updates the regularization term strength of the previous round according to the local prediction error.
[0015] In some possible embodiments, training the local model according to the optimization target value to obtain the trained local model includes: Obtaining a target training round according to the updated weight of the previous round and a preset round initial value; The local model is trained using the training data set, the target training round, and the optimization target value to obtain a trained local model and current model parameters of the local model.
[0016] In some possible embodiments, after obtaining the optimization target value, the method further includes: Obtaining a model difference according to the current model parameters and the local model parameters; The model difference is uploaded to the server, so that the server updates the global model update parameters of the previous round stored in the model parameters according to the model difference.
[0017] In some possible embodiments, after obtaining the current model parameters of the local model, the method further includes: Get the validation dataset; Determining the interaction record corresponding to the target object based on the training data set; Obtaining accuracy based on the interaction record, the current model parameters, and a preset accuracy function; Based on the accuracy and the validation data set, obtaining a fairness metric value; The fairness metric value is uploaded to the server, so that the server updates the last round of update weights according to the fairness metric value.
[0018] In a third aspect, an embodiment of the present application provides a recommendation device based on federated learning, which is applied to a server, and the device includes: A receiving module, used to receive target attributes uploaded by a target object; A first grouping module, configured to group the target objects based on the target attributes to obtain at least one group; A second grouping module is used for grouping the target objects based on the attribute value of the target attribute for each group to obtain at least one subgroup; The parameter sending module is used to send the model parameter set corresponding to each subgroup to each target object in the subgroup, so that the target object can train the local model according to the received model parameter set; the local model is used to perform the recommendation operation.
[0019] In some possible embodiments, the model parameter set includes: global model update parameters of the previous round, and the parameter sending module is further used to: Get the local data corresponding to each target object; Receive the model difference sent by each target object; Obtaining a second local parameter based on local data corresponding to each target object; Aggregating the second local parameter, the local data corresponding to each of the target objects, and the model difference corresponding to each of the target objects to obtain a global model update parameter; The global model update parameters are used to update the stored global model update parameters of the previous round.
[0020] In some possible embodiments, the model parameter set includes: the subgroup model update parameters of the previous round, and the parameter sending module is further used to: For each subgroup; constructing subgroup parameters based on the local data corresponding to each target object in the subgroup; Aggregating the second local parameter, the subpopulation parameter, and the model difference to obtain a subpopulation model update parameter; The sub-group model update parameters are used to update the stored sub-group model update parameters of the previous round.
[0021] In some possible embodiments, the model parameter set includes: the regularization term strength of the previous round, and the parameter delivery module is further used for: Receiving a local prediction error sent by each of the target objects; Aggregating the second local parameter, the subgroup parameter, and the local prediction error to obtain a target regularization term strength; The target regularization term strength is used to update the stored regularization term strength of the previous round.
[0022] In some possible embodiments, the model parameter set includes: the last round of update weights, and the parameter delivery module is further used to: Receive the fairness metric sent by each target object; Obtaining a fairness metric mean based on the fairness metric value sent by each target object; For each subgroup: obtaining a group measurement value based on the fairness measurement value sent by each target object in the subgroup; obtaining a target update weight corresponding to the subgroup based on the group measurement value and the fairness measurement mean; and updating the previous round update weight using the target update weight.
[0023] In a fourth aspect, an embodiment of the present application provides a recommendation device based on federated learning, which is applied to a target object, and the device includes: A parameter receiving module, used for acquiring a model parameter set from a server; the model parameter set is a model parameter set corresponding to the subgroup to which the target object belongs; the subgroup to which the target object belongs is determined according to the target attribute uploaded by the target object; An optimization target value determination module, used to determine the optimization target value according to the model parameter set; A training module, used for training the local model according to the optimization target value to obtain a trained local model; The recommendation module is used to perform recommendation operations using the trained local model.
[0024] In some possible embodiments, the model parameter set includes: global model update parameters of the previous round, subgroup model update parameters of the previous round, and the optimization target value determination module is used to: Get the initial model parameters of the previous round; Based on the initial model parameters of the previous round and the subpopulation model update parameters of the previous round, obtaining local model parameters of the local model; Based on the initial model parameters of the previous round and the global model update parameters of the previous round, obtaining global model parameters of the global model of the target object; An optimization target value is obtained based on the training data set corresponding to the target object, the local model parameters, and the global model parameters.
[0025] In some possible embodiments, the model parameter set includes: the regularization term strength of the previous round, and the optimization target value determination module is used to: Determine the interaction record and the amount of interaction data corresponding to the target object based on the training data set; The optimization target value is obtained based on the interaction record, the amount of interaction data, the regularization term strength of the previous round, the local model parameters, the global model parameters and a preset loss function.
[0026] In some possible embodiments, the optimization target value determination module is further used to: Determining the interaction record corresponding to the target object based on the training data set; Obtaining a local loss value based on the interaction record, the loss function, and the local model parameters; Obtaining a global loss value based on the interaction record, the loss function, and the global model parameters; Get the validation dataset; Obtaining a local prediction error based on the local loss value, the global loss value, and the validation data set; The local prediction error is uploaded to the server, so that the server updates the regularization term strength of the previous round according to the local prediction error.
[0027] In some possible embodiments, the training module is specifically used to: Obtaining a target training round according to the updated weight of the previous round and a preset round initial value; The local model is trained using the training data set, the target training round, and the optimization target value to obtain a trained local model and current model parameters of the local model.
[0028] In some possible embodiments, the optimization target value determination module is further used to: Obtaining a model difference according to the current model parameters and the local model parameters; The model difference is uploaded to the server, so that the server updates the global model update parameters of the previous round stored in the model parameters according to the model difference.
[0029] In some possible embodiments, the optimization target value determination module is further used to: Get the validation dataset; Determining the interaction record corresponding to the target object based on the training data set; Obtaining accuracy based on the interaction record, the current model parameters, and a preset accuracy function; Based on the accuracy and the validation data set, obtaining a fairness metric value; The fairness metric value is uploaded to the server, so that the server updates the last round of update weights according to the fairness metric value.
[0030] In the fifth aspect, another embodiment of the present application also provides an electronic device, comprising at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any method provided in the embodiment of the first aspect of the present application.
[0031] In the sixth aspect, another embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is used to enable a computer to execute any method provided in the embodiment of the first aspect of the present application.
[0032] Other features and advantages of the present application will be described in the subsequent description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0034] Figure 1 A schematic diagram of an application scenario of a recommendation method based on federated learning provided in an embodiment of the present application; Figure 2 A schematic diagram of the overall process of a recommendation method based on federated learning provided in an embodiment of the present application when the execution subject is a server; Figure 3 A schematic diagram of the update process of the global model update parameters of the previous round of a recommendation method based on federated learning provided in an embodiment of the present application; Figure 4 A schematic diagram of the updating process of the subgroup model updating parameters of the previous round of a recommendation method based on federated learning provided in an embodiment of the present application; Figure 5 A schematic diagram of a process for updating the strength of a regularization term in the previous round of a recommendation method based on federated learning provided in an embodiment of the present application; Figure 6 A schematic diagram of the update process of the last round of weight update of a recommendation method based on federated learning provided in an embodiment of the present application; Figure 7 A flowchart of a recommendation method based on federated learning provided in an embodiment of the present application, in which the execution subject is a target object; Figure 8 A schematic diagram of a flow chart of determining an optimization target value according to a model parameter set in a recommendation method based on federated learning provided in an embodiment of the present application; Fig. 9 A schematic diagram of a flow chart of determining a local prediction error in a recommendation method based on federated learning provided in an embodiment of the present application; Fig.10 A schematic diagram of a flow chart of determining a model difference in a recommendation method based on federated learning provided in an embodiment of the present application; Fig.11A schematic diagram of a process for determining a fairness metric value of a recommendation method based on federated learning provided in an embodiment of the present application; Fig.12 A schematic diagram of a device for a recommendation method based on federated learning provided in an embodiment of the present application; Fig.13 A schematic diagram of another device for a recommendation method based on federated learning provided in an embodiment of the present application; Fig.14 A schematic diagram of an electronic device for a recommendation method based on federated learning provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to better understand the technical solution of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0036] It should be clear that the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0037] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0038] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0039] The inventors found that the recommendation system can identify users' preferences for different items from a large amount of data, thereby providing accurate and satisfactory recommendation results. Centralized recommendation systems require users to upload local data to a central server or a third party, which brings the risk of privacy leakage. To address this problem, the federated recommendation system has become an effective solution, integrating federated learning into the recommendation scenario to provide users with potential and valuable services, while protecting their privacy by keeping sensitive data locally instead of transmitting it to a central server.
[0040] Fairness can ensure that the federated recommendation system provides fair recommendation performance to users, thereby improving the credibility of the system. Fairness can be divided into two concepts, namely individual fairness and group fairness. Specifically, individual fairness requires that similar individuals be treated equally. Group fairness, as the most widely studied fairness concept, aims to ensure that the recommendation performance is fair among various groups defined by sensitive attributes.
[0041] Most of the federated recommendation systems in the related art usually only focus on group fairness, that is, the federated recommendation systems usually only focus on a single sensitive attribute in the recommendation task and ignore the personalized needs of users.
[0042] In view of the above problems, the embodiments of the present application provide a recommendation method, apparatus, device and storage medium based on federated learning to solve the above problems. The inventive concept of the present application can be summarized as follows: receiving target attributes uploaded by a target object; grouping the target objects based on the target attributes to obtain at least one group; for each group: grouping the target objects based on the attribute values of the target attributes to obtain at least one subgroup; for each subgroup, sending the model parameter set corresponding to the subgroup to each target object in the subgroup; so that the target object trains the global model and the local model according to the received model parameter set; the local model is used to perform the recommendation operation.
[0043] In an embodiment of the present application, users can select their desired sensitive attributes, construct different groups based on different sensitive attributes, and construct subgroups based on different values in the groups. A corresponding set of model parameters is set for each subgroup, thereby ensuring that the trained local model is more accurate and can provide higher recommendation performance while ensuring fairness.
[0044] For ease of understanding, a recommendation method based on federated learning provided in an embodiment of the present application is described in detail below with reference to the accompanying drawings: like Figure 1 As shown, it is an application scenario diagram of a recommendation method based on federated learning in an embodiment of the present application. The diagram includes: a server 10, a target object 20; wherein: The server 10 receives the target attributes uploaded by the target object 20; the target objects 20 are grouped based on the target attributes to obtain at least one group; for each group: the target objects 20 are grouped based on the attribute values of the target attributes to obtain at least one subgroup; for each subgroup, the model parameter set corresponding to the subgroup is sent to each target object 20 in the subgroup; the target object 20 obtains the model parameter set from the server; the target object 20 determines whether the local model converges according to the model parameter set; if the local model does not converge, the model parameter set is used to train the local model to obtain a trained local model; and the trained local model is used to perform a recommendation operation.
[0045] In this application, the target object is the terminal device with the recommended function used by the user, including but not limited to: computers, laptops, mobile phones, tablet computers, and electronic watches.
[0046] The description in this application only details a single server 10 and a target object 20, but those skilled in the art should understand that the server 10 and the target object 20 shown are intended to represent the operation of the server 10 and the target object 20 involved in the technical solution of this application. It does not imply any limitation on the number, type or location of the server 10 and the target object 20. It should be noted that if additional modules are added to the illustrated environment or individual modules are removed therefrom, the underlying concepts of the exemplary embodiments of this application will not be changed.
[0047] It should be noted that the recommendation method based on federated learning proposed in this application is not only applicable to Figure 1 The application scenarios shown are also applicable to any device with recommended requirements.
[0048] First, a recommendation method based on federated learning with the execution subject being the server is described. Figure 2 As shown, a flowchart of a recommendation method based on federated learning provided by an embodiment of the present application, in which the execution subject is a server, is shown, wherein: In step 201: receiving target attributes uploaded by a target object.
[0049] In the embodiment of the present application, it is considered that the fairness research of the current federal recommendation system presets a sensitive attribute for all users, and users cannot choose the desired sensitive attribute according to their actual situation. For example, female users may want to use gender as a sensitive attribute, while older users tend to choose age as a sensitive attribute. If all users are forced to choose only a fixed sensitive attribute, it will greatly affect the enthusiasm of users. Therefore, in the embodiment of the present application, users can be provided with the opportunity to select attributes, and the attributes selected by users can be used as target attributes. Users can select the attributes they are concerned about in the target object, and the target object will upload the attributes selected by users to the server.
[0050] It should be noted that in the embodiment of the present application, there is no limit on the number of target attributes selected by the user, that is, the user can select only one attribute or select multiple attributes at the same time.
[0051] For example: User 1 selects gender as the target attribute, and User 2 selects gender and age as the target attributes.
[0052] In step 202: the target objects are grouped based on the target attributes to obtain at least one group.
[0053] In the embodiment of the present application, in order to ensure that each user can obtain the same recommendation performance, after obtaining the target attributes, the target objects can be grouped according to the target attributes to obtain multiple groups, and then different groups can be processed to ensure fairness among the groups.
[0054] In some possible embodiments, when the target objects are grouped based on the target attributes, it can be specifically implemented as follows: target objects with the same target attributes are grouped as one group.
[0055] For example: the target attribute uploaded by target object 1 is: gender, the target attribute uploaded by target object 2 is: age, the target attribute uploaded by target object 3 is: age, the target attribute uploaded by target object 4 is: age, the target attribute uploaded by target object 5 is: gender, the target attribute uploaded by target object 6 is: gender, and the target attribute uploaded by target object 7 is: age; then two groups can be obtained, namely: group 1 and group 2, among which group 1 includes: target object 1, target object 5, target object 6; group 2 includes: target object 2, target object 3, target object 4, target object 7.
[0056] For another example: the target attributes uploaded by target object 1 are: gender, age, the target attributes uploaded by target object 2 are: age, the target attributes uploaded by target object 3 are: age, the target attributes uploaded by target object 4 are: gender, age, the target attributes uploaded by target object 5 are: gender, the target attributes uploaded by target object 6 are: gender, and the target attributes uploaded by target object 7 are: age; then three groups can be obtained, namely: group 1, group 2 and group 3, among which group 1 includes: target object 1 and target object 4; group 2 includes: target object 2, target object 3 and target object 7; group 3 includes: target object 5 and target object 6.
[0057] That is, in the embodiment of the present application, only when the target attributes are completely the same can the corresponding target objects be divided into one group.
[0058] In step 203: for each group: group the target objects based on the attribute value of the target attribute to obtain at least one subgroup.
[0059] In an embodiment of the present application, different users may have different choices for the same attribute. For example, for the gender attribute, the attribute value of some users is "female", while the attribute value of other users is "male". Therefore, in order to further ensure that each user can enjoy the same recommendation performance, after obtaining the group, the target objects in the group can be grouped again according to the attribute value of the target object to obtain a sub-group.
[0060] In some possible embodiments, the grouping of target objects in a group may be implemented as follows: target objects with the same attribute values are grouped as a subgroup, or target objects with attribute values in the same range are grouped as a subgroup.
[0061] In the embodiment of the present application, considering that some attributes have fewer selectable attribute values, such as gender, and other attributes have more selectable attribute values, such as age. In the age attribute, users of the same age group may have the same needs, so an age range can be set, and the target objects within the same age range can be regarded as a subgroup.
[0062] For example: Group 1 is the group corresponding to the gender attribute, where the attribute value 1 represents male and the attribute value 0 represents female. Group 1 includes: target object 1, target object 2, target object 3, target object 4, and target object 5. The attribute value selected by target object 1 is 1, the attribute value selected by target object 2 is 0, the attribute value selected by target object 3 is 1, the attribute value selected by target object 4 is 1, and the attribute value selected by target object 5 is 0. Group 1 can be divided into two subgroups, namely subgroup 1 and subgroup 2. Subgroup 1 includes: target object 1, target object 3, and target object 4; subgroup 2 includes: target object 2 and target object 5.
[0063] For another example: Group 2 is a group corresponding to the age attribute, where the attribute value 0-18 represents the first age group, 18-60 represents the second age group, and 60-100 represents the third age group; Group 2 includes: target object 1, target object 2, target object 3, target object 4, and target object 5, where the attribute value selected by target object 1 is 12, the attribute value selected by target object 2 is 15, the attribute value selected by target object 3 is 22, the attribute value selected by target object 4 is 40, and the attribute value selected by target object 5 is 65; Group 2 can be divided into three subgroups, namely: subgroup 1, subgroup 2, and subgroup 3, where subgroup 1 includes: target object 1 and target object 2, subgroup 2 includes: target object 3 and target object 4, and subgroup 3 includes: target object 5.
[0064] For another example: Group 3 is a group corresponding to gender and age, wherein in gender, attribute value 1 represents male, attribute value 0 represents female, and in age, attribute value 0-18 represents the first age group, 18-60 represents the second age group, and 60-100 represents the third age group; Group 3 includes: target object 1, target object 2, target object 3, target object 4, and target object 5, wherein target object 1 selects a gender attribute value of 1 and an age attribute value of 12, target object 2 selects a gender attribute value of 0 and an age attribute value of 24, target object 3 selects a gender attribute value of 1 and an age attribute value of 15, target object 4 selects a gender attribute value of 0 and an age attribute value of 40, and target object 5 selects a gender attribute value of 1 and an age attribute value of 45; then Group 3 can be divided into three subgroups, namely: subgroup 1, subgroup 2, and subgroup 3, wherein subgroup 1 includes: target object 1 and target object 3; subgroup 2 includes: target object 2 and target object 4; and subgroup 3 includes: target object 5.
[0065] In step 204: for each subgroup, the model parameter set corresponding to the subgroup is sent to each target object in the subgroup; so that the target object trains the local model according to the received model parameter set; the local model is used to perform the recommendation operation.
[0066] In the embodiment of the present application, the steps executed for each subgroup are the same, and the values of the parameters in the model parameter set corresponding to different subgroups are different. Therefore, when issuing the model parameters, it is necessary to determine the subgroup corresponding to each target object and issue the model parameter set corresponding to the subgroup to the target object.
[0067] In some possible embodiments, in addition to sending the model parameter set to the target object, the server also needs to receive data uploaded by each target object, and needs to update the model parameter set based on the data uploaded by the target object, thereby ensuring the timeliness and accuracy of the data when the data is sent to the target object again.
[0068] In some possible embodiments, the model parameter set includes: global model update parameters of the previous round, the global model update parameters of the previous round are used to determine whether the local model of the target object converges, the global model update parameters of the previous round of each subgroup are the same, and the update process of the global model update parameters of the previous round can be implemented as follows: Figure 3 The steps shown, where: In step 301: receiving the first local parameter uploaded by each target object.
[0069] In the embodiment of the present application, the amount of local data of each target object is the first local parameter. express.
[0070] In step 302: receiving the model difference sent by each target object.
[0071] In the embodiment of the present application, the model difference is determined by the target object and sent to the server. express.
[0072] In step 303: a second local parameter is obtained based on the first local parameter uploaded by each target object.
[0073] The sum of the first local parameters corresponding to each target object is the second local parameter. express.
[0074] In step 304: the second local parameter, the first local parameter corresponding to each target object, and the model difference corresponding to each target object are aggregated to obtain a global model update parameter.
[0075] In the embodiment of the present application, the global model update parameter may be determined using Formula 1, where: , (Formula 1) in, Update parameters for the global model, Target The corresponding first local parameter, is the second local parameter, Target The corresponding model difference.
[0076] In step 305: the global model update parameters of the previous round of storage are updated using the global model update parameters.
[0077] In the embodiment of the present application, this round of update is round, then the previous round is round, the global model update parameter of the previous round is , then use right to update.
[0078] In some possible embodiments, the model parameter set includes: the subgroup model update parameters of the previous round, the subgroup model update parameters of the previous round are used to determine whether the local model of the target object converges, the subgroup model update parameters of the previous round of each subgroup are not necessarily the same, but the update process is the same, for each subgroup, the update process of the subgroup model update parameters of the previous round can be implemented as follows Figure 4 The steps shown, where: In step 401: constructing a subgroup parameter based on a first local parameter corresponding to each target object in the subgroup.
[0079] The sum of the first local parameters corresponding to each target object in the subgroup is the subgroup parameter. In the embodiment of the present application, express.
[0080] In step 402: the second local parameter, the sub-group parameter, and the model difference are aggregated to obtain the sub-group model update parameter.
[0081] In the embodiment of the present application, Formula 2 may be used to determine the subgroup model update parameter, where: , (Formula 2) in, Update parameters for the subpopulation model, Target The corresponding first local parameter, is the subgroup parameter, Target The corresponding model difference.
[0082] In step 403: the sub-group model update parameters are used to update the stored sub-group model update parameters of the previous round.
[0083] In the embodiment of the present application, this round of update is round, then the previous round is round, the global model update parameter of the previous round is , then use right to update.
[0084] In some possible embodiments, the model parameter set includes: the regularization term strength of the previous round, which is used to determine whether the local model of the target object converges. The regularization term strength of each subgroup in the previous round is not necessarily the same, but the update process is the same. For each subgroup, the update process of the regularization term strength of the previous round can be implemented as follows: Figure 5 The steps shown, where: In step 501: receiving the local prediction error sent by each target object.
[0085] In the embodiment of the present application, the local prediction error is determined by each target object according to the local generalization performance of the global model. to represent the local prediction error.
[0086] In step 502: the second local parameter, the subgroup parameter, and the local prediction error are aggregated to obtain the target regularization term strength.
[0087] In the embodiment of the present application, Formula 3 may be used to determine the target regularization term strength of each subgroup, where: , (Formula 3) in, represents the target regularization strength of the subgroup, Target The corresponding first local parameter, is the subgroup parameter, is the local prediction error, A preset value used to limit The minimum value of .
[0088] For example, Is a positive number.
[0089] In step 503: the target regularization term strength is used to update the stored regularization term strength of the previous round.
[0090] In the embodiment of the present application, this round of update is round, then the previous round is round, the regularization strength of the previous round is , then use right to update.
[0091] In some possible embodiments, the model parameter set includes: the last round of update weights, which are used to determine the training round of the local model of the target object. The last round of update weights of each subgroup are not necessarily the same, but the update process is the same. For each subgroup, the update process of the last round of update weights can be implemented as follows: Figure 6 The steps shown, where: In step 601: receiving the fairness metric value sent by each target object.
[0092] In the embodiment of the present application, the fairness metric value is determined by the target object according to the current model parameters of the local model. Indicates the fairness metric value sent by the target object.
[0093] In step 602: based on the fairness metric value sent by each target object, a fairness metric mean is obtained.
[0094] After receiving the fairness metric value of each target object, the fairness metric mean can be obtained. In the embodiment of the present application, the fairness metric mean is adopted. represents the fairness metric mean.
[0095] In step 603: a subgroup metric value is obtained based on the fairness metric value sent by each target object in the subgroup.
[0096] In the embodiment of the present application, the subgroup metric value is the average of the fairness metric values sent by each target object in the subgroup, using Represents a subpopulation metric.
[0097] In step 604: based on the subgroup metric value and the fairness metric mean, the target update weight corresponding to the subgroup is obtained.
[0098] In the embodiment of the present application, Formula 4 may be used to determine the target update weight of each subgroup, where: , (Formula 4) in, Update the weights for the subgroup's targets, is the fairness measure mean, is the subpopulation measure.
[0099] In step 605: the target update weight is used to update the last round update weight.
[0100] In the embodiment of the present application, this round of update is round, then the previous round is round, the update weight of the previous round is , then use right to update.
[0101] In summary, it can be known that the model parameter set corresponding to each subgroup includes: the global model update parameters of the previous round, the subgroup model update parameters of the previous round, the regularization term strength of the previous round, and the update weight of the previous round.
[0102] The following is an explanation of a recommendation method based on federated learning when the execution subject is the target object. Figure 7 As shown, where: In step 701: obtain the initial model parameters of the previous round.
[0103] In the embodiment of the present application, the initial model parameters of the previous round are obtained by the target object from the server. After the local model training is completed, each target object will upload the local model parameters of this time to the server, and the server will update the stored initial model parameters of the previous round according to the received local model parameters. Represents the initial model parameters of the previous round.
[0104] In step 702: a model parameter set is obtained from the server; the model parameter set is a model parameter set corresponding to the subgroup to which the target object belongs; the subgroup to which the target object belongs is determined according to the target attributes uploaded by the target object.
[0105] In an embodiment of the present application, in order to ensure that the trained local model is more accurate, the acquired model parameter set is constructed by the server according to the subgroup to which the target object belongs.
[0106] In step 703: an optimization target value is determined according to the model parameter set.
[0107] In some possible embodiments, the model parameter set includes: the initial model parameters of the previous round, the global model update parameters of the previous round, and the subgroup model update parameters of the previous round. The optimization target value is determined according to the model parameter set, which can be specifically implemented as follows: Figure 8 The steps shown, where: In step 801: local model parameters of the local model are obtained based on the initial model parameters of the previous round and the sub-group model update parameters of the previous round.
[0108] In the present embodiment, the initial model parameters of the previous round are Indicates that the subpopulation model update parameters of the previous round are express.
[0109] In the embodiment of the present application, the local model parameters of the local model may be obtained using Formula 5, where: , (Formula 5) in, are the local model parameters of the local model, is the initial model parameter of the previous round, Update parameters for subpopulation models.
[0110] It should be noted that the local models and global models of all target objects in this application are models of the same dimension, so operations such as addition and subtraction can be performed directly.
[0111] In step 802: based on the initial model parameters of the previous round and the global model update parameters of the previous round, the global model parameters of the global model of the target object are obtained.
[0112] In the embodiment of the present application, the global model update parameter of the previous round is It means that the global model parameters of the global model can be obtained by using Formula 6, where: , (Formula 6) in, are the global model parameters of the global model, is the initial model parameter of the previous round, Update parameters for the global model of the previous round.
[0113] In step 803: based on the training data set, local model parameters, and global model parameters corresponding to the target object, an optimization target value is obtained.
[0114] In some possible embodiments, in order to prevent the model from overfitting, it is necessary to obtain the regularization strength of the previous round when calculating the optimization target. Therefore, the optimization target is obtained based on the training data set, local model parameters, and global model parameters corresponding to the target object. Specifically, it can be implemented as follows: based on the training data set, the interaction records and the amount of interaction data corresponding to the target object are determined; based on the interaction records, the amount of interaction data, the regularization term strength of the previous round, the local model parameters, the global model parameters, and the preset loss function, the optimization target value is obtained.
[0115] The interaction record is the interaction record between the user and the item in the application scenario corresponding to the local model of the target object. For example, if the application scenario corresponding to the local model is a shopping platform, the items are the items displayed on the shopping platform, including: item 1, item 2, ..., item n. If the user clicks on item 1, an interaction record is generated for item 1. Similarly, if the user clicks on other items, corresponding interaction records will be generated. The generated interaction record is recorded as The amount of interaction data is the total number of user interaction records on the shopping platform, which can be recorded as The interaction records and the interaction data volume are stored together in the training data set of the target object, so the training data set can be recorded as .
[0116] In the embodiment of the present application, the optimization target value may be determined using Formula 7, where: , (Formula 7) in, To optimize the target value, is the amount of interaction data, Target items for users The generated interaction records, is a pre-set loss function, indicating that the user For items Predicted values and actual interaction records The prediction error between is the training data set, is the regularization strength of the previous round, where In formula 7, we can substitute , are the local model parameters of the local model, are the global model parameters of the global model, is the square of the 2-norm.
[0117] In the embodiment of the present application, after the optimization target value is determined, in order to ensure the accuracy of the subsequent calculation of the optimization target value, it is necessary to determine the local prediction error, the model difference and the fairness metric value according to the current relevant data of the local model, so that the server can update the parameters in the model parameter set according to the local prediction error, the model difference and the fairness metric value, which are described below respectively: In some possible embodiments, determining the local prediction error may be implemented as follows: Fig. 9 The steps shown, where: In step 901: the interaction record corresponding to the target object is determined based on the training data set.
[0118] The specific implementation of this step is the same as the method of determining the interaction record in step 803, and will not be repeated here.
[0119] In step 902: a local loss value is obtained based on the interaction record, the loss function and the local model parameters.
[0120] In the embodiment of the present application, the specific implementation of the loss function is not limited. The loss function in the present application is preset, indicating that the user For items Predicted values and actual interaction records The prediction error between , so the local loss value can be used express.
[0121] In step 903: based on the interaction record, the loss function and the global model parameters, a global loss value is obtained.
[0122] In the embodiment of the present application, the global loss value can be used express.
[0123] In step 904: obtain a verification data set.
[0124] In the embodiment of the present application, the verification data set is pre-stored in the target object and can be used Represents the validation dataset.
[0125] In step 905: based on the local loss value, the global loss value and the validation data set, a local prediction error is obtained.
[0126] In the embodiment of the present application, the local prediction error may be determined using Formula 8, where: , (Formula 8) in, is the local prediction error, To validate the dataset, is the local loss value, is the global loss value, For users For items The interaction record of In formula 8, we can substitute , are local model parameters, are global model parameters.
[0127] In step 906: the local prediction error is uploaded to the server, so that the server updates the regularization term strength of the previous round according to the local prediction error.
[0128] After obtaining the local prediction error based on formula 8, the local prediction error is uploaded to the server, and the server can use Figure 5 The process shown is used to update the regularization term strength of the previous round.
[0129] In some possible embodiments, determining the model difference may be implemented as follows: Fig.10 The steps shown, where: In step 1001: obtain the current model parameters of the trained local model.
[0130] In execution Fig.10 Before the steps shown, the local model needs to be trained first to obtain the current model parameters. The training process is the same as step 703 and will not be repeated here.
[0131] In step 1002: a model difference is obtained according to the current model parameters and the local model parameters.
[0132] In the embodiment of the present application, the model difference may be determined using formula 10, where: , (Formula 9) in, is the model difference, are the current model parameters, are local model parameters.
[0133] In step 1003: the model difference is uploaded to the server, so that the server updates the global model update parameters of the previous round stored in the model parameters according to the model difference.
[0134] After the model difference is obtained based on Formula 9, the model difference is uploaded to the server, and the server can use the method shown in Formula 1 to update the global model update parameters of the previous round.
[0135] In some other possible embodiments, the fairness metric value may be determined by: Fig.11 The steps shown, where: In step 1101: obtain a verification data set.
[0136] In the embodiment of the present application, the verification data set is pre-stored locally by the target object, and can be used To express.
[0137] In step 1102: the interaction record corresponding to the target object is determined based on the training data set.
[0138] The specific implementation method of this step is the same as step 803 and will not be repeated here.
[0139] In step 1103: the accuracy is obtained based on the interaction record, the current model parameters, and the preset accuracy function.
[0140] In the present application, there is no limitation on the specific implementation of the accuracy function, and any function that can calculate the accuracy is applicable to the present application.
[0141] In step 1104: a fairness metric value is obtained based on the accuracy and the validation data set.
[0142] In the implementation of this application, the fairness metric value may be determined using Formula 10, where: , (Formula 10) in, is the fairness metric, To validate the dataset, For accuracy, are the current model parameters, Target items for users The generated interaction records.
[0143] In step 1105: the fairness metric value is uploaded to the server, so that the server updates the last round of update weights according to the fairness metric value.
[0144] After obtaining the fairness metric value based on Formula 11, the fairness metric value is uploaded to the server, and the server can use the method shown in Formula 4 to update the last round of update weights.
[0145] In step 704: the local model is trained using the optimized target value to obtain a trained local model.
[0146] In the embodiment of the present application, the current model parameters of the local model are To indicate that the current model parameters are obtained by training the local model according to the optimized target value and the training data set stored locally with the target object. The training of the local model can be specifically implemented as follows: the local model is trained using the epoch and the training data set stored locally with the target object. Epoch refers to the process in which all samples in the training data set are trained once during training, that is, it can be specifically implemented as follows: first, the update weights of the previous round and the target number of iterations corresponding to the previous round are obtained from the model parameter set of the server, and then the target number of iterations (ie, epoch) is obtained according to the update weights of the previous round, the target number of iterations corresponding to the previous round, and the preset round initial value; the local model is trained using the training data set, the target number of iterations, and the optimized target value to obtain the trained local model.
[0147] Exemplarily, the target number of iterations may be determined using Formula 11, where: , (Formula 11) in, is the target number of iterations (epoch), The epoch corresponding to the last local model training obtained from the server. is the preset round initial value, is the updated weight of the previous round.
[0148] After obtaining the target number of iterations, the local model is trained based on the locally stored training data set and the optimization target value. After the training, the model parameters corresponding to the local model are obtained, which are recorded as .
[0149] In the embodiment of the present application, during the model training process, the convergence condition can be pre-set, and the convergence condition can be set to the continuous n rounds of optimization target. The value decreases less than the threshold Therefore, the optimization target value calculated before calculating the optimization target value this time can be obtained, and whether the local model converges can be determined based on the relationship between the decrease range of multiple optimization target values and the threshold.
[0150] For example: The optimization goal obtained in this calculation The value is 10, and the convergence condition can be set to optimize the target for 5 consecutive rounds. The value decreases less than the threshold , get the 4 optimization target values before this time, which are: 10.6, 10.5, 10.2, 10.1. Based on the 5 optimization target values, it can be determined that the decrease in the optimization target value is 0.6. If the threshold is determined If it is 1, it can be determined that the local model converges.
[0151] In step 705: the trained local model is used to perform a recommendation operation.
[0152] In the present application, since the local model is trained based on the value of the optimization target, and the value of the optimization target is obtained according to the model parameter set issued by the server, and the model parameter set is determined according to the attribute values uploaded by the user and the parameters generated during the model training process, the user can choose the desired attributes and attribute values based on his or her actual situation, thereby ensuring that the user's customized attributes and attribute values are the premise of the user's satisfaction with fairness; and in the present application, the relevant parameters of the local model and the global model are dynamically coordinated to ensure the recommendation performance of the federated recommendation system; in the process of local model training, the epoch is used to update the weights and the number of epochs of local training is calculated to ensure the fairness of each local model.
[0153] Based on the same inventive concept, after introducing a recommendation method based on federated learning provided in an embodiment of the present application, as shown in FIG. Fig.12 As shown, a recommendation device 1200 based on federated learning provided in an embodiment of the present application is described below, and the device includes: Receiving module 12001, used to receive target attributes uploaded by the target object; A first grouping module 12002, configured to group the target objects based on the target attributes to obtain at least one group; The second grouping module 12003 is used for: for each group: grouping the target objects based on the attribute value of the target attribute to obtain at least one subgroup; The parameter sending module 12004 is used to send the model parameter set corresponding to each subgroup to each target object in the subgroup, so that the target object can train the local model according to the received model parameter set; the local model is used to perform the recommendation operation.
[0154] In some possible embodiments, the model parameter set includes: global model update parameters of the previous round, and the parameter sending module 12004 is further used to: Receive the first local parameter uploaded by each target object; Receive the model difference sent by each target object; Obtaining a second local parameter based on local data corresponding to each target object; Aggregating the second local parameter, the first local parameter corresponding to each of the target objects, and the model difference corresponding to each of the target objects to obtain a global model update parameter; The global model update parameters are used to update the stored global model update parameters of the previous round.
[0155] In some possible embodiments, the model parameter set includes: the subgroup model update parameters of the previous round, and the parameter sending module 12004 is further used to: For each subgroup; constructing subgroup parameters based on the local data corresponding to each target object in the subgroup; Aggregating the second local parameter, the subpopulation parameter, and the model difference to obtain a subpopulation model update parameter; The sub-group model update parameters are used to update the stored sub-group model update parameters of the previous round.
[0156] In some possible embodiments, the model parameter set includes: the regularization term strength of the previous round, and the parameter delivery module 12004 is further used for: Receiving a local prediction error sent by each of the target objects; Aggregating the second local parameter, the subgroup parameter, and the local prediction error to obtain a target regularization term strength; The target regularization term strength is used to update the stored regularization term strength of the previous round.
[0157] In some possible embodiments, the model parameter set includes: the last round of update weights, and the parameter sending module 12004 is further used to: Receive the fairness metric sent by each target object; Obtaining a fairness metric mean based on the fairness metric value sent by each target object; For each subgroup: obtaining a group measurement value based on the fairness measurement value sent by each target object in the subgroup; obtaining a target update weight corresponding to the subgroup based on the group measurement value and the fairness measurement mean; and updating the previous round update weight using the target update weight.
[0158] Based on the same inventive concept, Fig.13 As shown, a recommendation device 1300 based on federated learning provided in an embodiment of the present application is described below, and the device includes: The parameter receiving module 13001 is used to obtain a model parameter set from a server; the model parameter set is a model parameter set corresponding to the subgroup to which the target object belongs; the subgroup to which the target object belongs is determined according to the target attribute uploaded by the target object; An optimization target value determination module 13002, used to determine an optimization target value according to the model parameter set; A training module 13003 is used to train the local model according to the optimization target value to obtain a trained local model; The recommendation module 13004 is used to perform recommendation operations using the trained local model.
[0159] In some possible embodiments, the model parameter set includes: global model update parameters of the previous round, subgroup model update parameters of the previous round, and the optimization target value determination module 13002 is used to: Get the initial model parameters of the previous round; Based on the initial model parameters of the previous round and the subpopulation model update parameters of the previous round, obtaining local model parameters of the local model; Based on the initial model parameters of the previous round and the global model update parameters of the previous round, obtaining global model parameters of the global model of the target object; An optimization target value is obtained based on the training data set corresponding to the target object, the local model parameters, and the global model parameters.
[0160] In some possible embodiments, the model parameter set includes: the regularization term strength of the previous round, and the optimization target value determination module 13002 is used to: Determine the interaction record and the amount of interaction data corresponding to the target object based on the training data set; The optimization target value is obtained based on the interaction record, the amount of interaction data, the regularization term strength of the previous round, the local model parameters, the global model parameters and a preset loss function.
[0161] In some possible embodiments, the optimization target value determination module 13002 is further used to: Determining the interaction record corresponding to the target object based on the training data set; Obtaining a local loss value based on the interaction record, the loss function, and the local model parameters; Obtaining a global loss value based on the interaction record, the loss function, and the global model parameters; Get the validation dataset; Obtaining a local prediction error based on the local loss value, the global loss value, and the validation data set; The local prediction error is uploaded to the server, so that the server updates the regularization term strength of the previous round according to the local prediction error.
[0162] In some possible embodiments, the training module 13003 is specifically used to: Obtaining a target training round according to the updated weight of the previous round and a preset round initial value; The local model is trained using the training data set, the target training round, and the optimization target value to obtain a trained local model and current model parameters of the local model.
[0163] In some possible embodiments, the optimization target value determination module 13002 is further used to: Obtaining a model difference according to the current model parameters and the local model parameters; The model difference is uploaded to the server, so that the server updates the global model update parameters of the previous round stored in the model parameters according to the model difference.
[0164] In some possible embodiments, the optimization target value determination module 13002 is further used to: Get the validation dataset; Determining the interaction record corresponding to the target object based on the training data set; Obtaining accuracy based on the interaction record, the current model parameters, and a preset accuracy function; Based on the accuracy and the validation data set, obtaining a fairness metric value; The fairness metric value is uploaded to the server, so that the server updates the last round of update weights according to the fairness metric value.
[0165] Corresponding to the above embodiments, the present application also provides an electronic device. Fig.14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present invention, the electronic device 1400 may include: a processor 1401, a memory 1402 and a communication unit 1403. These components communicate through one or more buses, and those skilled in the art can understand that the structure of the electronic device shown in the figure does not constitute a limitation on the embodiment of the present invention, it can be a bus structure or a star structure, and can also include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0166] The communication unit 1403 is used to establish a communication channel so that the electronic device can communicate with other devices, receive user data sent by other devices or send user data to other devices.
[0167] The processor 1401 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It runs or executes software programs and / or modules stored in the memory 1402, and calls data stored in the memory to perform various functions of the electronic device and / or process data. The processor can be composed of an integrated circuit (IC), for example, it can be composed of a single packaged IC, or it can be composed of multiple packaged ICs with the same or different functions. For example, the processor 1401 can only include a central processing unit (CPU). In an embodiment of the present invention, the CPU can be a single computing core or multiple computing cores.
[0168] The memory 1402 is used to store the execution instructions of the processor 1401. The memory 1402 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0169] When the execution instructions in the memory 1402 are executed by the processor 1401, the electronic device 1400 can execute Figure 7 Some or all of the steps in the illustrated embodiments.
[0170] In a specific implementation, the present invention further provides a computer storage medium, wherein the computer storage medium may store a program, and when the program is executed, the program may include some or all of the steps in each embodiment of the calling method provided by the present invention. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0171] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present invention or certain parts of the embodiments.
[0172] In this specification, the same or similar parts between the various embodiments can be referred to each other. In particular, for the device embodiment and the terminal embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.
Claims
1. A recommendation method based on federated learning, characterized in that: Applied to a server, the method comprises: Receive target attributes uploaded by the target object; Grouping the target objects based on the target attributes to obtain at least one group; For each group: grouping the target objects based on the attribute value of the target attribute to obtain at least one subgroup; For each subgroup, a model parameter set corresponding to the subgroup is sent to each target object in the subgroup; so that the target object trains a local model according to the received model parameter set; and the local model is used to perform a recommendation operation.
2. The method according to claim 1, characterized in that The model parameter set includes: global model update parameters of the previous round, and the method further includes: Receive the first local parameter uploaded by each target object; Receive the model difference sent by each target object; Obtaining a second local parameter based on the first local parameter corresponding to each target object; Aggregating the second local parameter, the first local parameter corresponding to each of the target objects, and the model difference corresponding to each of the target objects to obtain a global model update parameter; The global model update parameters are used to update the stored global model update parameters of the previous round.
3. The method according to claim 2, characterized in that The model parameter set includes: the subgroup model update parameters of the previous round. After receiving the model difference sent by each target object, the method further includes: For each subgroup; constructing subgroup parameters based on the local data corresponding to each target object in the subgroup; Aggregating the second local parameter, the subpopulation parameter, and the model difference to obtain a subpopulation model update parameter; The sub-group model update parameters are used to update the stored sub-group model update parameters of the previous round.
4. The method according to claim 2, characterized in that: The model parameter set includes: the regularization term strength of the previous round. After the subgroup parameters are constructed based on the local data corresponding to each target object in the subgroup, the method further includes: Receiving a local prediction error sent by each of the target objects; Aggregating the second local parameter, the subgroup parameter, and the local prediction error to obtain a target regularization term strength; The target regularization term strength is used to update the stored regularization term strength of the previous round.
5. The method according to claim 1, characterized in that: The model parameter set includes: the last round of update weights, and the method further includes: Receive the fairness metric sent by each target object; Obtaining a fairness metric mean based on the fairness metric value sent by each target object; For each subgroup: obtaining a group measurement value based on the fairness measurement value sent by each target object in the subgroup; obtaining a target update weight corresponding to the subgroup based on the group measurement value and the fairness measurement mean; and updating the previous round update weight using the target update weight.
6. A recommendation method based on federated learning, characterized in that: Applied to a target object, the method comprises: Acquire a model parameter set from a server; the model parameter set is a model parameter set corresponding to the subgroup to which the target object belongs; the subgroup to which the target object belongs is determined according to the target attribute uploaded by the target object; Determining an optimization target value according to the model parameter set; Training the local model according to the optimization target value to obtain a trained local model; The trained local model is used to perform a recommendation operation.
7. The method according to claim 6, characterized in that The model parameter set includes: global model update parameters of the previous round and subgroup model update parameters of the previous round. The step of determining the optimization target value according to the model parameter set includes: Get the initial model parameters of the previous round; Based on the initial model parameters of the previous round and the subpopulation model update parameters of the previous round, obtaining local model parameters of the local model; Based on the initial model parameters of the previous round and the global model update parameters of the previous round, obtaining global model parameters of the global model of the target object; An optimization target value is obtained based on the training data set corresponding to the target object, the local model parameters, and the global model parameters.
8. The method according to claim 7, characterized in that The model parameter set includes: the regularization term strength of the previous round, the training data set corresponding to the target object, the local model parameters, and the global model parameters, and obtains the optimization target value, including: Determine the interaction record and the amount of interaction data corresponding to the target object based on the training data set; The optimization target value is obtained based on the interaction record, the amount of interaction data, the regularization term strength of the previous round, the local model parameters, the global model parameters and a preset loss function.
9. The method according to claim 7, characterized in that: After obtaining the optimization target value, the method further includes: Determining the interaction record corresponding to the target object based on the training data set; Obtaining a local loss value based on the interaction record, the loss function, and the local model parameters; Obtaining a global loss value based on the interaction record, the loss function, and the global model parameters; Get the validation dataset; Obtaining a local prediction error based on the local loss value, the global loss value, and the validation data set; The local prediction error is uploaded to the server, so that the server updates the regularization term strength of the previous round according to the local prediction error.
10. The method according to claim 6, characterized in that The step of training the local model according to the optimization target value to obtain the trained local model includes: Obtaining a target training round according to the updated weight of the previous round and a preset round initial value; The local model is trained using the training data set, the target training round, and the optimization target value to obtain a trained local model and current model parameters of the local model.
11. The method according to claim 10, characterized in that After obtaining the optimization target value, the method further includes: Obtaining a model difference according to the current model parameters and the local model parameters; The model difference is uploaded to the server, so that the server updates the global model update parameters of the previous round stored in the model parameters according to the model difference.
12. The method according to claim 11, characterized in that After obtaining the current model parameters of the local model, the method further includes: Get the validation dataset; Determining the interaction record corresponding to the target object based on the training data set; Obtaining accuracy based on the interaction record, the current model parameters, and a preset accuracy function; Based on the accuracy and the validation data set, obtaining a fairness metric value; The fairness metric value is uploaded to the server, so that the server updates the last round of update weights according to the fairness metric value.
13. A recommendation device based on federated learning, characterized in that: Applied to a server, the device comprises: A receiving module, used to receive target attributes uploaded by a target object; A first grouping module, configured to group the target objects based on the target attributes to obtain at least one group; A second grouping module is used for grouping the target objects based on the attribute value of the target attribute for each group to obtain at least one subgroup; The parameter sending module is used to send the model parameter set corresponding to each subgroup to each target object in the subgroup, so that the target object can train the local model according to the received model parameter set; the local model is used to perform the recommendation operation.
14. The device according to claim 13, characterized in that The model parameter set includes: global model update parameters of the previous round, and the parameter sending module is also used for: Receive the first local parameter uploaded by each target object; Receive the model difference sent by each target object; Obtaining a second local parameter based on the first local parameter corresponding to each target object; Aggregating the second local parameter, the first local parameter corresponding to each of the target objects, and the model difference corresponding to each of the target objects to obtain a global model update parameter; The global model update parameters are used to update the stored global model update parameters of the previous round.
15. The device according to claim 14, characterized in that The model parameter set includes: the subgroup model update parameters of the previous round, and the parameter sending module is also used for: For each subgroup; constructing subgroup parameters based on the local data corresponding to each target object in the subgroup; Aggregating the second local parameter, the subpopulation parameter, and the model difference to obtain a subpopulation model update parameter; The sub-group model update parameters are used to update the stored sub-group model update parameters of the previous round.
16. The device according to claim 14, characterized in that The model parameter set includes: the regularization term strength of the previous round, and the parameter delivery module is also used for: Receiving a local prediction error sent by each of the target objects; Aggregating the second local parameter, the subgroup parameter, and the local prediction error to obtain a target regularization term strength; The target regularization term strength is used to update the stored regularization term strength of the previous round.
17. The device according to claim 13, characterized in that The model parameter set includes: the last round of update weights, and the parameter delivery module is also used for: Receive the fairness metric sent by each target object; Obtaining a fairness metric mean based on the fairness metric value sent by each target object; For each subgroup: obtaining a group measurement value based on the fairness measurement value sent by each target object in the subgroup; obtaining a target update weight corresponding to the subgroup based on the group measurement value and the fairness measurement mean; and updating the previous round update weight using the target update weight.
18. A recommendation device based on federated learning, characterized in that: Applied to a target object, the device comprises: A parameter receiving module, used for acquiring a model parameter set from a server; the model parameter set is a model parameter set corresponding to the subgroup to which the target object belongs; the subgroup to which the target object belongs is determined according to the target attribute uploaded by the target object; An optimization target value determination module, used to determine the optimization target value according to the model parameter set; A training module, used to train the local model according to the optimization target value to obtain a trained local model; The recommendation module is used to perform recommendation operations using the trained local model.
19. The device according to claim 18, characterized in that The model parameter set includes: the global model update parameters of the previous round, the sub-group model update parameters of the previous round, and the optimization target value determination module, which is used to: Get the initial model parameters of the previous round; Based on the initial model parameters of the previous round and the subpopulation model update parameters of the previous round, obtaining local model parameters of the local model; Based on the initial model parameters of the previous round and the global model update parameters of the previous round, obtaining global model parameters of the global model of the target object; An optimization target value is obtained based on the training data set corresponding to the target object, the local model parameters, and the global model parameters.
20. The device according to claim 19, characterized in that The model parameter set includes: the regularization term strength of the previous round, and the optimization target value determination module, which is used to: Determine the interaction record and the amount of interaction data corresponding to the target object based on the training data set; The optimization target value is obtained based on the interaction record, the amount of interaction data, the regularization term strength of the previous round, the local model parameters, the global model parameters and a preset loss function.
21. The device according to claim 19, characterized in that The optimization target value determination module is also used for: Determining the interaction record corresponding to the target object based on the training data set; Obtaining a local loss value based on the interaction record, the loss function, and the local model parameters; Obtaining a global loss value based on the interaction record, the loss function, and the global model parameters; Get the validation dataset; Obtaining a local prediction error based on the local loss value, the global loss value, and the validation data set; The local prediction error is uploaded to the server, so that the server updates the regularization term strength of the previous round according to the local prediction error.
22. The device according to claim 18, characterized in that The training module is specifically used for: Obtaining a target training round according to the updated weight of the previous round and a preset round initial value; The local model is trained using the training data set, the target training round, and the optimization target value to obtain a trained local model and current model parameters of the local model.
23. The device according to claim 22, characterized in that The optimization target value determination module is also used for: Obtaining a model difference according to the current model parameters and the local model parameters; The model difference is uploaded to the server, so that the server updates the global model update parameters of the previous round stored in the model parameters according to the model difference.
24. The device according to claim 23, characterized in that The optimization target value determination module is also used for: Get the validation dataset; Determining the interaction record corresponding to the target object based on the training data set; Obtaining accuracy based on the interaction record, the current model parameters, and a preset accuracy function; Based on the accuracy and the validation data set, obtaining a fairness metric value; The fairness metric value is uploaded to the server, so that the server updates the last round of update weights according to the fairness metric value.
25. An electronic device, characterized in that: It comprises a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the method according to any one of claims 1-5 and 6-12.
26. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method according to any one of claims 1 to 5 and 6 to 12.
Citation Information
Patent Citations
Recommendation model training method, medium, electronic equipment and recommendation model
CN112184391A
Federal learning model training method and device, equipment and storage medium
CN115660115A
Federal learning method and device based on social grouping
CN116011540A
Unknown-based fair federated learning asynchronous training method
CN116757294A
Method and system for federated learning, electronic device, and computer readable medium
US20220374776A1