Model training method and device, computer equipment and readable storage medium

By calculating data heterogeneity values ​​and building a model loss function, selecting the target data set for model training, the problem that data heterogeneity in the existing technology affects the accuracy of the model and improving the accuracy and efficiency of model training.

CN119539123APending Publication Date: 2025-02-28CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411626638.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

The prior art is difficult to effectively quantify the impact of data heterogeneity on model accuracy, resulting in low model training accuracy.

Method used

By calculating the data heterogeneity between each training data feature and the target data feature required by the central server, a model loss function is constructed, and with this as the goal, the target data set is selected for model training.

Benefits of technology

Improve the accuracy and efficiency of model training, ensure the quality of the data set, and inspire more local devices to participate in model training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119539123A_ABST
    Figure CN119539123A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of model training, in particular to a model training method and device, computer equipment and a readable storage medium. The method comprises the following steps: acquiring training data features corresponding to each training data set; constructing a model loss function according to a data heterogeneous value between each training data feature and a target data feature required by the central server; wherein the function value of the model loss function is in positive correlation with each data heterogeneous value; selecting a target data set from each training data set by taking the function value minimization of a model loss function as a target and taking participation rewards when local equipment corresponding to each training data set participates in model training as constraints; and training the initial model by adopting the target data set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of model training technology, and in particular to a model training method, apparatus, computer device and readable storage medium. Background Art

[0002] Federated learning is a distributed machine learning method. Compared with traditional machine learning methods, federated learning does not require participants to upload original data to the central server, so data privacy can be protected. Federated learning involves multiple rounds of communication between the central server and the participants. In each round, the central server selects a part of the participants and sends the global model to these participants. These participants perform local model training, and then send the trained local model updates to the central server for model aggregation until the predefined stop condition is met.

[0003] The model accuracy of federated learning depends largely on the data distribution of the participants. In practice, the participants usually have different data distributions. For example, when the central server wants to train an object detection model using the local photo album of a mobile phone, some participants have many photos of cars, some participants have many photos of pedestrians, and some participants have some photos of buildings. These heterogeneous photo data may have a negative effect on the model accuracy of federated learning. Therefore, for heterogeneous data federated learning, it is very important to characterize the impact of data heterogeneity on model accuracy. In traditional technologies, some metrics are defined to quantify data heterogeneity, such as weighted gradient variance and local gradient variance.

[0004] However, these measurement methods only characterize data heterogeneity through gradients, but cannot quantify the specific differences between the two data distributions. Therefore, they still affect the accuracy of model training and are in urgent need of improvement. Summary of the invention

[0005] Based on this, it is necessary to provide a model training method, device, computer equipment and readable storage medium that can improve the accuracy of model training in response to the above technical problems.

[0006] In a first aspect, the present application provides a model training method, which is applied to a central server, and the method includes:

[0007] Obtaining training data features corresponding to each training data set;

[0008] A model loss function is constructed according to the data heterogeneity value between each training data feature and the target data feature required by the central server; wherein the function value of the model loss function is positively correlated with each data heterogeneity value;

[0009] Taking minimizing the function value of the model loss function as the goal and taking the participation reward of the local device corresponding to each training data set when participating in the model training as the constraint, a target data set is selected from each training data set;

[0010] Use the target dataset to train the initial model.

[0011] In one embodiment, a model loss function is constructed according to data heterogeneity values ​​between each training data feature and a target data feature required by a central server, including:

[0012] A model loss function is constructed based on the data heterogeneity values ​​between each training data feature and the target data feature required by the central server, as well as the model training algorithm adopted by the initial model.

[0013] In one embodiment, if the model training algorithm used by the initial model is a federated learning algorithm, a model loss function is constructed according to the data heterogeneity values ​​between each training data feature and the target data feature required by the central server, and the model training algorithm used by the initial model, including:

[0014] The model loss function is constructed based on the number of training rounds and learning rate in the federated learning algorithm, as well as the data heterogeneity values ​​between each training data feature and the target data features required by the central server.

[0015] In one embodiment, the training data features corresponding to each training data set include the proportion of the local data volume of the training data set in the total data volume corresponding to each training data set, and each training data label in the training data set and the first distribution probability corresponding to each training data label; the target data features include each target data label and the second distribution probability corresponding to each target data label.

[0016] In one of the embodiments, the first distribution probability corresponding to each training data label in the training data set is determined by the ratio between the label data volume corresponding to the training data label and the local data volume of the training data set.

[0017] In one embodiment, the data heterogeneity value between the training data feature corresponding to any training data set and the target data feature required by the central server is determined in the following manner:

[0018] For each training data label in the training data set, determine a label isomerism value corresponding to the training data label according to a first distribution probability corresponding to the training data label and a second distribution probability corresponding to each target data label;

[0019] According to the label heterogeneity values ​​corresponding to each training data label in the training data set, the data heterogeneity values ​​between the training data features corresponding to the training data set and the target data features required by the central server are determined.

[0020] In one embodiment, determining the label isomerism value corresponding to the training data label according to the first distribution probability corresponding to the training data label and the second distribution probability corresponding to each target data label includes:

[0021] From each target data label, select a matching data label that matches the training data label;

[0022] The label isomerism value corresponding to the training data label is determined according to the first distribution probability corresponding to the training data label and the second distribution probability corresponding to each matching data label.

[0023] In one embodiment, minimizing the function value of the model loss function is taken as a goal, and a participation reward when a local device corresponding to each training data set participates in model training is taken as a constraint, and a target data set is selected from each training data set, including:

[0024] An alliance formation game algorithm is used to determine the device alliance to which the local devices corresponding to each training data set belong; wherein each device alliance can maximize the participation reward of the local devices it contains when participating in model training;

[0025] With the goal of minimizing the function value of the model loss function, a target data set is selected from the training data sets corresponding to the local devices included in each device alliance.

[0026] In one embodiment, if the model training algorithm adopted by the initial model is a federated learning algorithm, the participation reward of each local device when participating in the model training is determined according to the single alliance heterogeneity value corresponding to the device alliance to which the local device belongs, the data heterogeneity value between the training data feature and the target data feature corresponding to the training data set of the local device, the maximum reward that the central server can provide, the privacy loss when the local device joins the device alliance to which the local device belongs, and the energy loss when the local device participates in the model training;

[0027] Among them, the single alliance heterogeneity value corresponding to the device alliance is determined according to the data heterogeneity value between the training data features and the target data features corresponding to the training data set provided by each local device in the device alliance.

[0028] In one embodiment, an alliance formation game algorithm is used to determine the device alliance to which the local device corresponding to each training data set belongs, including:

[0029] A coalition formation game algorithm is used to determine a Nash stable partition; wherein the Nash stable partition includes at least one device coalition;

[0030] According to each device alliance in the Nash stable partition, the device alliance to which the local device corresponding to each training data set belongs is determined.

[0031] In one embodiment, a coalition formation game algorithm is used to determine a Nash stable partition, including:

[0032] With the stable partition formation conditions as constraints, the alliance formation game algorithm is used to determine the Nash stable partition;

[0033] Among them, the stable partition formation condition includes that all local devices join the Nash stable partition, or the stable partition formation condition includes that not all local devices join the Nash stable partition, and the privacy sensitivity of each local device joining the Nash stable partition is greater than the set sensitivity threshold.

[0034] In one embodiment, a Nash stable partition is determined by using a coalition formation game algorithm with a stable partition formation condition as a constraint, including:

[0035] With the upper limit of the number of alliance devices and the conditions for forming stable partitions as constraints, the alliance formation game algorithm is used to determine the Nash stable partitions;

[0036] Wherein, when all local devices join the Nash stable partition, the upper limit of the number of alliance devices is the first upper limit value, and the first upper limit value is determined according to the set privacy sensitivity;

[0037] When not all local devices join the Nash stable partition, the upper limit of the number of alliance devices is the second upper limit value, which is determined based on the set privacy sensitivity and the minimum energy loss among the energy losses of each local device when participating in model training.

[0038] In one embodiment, a coalition formation game algorithm is used to determine a Nash stable partition, including:

[0039] Construct an initial device alliance corresponding to each local device, and construct an initial Nash partition based on each initial device alliance;

[0040] Determine whether any two initial device alliances in the initial Nash partition meet the alliance update conditions;

[0041] If so, the two initial device alliances that meet the alliance update condition are updated to obtain an updated initial device alliance, and based on the updated initial device alliance, the initial Nash partition is updated, and the step of determining whether any two initial device alliances in the initial Nash partition meet the alliance update condition is returned to be executed;

[0042] If it is not satisfied, the initial Nash partition will be used as the Nash stable partition.

[0043] In one embodiment, the alliance update condition includes at least one of an alliance fusion condition, an alliance separation condition, or an alliance exchange condition; and judging whether any two initial device alliances in the initial Nash partition satisfy the alliance update condition includes:

[0044] If any two initial device alliances in the initial Nash partition satisfy any one of the alliance fusion condition, the alliance separation condition or the alliance exchange condition, it is determined that any two initial device alliances in the initial Nash partition satisfy the alliance update condition.

