Federal learning method based on node selection strategy, electronic device and storage medium
By employing a node selection strategy that weights the evaluation value based on gradient and the number of local training samples, nodes that have a significant impact on the global model training loss are prioritized for participation in federated learning. This addresses the issues of slow training speed and high latency caused by random selection, resulting in faster model convergence and lower latency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING TOPSEC NETWORK SECURITY TECH
- Filing Date
- 2024-11-08
- Publication Date
- 2026-05-01
AI Technical Summary
In scenarios involving a large number of nodes in federated learning, the random selection of nodes in existing technologies leads to slow convergence of federated learning model training, and the computational processing performance and network bandwidth of the parameter server limit efficiency.
A gradient-based node random selection strategy is adopted. By weighting the evaluation value and the number of local training samples, nodes that have a greater impact on reducing the overall training loss of the global model are selected to participate in each round of local model training, and the evaluation value is updated after a certain number of training rounds.
It accelerates the training and convergence speed of federated learning models, reduces the overall training time, lowers the processing latency and communication latency of parameter servers, and improves the accuracy of node selection results.
Smart Images

Figure CN119129780B_ABST
Abstract
Description
Federated learning methods based on node selection strategies, electronic devices and storage media Technical Field
[0001] This application relates to the field of federated learning technology, specifically to a federated learning method based on a node selection strategy, an electronic device, and a corresponding storage medium. Background Technology
[0002] Currently, with the rapid development of artificial intelligence (AI) technology, its applications are becoming increasingly widespread, including image analysis, speech recognition, text processing, intelligent recommendation, and security detection. Federated learning has become a cutting-edge hot topic in AI. In scenarios involving a large number of nodes in federated learning, due to the large number of model parameters, if all nodes participate in each iteration of the training process simultaneously, the computational processing performance and network bandwidth of the parameter server will become bottlenecks limiting the efficiency of federated learning. A common industry solution is to randomly select a small number of nodes to participate in each iteration of the training process to reduce processing and communication latency caused by the limited computational processing performance and network bandwidth of the parameter server. However, this solution, based on randomly and blindly selecting nodes with equal probability, results in a slow convergence speed for the federated learning model.
[0003] Existing technologies employ a strategy of randomly selecting client nodes based on predicted loss values, which can accelerate the training and convergence speed of federated learning models and reduce the overall training time. While this can speed up convergence to some extent, when client nodes with large predicted loss values have few training samples and the predicted loss values change little, selecting client nodes with large predicted loss values does not necessarily lead to faster model convergence than selecting client nodes with small predicted loss values. Summary of the Invention
[0004] The purpose of this application is to provide a federated learning method, electronic device, and storage medium based on a node selection strategy. It adopts a gradient-based evaluation value-based random node selection strategy, which prioritizes nodes that have a greater impact on reducing the overall training loss of the global model to participate in each round of local model training, so as to at least solve some of the problems in the background art.
[0005] To achieve the above objectives, this application provides a federated learning method based on a node selection strategy. The method includes: determining that client nodes in the federated learning system will not be all selected; obtaining the evaluation value corresponding to each client node; weighting the number of local training samples of the client node using the modulus of the evaluation value as the weight; obtaining the selection probability of the client node by the proportion of the weighted number of local training samples to the total number of weighted local training samples in the federated learning system; selecting several client nodes according to the selection probability of each client node to obtain the current training set; and distributing model parameters to the client nodes in the current training set, wherein the model parameters are used by the client nodes to obtain updated gradients after local training based on the distributed model parameters.
[0006] Optionally, the method further includes updating the evaluation value of the client node after each round of training.
[0007] Optionally, updating the evaluation value of the client node includes: if the client node does not belong to the current training set, the current evaluation value of the client node remains unchanged; if the client node belongs to the current training set and this training is the first training round, the updated evaluation value is the updated gradient uploaded by the client node; if the client node belongs to the current training set but this training is not the first training round, the updated evaluation value is the weighted sum of the current evaluation value and the uploaded updated gradient of the client node.
[0008] Optionally, determining that client nodes in the federated learning system will not be selected in all rounds includes: obtaining the round number of the current training round of the model; determining whether the round number belongs to a preset sequence; if the round number belongs to the preset sequence, all client nodes in the federated learning system are selected to the current training set; if the round number does not belong to the preset sequence, it is determined that client nodes in the federated learning system will not be selected in all rounds.
[0009] Optionally, the preset sequence is an arithmetic sequence with the first term being 1.
[0010] Optionally, a number of client nodes are selected to obtain the current training set based on the selection probability of each client node, including: for each client node, calculating the value of the cumulative distribution function based on the node index and selection probability of the client node, and obtaining a probability interval based on the selection probability of the client node and the value of the cumulative distribution function; generating a number of random numbers within the value range of the cumulative distribution function, and the client node corresponding to the probability interval of each random number is selected to the current training set; the number of random numbers generated corresponds to the number of client nodes in the current training set.
[0011] Optionally, a probability interval is obtained based on the selection probability of the client node and the value of the cumulative distribution function, including: the difference between the value of the cumulative distribution function and the selection probability, and the value of the cumulative distribution function being the endpoint of the probability interval; the probability interval includes the endpoint of the value of the cumulative distribution function but does not include the endpoint of the difference between the value of the cumulative distribution function and the selection probability.
[0012] Optionally, the update gradient obtained by the client node after local training based on the distributed model parameters is used to generate the global model update gradient by combining the number of local training samples of the client node; the global model update gradient is used to update the global model in combination with the model parameters.
[0013] Optionally, the method is configured to execute cyclically when the following preset conditions are met; the preset conditions include: after updating the global model in combination with model parameters, determining that the current state of the federated learning system does not meet the training stopping condition of federated learning.
[0014] This application also provides a federated learning device based on a node selection strategy. The device includes: a full-selection determination module for determining that client nodes in the federated learning system will not be selected; a probability calculation module for obtaining the evaluation value corresponding to each client node, weighting the number of local training samples of the client node using the modulus of the evaluation value as weight, and obtaining the selection probability of the client node by the proportion of the weighted number of local training samples to the total number of weighted local training samples in the federated learning system; a set determination module for selecting several client nodes according to the selection probability of each client node to obtain the current training set; and a parameter distribution module for distributing model parameters to the client nodes in the current training set, wherein the model parameters are used by the client nodes to obtain updated gradients after local training based on the distributed model parameters.
[0015] This application also provides an electronic device, including: at least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor implements the aforementioned federated learning method based on node selection strategy by executing the instructions stored in the memory.
[0016] This application also provides a machine-readable storage medium storing instructions that, when executed by a processor, configure the processor to perform the aforementioned federated learning method based on node selection strategy.
[0017] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the aforementioned federated learning method based on node selection strategy.
[0018] The above technical solution has the following beneficial effects:
[0019] (1) The method of randomly selecting client nodes to participate in federated learning model training is adopted, which reduces the need for client nodes in the federated learning system to send and upload data in each round of training, and reduces the processing delay and communication delay caused by the limited computing performance of parameter servers and the limited network bandwidth in federated learning scenarios.
[0020] (2) In the process of selecting client nodes, the number of local training samples and evaluation values are used as influencing factors. Nodes that have a greater impact on reducing the overall training loss of the global model are selected to participate in the local model training in each round, which accelerates the training convergence speed of the federated learning model and reduces the overall training time of the federated learning model.
[0021] (3) Every certain number of training rounds, the evaluation values of all client nodes are updated to solve the problem that the evaluation values of some client nodes are outdated or distorted due to random selection of client nodes, thereby improving the accuracy of the random selection results of nodes.
[0022] Other features and advantages of the embodiments of this application will be described in detail in the following detailed description section. Attached Figure Description
[0023] The accompanying drawings are provided to further illustrate the embodiments of this application and form part of the specification. They are used together with the following detailed description to explain the embodiments of this application, but do not constitute a limitation on the embodiments of this application. In the drawings:
[0024] Figure 1 schematically illustrates the steps of a federated learning method based on a node selection strategy according to an embodiment of this application;
[0025] Figure 2 schematically illustrates the implementation process of the federated learning method based on the node selection strategy according to the embodiments of this application;
[0026] Figure 3 schematically illustrates the structure of a federated learning device based on a node selection strategy according to an embodiment of this application;
[0027] Figure 4 schematically illustrates the internal structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0028] The specific embodiments of this application will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the embodiments of this application.
[0029] Figure 1 schematically illustrates the steps of a federated learning method based on a node selection strategy according to an embodiment of this application. As shown in Figure 1, a federated learning method based on a node selection strategy includes:
[0030] S01. Ensure that client nodes in the federated learning system are not all selected;
[0031] S02. Obtain the evaluation value corresponding to the client node, and use the modulus of the evaluation value as the weight to weight the number of local training samples of the client node. The probability of the client node being selected is obtained by the proportion of the weighted number of local training samples in the total number of weighted local training samples in the federated learning system.
[0032] S03. Select several client nodes according to the selection probability of each client node to obtain the training set for this round;
[0033] S04. The model parameters are sent to the client nodes in the current training set. The model parameters are used by the client nodes to update the gradient after local training based on the sent model parameters.
[0034] In step S01, if all client nodes are selected to participate in training during this round of training, based on user selection or the user's predetermined strategy, then there will be no client node selection, and subsequent steps cannot be executed. Therefore, it is necessary to determine in this step whether client node selection is required for this round of training.
[0035] In some scenarios, it may be necessary to perform model initialization. The parameter server S initializes the parameters of the deep neural network model used, and the initialization parameters are... .
[0036] In step S02, let the evaluation value of client node i in the r-th round be... Since the evaluation values are in vector form, they need to be modulo-processed. The number of local training samples is... The probability of being selected is calculated using the following formula:
[0037] , Let be the total number of client nodes in the federated learning system, and be a positive integer. .
[0038] The federated learning method based on node selection strategy described above reduces the number of client nodes participating in model training in each round, thereby reducing processing latency and communication latency caused by the limited computing performance of the parameter server and the limited network bandwidth in federated learning scenarios. Simultaneously, this implementation selects client nodes based on the selection probability generated by combining the evaluation value with the number of local training samples, prioritizing nodes that have a greater impact on reducing the overall training loss of the global model to participate in each round of local model training. This accelerates the convergence speed of the federated learning model and reduces the overall training time.
[0039] In some optional embodiments of this application, the method further includes updating the evaluation value of the client node after each round of training. This embodiment provides a mechanism for updating the evaluation value after each round of training, thereby avoiding the relative fixation of the evaluation value and making it more reflective of the characteristics of each client node, dynamically updating and adjusting its selection probability.
[0040] In some optional embodiments of this application, a strategy for updating the evaluation value of the client node is provided, including: in the... During the model training cycle, the parameter server S receives the set The local model parameters uploaded by the client nodes are aggregated to generate global model parameters. Update the evaluation value of each client node. .
[0041]
[0042] The above formula is explained as follows: If the client node does not belong to the training set in this round, i.e. The current evaluation value of the client node remains unchanged. = If the client node belongs to the current training set and this training round is the first training round, then... The updated evaluation value is the updated gradient uploaded by the client node. If the client node belongs to the current training set but this training round is not the first training round, i.e. The updated evaluation value is the weighted sum of the current evaluation value of the client node and the uploaded update gradient. = Where β is a constant coefficient, The above method enables the evaluation value to reflect the gradient characteristics of the client nodes. Furthermore, the weighted calculations in rounds two and beyond further ensure that the evaluation value reflects the continuity of gradient-based transformations. Therefore, it is evident that the evaluation value in this application is gradient-based. By employing gradient-based evaluation values, nodes with a greater impact on reducing the overall training loss of the global model are prioritized for participation in each round of local model training, accelerating the convergence speed of the federated learning model and reducing its overall training time.
[0043] In some optional implementations, determining that client nodes in the federated learning system will not be all selected includes: obtaining the epoch number of the current model training epoch; determining whether the epoch number belongs to a preset sequence; if the epoch number belongs to the preset sequence, all client nodes in the federated learning system are selected to the current training set; if the epoch number does not belong to the preset sequence, it is determined that client nodes in the federated learning system will not be all selected. The epoch number of the current model training epoch is denoted as r. When the value of r belongs to the preset sequence, the parameter server S selects all... A set of client nodes The parameters of the global model of the deep neural network model Send to The client nodes in the federated learning system. The preset sequence only needs to ensure that the values in the preset sequence are positive integers; it can be arbitrarily set according to user needs, and commonly used recursive sequences, Carant numbers, Pascal's triangle, etc., can also be used. It should be noted that this implementation can also be carried out in the opposite way: when the round number does not belong to the preset sequence, all client nodes in the federated learning system are selected for this round of training; when the round number belongs to the preset sequence, it is determined that all client nodes in the federated learning system will not be selected. This implementation also ensures that the evaluation values of all client nodes are completely updated every certain number of training rounds, and is a simple variation of the implementation of the claims in this application, therefore it should also fall within the protection scope of this application. This implementation updates the evaluation values of all client nodes every certain number of training rounds to solve the problem of outdated or distorted evaluation values of some client nodes caused by random selection of client nodes, thereby improving the accuracy of the node random selection algorithm.
[0044] In some optional implementations, the preset sequence is an arithmetic sequence with the first term being 1. The expression for this arithmetic sequence can be nT+1; where T is a positive integer and n is a non-negative integer. If the round number r = nT+1, the parameter server S selects all... A set of client nodes The parameters of the global model of the deep neural network model Send to The client nodes in the training algorithm. Taking T=4 as an example, all nodes will be selected in rounds 1, 5, 9, 13... This ensures that each client node will be selected to participate in training at least once within a fixed number of training rounds. This arithmetic sequence starts with 1, which guarantees that in round 1... Each client node is trained, thus each client node can obtain its own [status] after training. and with This leads to the corresponding evaluation value. This implementation updates the evaluation values of all client nodes every certain number of training rounds to address the problem of outdated or distorted evaluation values for some client nodes caused by random selection, thus improving the accuracy of the random node selection algorithm. Compared to the preset sequence method in the previous implementation, this implementation has better periodicity and ensures that the evaluation values of all client nodes are updated every fixed number of training rounds.
[0045] In step S03, selecting several client nodes to obtain the training set for this round based on the selection probability of each client node can be done in various ways. For example, selecting several client nodes with high selection probabilities can be used to obtain the training set for this round; or, by setting a probability threshold, several client nodes near that threshold can be selected to obtain the training set for this round; or, by setting a probability interval, several client nodes within that probability interval can be selected to obtain the training set for this round. In this optional embodiment, a more preferred selection method is provided, which includes: for each client node, calculating the value of the cumulative distribution function based on the node index and selection probability of the client node, i.e.: .
[0046] in, The node sequence number of the client node The probability function, Let i be the cumulative distribution function based on i.
[0047] A probability interval is obtained based on the selection probability of the client node and the value of the cumulative distribution function; the difference between the cumulative distribution function value and the selection probability, and the value of the cumulative distribution function are respectively used as the endpoints of the probability interval; the probability interval includes the endpoints of the cumulative distribution function value but excludes the endpoints of the difference between the cumulative distribution function value and the selection probability; that is, ( Generate several random numbers within the range of the cumulative distribution function, including: since the range of the cumulative distribution function is... Therefore, through a A random number generator with a uniform distribution between them generates a... Random numbers between The client node corresponding to the probability interval of each random number is selected into the current training set; for example, if Then the first One client node was selected this time. The number of random numbers generated corresponds to the number of client nodes in the training set in this round. If the distribution is relatively ideal, repeat the above process. You can get it randomly in one draw. There are [number] client nodes. The selection method based on selection probability in this embodiment has the advantage of better randomness. Among them... , It is a positive integer.
[0048] In the embodiments of this application, the client node obtains the updated gradient after local training based on the distributed model parameters through the following process: in the... During each model training cycle, the parameter server will send parameters... Send to Client nodes in the collection. The first in A client node utilizes the parameter server Received global model parameters Update the local model by training it on the local training dataset using gradient descent, and then update the gradients of the local model's parameters. The update gradient obtained from the above process is uploaded to the parameter server S. This update gradient is then used to generate the global model update gradient, taking into account the number of local training samples on the client node.
[0049] ;
[0050] in, These are constant coefficients. .
[0051] The global model update gradient is used to update the global model in conjunction with the model parameters, including:
[0052] ;
[0053] in, and These are the global model parameters for round r and round (r-1), respectively.
[0054] In some embodiments of this application, the method is configured to execute cyclically when the following preset conditions are met; the preset conditions include: after updating the global model in conjunction with model parameters, determining that the current state of the federated learning system does not meet the training stopping condition of federated learning. The training stopping condition includes: the parameters of the global model. convergence or If the parameters of the global model convergence or If so, terminate the training process; otherwise, let Increment the value by 1, and repeat the steps of selecting training nodes, distributing model parameters, training local models, and updating model parameters to start the next round of distributing model parameters, training local models, and updating model parameters. This is a preset training cycle threshold constant. It is a positive integer greater than 1.
[0055] Figure 2 schematically illustrates the implementation process of the federated learning method based on a node selection strategy according to the embodiments of this application. As shown in Figure 2, it includes the following implementation steps: The parameter server initializes the model parameters. The parameter server determines the set based on the evaluation values. The latest global model parameters are then distributed to the nodes in the set. Each node trains its local model and uploads its updated gradients. The parameter server aggregates and generates global model parameters, updates the node's evaluation values, and determines the termination condition for the training process.
[0056] The following example illustrates an implementation method for training a spam detection model using federated learning, based on this application. The specific process, as described in the detailed description of this application, is as follows:
[0057] (1) Assume the total number of client hosts with the neural network-based spam detection system installed is . The email security monitoring center S initializes the parameters of the deep neural network model (such as BERT, LSTM, RNN, etc.) used. The initialization parameters are as follows: .
[0058] (2) in the Round model training cycle, if Then the email security monitoring center S selects all A set of client hosts The parameters of the deep neural network model Send to The client host in the middle; otherwise, the email security monitoring center S will evaluate each client host based on its assessment value. Calculate the first The probability of a client host being randomly selected According to the above probability from Randomly selected from client hosts A set of client hosts , parameters Send to The client host in the middle. Among them It is a positive integer.
[0059] (3) in the Round model training cycle, set The first in Each client host utilizes global model parameters received from the email security monitoring center S. Update the local model by training it on a local spam training dataset using gradient descent, and then update the gradients of the local model's parameters. Uploaded to the email security monitoring center S.
[0060] (4) in the During the model training cycle, the email security monitoring center S receives the set The local model parameters uploaded by the client host are aggregated to generate global model parameters. Update the evaluation value for each client host. If the parameters of the global model convergence or If the condition is met, the entire federated learning model training process will be terminated; otherwise, the process will be terminated. Repeat all sub-steps of steps (2), (3), and (4) to begin the next model training cycle.
[0061] In the above implementation, the processing latency and communication latency of the spam detection model in the federated learning process are reduced, while the training convergence speed of the federated learning model is accelerated and the overall training time of the federated learning model is reduced.
[0062] Based on the same inventive concept, this application also provides a federated learning device based on a node selection strategy. Figure 3 schematically shows a structural diagram of the federated learning device based on a node selection strategy according to an embodiment of this application. As shown in Figure 3, the device includes: a full selection determination module, used to determine that client nodes in the federated learning system will not be selected; a probability calculation module, used to obtain the evaluation value corresponding to the client node, weight the number of local training samples of the client node with the modulus of the evaluation value as the weight, and obtain the selection probability of the client node by the proportion of the weighted number of local training samples to the total number of weighted local training samples in the federated learning system; a set determination module, used to select several client nodes according to the selection probability of each client node to obtain the current training set; and a parameter distribution module, used to distribute model parameters to the client nodes in the current training set, the model parameters being used by the client nodes to obtain updated gradients after local training based on the distributed model parameters.
[0063] In some optional embodiments of this application, the apparatus further includes an evaluation update module, which is used to update the evaluation value of the client node after each round of training.
[0064] In some optional embodiments of this application, updating the evaluation value of the client node includes: if the client node does not belong to the current training set, the current evaluation value of the client node remains unchanged; if the client node belongs to the current training set and the current training is the first training round, the updated evaluation value is the updated gradient uploaded by the client node; if the client node belongs to the current training set but the current training is not the first training round, the updated evaluation value is the weighted sum of the current evaluation value of the client node and the uploaded updated gradient.
[0065] In some optional embodiments of this application, determining that client nodes in the federated learning system will not be selected in all rounds includes: obtaining the round number of the current training round of the model; determining whether the round number belongs to a preset sequence; if the round number belongs to the preset sequence, the client nodes in the federated learning system are selected in the current training set; if the round number does not belong to the preset sequence, it is determined that the client nodes in the federated learning system will not be selected in all rounds.
[0066] In some optional embodiments of this application, the preset sequence is an arithmetic sequence with the first term being 1.
[0067] In some optional embodiments of this application, selecting several client nodes to obtain the current training set based on the selection probability of each client node includes: for each client node, calculating the value of the cumulative distribution function based on the node index and selection probability of the client node, and obtaining a probability interval based on the selection probability of the client node and the value of the cumulative distribution function; generating several random numbers within the value range of the cumulative distribution function, and the client node corresponding to the probability interval of each random number is selected to the current training set; the number of random numbers generated corresponds to the number of client nodes in the current training set.
[0068] In some optional embodiments of this application, a probability interval is obtained based on the selection probability of the client node and the value of the cumulative distribution function, including: taking the difference between the value of the cumulative distribution function and the selection probability, and the value of the cumulative distribution function as the end value of the probability interval; the probability interval includes the end value of the cumulative distribution function but does not include the end value of the difference between the value of the cumulative distribution function and the selection probability.
[0069] In some optional embodiments of this application, the update gradient obtained by the client node after local training based on the distributed model parameters is used to generate the global model update gradient in combination with the number of local training samples of the client node; the global model update gradient is used to update the global model in combination with the model parameters.
[0070] In some optional embodiments of this application, the apparatus is configured to execute cyclically when the following preset conditions are met; the preset conditions include: after updating the global model in combination with model parameters, determining that the current state of the federated learning system does not meet the training stopping condition of federated learning.
[0071] The specific limitations of each functional module in the aforementioned federated learning device based on node selection strategy can be found in the limitations of the federated learning method based on node selection strategy described above, and will not be repeated here. Each module in the above system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module. It also implements random node selection based on gradient-based evaluation values, thus having the advantages of reducing processing and communication latency, accelerating the training convergence speed of the federated learning model, and reducing the overall training time of the federated learning model.
[0072] In some embodiments of this application, an electronic device is also provided, comprising: at least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which executes the aforementioned federated learning method based on a node selection strategy. Its internal structure can be illustrated in Figure 4. Figure 4 schematically shows the internal structure of an electronic device according to an embodiment of this application. The electronic device includes a processor A01, a network interface A02, a memory (not shown in the figure), and a database (not shown in the figure) connected via a system bus. The processor A01 of the electronic device provides computational and control capabilities. The memory of the electronic device includes internal memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01, a computer program B02, and a database (not shown in the figure). The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A04. The network interface A02 of the electronic device is used for communication with an external terminal via a network connection. When the computer program B02 is executed by the processor A01, it implements a federated learning method based on a node selection strategy.
[0073] Those skilled in the art will understand that the structure shown in Figure 4 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0074] In one embodiment provided in this application, a machine-readable storage medium is provided, on which instructions are stored, which, when executed by a processor, cause the processor to be configured to perform the aforementioned federated learning method based on node selection strategy.
[0075] In one embodiment provided in this application, a computer program product is provided, including a computer program that, when executed by a processor, implements the aforementioned federated learning method based on node selection strategy.
[0076] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0077] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more flowchart illustrations and / or one or more block diagrams.
[0078] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.
[0079] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.
[0080] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0081] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0082] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0083] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0084] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A federated learning method based on a node selection strategy, characterized in that, The method includes: determining that client nodes in the federated learning system will not be selected all, including: obtaining the epoch number of the current training epoch; determining whether the epoch number belongs to a preset sequence; if the epoch number belongs to the preset sequence, all client nodes in the federated learning system are selected to the current training set; if the epoch number does not belong to the preset sequence, it is determined that client nodes in the federated learning system will not be selected all, wherein the preset sequence is an arithmetic sequence with the first term being 1; obtaining the evaluation value corresponding to the client node; weighting the number of local training samples of the client node with the modulus of the evaluation value as the weight; and obtaining the selection probability of the client node by the proportion of the weighted number of local training samples to the total number of weighted local training samples in the federated learning system; the method further includes: updating the evaluation value of the client node after each training epoch, including: if the client node does not belong to the current training set, the current evaluation value of the client node remains unchanged; if the client node belongs to the current training set and this training is the first training epoch, the updated evaluation value is the updated gradient uploaded by the client node; if the client node belongs to the current training set but... This training round is not the first round of training. The updated evaluation value is the weighted sum of the current evaluation value of the client node and the uploaded update gradient. Several client nodes are selected based on the selection probability of each client node to obtain the training set for this round. This includes: for each client node, calculating the cumulative distribution function based on the node index and selection probability, and obtaining a probability interval based on the selection probability and the cumulative distribution function value; generating several random numbers within the range of the cumulative distribution function, with the client node corresponding to the probability interval of each random number being selected into the training set for this round; the number of generated random numbers corresponds to the number of client nodes in the training set for this round; distributing model parameters to the client nodes in the training set for this round, which are used by the client nodes to obtain update gradients after local training based on the distributed model parameters; the update gradients obtained by the client nodes after local training based on the distributed model parameters are used to generate a global model update gradient by combining the number of local training samples of that client node; and the global model update gradient is used to update the global model by combining the model parameters.
2. The method according to claim 1, characterized in that, A probability interval is obtained based on the selection probability of the client node and the value of the cumulative distribution function, including: the difference between the value of the cumulative distribution function and the selection probability, and the value of the cumulative distribution function being the endpoint of the probability interval; the probability interval includes the endpoint of the value of the cumulative distribution function but does not include the endpoint of the difference between the value of the cumulative distribution function and the selection probability.
3. The method according to claim 1, characterized in that, The method is configured to execute cyclically when the following preset conditions are met: after updating the global model in combination with model parameters, it is determined that the current state of the federated learning system does not meet the training stopping condition of federated learning.
4. An electronic device, characterized in that, include: At least one processor; A memory connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor implements the steps of the federated learning method based on the node selection strategy of any one of claims 1 to 3 by executing the instructions stored in the memory.
5. A computer-readable storage medium having a computer program / instructions stored thereon, characterized in that, When executed by a processor, the computer program / instruction implements the steps of the federated learning method based on the node selection strategy as described in any one of claims 1 to 3.
6. A computer program product comprising a computer program / instructions, characterized in that, When executed by a processor, the computer program / instruction implements the steps of the federated learning method based on the node selection strategy as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Federal learning method and system based on customer selection and weight distribution, and medium
CN116776948A
Federal machine learning method and device, storage medium and processor
CN117521783A