Dynamic personalized network construction method and device for federated learning
Through the dynamic personalized network construction method, using early withdrawal strategy and selective sending parameters, the problem of improper computing resource allocation and single model structure caused by static network structure in federated learning is solved, and more efficient model training and prediction are achieved, saving resources and bandwidth.
Patent Information
- Application Number
- CN202210408257.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-19
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2042-04-19
AI Technical Summary
The existing method of building a personalized model for federated learning is based on a static network structure, resulting in improper allocation of computing resources, single model structure, low training efficiency, and inability to effectively utilize device resources and network bandwidth.
The dynamic personalized network construction method is adopted, and the neural network model is dynamically calculated and updated through early withdrawal strategy, the module is selectively activated, and parameters are selectively sent according to changes in node parameters, so as to achieve on-demand allocation of computing resources and dynamic balance of model accuracy and efficiency.
The acceleration ratio of model training and prediction is improved, and the local personalized model structure is generated, equipment resources and network bandwidth are saved, and the model's expression ability and reasoning efficiency are improved.
Smart Images

Figure CN114841313B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a method for constructing a personalized network, and in particular to a method and device for constructing a dynamic personalized network oriented to federated learning. Background Art
[0002] Deep neural networks have achieved great success in computer vision, natural language processing and other fields, and have witnessed the birth of efficient neural networks such as AlexNet, ResNet and Transformer. They have also enabled the development of many mobile deep learning, such as mobile chipsets equipped with more and more professional processing units to execute DNN more efficiently. Therefore, people have put forward higher requirements for device performance, energy consumption and data privacy in model training on mobile devices.
[0003] Typically, DNN models are trained on datasets and generalize the model. However, since data often appears in the form of non-IID in real life, the global model cannot reach a desired state after training. Federated learning, as an emerging distributed machine learning paradigm, can complete model training while solving data privacy leakage. However, device data is inherently non-IID, and the data in the device has a long-tail distribution. For example, the type of images on the device may be related to the user's preferences and environment, and the recognition between images is also different. The performance level of the device itself is also uneven. The performance of the client may not meet the needs of global model training. Some participants may not even be able to obtain a model that is better than the model trained using only local data, which greatly reduces the enthusiasm of some users to participate in federated learning. To allow each participant to benefit from the learning process, an effective way is to personalize the device, data, and model, and obtain a high-quality personalized model for each device while reducing the impact of heterogeneity. The basic strategy is divided into two parts: 1) Complete the construction of the global model through mutual cooperation of clients; 2) Use client data to personalize the global model for it, and derive many personalized federated learning schemes. The main ones include: 1) increasing the user's context, but whether contextual characterization will leak privacy remains to be discussed; 2) federated transfer learning, which has more or less the problem of catastrophic forgetting; 3) federated multi-task learning, when generating a model for each task, all clients must participate in each round of training; 4) federated knowledge distillation, in which users can easily overfit for small sample data sets; 5) federated meta-learning, which can build a high-precision global model, but will damage the model's personalization ability.
[0004] Although a lot of work has been done in the construction of personalized federated learning in recent years, the current construction of personalized models is mainly based on static network structures, which means that all samples consume the same amount of computing. Choosing a small model may not be able to get a good training, and choosing a larger model will inevitably lead to redundant calculations. This limits the expressiveness, reasoning efficiency and interpretability of the model to a certain extent. In addition, in the testing phase, the sample reasoning process still cannot reasonably release computing resources, and the models involved in the prediction are relatively simple, which cannot achieve the prediction of the sample personalized network.
[0005] In view of the shortcomings of the current personalized federated learning model, such as difficulty in releasing capacity, difficulty in allocating computing resources on devices, and single training model structure, a dynamic construction of the personalized method of federated learning is carried out, so that it has good characteristics that static networks cannot enjoy. 1) On-demand allocation of computing resources can be achieved by selectively activating modules, thereby saving redundant calculations on samples that are easier to identify; 2) The model effect is significantly improved with minimal increase in the model; 3) A dynamic balance between model accuracy and efficiency is achieved according to different operating environments. Summary of the invention
[0006] The main purpose of the present invention is to overcome the shortcomings and deficiencies of the prior art and to provide a method and device for building a dynamic personalized network for federated learning, which can improve the acceleration ratio of model training and prediction while generating a local personalized model structure during the sample reasoning process, thereby saving equipment resources and network bandwidth while obtaining a personalized network.
[0007] In order to achieve the above object, the present invention adopts the following technical solutions:
[0008] On the one hand, the present invention provides a method for constructing a dynamic personalized network for federated learning, comprising the following steps:
[0009] Create a neural network model, initialize the neural network model and send it to the client;
[0010] Dynamically calculate the client's samples according to the early exit strategy and complete the update of the early exit layer;
[0011] Select an early exit strategy execution layer, and selectively send the parameters in the selected early exit layer. The parameters to be selected are determined based on the size of the node parameter changes before and after training. Parameters with large changes are added to the sending queue, and those with small changes do not participate in the update of the global model.
[0012] After receiving the nodes and parameters uploaded by the client, the server aggregates the weights of the early-retirement layer nodes according to the aggregation strategy;
[0013] Receive the aggregated parameters from the server, complete the update operation of the model parameters in the client, and complete the construction of the personalized network by updating the early retirement layer.
[0014] As a preferred technical solution, after creating the neural network model, the following steps are also included:
[0015] Initialize the created neural network model; before the client model is inferred, set the early exit threshold T for the model to exit early Q ; After the client model completes inference, set the sending threshold T for the client model parameter sending S ; After receiving the client's parameters, the server sets the aggregation threshold T for the client model aggregation A .
[0016] As a preferred technical solution, the parameters of the model are jointly determined by the initial value of the model, early exit strategy, parameter sending strategy and parameter aggregation strategy; the model parameters are used to unify the initial state of the model; the client's early exit strategy is used for client model inference in sample training; the client model parameter sending strategy is used to screen out nodes and their corresponding parameters that meet the sending requirements; the server's aggregation strategy for model parameters is used to update the received client parameters.
[0017] As a preferred technical solution, the initial values of the parameters of the neural network model gradually tend to a fixed fluctuation range over time.
[0018] As a preferred technical solution, the client samples are dynamically calculated according to the early exit strategy, and the early exit layer is updated, specifically:
[0019] Calculate the prediction vector of the layer sample The exit threshold T during inference Q Make a comparison and select the prediction vector Greater than T Q Maximum
[0020] If the maximum value of the prediction vector Corresponding classification labels And the true label σ(p i,max ) is the same as the prediction vector of the next layer of samples. Compare the results;
[0021] If the classification label corresponding to the maximum value of the next layer exit sample And the true label σ(p i+1,max ), this layer is marked as the exit layer, the samples exit from this layer, and the layer and the previous layers in the model are updated;
[0022] If the classification label corresponding to the maximum value of the next layer exit sample And the true label σ(p i+1,max ) are not the same, the layer is marked as a non-exit layer, and the sample enters the next layer for prediction;
[0023] If the classification label corresponding to the largest value of the prediction vector And the true label σ(p i,max ) are not the same, the layer is marked as a non-exit layer, and the sample enters the next layer for prediction;
[0024] If no suitable exit layer is found, the last layer of the model is marked as the exit layer to complete the update of the model parameters.
[0025] As a preferred technical solution, the parameters to be selected are determined based on the size of the change in node parameters before and after training. Parameters with large changes are added to the sending queue, and those with small changes do not participate in the update of the global model. Specifically:
[0026] Calculate the maximum depth of the client during the model inference process and compare the difference between the node parameters of the model early-retirement layer in the client before and after training D i,j ;
[0027] If the difference between the node parameters is D i,j Greater than the sending threshold T S , then the corresponding node and its parameters are added to the sending queue
[0028] If the difference between the node parameters is D i Less than the sending threshold T S , the corresponding node and its parameters do not participate in the sending.
[0029] As a preferred technical solution, after receiving the nodes and parameters uploaded by the client, the server completes the aggregation of the weights of the early-retiring layer nodes according to the aggregation strategy, specifically:
[0030] Calculate the duplication R of nodes uploaded by each client i,j The size of the aggregation threshold T A Make a comparison;
[0031] If R i,j Greater than the aggregation threshold T A , calculate the average value of the corresponding parameters of the same nodes, and update the parameters of the client and server nodes;
[0032] If R i Less than the aggregation threshold T A , only the corresponding node on the server is updated.
[0033] On the other hand, the present invention provides a dynamic personalized network construction method system for federated learning, including a neural network model creation module, a model training module, a parameter selection module, an aggregation module and a network construction module;
[0034] The neural network model creation module is used to create a neural network model, initialize the neural network model and send it to the client;
[0035] The model training module is used to dynamically calculate the client's samples according to the early exit strategy and complete the update of the early exit layer;
[0036] The parameter selection module is used to select the early exit strategy execution layer and selectively send the parameters in the selected early exit layer. The parameters to be selected are determined based on the size of the node parameter changes before and after training. The parameters with large changes are added to the sending queue, and the parameters with small changes are not involved in the update of the global model.
[0037] The aggregation module is used for the server to complete the aggregation of the weights of the early-retirement layer nodes according to the aggregation strategy after receiving the nodes and parameters uploaded by the client;
[0038] The network construction module is used to receive the parameters after aggregation from the server, complete the update operation of the model parameters in the client, and complete the construction of the personalized network by updating the early retirement layer.
[0039] Another aspect of the present invention provides an electronic device, the electronic device comprising:
[0040] at least one processor; and,
[0041] a memory communicatively connected to the at least one processor; wherein,
[0042] The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute the dynamic personalized network construction method for federated learning.
[0043] On the other hand, the present invention provides a computer-readable storage medium storing a program, which, when executed by a processor, implements the method for constructing a dynamic personalized network for federated learning.
[0044] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0045] (1) The present invention is based on a dynamic neural network. Different from the general federated personalized learning training, the present method uses the data owned by the client to dynamically utilize computing resources during the training phase, allowing the network to focus more on the training of complex samples; in the prediction phase, the client's resources are dynamically used to achieve sample prediction.
[0046] (2) The present invention adopts a patient early exit mechanism to compare the prediction vectors between adjacent layers, ensuring the robustness of samples when exiting model inference and dynamically releasing network capacity and computing resources.
[0047] (3) The present invention uses the sending threshold as a basis to selectively send updated nodes and parameters, thereby reducing the pressure on bandwidth during the model sending process and lowering the requirements for the network environment.
[0048] (4) Regarding the aggregation of model parameters, the present invention realizes information sharing between clients to the greatest extent while ensuring the personalization of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0050] Figure 1 A schematic diagram of a method for constructing a dynamic personalized network for federated learning according to the present invention.
[0051] Figure 2 It is a schematic diagram of training the dynamic personalized network of the present invention.
[0052] Figure 3 The present invention is a flow chart for sending client model parameters.
[0053] Figure 4 This is a flow chart of server model parameter aggregation of the present invention.
[0054] Figure 5 A schematic diagram of the structure of a dynamic personalized network construction system for federated learning according to the present invention.
[0055] Figure 6 It is a schematic diagram of the structure of the computer-readable storage medium of the present invention. DETAILED DESCRIPTION
[0056] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application.
[0057] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments.
[0058] like Figure 1 As shown, this embodiment provides a method for constructing a dynamic personalized network for federated learning, including the following steps:
[0059] S1. Create a neural network model on the server, complete the initialization operation of the neural network model, and send the initialized model to the client.
[0060] It is understandable that the initialization includes: the parameters θ of the model i , an early exit strategy of the client model, a sending strategy of the client model parameters and an aggregation strategy of the model parameters on the server side; the parameters of the model are jointly determined by the initial value of the model, the early exit strategy, the parameter sending strategy and the parameter aggregation strategy; the model parameters are used to unify the initial state of the model; the early exit strategy of the client is used for client model inference in sample training; the sending strategy of the model parameters in the client is used to screen out nodes and their corresponding parameters that meet the sending requirements; the aggregation strategy of the model parameters on the server side is used to update the received client parameters.
[0061] Furthermore, after creating the neural network, the parameters θ are initialized for the created model. 0 ; Before inferring the model in the client, set the early exit threshold T for the model Q ; After the model completes inference in the client, set the sending threshold T for sending the parameters of the model early retirement layer S After receiving the parameters from the client, the server sets the aggregation threshold T for the nodes and their corresponding parameters from the client. A .
[0062] S2. When the client sample is training the dynamic model, assuming that the model has n layers, the prediction vectors between adjacent layers are calculated separately. and And select and In and
[0063] If the current layer is not the nth layer, and The reasoning of the sample exits from the i-th layer;
[0064] If the current layer is not the nth layer, or Or σ(p i,max )≠σ(p i+1,max )or or The reasoning of the sample starts from the i+1th layer;
[0065] If the current layer is the nth layer, exit from the nth layer.
[0066] S3. After completing the training, the client needs to select the uploaded nodes and their corresponding parameters for the early retirement layer. The difference between the node parameters of the early retirement layer in the model before and after training is D i,j , find the nodes that meet the requirements, where the comparison method of sending threshold is:
[0067] If D i,j ≥T S , the parameter corresponding to the jth node of the i-th layer Join the sending queue S;
[0068] If D i,j <T S , do not join the sending queue S.
[0069] S4. The server obtains the node and its parameters uploaded by the client After that, the global model and client node weights need to be aggregated to compare the repetition R from different client nodes. i,j , to achieve the aggregation update between nodes and the update of the global model. The comparison method of duplication is:
[0070] If R i,j ≥T A , Update the nodes and corresponding parameter weights of the client and global models;
[0071] If R i,j <T A ,
[0072] S5. Receive the aggregated parameters from the server, complete the update operation of the model parameters in the client, and complete the construction of the personalized network by updating the early retirement layer.
[0073] In another embodiment of the present application, the present invention is applied to the construction of a dynamic personalized network for images based on federated learning. Figure 1 , specifically:
[0074] First, randomly generate a deep neural network and perform network initialization operations for it. The model initialization parameters gradually stabilize over time until they fluctuate within a stable range. At the same time, specify the size of the early exit threshold, the sending threshold, and the aggregation threshold. After the client receives the model from the server, train the local model according to the early exit strategy of the model and wait for the local sample to complete the model reasoning. After the model reasoning is completed, according to the selection strategy of sending parameters, the node information to be sent is added to the sending queue, and the information in the queue is submitted to the server. After the server receives the parameters from the client, it implements aggregation according to the aggregation strategy of the parameters and completes the update operation of the server and client parameters.
[0075] like Figure 2 The training process of the dynamic personalized network uses the classification confidence of the image sample output in the network layer as a reference, and calculates the classification confidence of the subsequent layer; by comparing the two execution degrees with the early exit threshold, it is ensured that the network layer exit operation is performed in a highly reliable state under the premise of correct classification of the sample, thereby focusing the model's attention on complex training samples.
[0076] like Figure 3 The client model parameter sending strategy described above takes the network after sample training in the client as an example, and compares the change between nodes before and after training to quickly distinguish the types of nodes. For the client to send parameters to the server, this can reduce the number of sent parameters to a certain extent.
[0077] like Figure 4 ,The aggregation strategy of the server model parameters ,The server receives specific nodes from the client, which mainly includes ,the preservation of client personalization, the sharing of features between clients and ,the update of the global model. Based on the comparison of node ,repetition of nodes, the learning of shared node information and ,the
[0078] It should be noted that, for the sake of convenience, the aforementioned method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited to the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously.
[0079] Based on the same idea as the method for constructing a dynamic personalized network for federated learning in the above-mentioned embodiment, the present invention also provides a system for constructing a dynamic personalized network for federated learning, which can be used to execute the above-mentioned method for constructing a dynamic personalized network for federated learning. For ease of explanation, the structural diagram of the embodiment of the system for constructing a dynamic personalized network for federated learning only shows the parts related to the embodiment of the present invention. Those skilled in the art can understand that the illustrated structure does not constitute a limitation on the device, and may include more or fewer components than shown in the diagram, or combine certain components, or arrange the components differently.
[0080] like Figure 5 As shown, in another embodiment of the present application, a dynamic personalized network construction system 100 for federated learning is provided, the system comprising a neural network model creation module 101, a model training module 102, a parameter selection module 103, an aggregation module 104 and a network construction module 105;
[0081] The neural network model creation module 101 is used to create a neural network model, initialize the neural network model and send it to the client;
[0082] The model training module 102 is used to dynamically calculate the client's samples according to the early exit strategy and complete the update of the early exit layer;
[0083] The parameter selection module 103 is used to select the early exit strategy execution layer and selectively send the parameters in the selected early exit layer. The parameters to be selected are determined based on the size of the node parameter changes before and after training. The parameters with large changes are added to the sending queue, and the parameters with small changes are not involved in the update of the global model.
[0084] The aggregation module 104 is used for the server to complete the aggregation of the weights of the early-retirement layer nodes according to the aggregation strategy after receiving the nodes and parameters uploaded by the client;
[0085] The network construction module 105 is used to receive the aggregated parameters from the server, complete the update operation of the model parameters in the client, and complete the construction of the personalized network by updating the early retirement layer.
[0086] It should be noted that the dynamic personalized network construction system for federated learning of the present invention corresponds one-to-one to the dynamic personalized network construction method for federated learning of the present invention. The technical features and beneficial effects described in the embodiment of the dynamic personalized network construction method for federated learning are applicable to the embodiment of the dynamic personalized network construction for federated learning. For specific contents, please refer to the description in the embodiment of the method of the present invention, which will not be repeated here. This is hereby declared.
[0087] In addition, in the implementation of the dynamic personalized network construction system for federated learning in the above-mentioned embodiment, the logical division of each program module is only an example. In actual applications, the above-mentioned functions can be assigned to different program modules as needed, for example, for the configuration requirements of the corresponding hardware or the convenience of software implementation. That is, the internal structure of the dynamic personalized network construction system for federated learning is divided into different program modules to complete all or part of the functions described above.
[0088] See also Figure 6 In one embodiment, an electronic device for implementing a dynamic personalized network construction method for federated learning is provided. The electronic device 200 may include a first processor 201, a first memory 202 and a bus, and may also include a computer program stored in the first memory 202 and executable on the first processor 201, such as a dynamic personalized network construction program 203.
[0089] The first memory 202 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the first memory 202 can be an internal storage unit of the electronic device 200, such as a mobile hard disk of the electronic device 200. In other embodiments, the first memory 202 can also be an external storage device of the electronic device 200, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 200. Further, the first memory 202 can also include both an internal storage unit of the electronic device 200 and an external storage device. The first memory 202 can not only be used to store application software and various types of data installed in the electronic device 200, such as the code of the dynamic personalized network construction program 203, but also can be used to temporarily store data that has been output or is to be output.
[0090] In some embodiments, the first processor 201 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips, etc. The first processor 201 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes various functions and processes data of the electronic device 200 by running or executing programs or modules stored in the first memory 202, and calling data stored in the first memory 202.
[0091] Figure 6 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 6 The structure shown does not constitute a limitation on the electronic device 200 , and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0092] The dynamic personalized network construction program 203 stored in the first memory 202 in the electronic device 200 is a combination of multiple instructions, and when executed in the first processor 201, it can achieve:
[0093] Create a neural network model, initialize the neural network model and send it to the client;
[0094] Dynamically calculate the client's samples according to the early exit strategy and complete the update of the early exit layer;
[0095] Select an early exit strategy execution layer, and selectively send the parameters in the selected early exit layer. The parameters to be selected are determined based on the size of the node parameter changes before and after training. Parameters with large changes are added to the sending queue, and those with small changes do not participate in the update of the global model.
[0096] After receiving the nodes and parameters uploaded by the client, the server aggregates the weights of the early-retirement layer nodes according to the aggregation strategy;
[0097] Receive the aggregated parameters from the server, complete the update operation of the model parameters in the client, and complete the construction of the personalized network by updating the early retirement layer.
[0098] Furthermore, if the module / unit integrated in the electronic device 200 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0099] Those skilled 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 program can be stored in a non-volatile computer-readable storage medium. When the 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 non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0100] 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.
[0101] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A dynamic personalized network construction method for federated learning, characterized in that: The steps include: Create a neural network model, initialize the neural network model and send it to the client; Dynamically calculate the client's samples according to the early exit strategy and complete the update of the early exit layer; Select the early exit strategy execution layer, and selectively send the parameters in the selected early exit layer. The parameters to be selected are determined based on the size of the node parameter changes before and after training. The parameters with large changes are added to the sending queue, and the parameters with small changes are not involved in the update of the global model. After receiving the nodes and parameters uploaded by the client, the server aggregates the weights of the early-retirement layer nodes according to the aggregation strategy; Receive the aggregated parameters from the server, complete the update operation of the model parameters in the client, and complete the construction of the personalized network by updating the early-retirement layer; The client samples are dynamically calculated according to the early exit strategy, and the early exit layer is updated, specifically: Calculate the prediction vector of the layer sample The exit threshold T during inference Q Make a comparison and select the prediction vector Greater than T Q Maximum If the predicted vector has the largest value Corresponding classification labels And the true label σ(p i,max ) is the same as the prediction vector of the next layer of samples. Compare the results; If the classification label corresponding to the maximum value of the next layer exit sample And the true label σ(p i+1,max ), this layer is marked as the exit layer, the samples exit from this layer, and the layer and the previous layers in the model are updated; If the classification label corresponding to the maximum value of the next layer exit sample And the true label σ(p i+1,max ) are not the same, the layer is marked as a non-exit layer, and the sample enters the next layer for prediction; If the classification label corresponding to the largest value of the prediction vector And the true label σ(p i,max ) are not the same, the layer is marked as a non-exit layer, and the sample enters the next layer for prediction; If no suitable exit layer is found, the last layer of the model is marked as the exit layer to complete the update of the model parameters.
2. The method for constructing a dynamic personalized network for federated learning according to claim 1, characterized in that: After creating the neural network model, the following steps are also included: Initialize the created neural network model; before the client model is inferred, set the early exit threshold T for the model to exit early Q ; After the client model completes inference, set the sending threshold T for the client model parameter sending S ; After receiving the client's parameters, the server sets the aggregation threshold T for the client model aggregation A .
3. The method for constructing a dynamic personalized network for federated learning according to claim 2, characterized in that: The parameters of the model are jointly determined by the initial value of the model, the early exit strategy, the parameter sending strategy and the parameter aggregation strategy; the model parameters are used to unify the initial state of the model; the early exit strategy of the client is used for client model inference in sample training; the sending strategy of the client model parameters is used to screen out nodes and their corresponding parameters that meet the sending requirements; the server's aggregation strategy for the model parameters is used to update the received client parameters.
4. The method for constructing a dynamic personalized network for federated learning according to claim 1, characterized in that: The initial values of the parameters of the neural network model gradually tend to a fixed fluctuation range over time.
5. The method for constructing a dynamic personalized network for federated learning according to claim 1, characterized in that: The parameters to be selected are determined based on the size of the node parameter changes before and after training. Parameters with large changes are added to the sending queue, and those with small changes do not participate in the update of the global model. Specifically: Calculate the maximum depth of the client during the model inference process and compare the difference between the node parameters of the model early-retirement layer in the client before and after training D i,j ; If the difference between the node parameters is D i,j Greater than the sending threshold T S , then the corresponding node and its parameters are added to the sending queue S; If the difference between the node parameters is D i Less than the sending threshold T S , the corresponding node and its parameters do not participate in the sending.
6. The method for constructing a dynamic personalized network for federated learning according to claim 1, characterized in that: After receiving the nodes and parameters uploaded by the client, the server completes the aggregation of the weights of the early-retirement layer nodes according to the aggregation strategy, specifically: Calculate the duplication R of nodes uploaded by each client i,j The size of the aggregation threshold T A Make a comparison; If R i,j Greater than the aggregation threshold T A , calculate the average value of the corresponding parameters of the same nodes, and update the parameters of the client and server nodes; If R i Less than the aggregation threshold T A , only the corresponding node on the server is updated.
7. A dynamic personalized network construction method system for federated learning, characterized in that: It includes neural network model creation module, model training module, parameter selection module, aggregation module and network construction module; The neural network model creation module is used to create a neural network model, initialize the neural network model and send it to the client; The model training module is used to dynamically calculate the client's samples according to the early exit strategy and complete the update of the early exit layer; The parameter selection module is used to select the early exit strategy execution layer, and selectively send the parameters in the selected early exit layer. The parameters to be selected are determined based on the size of the node parameter changes before and after training. The parameters with large changes are added to the sending queue, and the parameters with small changes are not involved in the update of the global model. The aggregation module is used for the server to complete the aggregation of the weights of the early-retirement layer nodes according to the aggregation strategy after receiving the nodes and parameters uploaded by the client; The network construction module is used to receive the aggregated parameters from the server, complete the update operation of the model parameters in the client, and complete the construction of the personalized network by updating the early-retirement layer; The client samples are dynamically calculated according to the early exit strategy, and the early exit layer is updated, specifically: Calculate the prediction vector of the layer sample The exit threshold T during inference Q Make a comparison and select the prediction vector Greater than T Q Maximum If the predicted vector has the largest value Corresponding classification labels And the true label σ(p i,max ) is the same as the prediction vector of the next layer of samples. Compare the results; If the classification label corresponding to the maximum value of the next layer exit sample And the true label σ(p i+1,max ), this layer is marked as the exit layer, the samples exit from this layer, and the layer and the previous layers in the model are updated; If the classification label corresponding to the maximum value of the next layer exit sample And the true label σ(p i+1,max ) are not the same, the layer is marked as a non-exit layer, and the sample enters the next layer for prediction; If the classification label corresponding to the largest value of the prediction vector And the true label σ(p i,max ) are not the same, the layer is marked as a non-exit layer, and the sample enters the next layer for prediction; If no suitable exit layer is found, the last layer of the model is marked as the exit layer to complete the update of the model parameters.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor so that the at least one processor can execute the dynamic personalized network construction method for federated learning as described in any one of claims 1-6.
9. A computer-readable storage medium storing a program, characterized in that: When the program is executed by a processor, the dynamic personalized network construction method for federated learning described in any one of claims 1 to 6 is implemented.