[0045] In one embodiment, with the goal of minimizing the function value of the model loss function, a target data set is selected from the training data sets corresponding to the local devices included in each device alliance, including:

[0046] Based on the device alliance to which each local device belongs, different alliance combinations are formed; wherein different alliance combinations contain different device alliances;

[0047] For each alliance combination, determine the combined alliance heterogeneity value corresponding to the alliance combination according to the single alliance heterogeneity value corresponding to each device alliance included in the alliance combination;

[0048] Substitute the heterogeneous values ​​of each alliance combination into the model loss function to obtain the function value corresponding to each alliance combination;

[0049] A coalition combination with the smallest function value is selected from each coalition combination, and the training data set of the local device contained in the coalition combination with the smallest function value is used as the target data set.

[0050] In a second aspect, the present application also provides a model training device, which is configured on a central server and includes:

[0051] An acquisition module, used to acquire training data features corresponding to each training data set;

[0052] A function construction module is used to construct a model loss function according to data heterogeneity values ​​between each training data feature and a target data feature required by the central server; wherein the function value of the model loss function is positively correlated with each data heterogeneity value;

[0053] A data selection module, used to select a target data set from each training data set with minimization of the function value of the model loss function as the goal and participation rewards when the local devices corresponding to each training data set participate in the model training as the constraint;

[0054] The model training module is used to train the initial model using the target data set.

[0055] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0056] Obtaining training data features corresponding to each training data set;

[0057] A model loss function is constructed according to the data heterogeneity value between each training data feature and the target data feature required by the central server; wherein the function value of the model loss function is positively correlated with each data heterogeneity value;

[0058] Taking minimizing the function value of the model loss function as the goal and taking the participation reward of the local device corresponding to each training data set when participating in the model training as the constraint, a target data set is selected from each training data set;

[0059] Use the target dataset to train the initial model.

[0060] In a fourth aspect, the present application further provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:

[0061] Obtaining training data features corresponding to each training data set;

[0062] A model loss function is constructed according to the data heterogeneity value between each training data feature and the target data feature required by the central server; wherein the function value of the model loss function is positively correlated with each data heterogeneity value;

[0063] Taking minimizing the function value of the model loss function as the goal and taking the participation reward of the local device corresponding to each training data set when participating in the model training as the constraint, a target data set is selected from each training data set;

[0064] Use the target dataset to train the initial model.

[0065] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0066] Obtaining training data features corresponding to each training data set;

[0067] A model loss function is constructed according to the data heterogeneity value between each training data feature and the target data feature required by the central server; wherein the function value of the model loss function is positively correlated with each data heterogeneity value;

[0068] Taking minimizing the function value of the model loss function as the goal and taking the participation reward of the local device corresponding to each training data set when participating in the model training as the constraint, a target data set is selected from each training data set;

[0069] Use the target dataset to train the initial model.

[0070] The above-mentioned model training method, device, computer equipment and readable storage medium, the present application can accurately evaluate the degree of data matching by calculating the data heterogeneity values ​​between each training data feature and the target data feature required by the central server, which helps the central server to select the training data set that is closest to the target data feature, thereby improving the training efficiency and accuracy of the model, with the goal of minimizing the model loss function, while considering the participation reward of local devices in model training as a constraint. This screening mechanism not only ensures the quality of the data set, but also encourages more local devices to actively participate in model training. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions 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 related drawings can be obtained based on these drawings without paying creative work.

[0072] FIG1 is an application environment diagram of a model training method in one embodiment;

[0073] FIG2 is a schematic diagram of a flow chart of a model training method in one embodiment;

[0074] 3 is a flow chart of a step of determining data heterogeneity values ​​between training data features corresponding to any training data set and target data features required by a central server in one embodiment;

[0075] FIG4 is a schematic diagram of a flow chart of a step of selecting a target data set from various training data sets in one embodiment;

[0076] FIG5 is a flowchart of a step of determining a device alliance to which a local device corresponding to each training data set belongs in one embodiment;

[0077] FIG6 is a schematic diagram of a process for determining a Nash stable partition in one embodiment;

[0078] FIG7 is a schematic diagram of a flow chart of the step of selecting a target data set from each training data set in another embodiment;

[0079] FIG8 is a structural block diagram of a model training device in one embodiment;

[0080] FIG. 9 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0081] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0082] In one embodiment, as shown in FIG1 , this embodiment provides an application environment diagram of a model training method, which includes a central server 102 and multiple local devices 104; the central server 102 communicates with each local device 104 in a point-to-point (Device-to-Device, D2D) manner, and each local device 104 also uses point-to-point communication. In the federated learning algorithm, the central server 102 is the central server in the federated learning algorithm, and the local device 104 is the participant of the federated learning algorithm, and each local device 104 stores a training data set locally.

[0083] In an exemplary embodiment, as shown in FIG2 , this embodiment provides a model training method, which is applied to the central server 102 in FIG1 , and includes:

[0084] S201, obtaining training data features corresponding to each training data set.

[0085] It is understandable that federated learning is a distributed machine learning method that allows multiple participants (i.e., multiple local devices in this embodiment) to collaboratively train models without sharing original data. Each participant participates in the model training process based on a local training data set and only exchanges updated parameters in the model or gradient information of the model with the central server to protect data privacy. In federated learning, there may be significant differences in the data distribution of different local devices. This data difference may cause the model to overfit or underfit on some local devices. For example, if the data of one local device mainly contains photos of cars, and the data of another local device mainly contains photos of pedestrians, in this case, the data heterogeneity between different local devices may make it impossible for the model to fully capture the characteristics of global data, thereby affecting the performance of the model on certain types of data. In order to better understand the impact of data heterogeneity on model accuracy, it is necessary to characterize the data distribution of different types of data contained in each training data set participating in model training, and the data distribution is the training data feature corresponding to the training data set in this embodiment.

[0086] Optionally, the training data features corresponding to each training data set are used to describe key information such as the quantity, proportion, and distribution of various types of data in the training data set. By extracting and analyzing these training data features, we can gain a deeper understanding of the degree and nature of data heterogeneity. For example, we can find that some types of data dominate the overall training data, while other types of data are relatively rare. This imbalance may cause the model to perform poorly on less common data types.

[0087] S202, constructing a model loss function according to the data heterogeneity values ​​between each training data feature and the target data feature required by the central server.

[0088] The target data features required by the central server refer to the key data types and distribution of key data types that the central server expects to see or needs in the training data, so as to be able to train an accurate and generalizable model. It is understandable that the target data features are usually closely related to the business scenarios, problem types, and application goals of the model handled by the central server.

[0089] At present, some measurement methods are defined in traditional technologies to quantify the data heterogeneity between two data sets (or training data features and target data features), such as weighted gradient variance and local gradient variance. However, these measurement methods can only characterize data heterogeneity through gradients, but cannot quantify the specific differences in data distribution between the two data sets.

[0090] In order to accurately characterize the data heterogeneity value between each training data feature and the target data feature required by the central server, in this embodiment, when describing the data heterogeneity value between each training data feature and the target data feature, the Earth Movers Distance (EMD) is introduced to quantify the data heterogeneity between each training data feature and the target data feature, and the data heterogeneity value EMD corresponding to each training data feature is obtained.

[0091] It can be understood that for discrete probability distributions, if the two data distributions are imagined as two piles of soil with a certain amount of soil, then the bulldozer Wasserstein distance is the minimum total work required to transform one pile into another, where the work is defined as the amount of soil per unit multiplied by the distance it moves.

[0092] For example, for data types For example, data types One of the corresponding data distributions is and data types Another corresponding data distribution , then the data type Bulldozing Wasserstein distance between the two different data distributions above It is expressed by the following formula (1):

[0093] (1)

[0094] In this embodiment, The label of the local device k can be Data of type ), You can add a label to the central server Data of type ) data distribution.

[0095] Furthermore, when constructing the model loss function, it is necessary to consider the impact of data heterogeneity between the training data features and the target data features required by the central server on the model loss. Specifically, between the central server and each local device (defined as the local device set ), the central server initiates the federated learning process and collects data from local devices with heterogeneous data. Select multiple local devices to participate in training to minimize the accuracy loss of the model, that is, select multiple local devices from the local device set A target data set corresponding to a plurality of local devices is selected from the corresponding training data sets, and the target data set is used to train the initial model.

[0096] Optionally, a modeling approach is used to analyze federated learning and how data heterogeneity affects the accuracy of the model obtained by federated learning. The modeling process is as follows:

[0097] In federated learning, the central server initiates the federated learning process and collects Select a local device subset To train a global model , the training goal is to minimize the global loss function .

[0098] For example, suppose the training dataset for each local device contains data samples, and the training data sets of each local device have different data distributions. For example, The data samples in the training dataset belong to the label The probability of .

[0099] Furthermore, it is assumed that the central server has global data samples. According to the global data samples, the target data features required by the central server can be determined. It is assumed that the data samples in the global sample data of the central server belong to the data label The probability of . Then a local device The local device heterogeneous value , which can be expressed as the following formula (2):

[0100] (2)

[0101] Among them, in formula (2), For local devices The corresponding matching data tag set, each data tag in the data tag set exists on the local device It also exists in the global sample data.

