Federal model training system, method and device, communication equipment and storage medium
By introducing the collaborative work of the master server, aggregation node and terminal in the federated learning system, aggregation and selection of model parameters, the problem of poor model adaptability in federated learning is solved, and better adaptation to the needs of each terminal is achieved.
Patent Information
- Application Number
- CN202310849071.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-11
- Publication Date
- 2025-01-14
AI Technical Summary
The existing federated learning training methods are inconsistent in the distribution of training data of each participant, resulting in poor adaptability of the federated model and cannot meet the needs of each participant.
By introducing the main server, aggregation node and terminal in the federated model training system, the terminal sends training result data to the aggregate node corresponding to the target classification after completing the model training. The aggregate node performs model parameter aggregation, and sends the aggregate model and the main to the terminal The server uploads, and the main server receives and aggregates each aggregate model to generate a global model. The terminal determines the target model from the aggregate model and the global model for the next round of training.
The adaptability of the federated model is improved, so that each terminal can obtain a federated model with better needs after multiple rounds of training.
Smart Images

Figure CN119312878A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of pan-intelligent terminal technology, and in particular to a federated model training system, method, apparatus, communication equipment, storage medium and computer program product. Background Art
[0002] With the development of the pan-intelligent terminal field, federated learning technology has emerged. Multiple participants in federated learning can conduct federated learning training on the initial model to obtain a federated model that is highly applicable to the needs of each participant.
[0003] In the current federated learning training method, each participant first downloads the initial model from the server and uses local data to train the initial model. After the model training is completed, the model parameters are sent to the server. The server aggregates the model parameters sent by each participant to obtain the model parameters to be updated, thereby updating the model parameters of the initial model to obtain the federated model after the model parameters are updated. The server then feeds back the model parameters of the latest federated model to each participant.
[0004] However, since the training data distribution of each participant in the current federated learning may be inconsistent, the federated model obtained based on this cannot meet the needs of each federated learning participant for the federated model, resulting in poor adaptability of the federated model. Summary of the invention
[0005] Embodiments of the present application provide a federated model training system, method, apparatus, communication device, storage medium, and computer program product that can improve the adaptability of the federated model.
[0006] A federated model system, the system comprising a main server, an aggregation node and a terminal, wherein:
[0007] The terminal is used to send training result data to the aggregation node corresponding to the target classification where the terminal is located after completing the current round of model training, wherein the training result data includes model parameters;
[0008] The aggregation node is used to receive the training result data sent by each terminal in the target category, aggregate the model parameters in each training result data to obtain an aggregate model, send the aggregate model to each terminal in the target category, and upload the aggregate model to the main server;
[0009] The main server is used to receive the aggregation model sent by each aggregation node, and aggregate the aggregation model uploaded by each aggregation node to obtain a global model;
[0010] The terminal is also used to receive the aggregation model sent by the aggregation node corresponding to the target classification where the terminal is located, and receive the global model sent by the main server, determine the target model from the aggregation model and the global model, and perform the next round of model training based on the target model.
[0011] In one embodiment, the system further comprises a hierarchical node, wherein:
[0012] The terminal is further used to send training result data to the hierarchical node after the first training is completed;
[0013] The hierarchical node is used to receive the training result data sent by the terminal, and according to the preset classification strategy, classify each terminal according to the training result data sent by each terminal to obtain a target classification, and for the target classification, based on each terminal in the target classification and the training result data sent by each terminal, generate an aggregate message corresponding to the target classification, and send the aggregate message corresponding to each target classification to each aggregation node respectively;
[0014] The aggregation node is used to receive the aggregation message, perform aggregation processing according to the model parameters of each terminal carried in the aggregation message, obtain the aggregation model, send the aggregation model to each terminal corresponding to the aggregation message, and upload the aggregation model to the main server.
[0015] In one of the embodiments, the terminal is also used to obtain the model training loss of the aggregate model and the model training loss of the global model, and determine the target model from the aggregate model and the global model based on the model training loss of the aggregate model and the model training loss of the global model.
[0016] In one of the embodiments, the terminal is further used to use the aggregate model as the target model if the model training loss of the aggregate model is less than the model training loss of the global model; or use the global model as the target model if the model training loss of the global model is less than the model training loss of the aggregate model.
[0017] In one embodiment, the training result data includes at least one of a data type, a number of training samples, a training sample number, and a training model, and the training result data also includes model parameters.
[0018] In one of the embodiments, the preset classification strategy includes at least one of classification based on data type, classification based on the degree of overlap of data features, and classification based on the number of training samples.
[0019] A federated model training method, applied to a terminal, comprising:
[0020] After completing the current round of model training, sending training result data to the aggregation node corresponding to the target category where the terminal is located, the training result data including model parameters;
[0021] Receiving the aggregation model sent by the aggregation node corresponding to the target classification and the global model sent by the main server;
[0022] A target model is determined from the aggregate model and the global model, and the next round of model training is performed based on the target model.
[0023] In one embodiment, the method further comprises:
[0024] After the first training is completed, an upload message carrying the training result data is sent to the hierarchical node, wherein the upload message is used to instruct the hierarchical node to determine the target category where the terminal belongs according to the training result data.
[0025] In one embodiment, determining the target model from the aggregate model and the global model includes:
[0026] Obtaining the model training loss of the aggregate model and obtaining the model training loss of the global model;
[0027] The target model is determined from the aggregate model and the global model according to the model training loss of the aggregate model and the model training loss of the global model.
[0028] In one embodiment, determining the target model from the aggregate model and the global model according to the model training loss of the aggregate model and the model training loss of the global model includes:
[0029] Compare the model training loss of the aggregate model with the model training loss of the global model, and if the model training loss of the aggregate model is less than the model training loss of the global model, use the aggregate model as the target model; or
[0030] If the model training loss of the global model is less than the model training loss of the aggregate model, the global model is used as the target model.
[0031] A federated model training method, applied to a master server, comprising:
[0032] Receiving an aggregation model uploaded by each aggregation node, wherein the aggregation model is a model obtained by aggregating model parameters carried in the training result data sent by each terminal belonging to the target classification after the aggregation node receives the training result data sent by each terminal;
[0033] Aggregating the aggregation models uploaded by each aggregation node to obtain a global model;
[0034] Determine whether the global model meets the iterative training conditions. If the global model does not meet the iterative training conditions, send the global model to each of the terminals so that each of the terminals determines the target model to be used in the next round of training from the aggregate model and the global model.
[0035] In one of the embodiments, the iterative training condition is that the global model converges, or the number of model training rounds reaches a preset number of training rounds.
[0036] A federated model training device, comprising:
[0037] A sending module, used to send training result data including model parameters to the aggregation node corresponding to the target category where the terminal is located after completing the current round of model training;
[0038] A receiving module, used for receiving the aggregation model sent by the aggregation node corresponding to the target classification and the global model sent by the main server;
[0039] The first determination module is used to determine the target model from the aggregate model and the global model, and perform the next round of model training based on the target model.
[0040] In one embodiment, the device further comprises:
[0041] The second determination module sends an upload message carrying the training result data to the hierarchical node after the first training is completed, wherein the upload message is used to instruct the hierarchical node to determine the target category where the terminal belongs according to the training result data.
[0042] In one embodiment, the first determining module is specifically configured to:
[0043] Obtaining the model training loss of the aggregate model and obtaining the model training loss of the global model;
[0044] The target model is determined from the aggregate model and the global model according to the model training loss of the aggregate model and the model training loss of the global model.
[0045] In one embodiment, the first determining module is specifically configured to:
[0046] Compare the model training loss of the aggregate model with the model training loss of the global model, and if the model training loss of the aggregate model is less than the model training loss of the global model, use the aggregate model as the target model; or
[0047] If the model training loss of the global model is less than the model training loss of the aggregate model, the global model is used as the target model.
[0048] A federated model training device, comprising:
[0049] A receiving module, used to receive the aggregation model uploaded by each aggregation node, wherein the aggregation model is a model obtained by aggregating the model parameters carried in the training result data sent by each terminal belonging to the target classification after the aggregation node receives the training result data sent by each terminal;
[0050] An aggregation module, used for aggregating the aggregation models uploaded by each aggregation node to obtain a global model;
[0051] A determination module is used to determine whether the global model meets the iterative training conditions. If the global model does not meet the iterative training conditions, the global model is sent to each terminal so that each terminal determines the target model used in the next round of training from the aggregate model and the global model.
[0052] In one of the embodiments, the iterative training condition is that the global model converges, or the number of model training rounds reaches a preset number of training rounds.
[0053] A communication device, comprising: a transmitter, a processor and a receiver;
[0054] The transmitter is used to send training result data to the aggregation node corresponding to the target classification where the terminal is located after completing the current round of model training, wherein the training result data includes model parameters;
[0055] The receiver is used to receive the aggregation model sent by the aggregation node corresponding to the target classification and the global model sent by the main server;
[0056] The processor is used to determine a target model from the aggregate model and the global model, and perform a next round of model training based on the target model.
[0057] A communication device, comprising: a transmitter, a processor and a receiver;
[0058] The receiver is used to receive the aggregation model sent by each aggregation node, where the aggregation model is a model obtained by aggregating the model parameters carried in the training result data sent by each terminal belonging to the target classification after the aggregation node receives the training result data sent by each terminal;
[0059] The processor is used to aggregate the aggregation models sent by each aggregation node to obtain a global model, and determine whether the global model meets the iterative training condition;
[0060] The transmitter is used to send the global model to each of the terminals if the global model does not meet the iterative training conditions, so that each of the terminals determines the target model used in the next round of training from the aggregate model and the global model.
[0061] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-mentioned federated model training methods.
[0062] A chip includes a programmable logic circuit and / or program instructions, which can implement the steps of the above-mentioned federated model training method when the chip is running.
[0063] A computer program product includes a computer program, characterized in that when the computer program is executed by a processor, the steps of the above-mentioned federated model training method are implemented.
[0064] The above-mentioned federated model training system, method, apparatus, communication equipment, storage medium and computer program product, wherein the federated model training system includes a main server, an aggregation node and a terminal, wherein: the terminal is used to send training result data to the aggregation node corresponding to the target classification where the terminal is located after completing the current round of model training, and the training result data includes model parameters; the aggregation node is used to receive the training result data sent by each of the terminals in the target classification, and aggregate the model parameters in each of the training result data to obtain an aggregate model, and send the aggregate model to each of the terminals in the target classification, and send the aggregate model to the main server; the main server is used to receive the aggregate model sent by each of the aggregation nodes, and aggregate the aggregate models uploaded by each of the aggregation nodes to obtain a global model; the terminal is also used to receive the aggregate model sent by the aggregation node corresponding to the target classification where the terminal is located, and receive the global model sent by the main server, determine the target model from the aggregate model and the global model, and perform the next round of model training based on the target model. Each aggregation node aggregates the model parameters corresponding to each target category, and each terminal can obtain the aggregate model corresponding to the target category where the terminal is located. Since the target model with better adaptability to the terminal can be selected from the global model and the aggregate model, and the next round of model training is performed based on the target model, after multiple rounds of model training, a federated model with good adaptability to each terminal can be obtained. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 A schematic diagram of an application scenario of a federated model training system in an embodiment;
[0066] Figure 2 A schematic diagram of an application scenario of a federated model training system in another embodiment;
[0067] Figure 3 A schematic diagram of a process of a federated model training method in one embodiment;
[0068] Figure 4 A schematic diagram of a process for determining a target model in one embodiment;
[0069] Figure 5 A schematic diagram of a process for comparing the model training loss of an aggregate model with the model training loss of a global model to determine a target model in one embodiment;
[0070] Figure 6 A schematic diagram of a flow chart of a federated model training method in another embodiment;
[0071] Figure 7A flowchart of an example of a processing process of a main server, a terminal, a hierarchical node, and an aggregation node in a federated model training method in one embodiment;
[0072] Figure 8 A signaling interaction flow chart of a training method for a federated model in an embodiment;
[0073] Fig. 9 is a structural block diagram of a federated model training device in one embodiment;
[0074] Fig.10 is a structural block diagram of a federated model training device in another embodiment;
[0075] Fig.11 is an internal structure diagram of a communication device in one embodiment;
[0076] Fig.12 FIG. 4 is a diagram showing the internal structure of a communication device in one embodiment. DETAILED DESCRIPTION
[0077] 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.
[0078] Figure 1 A schematic diagram of an application scenario of a federated model training system provided in an embodiment of the present application. Figure 1 As shown, the scenario includes a terminal 100, an aggregation node 200, and a main server 300. The terminal 100 and the aggregation node 200 perform data transmission through the network, the terminal 100 and the main server 300 perform data transmission through the network, and the aggregation node 200 and the main server 300 perform data transmission through the network. The terminal 100 is a terminal used by a participant in federated learning.
[0079] The terminal 100 may be a wireless terminal, which may be a device that provides voice and / or other business data connectivity to a user, or a handheld device with a wireless connection function, or other processing devices connected to a wireless modem. The wireless terminal may communicate with one or more core networks via a radio access network (Radio Access Network, referred to as RAN). The wireless terminal may be a mobile terminal, such as a mobile phone (or "cellular" phone) and a computer with a mobile terminal, for example, a portable, pocket-sized, handheld, computer-built-in or vehicle-mounted mobile device, which exchanges language and / or data with a radio access network. The wireless terminal may also be referred to as a system, a subscriber unit (Subscriber Unit), a subscriber station (Subscriber Station), a mobile station (Mobile Station), a mobile station (Mobile), a remote station (Remote Station), a remote terminal (Remote Terminal), an access terminal (Access Terminal), a user terminal (User Terminal), a user agent (User Agent), a user device (User Device or User Equipment), which is not limited here. The main server 300 and each aggregation node 200 may be implemented with an independent server or a server cluster consisting of multiple servers.
[0080] Before introducing the specific embodiments of the present invention, the professional terms involved in the present invention are explained first:
[0081] Federated Machine Learning (FML): is a paradigm of model centralization and data decentralization, which aims to protect user privacy and data security. According to the distribution of data features and data samples among participants, federated learning can generally be divided into horizontal federated learning, vertical federated learning, and federated transfer learning. Horizontal federated learning is suitable for scenarios with large feature overlap and small user overlap; vertical federated learning is suitable for scenarios with large user overlap and small feature overlap; and federated transfer learning is suitable for scenarios with small overlap of both user and sample features.
[0082] Federated learning mainly consists of four steps: first, the server initializes the model parameters; then each participant downloads the model from the server and trains the model using local data; then the parameters that need to be updated are returned to the server; finally, the server aggregates the parameters returned by each participant, updates the model, and then feeds the latest model back to each participant.
[0083] Edge learning: A "cloud-edge-end" hierarchical, distributed computing framework that ensures that data is processed locally at the data source or the nearest edge server, and only needs to communicate the necessary model parameters with the cloud center server. Edge learning uses the method of processing data locally on the nearest edge server / terminal device, which provides a basic guarantee for the implementation of privacy computing based on federated learning.
[0084] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0085] In one embodiment, Figure 1 As shown, a federated model training system is provided. The federated model training system includes a main server, an aggregation node and a terminal.
[0086] Among them, the terminal is used to send training result data to the aggregation node corresponding to the target classification where the terminal is located after completing the current round of model training, and the training result data includes model parameters. The aggregation node is used to receive the training result data sent by each terminal in the target classification, and aggregate the model parameters in each training result data to obtain an aggregate model, and send the aggregate model to each terminal in the target classification, and upload the aggregate model to the main server. The main server is used to receive the aggregate model sent by each aggregation node, and aggregate the aggregate models uploaded by each aggregation node to obtain a global model; the terminal is also used to receive the aggregate model sent by the aggregation node corresponding to the target classification where the terminal is located, and receive the global model sent by the main server, determine the target model from the aggregate model and the global model, and perform the next round of model training based on the target model.
[0087] Among them, the aggregation model and the global model are models that can perform federated learning. Any model that can be used for federated learning can be used as an aggregation model and a global model. The embodiments of this application do not specifically limit the types of aggregation models and global models. Aggregation processing refers to the process of merging model parameters of multiple models into one model. For aggregation processing, a weighted average algorithm can be used. For the algorithm used for aggregation processing, any algorithm that can achieve aggregation processing of the model can be applied to this application, and this application does not limit this.
[0088] In the embodiment of the present application, for each terminal, before the terminal performs the current round of model training, the main server determines whether the global model meets the iterative training conditions. If the global model does not meet the iterative training conditions, the main server can send the global model to each terminal, and the aggregation node corresponding to the target classification where the terminal is located can send the aggregation model to the terminal. The terminal receives the global model sent by the main server and the aggregation model sent by the aggregation node. The terminal determines the target model from the aggregation model and the global model, and performs the current round of model training based on the target model.
[0089] After each terminal completes the current round of model training, each terminal sends the training result data to the aggregation node corresponding to the target category where each terminal is located. For each aggregation node, after receiving the training result data sent by multiple terminals corresponding to each target category, the aggregation node can aggregate the model parameters in each training result data to obtain the aggregation model of the current round, and send the aggregation model to each terminal in the target category. At the same time, the aggregation node can also upload the aggregation model to the main server, where the aggregation model includes the model parameters of the aggregation model.
[0090] Optionally, the aggregation node may also upload only the model parameters of the aggregation model to the main server.
[0091] After receiving the aggregation model sent by each aggregation node, the main server aggregates the aggregation model uploaded by each aggregation node to obtain the global model corresponding to the current round. The main server determines whether the global model meets the iterative training conditions. If the global model does not meet the iterative training conditions, the main server can send the global model to each terminal. The global model includes the model parameters of the global model.
[0092] Optionally, the main server may also only send the model parameters of the global model to each terminal.
[0093] For each terminal, after receiving the current round of aggregation model sent by the aggregation node corresponding to the target classification and the current round of global model sent by the main server, the terminal determines the target model from the aggregation model and the global model, and performs the next round of model training based on the target model.
[0094] Among them, the global model meets the iterative training condition to represent that the global model has completed model training and obtained the target federated model.
[0095] In the above-mentioned federated learning system, the terminal is used to send the training result data to the aggregation node corresponding to the target classification where the terminal is located after completing the current round of model training; the aggregation node is used to receive the training result data sent by each terminal in the target classification, and aggregate the model parameters in each training result data to obtain an aggregate model, and send the aggregate model to each terminal in the target classification, and send the aggregate model to the main server; the main server is used to receive the aggregate model sent by each aggregation node, and aggregate the aggregate model uploaded by each aggregation node to obtain a global model; the terminal is also used to receive the aggregate model sent by the aggregation node corresponding to the target classification where the terminal is located, and receive the global model sent by the main server, determine the target model from the aggregate model and the global model, and perform the next round of model training based on the target model. Each aggregation node aggregates the model parameters corresponding to each target classification, and each terminal can obtain the aggregate model corresponding to the target classification where the terminal is located. Since the target model with better adaptability to the terminal can be selected from the global model and the aggregation model, and the next round of model training can be performed according to the target model, after multiple rounds of model training, a federated model with good adaptability to each terminal can be obtained.
[0096] In one embodiment, Figure 2 As shown, the above system also includes hierarchical nodes.
[0097] Among them, the terminal is also used to send training result data to the hierarchical node after the first training is completed; the hierarchical node is used to receive the training result data sent by the terminal, and according to the preset classification strategy, classify each terminal according to the training result data sent by each terminal to obtain the target classification, and for the target classification, based on each terminal in the target classification and the training result data sent by each terminal, generate an aggregation message corresponding to the target classification, and send the aggregation message corresponding to each target classification to each aggregation node respectively; the aggregation node is used to receive the aggregation message, perform aggregation processing according to the model parameters of each terminal carried in the aggregation message, obtain the aggregation model, and send the aggregation model to each terminal corresponding to the aggregation message, and upload the aggregation model to the main server.
[0098] The hierarchical nodes can be implemented by independent servers or server clusters composed of multiple servers. The target category includes at least one terminal.
[0099] In the embodiment of the present application, before each terminal performs the first model training, the main server sends an initial model to each terminal. After receiving the initial model sent by the main server, each terminal performs the first model training on the initial model based on the training data.
[0100] The training data refers to a plurality of training sample data required for model training.
[0101] After the first training is completed, the terminal obtains the training result data. After each terminal completes the first model training, each terminal can send the training result data to the hierarchical node. The hierarchical node receives the training result data sent by each terminal, and classifies each terminal according to the preset classification strategy and the training result data sent by each terminal to obtain at least one classification.
[0102] Each classification may correspond to an aggregation node. For example, when the hierarchical node is determined to be classified into five categories, five aggregation nodes may be determined. Optionally, when the hierarchical node is determined to be classified into five categories, five different aggregation modules in one aggregation node may also correspond. The number of aggregation nodes is not specifically limited in this application.
[0103] For any classification, the hierarchical node generates an aggregate message corresponding to the classification based on the identification information of each terminal in the classification and the training result data sent by each terminal, and sends the aggregate message corresponding to each classification to each aggregation node respectively.
[0104] Each aggregation node receives the aggregation messages corresponding to each classification determined by the hierarchical node. For each aggregation node, the aggregation node aggregates the model parameters according to the model parameters of each terminal carried in the corresponding aggregation message to obtain an aggregation model, and sends the aggregation model to the terminal corresponding to the identification information of each terminal according to the identification information of each terminal carried in the aggregation message. The aggregation node can also upload the aggregation model to the main server.
[0105] The identification information of the terminal is used to enable the main server or the aggregation node to send the global model or the aggregation model to the terminal corresponding to the identification information.
[0106] In this embodiment, by introducing hierarchical nodes, the training result data corresponding to the terminals participating in the model training in the federated learning can be classified during the first training process, which can reduce the impact of the data volume caused by data heterogeneity on the federated learning participants, thereby reducing the amount of calculation of the federated training. The hierarchical nodes can also send the training result data corresponding to each target classification to the aggregation node corresponding to each target classification after determining the target classification corresponding to each terminal, so as to facilitate the subsequent acquisition of an aggregation model adapted to each target classification through multiple aggregation nodes.
[0107] In one embodiment, the terminal is also used to obtain the model training loss of the aggregate model and the model training loss of the global model, and determine the target model from the aggregate model and the global model according to the model training loss of the aggregate model and the model training loss of the global model.
[0108] In an embodiment of the present application, the terminal can determine the model training loss of the aggregate model and the model training loss of the global model based on the model parameters carried by the aggregate model and the global model before performing the current round of model training.
[0109] Among them, for the calculation method of model training loss, any algorithm that can determine the model training loss based on the model parameters of the model can be applied to this application, and the embodiments of this application do not make specific limitations on this.
[0110] Then, the terminal compares the model training loss of the aggregate model and the model training loss of the global model to obtain a comparison result. According to the comparison result, the terminal determines the target model from the aggregate model and the global model.
[0111] In this embodiment, the terminal can determine a target model with better training effect according to the model training loss of the aggregate model and the model training loss of the global model, so that the subsequent terminal can perform the next round of model training based on the target model.
[0112] In one embodiment, the terminal is further used to use the aggregate model as the target model if the model training loss of the aggregate model is less than the model training loss of the global model; or use the global model as the target model if the model training loss of the global model is less than the model training loss of the aggregate model.
[0113] In an embodiment of the present application, the terminal may compare the model training loss of the aggregate model with the model training loss of the global model to obtain a comparison result. Based on the comparison result, the terminal determines the size of the model training loss of the aggregate model and the model training loss of the global model, and uses the model with the smaller model training loss as the target aggregate model. For the method of comparing the model training loss of the aggregate model with the model training loss of the global model, the method of formula (1) can be referred to, and the specific process is as follows:
[0114]
[0115] Among them, when Φ t <0, the aggregate model is used as the target model. t <1, the global model is used as the target model; L represents the loss function used by the terminal for the model, such as the square loss function, the exponential loss function, etc. This application does not specifically limit the choice of the loss function; Characterizing the aggregation model, ω t represents the global model, t represents the model training round, and a represents the node identifier of the aggregation node corresponding to the aggregation model.
[0116] It is understandable that when the model training loss of the aggregate model is the same as the model training loss of the global model, the terminal can further compare the other parameters of the aggregate model and the global model, and select one of the models from the aggregate model and the global model as the target model. For example, the terminal can determine the target model based on the learning rate and convergence of the aggregate model and the global model. The method for determining the target model can be determined by technicians in actual applications, and this application does not limit it.
[0117] In this embodiment, the terminal may compare the model training loss of the aggregate model with the model training loss of the global model to determine a target model with a smaller model training loss, so that subsequent terminals can perform the next round of model training based on the target model.
[0118] In one embodiment, the training result data includes at least one of a data type, a number of training samples, a training sample number, and a training model, and the training result data also includes model parameters.
[0119] Among them, the data type can represent the format of the training samples for model training of the terminal, for example, the data type is picture type, text type, video type, audio type, computer language type, graphic type, image type, etc.; the number of training samples represents the number of training samples or data capacity for model training of the terminal, for example, 10,000; the training sample number represents the identification of the training samples for model training of the terminal, which can enable the hierarchical nodes to further distinguish the training result data, and facilitate the classification of the training result data; the training model can represent the identification of the model, such as the name and category of the model; the model parameters may include but are not limited to model weights and model biases. In the case where the global model or the aggregate model is a deep learning model, the model weight represents the connection strength between neurons, and the size of the weight represents the size of the possibility; the model bias is an important parameter in the model, which is equivalent to adding a constant.
[0120] In one embodiment, the preset classification strategy includes at least one of classification based on data type, classification based on the degree of overlap of data features, and classification based on the number of training samples.
[0121] In the embodiment of the present application, the hierarchical node may pre-store a preset classification strategy. The hierarchical node may classify the training result data based on one of the strategies of classifying according to data type, classifying according to the degree of overlap of data features, and classifying according to the number of training samples.
[0122] Exemplarily, for a preset classification strategy for classification based on data type, the hierarchical node may take training sample data of picture type as the first classification, training sample data of text type as the second classification, and training sample data of audio type as the third classification.
[0123] Exemplarily, for a preset classification strategy for classification based on the degree of data feature overlap, the hierarchical node may pre-store multiple data feature overlap thresholds and determine the degree of data feature overlap of each training result data. The hierarchical node determines that the training result data belongs to the first classification when the degree of data feature overlap of the training result data is greater than the first data feature overlap threshold; determines that the training result data belongs to the second classification when the degree of data feature overlap of the training result data is greater than the second data feature overlap threshold and is less than or equal to the first data feature overlap threshold; determines that the training result data belongs to the third classification when the degree of data feature overlap of the training result data is greater than the third data feature overlap threshold and is less than or equal to the second data feature overlap threshold.
[0124] The first data feature overlap threshold is higher than the second data feature overlap threshold, and the second data feature overlap threshold is higher than the third data feature overlap threshold. The number of data feature overlap thresholds is not specifically limited in the present embodiment.
[0125] Exemplarily, for a preset classification strategy for classification based on the number of training samples, the hierarchical node may pre-store multiple training sample number thresholds. The hierarchical node determines that the training result data belongs to the first classification when the number of training samples of the training result data is greater than the first training sample number threshold; determines that the training result data belongs to the second classification when the number of training samples of the training result data is greater than the second training sample number threshold and less than or equal to the first training sample number threshold; determines that the training result data belongs to the third classification when the number of training samples of the training result data is greater than the third training sample number threshold and less than or equal to the second training sample number threshold.
[0126] The first training sample quantity threshold is higher than the second training sample quantity threshold, and the second training sample quantity threshold is higher than the third training sample quantity threshold. The embodiment of the present application does not specifically limit the number of training sample quantity thresholds.
[0127] Optionally, the hierarchical node can also classify each training result data based on a variety of classification strategies such as classification according to data type, classification according to the degree of overlap of data features, and classification according to the number of training samples. For example, the hierarchical node determines that the data type of a training result data is a picture type and the number of training samples is less than or equal to the training sample number threshold, the data type of b training result data is a picture and the number of training samples is greater than the training sample threshold, and the data type of c training result data is a text type and the data volume is less than or equal to the training sample number threshold, then the hierarchical node determines that the training result data can be divided into three categories.
[0128] Optionally, the preset classification strategies may be further divided according to the actual application by the technicians. The embodiment of the present application does not limit the number and combination of the preset classification strategies.
[0129] In this embodiment, the hierarchical node can classify multiple training data results based on multiple preset classification strategies, which can reduce the impact of data volume on federated learning participants due to data heterogeneity, thereby reducing the amount of computation for federated training. The hierarchical node can also send the training result data corresponding to each target classification to the aggregation node corresponding to each target classification after determining the target classification corresponding to each terminal, so as to obtain an aggregation model adapted to each target classification through multiple aggregation nodes.
[0130] In one embodiment, Figure 3 As shown in Figure 1, a federated model training method is provided. This method is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0131] Step 302, after completing the current round of model training, the training result data is sent to the aggregation node corresponding to the target category where the terminal is located.
[0132] The training result data includes model parameters, which may include but are not limited to model weights and model biases. The training result data may also include at least one of a data type, a number of training samples, a training sample number, and a training model.
[0133] In the embodiment of the present application, for each terminal, before the terminal performs the current round of model training, the main server may send a global model to the terminal, and the aggregation node corresponding to the target classification where the terminal is located may send an aggregation model to the terminal. The terminal receives the global model sent by the main server and the aggregation model sent by the aggregation node, and the terminal determines the target model from the aggregation model and the global model, and performs the current round of model training based on the target model.
[0134] After each terminal completes the current round of model training, each terminal sends the training result data to the aggregation node corresponding to the target category of each terminal.
[0135] Step 304: Receive the aggregation model sent by the aggregation node corresponding to the target classification and the global model sent by the main server.
[0136] In an embodiment of the present application, for each aggregation node, after receiving the training result data sent by multiple terminals corresponding to each target classification, the aggregation node can aggregate the model parameters in each training result data to obtain the aggregation model of the current round, and send the aggregation model to each terminal in the target classification. At the same time, the aggregation node can also upload the aggregation model to the main server.
[0137] After receiving the aggregation model sent by each aggregation node, the main server aggregates the aggregation model uploaded by each aggregation node to obtain the global model corresponding to the current round. The main server determines whether the global model meets the iterative training conditions. If the global model does not meet the iterative training conditions, the main server can send the global model to each terminal. Optionally, the main server can also send the model parameters of the global model to each terminal.
[0138] Each terminal receives the current round of aggregation model sent by the aggregation node corresponding to the target classification, and the current round of global model sent by the main server.
[0139] Step 306, determining a target model from the aggregate model and the global model, and performing the next round of model training based on the target model.
[0140] In an embodiment of the present application, after receiving the aggregate model and the global model, each terminal determines the target model from the aggregate model and the global model, and performs the next round of model training based on the target model.
[0141] In the above-mentioned federated model training method, after completing the current round of model training, the training result data is sent to the aggregation node corresponding to the target classification where the terminal is located, and the training result data includes model parameters; the aggregation model sent by the aggregation node corresponding to the target classification and the global model sent by the main server are received; the target model is determined from the aggregation model and the global model, and the next round of model training is performed based on the target model, and each aggregation node respectively aggregates the model parameters corresponding to each target classification, so that each terminal can obtain the aggregation model corresponding to the target classification where the terminal is located. Since the aggregation node can classify and aggregate the data classified by the hierarchical nodes and update the model with the main server, the main server can determine the weight of the global model aggregation according to the number of training samples in the training result data of different aggregation nodes. The terminal can select a target model with better adaptability to the terminal from the global model and the aggregation model, and perform the next round of model training according to the target model. Therefore, after multiple rounds of model training, a federated model with good adaptability to each terminal can be obtained.
[0142] In one embodiment, the method further includes:
[0143] After the first training is completed, an upload message carrying the training result data is sent to the layer node.
[0144] The upload message is used to instruct the hierarchical node to determine the target category of the terminal according to the training result data.
[0145] In the embodiment of the present application, before each terminal performs the first model training, the main server sends an initial model to each terminal. After receiving the initial model sent by the main server, each terminal performs the first model training on the initial model based on the training data.
[0146] After the first training is completed, the terminal obtains the training result data. After each terminal completes the first model training, each terminal can send an upload message carrying the training result data to the hierarchical node. The hierarchical node receives the training result data sent by each terminal, and classifies each terminal according to the preset classification strategy and the training result data sent by each terminal to obtain at least one classification. The hierarchical node can determine the target classification corresponding to each terminal based on the identification information of each terminal.
[0147] In this embodiment, the hierarchical nodes can be used to classify the training result data corresponding to the terminals participating in the model training in the federated learning during the first training process, which can reduce the impact of the data volume caused by data heterogeneity on the participants of the federated learning, thereby reducing the amount of calculation of the federated training. The hierarchical nodes can also send the training result data corresponding to each target classification to the aggregation node corresponding to each target classification after determining the target classification corresponding to each terminal, so as to facilitate the subsequent acquisition of an aggregation model adapted to each target classification through multiple aggregation nodes.
[0148] In one embodiment, Figure 4 As shown, step 306 includes:
[0149] Step 402, obtaining the model training loss of the aggregate model and obtaining the model training loss of the global model.
[0150] In an embodiment of the present application, the terminal can determine the model training loss of the aggregate model and the model training loss of the global model based on the model parameters carried by the aggregate model and the global model before performing the current round of model training.
[0151] Step 404 , determining a target model from the aggregate model and the global model according to the model training loss of the aggregate model and the model training loss of the global model.
[0152] In the embodiment of the present application, the terminal compares the model training loss of the aggregate model and the model training loss of the global model to obtain a comparison result. According to the comparison result, the terminal determines the target model from the aggregate model and the global model.
[0153] In this embodiment, the terminal can determine a target model with better training effect according to the model training loss of the aggregate model and the model training loss of the global model, so that the subsequent terminal can perform the next round of model training based on the target model.
[0154] In one embodiment, Figure 5 As shown, step 404 includes:
[0155] Step 502: compare the model training loss of the aggregate model with the model training loss of the global model. If the model training loss of the aggregate model is less than the model training loss of the global model, use the aggregate model as the target model.
[0156] In an embodiment of the present application, the terminal may compare the model training loss of the aggregate model with the model training loss of the global model to obtain a comparison result. If the comparison result indicates that the model training loss of the aggregate model is less than the model training loss of the global model, the terminal uses the aggregate model as the target model.
[0157] Step 504: If the model training loss of the global model is less than the model training loss of the aggregate model, the global model is used as the target model.
[0158] In the embodiment of the present application, when the comparison result indicates that the model training loss of the global model is less than the model training loss of the aggregate model, the terminal uses the aggregate model as the target model.
[0159] It is understandable that when the model training loss of the aggregate model is the same as the model training loss of the global model, the terminal can further compare the other parameters of the aggregate model and the global model, and select one of the models from the aggregate model and the global model as the target model. For example, the terminal can determine the target model based on the learning rate and convergence of the aggregate model and the global model. The method for determining the target model can be determined by technicians in actual applications, and this application does not limit it.
[0160] In this embodiment, the terminal can compare the model training loss of the aggregate model with the model training loss of the global model to obtain model parameters that are closer to its own goals, and then a target model with a smaller model training loss, so that subsequent terminals can perform the next round of model training based on the target model.
[0161] In one embodiment, Figure 6 As shown in Figure 1, a federated model training method is provided. This method is applied to Figure 1 The following steps are used as an example to illustrate the main server in the example:
[0162] Step 602: receiving the aggregation model uploaded by each aggregation node.
[0163] The aggregation model is a model obtained by aggregating the model parameters carried in the training result data sent by each terminal after the aggregation node receives the training result data sent by each terminal belonging to the target classification.
[0164] In the embodiment of the present application, after the aggregation node receives the training result data sent by multiple terminals corresponding to each target classification, the model parameters in each training result data can be aggregated to obtain the aggregation model of the current round. The aggregation node can upload the aggregation model to the main server. The main server receives the aggregation model sent by each aggregation node.
[0165] Step 604: Aggregate the aggregation models uploaded by each aggregation node to obtain a global model.
[0166] In the embodiment of the present application, after receiving the aggregation model sent by each aggregation node, the main server aggregates the aggregation model uploaded by each aggregation node to obtain a global model corresponding to the current round.
[0167] Step 606, determine whether the global model meets the iterative training conditions. If the global model does not meet the iterative training conditions, send the global model to each terminal so that each terminal determines the target model to be used in the next round of training from the aggregate model and the global model.
[0168] In the embodiment of the present application, the main server determines whether the global model meets the iterative training conditions. If the global model does not meet the iterative training conditions, the main server can send the global model to each terminal. After receiving the current round of aggregation model sent by the aggregation node corresponding to the target classification and the current round of global model sent by the main server, each terminal determines the target model from the aggregation model and the global model to perform the next round of model training based on the target model.
[0169] In the above-mentioned federated model training method, by receiving the aggregate model uploaded by each aggregation node, the aggregate model is a model obtained by aggregating the model parameters carried in the training result data sent by each terminal after the aggregation node receives the training result data sent by each terminal belonging to the target classification; aggregating the aggregate models uploaded by each aggregation node to obtain a global model; judging whether the global model meets the iterative training conditions, if the global model does not meet the iterative training conditions, sending the global model to each terminal, so that each terminal determines the target model used in the next round of training from the aggregate model and the global model. Since the terminal can select a target model with better adaptability from the global model and the aggregate model, and perform the next round of model training according to the target model, after multiple rounds of model training, a federated model with good adaptability to each terminal can be obtained.
[0170] In one embodiment, the iterative training condition is that the global model converges, or the number of rounds of model training reaches a preset number of training rounds.
[0171] In an embodiment of the present application, the main server may pre-store preset training rounds. After the main server sends the global model to the terminal once, the model training rounds may be increased until the terminal reaches the preset training rounds. The main server then determines that the global model meets the iterative training conditions.
[0172] The main server may also test the convergence of the global model. When it is determined that the global model has converged, the main server determines that the global model meets the iterative training conditions.
[0173] Among them, for the method of testing the convergence of the global model, any algorithm that can determine whether the model has converged can be applied to the present application, and the embodiments of the present application do not limit this.
[0174] In one embodiment, Figure 7As shown, an example of the processing process of the main server, terminal, hierarchical node and aggregation node in the federated model training method is also provided, and the specific contents include:
[0175] Step A1: Each terminal obtains the initial model sent by the main server.
[0176] Exemplarily, when the number of participants is 3, each participant may download the initial model from the main server through a terminal.
[0177] In step A2, each terminal performs model training on the initial model using training data, and uploads the training result data to the hierarchical node.
[0178] Exemplarily, three participants use local data (ie, training data) through a terminal to perform model training on the initial model, and upload the training result data to the hierarchical node.
[0179] The training result data uploaded by participant 1 through the terminal include: data type image, number of training samples 10 and training sample ID number (i.e. training sample identification), training model, weight, and bias; the data uploaded by participant 2 include: data type image, number of training samples 100 and training sample ID number (i.e. training sample identification), training model, model weight, and model bias; the data uploaded by participant 3 include: data type image, number of training samples 49 and training sample ID number (i.e. training sample identification), training model, model weight, and model bias;
[0180] In step A3, the hierarchical node obtains the target classification according to the training result data and the preset classification strategy. For the target classification, based on the identification information of each terminal in the target classification and the training result data sent by each terminal, an aggregate message corresponding to the target classification is generated, and the aggregate message corresponding to each target classification is sent to each aggregation node respectively.
[0181] Exemplarily, the hierarchical node classifies the training result data according to the preset classification strategy: data type, data quantity of 50 preset classification strategies, and each training result data. Since the training result data of participants 1 and 3 are of data type of picture and the number of training samples is less than 50, and the training result data of participant 2 are of data type of picture and the number of training samples is greater than 50. The hierarchical node determines each training result data into two categories, and sends the training result data of participants 1 and 3 of the first category to aggregation node 1, and sends the training result data of participant 2 of the second category to aggregation node 2.
[0182] In step A4, each aggregation node aggregates the received training result data to obtain an aggregation model, sends the aggregation model to the main server, and sends the aggregation model to each terminal.
[0183] Exemplarily, aggregation node 1 and aggregation node 2 respectively aggregate the received training result data and obtain an aggregation model Aggregation Model
[0184] Step A5: The main server receives the aggregation models sent by each aggregation node, and performs aggregation processing on each aggregation model to obtain a global model. The main server determines whether the global model meets the iterative training conditions.
[0185] Exemplarily, the main server receives the model parameters of the aggregation model sent by the two aggregation nodes, and performs aggregation processing according to the model parameters of each aggregation model to obtain the global model ω1. The main server determines whether the global model meets the iterative training conditions, and finds that the global model has not converged, that is, it determines that the global model does not meet the iterative training conditions.
[0186] Step A6: Each terminal receives the aggregation model sent by the aggregation node corresponding to the target classification and the global model sent by the main server.
[0187] For example, participants 1 and 3 receive the aggregation model sent by aggregation node 1 through the terminal. And the global model ω1 sent by the main server, participant 2 receives the aggregation model sent by aggregation node 2 through the terminal And the global model ω1 sent by the server.
[0188] Step A7: Each terminal determines a target model between the aggregate model and the global model.
[0189] Exemplarily, each participant judges the model training loss of the aggregate model and the global model based on the terminal. If participant 1 determines that the training loss of the global model ω1 is small, participant 1 determines that the global model ω1 is the target model and will use the global model ω1 to participate in the next round of model training. If participant 2 determines that the training loss of the global model ω1 is small, participant 2 determines that the global model ω1 is the target model and will use the global model ω1 to participate in the next round of model training. If participant 3 determines that the aggregate model The training loss is small, then participant 3 determines the aggregation model For the target model, the aggregation model will be used Participate in the next round of model training.
[0190] In step A8, each terminal performs the next round of model training and uploads the training result data to the corresponding aggregation node. The above process is repeated until the global model meets the iterative training conditions in step A5, and the training of the federated model is completed.
[0191] Exemplarily, three participants use the training data to perform the current round of model training on the target model through the terminal, and upload the training result data to the corresponding aggregation node 1 and aggregation node 2. The above process is repeated until the global model meets the iterative training conditions in step A5.
[0192] It can be understood that in the process of multiple rounds of model training, if the training data used by each terminal is the same in each round, the training result data will be uploaded to the hierarchical node only after the first round of training is completed. If the training data used by each terminal is different in each round, it is necessary to upload the training result data to the hierarchical node after each round of training is completed to re-determine the target classification and the aggregation model corresponding to the training result data.
[0193] Regarding the method for determining whether there are differences in the training data used by each terminal, any algorithm that can determine data differences can be applied to the present application, and the embodiments of the present application do not limit this.
[0194] In one embodiment, a signaling interaction flow chart of a training method for a federated model is also provided. Figure 8 As shown, the method includes the following steps.
[0195] Step 801: Each terminal obtains an initial model sent by a main server.
[0196] Step 802: Each terminal performs model training on the initial model using training data, and uploads the training result data to the hierarchical node.
[0197] In step 803, the hierarchical node obtains the target classification according to the training result data and the preset classification strategy, and generates an aggregate message corresponding to the target classification based on the identification information of each terminal in the target classification and the training result data sent by each terminal, and sends the aggregate message corresponding to each target classification to each aggregation node respectively.
[0198] Step 804: Each aggregation node aggregates the received training result data to obtain an aggregation model, and sends the aggregation model to each terminal.
[0199] Step 805: Each aggregation node sends the aggregation model to the main server.
[0200] Step 806: The main server receives the aggregated models sent by each aggregation node, and performs aggregation processing on each aggregated model to obtain a global model. The main server determines whether the global model meets the iterative training conditions.
[0201] Step 807: Each terminal receives the aggregation model sent by the aggregation node corresponding to the target classification and the global model sent by the main server.
[0202] Step 808: Each terminal determines a target model between the aggregate model and the global model.
[0203] In step 809, each terminal performs the next round of model training and uploads the training result data to the corresponding aggregation node. The above process is repeated until the global model meets the iterative training conditions at step 806, and the training of the federated model is completed.
[0204] It should be understood that although Figure 3-6 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 3-6 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0205] In one embodiment, Fig. 9 As shown, a federated model training device 900 is provided, comprising: a sending module 902, a receiving module 904 and a first determining module 906, wherein:
[0206] The sending module 902 is used to send training result data to the aggregation node corresponding to the target category where the terminal is located after completing the current round of model training, and the training result data includes model parameters.
[0207] The receiving module 904 is used to receive the aggregation model sent by the aggregation node corresponding to the target classification and the global model sent by the main server.
[0208] The first determination module 906 is used to determine the target model from the aggregate model and the global model, and perform the next round of model training based on the target model.
[0209] By using the federal model training device provided by the embodiment of the present disclosure, it is possible to select a target model with better adaptability to the terminal from the global model and the aggregate model, and perform the next round of model training based on the target model. Therefore, after multiple rounds of model training, a federal model with good adaptability to each terminal can be obtained.
[0210] In one embodiment, the apparatus further comprises:
[0211] The second determination module sends an upload message carrying the training result data to the hierarchical node after the first training is completed, wherein the upload message is used to instruct the hierarchical node to determine the target category where the terminal belongs according to the training result data.
[0212] In one embodiment, the first determining module 906 is specifically configured to:
[0213] Obtaining the model training loss of the aggregate model and obtaining the model training loss of the global model;
[0214] The target model is determined from the aggregate model and the global model according to the model training loss of the aggregate model and the model training loss of the global model.
[0215] In one embodiment, the first determining module 906 is specifically configured to:
[0216] Compare the model training loss of the aggregate model with the model training loss of the global model, and if the model training loss of the aggregate model is less than the model training loss of the global model, use the aggregate model as the target model; or
[0217] If the model training loss of the global model is less than the model training loss of the aggregate model, the global model is used as the target model.
[0218] In one embodiment, Fig.10 As shown, a federated model training device 1000 is provided, including: a receiving module 1002, an aggregation module 1004 and a determination module 1006, wherein:
[0219] The receiving module 1002 is used to receive the aggregation model uploaded by each aggregation node, where the aggregation model is a model obtained by aggregating the model parameters carried in the training result data sent by each terminal belonging to the target classification after the aggregation node receives the training result data sent by each terminal;
[0220] Aggregation module 1004, used for aggregating the aggregation models uploaded by each aggregation node to obtain a global model;
[0221] The determination module 1006 is used to determine whether the global model meets the iterative training conditions. If the global model does not meet the iterative training conditions, the global model is sent to each terminal so that each terminal determines the target model used in the next round of training from the aggregate model and the global model.
[0222] In one embodiment, the iterative training condition is that the global model converges, or the number of rounds of model training reaches a preset number of training rounds.
[0223] By using the federal model training device provided in the embodiment of the present disclosure, the terminal can select a target model with better adaptability from the global model and the aggregate model, and perform the next round of model training based on the target model. Therefore, after multiple rounds of model training, a federal model with good adaptability to each terminal can be obtained.
[0224] For the specific definition of the federated model training device, please refer to the definition of the federated model training method above, which will not be repeated here. Each module in the above-mentioned federated model training device can be implemented in whole or in part by software, hardware and a combination thereof. 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 of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0225] In one embodiment, a communication device is provided. Fig.11 . Fig.11 It is a schematic diagram of the structure of a terminal device provided in an embodiment of the present invention. Fig.11 The terminal device 1100 shown includes: at least one processor 1101, a memory 1102, at least one network interface 1104 and a user interface 1103. The various components in the terminal device 1100 are coupled together via a bus system 1105. It is understood that the bus system 1105 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 1105 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 1105 is not shown in FIG. Fig.11 Various buses are labeled as bus system 1105. In addition, the embodiment of the present invention also includes a transceiver 1106, which can be multiple components, that is, including a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium.
[0226] The user interface 1103 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touch pad, or a touch screen).
[0227] It can be understood that the memory 1102 in the embodiment of the present invention can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct RAM bus random access memory (DRRAM). The memory 1102 of the system and method described in the embodiments of the present invention is intended to include, but is not limited to, these and any other suitable types of memory.
[0228] In some embodiments, the memory 1102 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof: an operating system 11021 and an application program 11022 .
[0229] The operating system 11021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 11022 includes various application programs, such as a media player (MediaPlayer), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present invention can be included in the application 11022.
[0230] In an embodiment of the present invention, by calling the program or instructions stored in the memory 1102, specifically, it can be the program or instructions stored in the application 11022, wherein the transmitter is used to send training result data to the aggregation node corresponding to the target classification where the terminal is located after completing the current round of model training, and the training result data includes model parameters; the receiver is used to receive the aggregation model sent by the aggregation node corresponding to the target classification, and the global model sent by the main server; the processor is used to determine the target model from the aggregation model and the global model, and perform the next round of model training based on the target model.
[0231] Part or all of the methods disclosed in the above embodiments of the present invention may also be applied to the processor 1101, or implemented by the processor 1101, or implemented by the processor 1101 in cooperation with other components (such as a transceiver). The processor 1101 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by an integrated logic circuit of hardware or software instructions in the processor 1101. The above processor 1101 may be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1102, and the processor 1101 reads the information in the memory 1102 and completes the steps of the above method in combination with its hardware.
[0232] It is to be understood that the embodiments described in the embodiments of the present invention may be implemented by hardware, software, firmware, middleware, microcode or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSP devices, DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application or a combination thereof.
[0233] For software implementation, the technology described in the embodiments of the present invention can be implemented by a module (such as a process, function, etc.) that performs the functions described in the embodiments of the present invention. The software code can be stored in a memory and executed by the processor 1101. The memory can be implemented in the processor 1101 or outside the processor 1101.
[0234] In one embodiment, a communication device is provided. Fig.12 . Fig.12 It is a structural diagram of a main server device provided in an embodiment of the present invention. Fig.12 The main server device 1200 shown includes: at least one processor 1201, a memory 1202, and at least one network interface 1204. The various components in the main server device 1200 are coupled together through a bus system 1205. It can be understood that the bus system 1205 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 1205 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 1205 is not shown in FIG. Fig.12 Various buses are labeled as bus system 1205. In addition, the embodiment of the present invention also includes a transceiver 1206, which can be multiple components, that is, including a transmitter and a receiver, providing a unit for communicating with various other devices on a transmission medium.
[0235] It can be understood that the memory 1202 in the embodiment of the present invention can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct RAM bus random access memory (DRRAM). The memory 1202 of the system and method described in the embodiments of the present invention is intended to include, but is not limited to, these and any other suitable types of memory.
[0236] In some embodiments, the memory 1202 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof: an operating system 12021 and an application 12022 .
[0237] The operating system 12021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 12022 includes various application programs, such as a media player (MediaPlayer), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present invention can be included in the application 12022.
[0238] In an embodiment of the present invention, by calling a program or instruction stored in the memory 1202, specifically, it may be a program or instruction stored in the application 12022, wherein the receiver is used to receive an aggregation model sent by each aggregation node, and the aggregation model is a model obtained by aggregating the model parameters carried in the training result data sent by each terminal belonging to the target classification after the aggregation node receives the training result data sent by each terminal; the processor is used to aggregate the aggregation models sent by each aggregation node to obtain a global model, and determine whether the global model meets the iterative training conditions; the transmitter is used to send the global model to each terminal if the global model does not meet the iterative training conditions, so that each terminal determines the target model to be used in the next round of training from the aggregation model and the global model.
[0239] Part or all of the methods disclosed in the above embodiments of the present invention may also be applied to the processor 1201, or implemented by the processor 1201, or implemented by the processor 1201 in cooperation with other components (such as a transceiver). The processor 1201 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by an integrated logic circuit of hardware in the processor 1201 or by instructions in the form of software. The above processor 1201 may be a general-purpose processor, a digital signal processor (DigitalSignalProcessor, DSP), an application-specific integrated circuit (ApplicationSpecific IntegratedCircuit, ASIC), a field programmable gate array (FieldProgrammableGateArray, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 1202, and the processor 1201 reads the information in the memory 1202 and completes the steps of the above method in combination with its hardware.
[0240] It is to be understood that the embodiments described in the embodiments of the present invention may be implemented by hardware, software, firmware, middleware, microcode or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSP devices, DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application or a combination thereof.
[0241] For software implementation, the technology described in the embodiments of the present invention can be implemented by a module (such as a process, function, etc.) that performs the functions described in the embodiments of the present invention. The software code can be stored in a memory and executed by the processor 1201. The memory can be implemented in the processor 1201 or outside the processor 1201.
[0242] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0243] In one embodiment, a chip is provided, which includes a programmable logic circuit and / or program instructions, and when the chip is running, the steps in the above method embodiments are implemented.
[0244] The embodiments of the present application also provide a computer program product including instructions, which, when executed on a computer, enables the computer to execute the steps in the above-mentioned method embodiments.
[0245] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods 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 memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. 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).
[0246] 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 specification.
[0247] The above-mentioned 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 invention patent. 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 patent of the present application shall be subject to the attached claims.
Claims
1. A federated model training system, characterized in that: The system includes a main server, an aggregation node and a terminal, wherein: The terminal is used to send training result data to the aggregation node corresponding to the target classification where the terminal is located after completing the current round of model training, wherein the training result data includes model parameters; The aggregation node is used to receive the training result data sent by each terminal in the target category, aggregate the model parameters in each training result data to obtain an aggregate model, send the aggregate model to each terminal in the target category, and upload the aggregate model to the main server; The main server is used to receive the aggregation model sent by each aggregation node, and aggregate the aggregation model uploaded by each aggregation node to obtain a global model; The terminal is also used to receive the aggregation model sent by the aggregation node corresponding to the target classification where the terminal is located, and receive the global model sent by the main server, determine the target model from the aggregation model and the global model, and perform the next round of model training based on the target model.
2. The system according to claim 1, characterized in that The system also includes a hierarchical node, wherein: The terminal is further used to send training result data to the hierarchical node after the first training is completed; The hierarchical node is used to receive the training result data sent by the terminal, and according to the preset classification strategy, classify each terminal according to the training result data sent by each terminal to obtain a target classification, and for the target classification, based on each terminal in the target classification and the training result data sent by each terminal, generate an aggregate message corresponding to the target classification, and send the aggregate message corresponding to each target classification to each aggregation node respectively; The aggregation node is used to receive the aggregation message, perform aggregation processing according to the model parameters of each terminal carried in the aggregation message, obtain the aggregation model, send the aggregation model to each terminal corresponding to the aggregation message, and upload the aggregation model to the main server.
3. The system according to claim 1 or 2, characterized in that: The terminal is also used to obtain the model training loss of the aggregate model and the model training loss of the global model, and determine the target model from the aggregate model and the global model according to the model training loss of the aggregate model and the model training loss of the global model.
4. The system according to claim 3, characterized in that The terminal is also used to use the aggregate model as the target model if the model training loss of the aggregate model is less than the model training loss of the global model; or use the global model as the target model if the model training loss of the global model is less than the model training loss of the aggregate model.
5. The system according to claim 2, characterized in that The training result data includes at least one of a data type, a number of training samples, a training sample number, and a training model, and the training result data also includes model parameters.
6. The system according to claim 5, characterized in that The preset classification strategy includes at least one of classification based on data type, classification based on the degree of overlap of data features, and classification based on the number of training samples.
7. A federated model training method, characterized in that: Applied to a terminal, the method comprises: After completing the current round of model training, sending training result data to the aggregation node corresponding to the target category where the terminal is located, the training result data including model parameters; Receiving the aggregation model sent by the aggregation node corresponding to the target classification and the global model sent by the main server; A target model is determined from the aggregate model and the global model, and the next round of model training is performed based on the target model.
8. The method according to claim 7, characterized in that The method further comprises: After the first training is completed, an upload message carrying the training result data is sent to the hierarchical node, wherein the upload message is used to instruct the hierarchical node to determine the target category to which the terminal belongs based on the training result data.
9. The method according to claim 7, characterized in that: The determining of the target model from the aggregate model and the global model comprises: Obtaining the model training loss of the aggregate model and obtaining the model training loss of the global model; The target model is determined from the aggregate model and the global model according to the model training loss of the aggregate model and the model training loss of the global model.
10. The method according to claim 9, characterized in that The determining the target model from the aggregate model and the global model according to the model training loss of the aggregate model and the model training loss of the global model comprises: Compare the model training loss of the aggregate model with the model training loss of the global model, and if the model training loss of the aggregate model is less than the model training loss of the global model, use the aggregate model as the target model; or If the model training loss of the global model is less than the model training loss of the aggregate model, the global model is used as the target model.
11. A federated model training method, characterized in that: Applied to the main server, the method comprises: Receiving an aggregation model uploaded by each aggregation node, wherein the aggregation model is a model obtained by aggregating model parameters carried in the training result data sent by each terminal belonging to the target classification after the aggregation node receives the training result data sent by each terminal; Aggregating the aggregation models uploaded by each aggregation node to obtain a global model; Determine whether the global model meets the iterative training conditions. If the global model does not meet the iterative training conditions, send the global model to each of the terminals so that each of the terminals determines the target model to be used in the next round of training from the aggregate model and the global model.
12. The method according to claim 11, characterized in that The iterative training condition is that the global model converges, or the number of model training rounds reaches a preset training round.
13. A federated model training device, characterized in that: The device comprises: A sending module, used to send training result data including model parameters to the aggregation node corresponding to the target category where the terminal is located after completing the current round of model training; A receiving module, used for receiving the aggregation model sent by the aggregation node corresponding to the target classification and the global model sent by the main server; The first determination module is used to determine the target model from the aggregate model and the global model, and perform the next round of model training based on the target model.
14. A federated model training device, characterized in that: The device comprises: A receiving module, used to receive the aggregation model uploaded by each aggregation node, wherein the aggregation model is a model obtained by aggregating the model parameters carried in the training result data sent by each terminal belonging to the target classification after the aggregation node receives the training result data sent by each terminal; An aggregation module, used for aggregating the aggregation models uploaded by each aggregation node to obtain a global model; A determination module is used to determine whether the global model meets the iterative training conditions. If the global model does not meet the iterative training conditions, the global model is sent to each terminal so that each terminal determines the target model used in the next round of training from the aggregate model and the global model.
15. A communication device, characterized in that: include: transmitter, processor, and receiver; The transmitter is used to send training result data to the aggregation node corresponding to the target classification where the terminal is located after completing the current round of model training, wherein the training result data includes model parameters; The receiver is used to receive the aggregation model sent by the aggregation node corresponding to the target classification and the global model sent by the main server; The processor is used to determine a target model from the aggregate model and the global model, and perform a next round of model training based on the target model.
16. A communication device, characterized in that: include: transmitter, processor, and receiver; The receiver is used to receive the aggregation model sent by each aggregation node, where the aggregation model is a model obtained by aggregating the model parameters carried in the training result data sent by each terminal belonging to the target classification after the aggregation node receives the training result data sent by each terminal; The processor is used to aggregate the aggregation models sent by each aggregation node to obtain a global model, and determine whether the global model meets the iterative training condition; The transmitter is used to send the global model to each of the terminals if the global model does not meet the iterative training conditions, so that each of the terminals determines the target model used in the next round of training from the aggregate model and the global model.
17. A computer-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 of any one of claims 7 to 10 or claims 11 to 12 are implemented.
18. A chip, characterized in that: The chip comprises a programmable logic circuit and / or program instructions, and when the chip is run, the steps of the method according to any one of claims 7 to 10 or claims 11 to 12 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 of any one of claims 7 to 10 or claims 11 to 12 are implemented.