[0102] As in the above example, from the local device collection Select a subset of local devices , a subset of local devices The training data set corresponding to each local device contained in is used as the target data set (the number of target data sets is at least one); then, the target data set is used to train the initial model. When multiple target data sets are used for training, in order to further accurately characterize the model heterogeneity, the impact of data volume on data heterogeneity is considered, and the local device subset is trained. The heterogeneous values ​​of each local device in Perform summary analysis to obtain a local device subset Corresponding weighted device heterogeneity value , weighted device heterogeneity value

[0103] It can be expressed as the following formula (3):

[0104] (3)

[0105] Among them, set the local device subset The number of devices is , is a positive integer greater than 0; For local device subset Middle local device, then and The value range is the interval A positive integer in ; local device The amount of local data in the training dataset , For the The amount of other data in the training data set corresponding to each local device.

[0106] For local device subset The total amount of data corresponding to each training data set in the local device subset The proportion of data in the total amount of data corresponding to each training data set can be expressed as .

[0107] Therefore, in this embodiment, , as a local device The data heterogeneity values ​​between the training data features and the target data features required by the central server.

[0108] For a subset of local devices Corresponding weighted device heterogeneity value , from formula (3), we can know that the local device subset Corresponding weighted device heterogeneity value With local device The local device heterogeneous value There is a positive correlation.

[0109] In federated learning, it specifically includes The communication between the central server and the selected local device, is a positive integer greater than 0. In each round of communication, each selected local device uses the stochastic gradient descent algorithm to The local model training of the step, the learning rate of the model training is ; For example, using the symbol Indicates Communication rounds, is a positive integer and its value range is the interval In each round, the last selected local device obtains the local update model of this round and uploads the local update model to the central server. After the round of communication, the central server uses the data size of each local device as the weight to perform weighted aggregation on the local update models uploaded in each round, and the central server obtains the final global model. In this embodiment, the global model The model accuracy loss (that is, in this embodiment, the function value of the model loss function can be expressed as: .

[0110] in, For the global model The actual accuracy loss is The theoretically optimal model Theoretical accuracy loss; Theoretical optimal model is the theoretical optimal case of the global model, that is, the optimal model obtained by training the initial model in theory.

[0111] Next, we calculate the model accuracy loss (i.e. Analyze the relationship between the heterogeneous values ​​of the data. When the loss function yes -smooth and -Lipschitz, we can get the learning rate satisfy When , the function value of the model loss function Satisfies the following formula (4):

[0112] (4)

[0113] Among them, β is the loss function The smoothness parameter of β reflects the smoothness of the loss function in the parameter space. A smaller β value means that the loss function is smoother, which is helpful for model optimization.

[0114] L is the loss function The Lipschitz constant is used to describe the rate at which the loss function changes in the parameter space. A smaller value of L means that the loss function changes more slowly in the parameter space.

[0115] Learning Rate It is an important hyperparameter in the model training process, which is used to control the step size of parameter update. A suitable learning rate can accelerate the training of the model and avoid falling into the local optimal solution.

[0116] For the above Steps refers to the number of times the model is updated during the training process. More iterations usually mean that the model can fit the data better, but it may also lead to overfitting.

[0117] are constants related to the centralized machine learning process and can be set empirically. They are independent of the federated learning process and are used to describe some characteristics of the centralized machine learning process.

[0118] The above formula (4) shows that: the global model The model accuracy loss (i.e., the function value of the model loss function) has an upper bound, and the upper bound is related to the weighted device heterogeneity value Inversely proportional, that is, the loss of model accuracy increases with the local device subset selected by the central server Weighted device heterogeneity value It increases with the increase of , that is, the function value of the model loss function in this embodiment is positively correlated with the heterogeneous values ​​of each data.

[0119] S203, with minimizing the function value of the model loss function as the goal and with the participation reward of the local device corresponding to each training data set when participating in the model training as the constraint, a target data set is selected from each training data set.

[0120] Optionally, for each local device, the participation reward of the local device may be the device income of the local device; the device income may be determined based on factors such as the data volume, data quality, and computing resource contribution of the local device.

[0121] Optionally, when selecting a target data set from each training data set with minimizing the function value of the model loss function as the goal and with the participation reward of the local devices corresponding to each training data set when participating in the model training as a constraint, a target optimization problem can be constructed. The core of the target optimization problem is to minimize the function value of the model loss function. At the same time, the target optimization problem is solved with the participation reward of the local devices corresponding to each training data set when participating in the model training as a constraint, and the solution obtained is the target data set selected from each training data set.

[0122] S204, using the target data set to train the initial model.

[0123] Optionally, based on the selected target data set, the specific process of using the federated learning algorithm to train the initial model is as follows: First, the central server initializes an initial global model, which can be randomly initialized or fine-tuned based on a pre-trained model; the distribution version of this initial global model is sent to all local devices participating in federated learning. Then, each local device uses the training data set of the local device to train the initial global model. During the training process, each local device selects a suitable training strategy (such as batch size, learning rate, number of training rounds, etc.) according to its own computing resources and data characteristics. After the training is completed, the local device obtains the updated local model parameters or gradient information. Next, the local device uploads its updated model parameters or gradient information to the central server. The central server receives the updated information from all local devices, and aggregates this information according to a predetermined aggregation strategy (such as average aggregation, weighted average aggregation, etc.) to obtain an updated global model. Finally, the central server distributes the updated global model to all participating local devices for the next round of local training. Repeat the steps of local training, model updating and aggregation until the predetermined number of training rounds is reached or the model performance meets the requirements, and finally obtain the global model in S203 above .

[0124] The above-mentioned model training method, this application can accurately evaluate the degree of data matching by calculating the data heterogeneity values ​​between each training data feature and the target data feature required by the central server, which helps the central server to select the training data set that is closest to the target data feature, thereby improving the training efficiency and accuracy of the model. The goal is to minimize the model loss function, and at the same time consider the participation reward of local devices in model training as a constraint. This screening mechanism not only ensures the quality of the data set, but also encourages more local devices to actively participate in model training.

[0125] In an exemplary embodiment, a model loss function is constructed based on data heterogeneity values ​​between each training data feature and the target data feature required by the central server, including: constructing a model loss function based on data heterogeneity values ​​between each training data feature and the target data feature required by the central server, and the model training algorithm adopted by the initial model.

[0126] Optionally, if the model training algorithm adopted by the initial model is a federated learning algorithm, then a model loss function is constructed according to the data heterogeneity values ​​between each training data feature and the target data feature required by the central server, and the model training algorithm adopted by the initial model, including: constructing a model loss function according to the number of training rounds and learning rate in the federated learning algorithm, and the data heterogeneity values ​​between each training data feature and the target data feature required by the central server.

[0127] Specifically, the model loss function corresponding to the federated learning algorithm is the above S203 In this embodiment, the number of training rounds in the federated learning algorithm is the number of rounds in S203 above. The learning rate in the federated learning algorithm is the same as the value in S203 above. .

[0128] In this embodiment, a model loss function suitable for the federated learning model is constructed according to the algorithm characteristics of the federated learning algorithm itself.

[0129] In an exemplary embodiment, the training data features corresponding to each training data set include the proportion of the local data volume of the training data set in the total data volume corresponding to each training data set, as well as each training data label in the training data set and the first distribution probability corresponding to each training data label; the target data features include each target data label and the second distribution probability corresponding to each target data label.

[0130] Optionally, as in the example in S202 above, for example, assuming that the training data set of each local device includes data samples, and the training data sets of each local device have different data distributions.

[0131] For example, on a local device The data samples in the training dataset belong to the label The probability of , that is, on the local device The training data labels in the training dataset The corresponding first distribution probability is ; The global data samples of the central server belong to the target data label The probability of , that is, the second distribution probability corresponding to the target data label is .

[0132] It can be understood that the first distribution probability corresponding to each training data label in the training data set is determined by the ratio between the label data volume corresponding to the training data label and the local data volume of the training data set, and each training data label can correspond to a data type.

[0133] Further, as shown in FIG3 , the data heterogeneity value between the training data feature corresponding to any training data set and the target data feature required by the central server is determined in the following manner:

[0134] S301, for each training data label in the training data set, determine a label isomerism value corresponding to the training data label according to a first distribution probability corresponding to the training data label and a second distribution probability corresponding to each target data label.

[0135] Optionally, the specific process of determining the label heterogeneous value corresponding to the training data label based on the first distribution probability corresponding to the training data label and the second distribution probability corresponding to each target data label is as follows: from each target data label, select a matching data label that matches the training data label; and determine the label heterogeneous value corresponding to the training data label based on the first distribution probability corresponding to the training data label and the second distribution probability corresponding to each matching data label.

[0136] The first distribution probability is and the second distribution probability For example, the local device Training data labels Corresponding label heterogeneous values It is the following formula (5):

[0137] (5)

[0138] S302, according to the label heterogeneity values ​​corresponding to each training data label in the training data set, determine the data heterogeneity values ​​between the training data features corresponding to the training data set and the target data features required by the central server.

[0139] Specifically, the sum of the label heterogeneity values ​​corresponding to each training data label in the training data set is used as the local device heterogeneity value of the training data set. The data heterogeneity values ​​corresponding to the training data set It is the following formula (6):

[0140] (6)

[0141] So far, the above analysis process has described how data heterogeneity affects the model accuracy achieved by federated learning.

[0142] It is understandable that in the federated learning of heterogeneous data, the interaction between local devices also affects the performance of the federated learning model. In traditional technology, each local device is regarded as the subject of competition, and the central server only selects a subset of local devices from each local device for model training. In this case, the selected local devices may have unbalanced data, and the unselected local devices cannot contribute to the training of the federated learning model. In order to solve the problem of data imbalance in the selected local devices, this embodiment proposes a device alliance federated learning framework. For heterogeneous data federated learning, local devices with complementary data distribution can cooperate to form a device alliance.

[0143] For example, in a device alliance, each local device can first perform local training, and then share its model updates with other local devices in the device alliance through a peer-to-peer process until a consensus model is reached. When the central server selects a device alliance, the representative local devices in the device alliance upload the consensus model to the central server for global aggregation. Based on this framework, in the device alliance federated learning framework, the device alliance selected by the central server usually has more balanced data, and by joining the device alliance, more local devices can contribute to the federated learning model training.

[0144] When forming a device alliance, each local device is rational and each local device will selfishly maximize their own interests by forming a device alliance through device alliance formation behavior (interests are used to determine the participation reward of local devices. The greater the interest, the greater the participation reward of local devices). Specifically, in order to obtain a highly accurate federated learning model (i.e., the global model mentioned above), the central server usually selects device alliances with more balanced data and pays these device alliances (for any local device, the reward paid by the central server to the local device is consistent with the interest obtained by the local device from the central server). Therefore, a local device tends to form a device alliance with many local devices, which can supplement its unbalanced data and thus obtain rewards from the central server.

[0145] However, when a local device in a device alliance shares model updates with other local devices in the device alliance, privacy loss occurs. Therefore, each local device needs to make a trade-off between participation rewards and privacy loss. In addition, the alliance formation behaviors of local devices also affect each other. For example, when a local device joins a device alliance, the number of devices in the device alliance increases. The joining behavior of the local device brings greater privacy loss to other local devices in the device alliance. The rewards obtained by each local device in the device alliance from the central server may also change, because the addition of new local devices may lead to a device alliance with more balanced data, which can obtain greater rewards from the central server. Therefore, the selfish device alliance formation behavior of local devices can be modeled as an alliance formation game. Next, we analyze how each local device selfishly chooses its own device alliance and achieves a Nash stable partition.

[0146] In an exemplary embodiment, as shown in FIG4 , minimizing the function value of the model loss function is taken as a goal, and the participation reward of the local device corresponding to each training data set when participating in the model training is taken as a constraint, and the target data set is selected from each training data set, including:

[0147] S401, using an alliance formation game algorithm to determine the device alliance to which the local device corresponding to each training data set belongs.

[0148] Among them, each device alliance can maximize the participation rewards of its local devices when they participate in model training.

[0149] It can be understood that, from the above S203, the function value of the model loss function changes with the local device subset selected by the central server. Weighted device heterogeneity value Therefore, the central server will select local devices with more balanced data and pay them. In order to get rewards from the central server, each local device can cooperate with other local devices with complementary data distribution to form a device alliance with more balanced data, that is, to form a local device subset with more balanced data. .

[0150] Specifically, the process of each local device forming a device alliance can be constructed as an alliance formation game model. The specific modeling process is as follows:

[0151] In the device alliance formation behavior of the local device, the total number of device alliances formed by each local device is set to , the device alliance formation decision of each local device is ,in, Indicates the local device Opt-in to the Device Alliance , and set the device alliance The number of local devices in is The central server will Select at least one device alliance from the device alliances.

[0152] Then, the selected device alliance participates In each round of model training, each local device in the device alliance performs local training based on the global model corresponding to the current round, and then shares the model update with other local devices in the device alliance in a peer-to-peer manner until a consensus model is reached. The consensus model is similar to a centralized learning model trained on the training dataset of all local devices in the device alliance.

[0153] At the end of each round, each device alliance selects a representative local device to upload the consensus model corresponding to the device alliance to the central server. A device alliance appears as a whole to the central server, that is, the central server regards "a device alliance" as "a local device". In this case, the data heterogeneous value of this device alliance should be changed from the data heterogeneous value corresponding to the local device to the single alliance heterogeneous value corresponding to the device alliance. (Also known as GEMD).

[0154] It is understandable that for local devices For example, setting the local device The device alliance it belongs to is the device alliance , then the device alliance Corresponding single alliance heterogeneous value Used to describe the difference between the device alliance data characteristics of the device alliance and the target data characteristics of the central server.

[0155] Assume Device Alliance The total number of local devices included in is Specifically, the device alliance data feature of the device alliance is the distribution of data samples under each data label in the device alliance, and the single alliance heterogeneous value It can be expressed as the following formula (7):

[0156] (7)

[0157] Among them, in formula (7), Device Alliance The corresponding alliance data tag set, each data tag in the data tag set exists in the device alliance , and also exists in the global sample data, such as the label A collection of alliance data labels The single alliance heterogeneity value obtained by the above formula (7) is determined according to the data heterogeneity value between the training data features and the target data features corresponding to the training data set provided by each local device in the device alliance.

[0158] Furthermore, in heterogeneous data federated learning, each local device (Local Device Collection ) Make decisions through device alliances Decide which equipment alliance to join to maximize your benefits, Indicates the local device Opt-in to the Device Alliance For example, the benefit (participation reward) of a local device depends on the device alliance selection strategy of the central server. , Indicates that the central server selects the device alliance ,and Indicates that the central server has not selected a device alliance If the local device If a local device joins a device alliance that is not selected by the central server, it will not perform local training and will not receive rewards from the central server. At this time, the participation reward of the local device is 0. Join the device alliance selected by the central server, then the local device It will conduct local training, share model parameters with other local devices in the device alliance, and eventually receive a reward from the central server, based on which the participation reward of the local device is determined. Therefore, each local device will selfishly decide which device alliance to join to maximize its own benefits, and this process can be modeled as a coalition formation game.

[0159] Assume Device Alliance The set of local devices included is , Contains all selected device alliances Local devices, alliances form partitions in the game Refers to a collection of separate device alliances , the intersection of each other is empty , partition The union of all device alliances in ( Local device collection ). The preference order of the alliance formation game is defined as follows, for local devices For both device alliances and The preference is determined by the following conditions (1) and (2). Among them, condition (1), the local device Join the Device Alliance The benefits are no less than joining the equipment alliance The benefit when: Condition (2), local device The joining of the device alliance did not result in When the benefits of other local devices decrease, the preference order can be expressed as .

[0160] Based on the preference order of the above alliance formation game, the selfish device alliance formation interaction process of local devices can be modeled as the following device alliance game, where the participants of the alliance formation game are the local device set All local devices in the network, each participant's participation strategy is to decide which device alliance to join , the decision-making goal of the participants is to maximize the profit function , the profit function This is the participation reward in this embodiment; if the participant is compared with the device alliance Prefer to join device alliance , then the preference order is The Nash stable partition of this game is a partition , for each local device The currently selected device alliance is the optimal preference order. At this time, no local device has the motivation to leave the current device alliance and join other device alliances.

[0161] S402 , with the goal of minimizing the function value of the model loss function, select a target data set from the training data sets corresponding to the local devices included in each device alliance.

[0162] It can be understood that in the device alliance federated learning framework, each formed device alliance is composed of local devices with complementary data distribution. The purpose of these device alliances is to maximize the interests of each local device, that is, to maximize the above-mentioned benefit function Selfishly choose the equipment alliance for the goal to get.

[0163] For the central server, at least one target alliance is selected from the device alliances formed by the local devices, and the training data set included in the target alliance is used as the target data set.

[0164] In an exemplary embodiment, if the model training algorithm adopted by the initial model is a federated learning algorithm, the participation reward of each local device participating in the model training is determined according to the single alliance heterogeneity value corresponding to the device alliance to which the local device belongs, the data heterogeneity value between the training data features and the target data features corresponding to the training data set of the local device, the maximum reward that the central server can provide, the privacy loss when the local device joins the device alliance to which the local device belongs, and the energy loss when the local device participates in the model training.

[0165] For example, a local device The participation reward (i.e. the above profit function ) including local devices Rewards received from the central server, local device Privacy loss when sharing model parameters with other local devices in a device federation, and local devices Energy loss when participating in model training, for example:

[0166] (1) For local devices The compensation received from the central server is analyzed: Since the model accuracy loss increases with the increase of data heterogeneity of the selected device alliance, the compensation received by the selected device alliance from the central server decreases with the increase of data heterogeneity of the device alliance. Rewards received from the central server It is expressed as the following formula (8):

[0167] (8)

[0168] in, It is the maximum reward that the central server pays to any device alliance, that is, the maximum reward that the central server can provide in this embodiment.

[0169] use Represents a device alliance The league score, The value range of is [0, 1]. For example, when the single alliance heterogeneity value corresponding to the device alliance is the largest, the alliance score of the device alliance is 0 and the reward obtained by the device alliance from the central server is When the single alliance heterogeneity value of the device alliance is the smallest, the alliance score of the device alliance is 1 and the reward obtained by the device alliance from the central server is for .

[0170] Within a selected device alliance, local devices share the device alliance fairly. Rewards received from the central server Specifically, each local device receives a proportional device benefit based on its contribution to the device alliance. Join the Device Alliance The equipment benefit obtained is as follows (9):

[0171] (9)

[0172] in, Refers to the decision set of other device alliances, that is, the local device A collection of other device alliances that can be joined.

[0173] For local devices Device score, set device alliance The number of devices included in , Device Alliance No. local devices, The value range of is [1, ] is a positive integer in ].

[0174] For local devices Device score; Device Alliance The sum of the device scores of all local devices in .

[0175] It is understandable that the device score of each local device is related to the utility value, benefit or contribution of the local device in the device alliance. Among them, the utility value is usually used to measure the satisfaction or preference of a local device or individual in a specific state. In the device alliance formation game, the utility value of the local device may be related to factors such as the resources, benefits or amount of tasks completed in the device alliance. In more specific scenarios, the device score may directly represent the material benefits or economic benefits obtained by participating in the device alliance. In some algorithms, the device score may reflect its contribution to the overall goal of the device alliance. This can be evaluated through indicators such as the task completion of the local device in the device alliance and the efficiency of resource allocation.

[0176] (2) For local devices Analyze the privacy loss when sharing model parameters with other local devices in the device alliance: During model training, local devices Perform local training and share model updates in the device alliance to which it belongs. Since model updates are vulnerable to reconstruction attacks or member inference attacks, local devices Privacy loss. Local device Privacy loss and local devices The number of devices in the device alliance to which it belongs is also related to the number of local devices. The data heterogeneity is related to the local device. When the model needs to be shared with more local devices, it is more vulnerable to attacks. When the data heterogeneity is small, the local device The data of local devices is more valuable for federated learning. Therefore, the data of local devices is summarized as follows: Join the Device Alliance Privacy loss It can be expressed as the following formula (10): (10)

[0177] in, For local devices The privacy sensitivity of the local device can be set based on experience, and the privacy sensitivity of different local devices can be set to the same value or different values; For local devices Device Alliance The number of devices in the

[0178] (3) Analysis of energy loss when local devices participate in model training: When participating in model training, it will cause computing energy loss and communication energy loss. The computing energy loss is related to the computing power, while the communication energy loss is related to the communication capability of the device. Since the energy loss does not depend on the device alliance to form a decision, it can be expressed as a constant energy loss. , energy loss Can be obtained directly from each local device.

[0179] In summary, local devices Participation rewards for model training It can be expressed as the following formula (11):

[0180] (11)

[0181] in, Indicates that the central server selects the device alliance ,and Indicates that the central server has not selected a device alliance .

[0182] In this embodiment, by considering the single alliance heterogeneity value of the device alliance to which the local device belongs, it is possible to ensure that the model is trained in a variety of different environments and data distributions, thereby improving the generalization ability and adaptability of the model; Federated learning itself is a training method that protects data privacy, because it allows local devices to participate in model training without uploading original data. In this embodiment, the privacy loss of local devices is taken as a consideration for participation rewards, which can motivate devices to participate in training under the premise of protecting privacy, thereby strengthening data privacy protection. By considering the data heterogeneity value between the training data set of the local device and the target data features, the contribution of each device to model training can be more accurately evaluated, thereby distributing rewards more fairly; taking into account the energy loss of local devices when participating in model training, it can motivate devices to participate in training in a more energy-efficient state, thereby reducing overall energy consumption; by comprehensively considering multiple factors to determine participation rewards, it is possible to balance the interests of all parties, enhance the willingness and stability of cooperation among device alliance members, and thus improve the effect and efficiency of model training.

[0183] In an exemplary embodiment, as shown in FIG5 , an alliance formation game algorithm is used to determine the device alliance to which the local device corresponding to each training data set belongs, including:

[0184] S501, adopt the coalition formation game algorithm to determine the Nash stable partition.

[0185] The Nash stable partition includes at least one device alliance.

[0186] It can be understood that in the alliance formation game, a Nash stable partition refers to a set of device alliance structures, each device alliance in the Nash stable partition is stable both inside and outside the alliance. Internal alliance stability means that devices in the device alliance cannot increase their benefits by leaving the current device alliance and joining other device alliances; external alliance stability means that there are no two or more device alliances that can further increase the total benefits of their members by merging. Since the alliance formation game may involve multiple devices and complex benefit functions, there may be multiple different device alliance structures that meet the Nash stability conditions. These different device alliance structures constitute multiple Nash stable partitions.

[0187] Optionally, a coalition formation game algorithm is used to determine the process of Nash stable partitions, which can be specifically:

[0188] a1. Initialization settings: 1) Define devices and device alliances: define the set of local devices participating in the game, and each device is initially considered as an initial device alliance. 2) Set the revenue function: define a revenue function for each device, which should reflect the participation reward that the device can obtain after joining a device alliance. This reward may be based on a variety of factors, such as training effect, resource contribution, privacy loss, energy consumption, etc.

[0189] a2. Device alliance formation process: 1) Proposal and response mechanism: Allow devices to propose to join or leave an initial device alliance, and set the response rules for other devices or the initial device alliance to this proposal. Proposals and responses can be achieved through communication between devices. 2) Benefit evaluation and policy update: Whenever a device proposes a proposal, it is necessary to evaluate the impact of this change on the benefits of all relevant devices (including the proposing device and the affected device alliance members). Based on the evaluation results, the device can update its policy and decide whether to accept the proposal. 3) Iterative update: Repeat the process of proposal and response, benefit evaluation and policy update until a stable state is reached, that is, no device is willing to increase its benefits by changing the device alliance structure.

[0190] a3. Nash stability check: 1) Internal stability check: For each device alliance, check whether there is any device that can improve its benefits by leaving the current device alliance and joining other device alliances (or independently as a new device alliance). If there is no such device, the device alliance is internally stable. 2) External stability check: Check whether there are any two or more device alliances that can further improve the total benefits of their members by merging (or splitting). If there is no such merger (or splitting) opportunity, the device alliance structure is externally stable.

[0191] a4. Determine the Nash stable partition: By continuously iterating the device alliance formation process and performing Nash stability checks, a Nash stable partition is reached. The Nash stable partition contains a set of updated device alliances (compared to the initial device alliance in a1 above), which meet the conditions for maximizing device participation rewards (under a given profit function).

[0192] In this embodiment, the updated device alliance obtained in a4 is used as the device alliance included in the Nash stable partition.

[0193] a5. Output results and implementation: According to the operation results of the algorithm, output the Nash stable partition.

[0194] S502: Determine, according to each device alliance in the Nash stable partition, the device alliance to which the local device corresponding to each training data set belongs.

[0195] Specifically, each updated device alliance included in the above Nash stable partition is determined, and for each local device, the updated device alliance to which the local device belongs is used as the device alliance to which each local device belongs.

[0196] Furthermore, a coalition formation game algorithm is used to determine the Nash stable partition, including: taking the stable partition formation condition as a constraint, and using the coalition formation game algorithm to determine the Nash stable partition.

[0197] Among them, the stable partition formation condition includes that all local devices join the Nash stable partition, or the stable partition formation condition includes that not all local devices join the Nash stable partition, and the privacy sensitivity of each local device joining the Nash stable partition is greater than the set sensitivity threshold.

[0198] Next, the process of determining the conditions for forming the above-mentioned stable partitions is analyzed: for the special case where the central server selects all device alliances (Case 1), and the general case where the central server selects some device alliances (Case 2), the existence of Nash stable partitions and whether the alliance formation game algorithm can converge to Nash stable partitions are analyzed and discussed.

[0199] In order to analyze the problem of coalition formation game algorithm converging to Nash stable partitions, we first define the concept of partition cycle. A cycle refers to a partition sequence. , assuming there is at least one device alliance step that partitions Change to partition And for all have If there is a partition cycle in the device coalition formation process of the coalition formation game algorithm, the coalition formation game algorithm may get stuck in a cycle and never converge to a Nash stable partition.

[0200] Therefore, in (case 1), when the central server selects all device alliances from each device alliance, we can draw the following conclusion: in the device alliance formation process of the alliance formation game algorithm, any partition will only appear at most once, and in this case, the partition cycle does not exist. Since the number of possible partitions is finite, the alliance formation game algorithm can always converge, and it can be proved that the alliance formation game algorithm converges to a Nash stable partition after a finite number of steps.

[0201] In (Case 2), when the central server chooses to select some device alliances from each device alliance, it can be proved that the Nash stable partition does not always exist. It can be found that the existence of the Nash stable partition in this case depends on the privacy sensitivity of the local device. , we can find that there is a privacy sensitivity threshold , the privacy sensitivity threshold is the minimum privacy sensitivity that makes any partition cycle that may be formed by all current local devices invalid. When , the Nash stable partition of the coalition formation game always exists, and the coalition formation game algorithm can converge to the Nash stable partition. When , the Nash stable partition of the coalition formation game does not exist. In particular, when When , the Nash stable partition is formed by each local device forming a device alliance. Indicates the lowest device score among all local devices. Represents the minimum energy loss among the energy losses of all local devices.

[0202] Furthermore, with the stable partition formation conditions as constraints, an alliance formation game algorithm is used to determine the Nash stable partition, including: with the upper limit of the number of alliance devices and the stable partition formation conditions as constraints, an alliance formation game algorithm is used to determine the Nash stable partition.

[0203] On the one hand, using the upper limit of the number of alliance devices as a constraint is an acceleration strategy to form a Nash stable partition.

[0204] For the above (case 1) and (case 2), the upper limit of the number of devices in each device alliance is also divided into the following two cases:

[0205] In one implementation (method 1), when all local devices join the Nash stable partition, the upper limit of the number of alliance devices is the first upper limit value. (Method 1) Corresponding to the above (case 1), when the central server selects the alliance of all devices, the number of devices in the device alliance is Satisfies the following formula (12):

[0206] (12)

[0207] in, is the first upper limit value; the first upper limit value is based on the privacy sensitivity of the local device , the maximum reward that the central server can provide and minimum equipment score Determine, among other things, the privacy sensitivity of the local device You can set the privacy sensitivity.

[0208] In another implementation manner (method 2), when not all local devices have joined the Nash stable partition, the upper limit of the number of alliance devices is the second upper limit value.

[0209] (Method 2) Corresponding to the above (Case 2), when the central server selects part of the device alliance, the number of devices in the device alliance must satisfy the following formula (13):

[0210] (13)

[0211] From formula (12), we can see that the second upper limit value is based on the privacy sensitivity of the local device , minimum energy loss , the maximum reward that the central server can provide and minimum equipment score Determine the privacy sensitivity of the local device You can set the privacy sensitivity.

[0212] On the other hand, the acceleration strategy for forming Nash stable partitions can also be considered from the perspective of alliance score. For example, when the device alliance and Device Alliance Converging into a new device alliance (New Device Alliance use ), then the condition for alliance integration is as follows (14):

[0213] (14)

[0214] in, Device Alliance The alliance score, Device Alliance The alliance score, Device Alliance Alliance score.

[0215] When the equipment alliance Local devices in Move to Device Alliance When , the condition for alliance transfer is as follows (15):

[0216] (15)

[0217] in, Device Alliance Alliance score.

[0218] Device Alliance For the device alliance after the device transfer and Device Alliance Get the device alliance.

[0219] Device Alliance The local devices, set device alliance The number of local devices in is ,but The value range of is [1, ] is a positive integer in ].

[0220] For local devices The device score, For local devices Device score.

[0221] In an exemplary embodiment, as shown in FIG6 , a coalition formation game algorithm is used to determine a Nash stable partition, including:

[0222] S601, constructing an initial device alliance corresponding to each local device, and constructing an initial Nash partition according to each initial device alliance.

[0223] For example, six local devices form six initial device alliances, each of which contains only the corresponding local devices, to obtain an initial Nash partition.

[0224] S602, judging whether any two initial device alliances in the initial Nash partition meet the alliance update condition. If so, executing S603; if not, executing S604.

[0225] The alliance update condition includes at least one of an alliance fusion condition, an alliance separation condition, or an alliance exchange condition. Specifically, judging whether any two initial device alliances in the initial Nash partition meet the alliance update condition includes: if any two initial device alliances in the initial Nash partition meet any one of the alliance fusion condition, the alliance separation condition, or the alliance exchange condition, then determining that any two initial device alliances in the initial Nash partition meet the alliance update condition.

[0226] The fusion algorithm corresponding to the alliance fusion condition is: if the partition after fusion under the current partition satisfies the Pareto Order compared to the partition before fusion, then the two device alliances are merged and the current partition is updated. Compared with the traditional method of checking whether the fusion of each two device alliances satisfies the Pareto Order, this method can effectively reduce unnecessary fusion attempts, thereby accelerating the convergence process.

[0227] The separation algorithm corresponding to the alliance separation condition is: for any device alliance with at least two devices, if the partition formed by separating the device alliance into multiple small device alliances satisfies the Pareto Order compared to the partition before separation, then separate the device alliance and update the current partition. Since the number of devices in each device alliance is guaranteed by the upper bound, there are not many possible separation steps.

[0228] The exchange algorithm corresponding to the alliance exchange condition is: if a device is transferred from the current device alliance to another device alliance, and the partition after the transfer satisfies the Pareto Order compared to the partition before the transfer, then transfer the device to the new device alliance and update the current partition. Compared with the traditional method of checking whether each device transfer to each device alliance satisfies the Pareto Order, this method can effectively reduce unnecessary transfer attempts, thereby accelerating the convergence process.

[0229] In this embodiment, each local device first calculates its own data heterogeneity value, and then initializes the partition setting. Then, each local device performs fusion, separation, and exchange in turn, and repeats these three steps until no device performs any of the above fusion, separation, and exchange steps in the current partition. Then, the alliance formation game algorithm converges to the Nash stable partition.

[0230] It is understandable that according to the Pareto Order, for two partitions and , if for all devices there is , and at least one device satisfies In the case of strictly greater than , the Pareto Order of the two partitions can be obtained as Based on Pareto Order, we can define the fusion, separation, and exchange steps. The specific process is as follows:

[0231] Fusion: When , then the Converged Device Alliance and Device Alliance for .

[0232] Separation: When When the separation equipment alliance for .

[0233] Transfer: For device alliance Devices in ,when When the device is transferred To Device Alliance .

[0234] S603, update the two initial device alliances that meet the alliance update condition to obtain an updated initial device alliance, and based on the updated initial device alliance, update the initial Nash partition, and return to execute S602.

[0235] In the alliance formation game algorithm, if there are device alliances that meet the above alliance update conditions, then these alliances will be updated accordingly (such as merging, separating, or exchanging devices). The updated alliance structure will affect the entire Nash partition, so the entire partition needs to be re-evaluated based on the new alliance structure. This process is cyclical, because an update may trigger more update conditions, so the judgment and update steps need to be repeated until a stable state is reached.

[0236] S604: Use the initial Nash partition as a Nash stable partition.

[0237] In the alliance formation game algorithm, if no two alliances meet the update conditions in a certain round of judgment, the current Nash partition is considered stable, that is, a Nash stable partition. In this state, any change in equipment or alliance will not bring about an improvement in overall efficiency, so the system has reached a relatively stable state.

[0238] In an exemplary embodiment, as shown in FIG. 7 , with the goal of minimizing the function value of the model loss function, a target data set is selected from the training data sets corresponding to the local devices included in each device alliance, including:

[0239] S701, forming different alliance combinations based on the device alliances to which each local device belongs.

[0240] Among them, different alliance combinations contain different device alliances.

[0241] For example, the local device set The local devices in are 1, 2, 3, 4, 5, 6, 7, 8, and 9 respectively. The alliance formation game algorithm is used to obtain the local device set The corresponding Nash stable partition includes four device alliances {1, 2}, {3, 4, 5}, {6, 7,}, and {8, 9}.

[0242] Furthermore, the above four device alliances {1, 2}, {3, 4, 5}, {6, 7}, and {8, 9} are combined to obtain multiple different device alliances; for example, different alliance combinations may include: Alliance combination one: {1, 2}, {3, 4, 5}; Alliance combination two: {6, 7}, {8, 9}; Alliance combination three: {1, 2}, {3, 4, 5}, {6, 7}; Alliance combination four: {3, 4, 5}, {6, 7}, {8, 9}.

[0243] S702 , for each alliance combination, determine a combined alliance heterogeneity value corresponding to the alliance combination according to the single alliance heterogeneity value corresponding to each device alliance included in the alliance combination.

[0244] For each alliance combination, the single alliance heterogeneity values ​​corresponding to all device alliances within it are aggregated or weighted averaged to obtain the combined alliance heterogeneity value of the alliance combination. is the alliance combination selected by the central server, then the alliance combination Corresponding combined alliance heterogeneity value

[0245] As shown in formula (16):

[0246] (16)

[0247] in, Device Alliance The number of samples in the training data set of each local device included in, For Nash stable partitions in device alliance The number of samples in the training data set of each local device included in .

[0248] Among them, the strategy is selected by the upper device alliance , Indicates that the central server selects the device alliance ,and Indicates that the central server has not selected a device alliance It can be seen that Characterization Equipment Alliance Selected by the central server to participate in model training.

[0249] S703, substitute the heterogeneous values ​​of each alliance combination into the model loss function to obtain the function value corresponding to each alliance combination.

[0250] Specifically, the combined alliance heterogeneous values Substituting into the model loss function, the function value corresponding to the model loss function is expressed by the following formula (17):

[0251] (17)

[0252] S704, selecting a coalition combination with the smallest function value from each coalition combination, and using the training data set of the local device included in the coalition combination with the smallest function value as the target data set.

[0253] Specifically, the alliance combination with the smallest function value is determined from each alliance combination, and the training data set contained in the alliance combination with the smallest function value is used as the target data set, which can be solved by the following formula (18):

[0254] (18)

[0255] In the above formula (18), the function value corresponding to the model loss function increases as The increase of increases, combined with formula (3) The definition of and formula (17) can make formula (18) equivalent to the following formula (19):

[0256] (19)

[0257] Furthermore, it can be found that With the selected device alliance corresponding to the single alliance heterogeneous value monotonically increasing, and with the number of data samples In addition, the number of data samples depends on the device alliance formation behavior of the device, and the device alliance formation behavior of the device depends on the device alliance selection strategy of the central server. Therefore, it is very difficult to directly obtain the closed-form solution of the central server device alliance selection optimization problem. In this case, in order to solve equation (17), the above equation (17) can be split into two sub-problems.

[0258] First, the first sub-problem is to constrain Next, for fixed The value selects a subset of the optimal device alliance to minimize , that is, the following optimization problem (20):

[0259] (20)

[0260] Secondly, the second sub-problem is to find the smallest The value is such that a solution exists for the first subproblem.

[0261] Furthermore, for the first sub-problem, due to , the first constraint is equivalent to To find a coalition combination that satisfies this constraint, we can follow Sort each device alliance in ascending order, and then select the first S device alliances. Here, the metric To capture and the combined impact.

[0262] Furthermore, we hope to find the minimum Value, denoted as . Easy to know , then we can know So we can find :

[0263] First, set the initial left and right boundaries , when the distance between the left and right boundaries is greater than the error tolerance level ( can be a set value), the midpoint of the left and right boundaries is taken as Value, if in the current Under the value, we can find a set of device alliances that are the solution to the first subproblem by solving the first subproblem, then the right boundary is set to the current value, otherwise, the left border is set to the current Finally, the optimal alliance combination selected by the central server from each alliance combination can be found. The optimal alliance combination is the alliance combination with the smallest function value selected from each alliance combination.

[0264] For example, in this embodiment, the central server selects the alliance combination containing {3, 4, 5}, {8, 9} as the optimal alliance combination, that is, the training data set corresponding to local device 3, the training data set corresponding to local device 4, the training data set corresponding to local device 5, the training data set corresponding to local device 8 and the training data set corresponding to local device 9 are used as target data sets.

[0265] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0266] Based on the same inventive concept, the embodiment of the present application also provides a model training device for implementing the model training method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more model training device embodiments provided below can refer to the limitations on the model training method above, and will not be repeated here.

[0267] In an exemplary embodiment, as shown in FIG8 , a model training device is provided, comprising: an acquisition module 11, a function construction module 12, a data selection module 13 and a model training module 14, wherein:

[0268] An acquisition module 11 is used to acquire training data features corresponding to each training data set;

[0269] The function construction module 12 is used to construct a model loss function according to the data heterogeneity value between each training data feature and the target data feature required by the central server; wherein the function value of the model loss function is positively correlated with each data heterogeneity value;

[0270] A data selection module 13 is used to select a target data set from each training data set with the goal of minimizing the function value of the model loss function and with the participation reward of the local device corresponding to each training data set when participating in the model training as a constraint;

[0271] The model training module 14 is used to train the initial model using the target data set.

[0272] In one of the embodiments, the function construction module 12 is further used to construct a model loss function according to data heterogeneity values ​​between each training data feature and the target data feature required by the central server, and the model training algorithm adopted by the initial model.

[0273] In one of the embodiments, if the model training algorithm adopted by the initial model is a federated learning algorithm, the function construction module 12 is also used to: construct a model loss function according to the number of training rounds and learning rate in the federated learning algorithm, and the data heterogeneity values ​​between each training data feature and the target data feature required by the central server.

[0274] In one embodiment, the training data features corresponding to each training data set include the proportion of the local data volume of the training data set in the total data volume corresponding to each training data set, and each training data label in the training data set and the first distribution probability corresponding to each training data label; the target data features include each target data label and the second distribution probability corresponding to each target data label.

[0275] In one of the embodiments, the first distribution probability corresponding to each training data label in the training data set is determined by the ratio between the label data volume corresponding to the training data label and the local data volume of the training data set.

[0276] In one of the embodiments, the data heterogeneity value between the training data feature corresponding to any training data set and the target data feature required by the central server is determined in the following manner: for each training data label in the training data set, the label heterogeneity value corresponding to the training data label is determined according to the first distribution probability corresponding to the training data label and the second distribution probability corresponding to each target data label;

[0277] According to the label heterogeneity values ​​corresponding to each training data label in the training data set, the data heterogeneity values ​​between the training data features corresponding to the training data set and the target data features required by the central server are determined.

[0278] In one embodiment, the function construction module 12 is further used to: select a matching data label that matches the training data label from each target data label;

[0279] The label isomerism value corresponding to the training data label is determined according to the first distribution probability corresponding to the training data label and the second distribution probability corresponding to each matching data label.

[0280] In one embodiment, the data selection module 13 is further used to: use an alliance formation game algorithm to determine the device alliance to which the local devices corresponding to each training data set belong; wherein each device alliance can maximize the participation reward of the local devices included in it when participating in model training;

[0281] With the goal of minimizing the function value of the model loss function, a target data set is selected from the training data sets corresponding to the local devices included in each device alliance.

[0282] In one embodiment, if the model training algorithm adopted by the initial model is a federated learning algorithm, the participation reward of each local device when participating in the model training is determined according to the single alliance heterogeneity value corresponding to the device alliance to which the local device belongs, the data heterogeneity value between the training data feature and the target data feature corresponding to the training data set of the local device, the maximum reward that the central server can provide, the privacy loss when the local device joins the device alliance to which the local device belongs, and the energy loss when the local device participates in the model training;

[0283] Among them, the single alliance heterogeneity value corresponding to the device alliance is determined according to the data heterogeneity value between the training data features and the target data features corresponding to the training data set provided by each local device in the device alliance.

[0284] In one embodiment, the data selection module 13 is further used to: determine a Nash stable partition using a coalition formation game algorithm; wherein the Nash stable partition includes at least one device coalition;

[0285] According to each device alliance in the Nash stable partition, the device alliance to which the local device corresponding to each training data set belongs is determined.

[0286] In one embodiment, the data selection module 13 is further used to: determine the Nash stable partition by using the alliance formation game algorithm with the stable partition formation condition as a constraint;

[0287] Among them, the stable partition formation condition includes that all local devices join the Nash stable partition, or the stable partition formation condition includes that not all local devices join the Nash stable partition, and the privacy sensitivity of each local device joining the Nash stable partition is greater than the set sensitivity threshold.

[0288] In one embodiment, the data selection module 13 is further used to: determine the Nash stable partition by using the alliance formation game algorithm with the upper limit of the number of alliance devices and the stable partition formation condition as constraints;

[0289] Wherein, when all local devices join the Nash stable partition, the upper limit of the number of alliance devices is the first upper limit value, and the first upper limit value is determined according to the set privacy sensitivity;

[0290] When not all local devices join the Nash stable partition, the upper limit of the number of alliance devices is the second upper limit value, which is determined based on the set privacy sensitivity and the minimum energy loss among the energy losses of each local device when participating in model training.

[0291] In one embodiment, the data selection module 13 is further used to: construct an initial device alliance corresponding to each local device, and construct an initial Nash partition according to each initial device alliance;

[0292] Determine whether any two initial device alliances in the initial Nash partition meet the alliance update conditions;

[0293] If so, the two initial device alliances that meet the alliance update condition are updated to obtain an updated initial device alliance, and based on the updated initial device alliance, the initial Nash partition is updated, and the step of determining whether any two initial device alliances in the initial Nash partition meet the alliance update condition is returned to be executed;

[0294] If it is not satisfied, the initial Nash partition will be used as the Nash stable partition.

[0295] In one embodiment, the alliance update condition includes at least one of an alliance fusion condition, an alliance separation condition or an alliance exchange condition; the data selection module 13 is further used to: if any two initial device alliances in the initial Nash partition meet any one of the alliance fusion condition, the alliance separation condition or the alliance exchange condition, then determine that any two initial device alliances in the initial Nash partition meet the alliance update condition.

[0296] In one embodiment, the data selection module 13 is further used to: form different alliance combinations based on the device alliances to which each local device belongs; wherein different alliance combinations include different device alliances;

[0297] For each alliance combination, determine the combined alliance heterogeneity value corresponding to the alliance combination according to the single alliance heterogeneity value corresponding to each device alliance included in the alliance combination;

[0298] Substitute the heterogeneous values ​​of each alliance combination into the model loss function to obtain the function value corresponding to each alliance combination;

[0299] A coalition combination with the smallest function value is selected from each coalition combination, and the training data set of the local device contained in the coalition combination with the smallest function value is used as the target data set.

[0300] Each module in the above-mentioned model training device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0301] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG9. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile 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 non-volatile storage medium. The database of the computer device is used to store data of the model training method. The input / output interface of the computer device is used to exchange information between the processor and an external local device. The communication 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, a model training method is implemented.

[0302] Those skilled in the art will understand that the structure shown in FIG. 9 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0303] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0304] Obtaining training data features corresponding to each training data set;

[0305] A model loss function is constructed according to the data heterogeneity value between each training data feature and the target data feature required by the central server; wherein the function value of the model loss function is positively correlated with each data heterogeneity value;

[0306] Taking minimizing the function value of the model loss function as the goal and taking the participation reward of the local device corresponding to each training data set when participating in the model training as the constraint, a target data set is selected from each training data set;

[0307] Use the target dataset to train the initial model.

[0308] In one embodiment, a readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0309] Obtaining training data features corresponding to each training data set;

[0310] A model loss function is constructed according to the data heterogeneity value between each training data feature and the target data feature required by the central server; wherein the function value of the model loss function is positively correlated with each data heterogeneity value;

[0311] Taking minimizing the function value of the model loss function as the goal and taking the participation reward of the local device corresponding to each training data set when participating in the model training as the constraint, a target data set is selected from each training data set;

[0312] Use the target dataset to train the initial model.

[0313] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0314] Obtaining training data features corresponding to each training data set;

[0315] A model loss function is constructed according to the data heterogeneity value between each training data feature and the target data feature required by the central server; wherein the function value of the model loss function is positively correlated with each data heterogeneity value;

[0316] Taking minimizing the function value of the model loss function as the goal and taking the participation reward of the local device corresponding to each training data set when participating in the model training as the constraint, a target data set is selected from each training data set;

[0317] Use the target dataset to train the initial model.

[0318] It should be noted that the user information (including but not limited to user local device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0319] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0320] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0321] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A model training method, characterized in that: Applied to a central server, the method comprises: Obtaining training data features corresponding to each training data set; Constructing a model loss function according to the data heterogeneity value between each training data feature and the target data feature required by the central server; wherein the function value of the model loss function is positively correlated with each data heterogeneity value; Taking minimizing the function value of the model loss function as a goal and taking the participation reward of the local device corresponding to each training data set when participating in the model training as a constraint, selecting a target data set from each training data set; The target data set is used to train the initial model.

2. The method according to claim 1, characterized in that The constructing of a model loss function according to data heterogeneity values ​​between each training data feature and the target data feature required by the central server includes: A model loss function is constructed according to data heterogeneity values ​​between each training data feature and the target data feature required by the central server, and a model training algorithm adopted by the initial model.

3. The method according to claim 2, characterized in that If the model training algorithm used by the initial model is a federated learning algorithm, then the model loss function is constructed according to the data heterogeneity values ​​between each training data feature and the target data feature required by the central server, and the model training algorithm used by the initial model, including: A model loss function is constructed according to the number of training rounds and the learning rate in the federated learning algorithm, and the data heterogeneity values ​​between each training data feature and the target data feature required by the central server.

4. The method according to claim 2, characterized in that The training data features corresponding to each training data set include the proportion of the local data volume of the training data set in the total data volume corresponding to each training data set, and each training data label in the training data set and the first distribution probability corresponding to each training data label; the target data features include each target data label and the second distribution probability corresponding to each target data label.

5. The method according to claim 4, characterized in that The first distribution probability corresponding to each training data label in the training data set is determined by the ratio between the label data volume corresponding to the training data label and the local data volume of the training data set.

6. The method according to claim 5, characterized in that The data heterogeneity value between the training data feature corresponding to any training data set and the target data feature required by the central server is determined in the following manner: For each training data label in the training data set, determining a label isomerism value corresponding to the training data label according to a first distribution probability corresponding to the training data label and a second distribution probability corresponding to each target data label; According to the label heterogeneity values ​​corresponding to the training data labels in the training data set, the data heterogeneity values ​​between the training data features corresponding to the training data set and the target data features required by the central server are determined.

7. The method according to claim 6, characterized in that The determining, according to the first distribution probability corresponding to the training data label and the second distribution probability corresponding to each target data label, the label isomerism value corresponding to the training data label comprises: Selecting a matching data label that matches the training data label from each target data label; The label isomerism value corresponding to the training data label is determined according to the first distribution probability corresponding to the training data label and the second distribution probability corresponding to each matching data label.

8. The method according to claim 1, characterized in that The method takes minimizing the function value of the model loss function as a goal, takes the participation reward of the local device corresponding to each training data set when participating in the model training as a constraint, and selects the target data set from each training data set, including: An alliance formation game algorithm is used to determine the device alliance to which the local devices corresponding to each training data set belong; wherein each device alliance can maximize the participation reward of the local devices it contains when participating in model training; With the goal of minimizing the function value of the model loss function, a target data set is selected from the training data sets corresponding to the local devices included in each device alliance.

9. The method according to claim 8, characterized in that If the model training algorithm adopted by the initial model is a federated learning algorithm, the participation reward of each local device when participating in the model training is determined according to the single alliance heterogeneity value corresponding to the device alliance to which the local device belongs, the data heterogeneity value between the training data feature corresponding to the training data set of the local device and the target data feature, the maximum reward that the central server can provide, the privacy loss when the local device joins the device alliance to which the local device belongs, and the energy loss when the local device participates in the model training; The single alliance heterogeneity value corresponding to the device alliance is determined according to the data heterogeneity value between the training data feature corresponding to the training data set provided by each local device in the device alliance and the target data feature.

10. The method according to claim 9, characterized in that The method of adopting an alliance formation game algorithm to determine the device alliance to which the local device corresponding to each training data set belongs includes: Adopting a coalition formation game algorithm to determine a Nash stable partition; wherein the Nash stable partition includes at least one device coalition; According to each device alliance in the Nash stable partition, the device alliance to which the local device corresponding to each training data set belongs is determined.

11. The method according to claim 10, characterized in that The coalition formation game algorithm is used to determine the Nash stable partition, including: With the stable partition formation conditions as constraints, the alliance formation game algorithm is used to determine the Nash stable partition; The stable partition formation condition includes that all local devices join the Nash stable partition; or, the stable partition formation condition includes that not all local devices join the Nash stable partition, and the privacy sensitivity of each local device joining the Nash stable partition is greater than a set sensitivity threshold.

12. The method according to claim 11, characterized in that The method of determining the Nash stable partition by using the alliance formation game algorithm with the stable partition formation conditions as constraints includes: Taking the upper limit of the number of alliance devices and the stable partition formation conditions as constraints, the alliance formation game algorithm is adopted to determine the Nash stable partition; Wherein, when all local devices join the Nash stable partition, the upper limit of the number of alliance devices is a first upper limit value, and the first upper limit value is determined according to the set privacy sensitivity; When not all local devices join the Nash stable partition, the upper limit of the number of alliance devices is a second upper limit value, and the second upper limit value is determined according to the set privacy sensitivity and the minimum energy loss of each local device when participating in model training.

13. The method according to claim 12, characterized in that The coalition formation game algorithm is used to determine the Nash stable partition, including: Construct an initial device alliance corresponding to each local device, and construct an initial Nash partition based on each initial device alliance; Determine whether any two initial device alliances in the initial Nash partition meet an alliance update condition; If so, the two initial device alliances that meet the alliance update condition are updated to obtain an updated initial device alliance, and based on the updated initial device alliance, the initial Nash partition is updated, and the step of determining whether any two initial device alliances in the initial Nash partition meet the alliance update condition is returned to be executed; If not, the initial Nash partition is used as a Nash stable partition.

14. The method according to claim 13, characterized in that The alliance update condition includes at least one of an alliance fusion condition, an alliance separation condition, or an alliance exchange condition; and the determining whether any two initial device alliances in the initial Nash partition meet the alliance update condition includes: If any two initial device alliances in the initial Nash partition satisfy any one of the alliance fusion condition, the alliance separation condition or the alliance exchange condition, it is determined that any two initial device alliances in the initial Nash partition satisfy the alliance update condition.

15. The method according to claim 8, characterized in that The step of minimizing the function value of the model loss function as a goal and selecting a target data set from the training data sets corresponding to the local devices included in each device alliance includes: Based on the device alliance to which each local device belongs, different alliance combinations are formed; wherein different alliance combinations contain different device alliances; For each alliance combination, determine the combined alliance heterogeneity value corresponding to the alliance combination according to the single alliance heterogeneity values ​​corresponding to each device alliance included in the alliance combination; Substitute the heterogeneous values ​​of each combined alliance into the model loss function to obtain the function value corresponding to each alliance combination; A coalition combination with the smallest function value is selected from each coalition combination, and the training data set of the local device contained in the coalition combination with the smallest function value is used as the target data set.

16. A model training device, characterized in that: Configured on a central server, the device includes: An acquisition module, used to acquire training data features corresponding to each training data set; A function construction module, used to construct a model loss function according to the data heterogeneity value between each training data feature and the target data feature required by the central server; wherein the function value of the model loss function is positively correlated with each data heterogeneity value; A data selection module, configured to select a target data set from each training data set with minimization of the function value of the model loss function as a goal and participation rewards when a local device corresponding to each training data set participates in model training as a constraint; The model training module is used to train the initial model using the target data set.

17. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 15 are implemented.

18. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 15 are implemented.

19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 15 are implemented.