A grouping optimization approach for model aggregation in distributed edge learning

By using heuristic genetic algorithms to automatically group and optimize model aggregation in distributed edge learning, the problems of non-independent and identically distributed data and communication overhead are solved, the convergence accuracy and speed of the global model are improved, and local optimal solutions are avoided.

CN114372337BActive Publication Date: 2024-10-18SOUTH CHINA UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111603177.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-24
Publication Date
2024-10-18
Estimated Expiration
2041-12-24

AI Technical Summary

Technical Problem

In distributed edge learning, the convergence time and accuracy of the global model are affected by the non-independent and identically distributed data of edge devices, huge communication overhead, saturation of the backbone network, and single point failures. The existing grouping algorithm is based on distance and needs to be manually specified. The number of groups makes it difficult to obtain good clustering results and lacks generalization ability.

Method used

By considering the data distribution and network distance of edge devices, a heuristic genetic algorithm is used to automatically group, determine the number of groups and group members, optimize model aggregation, reduce communication between devices and cloud servers, and improve the convergence accuracy and speed of the global model.

Benefits of technology

It realizes the automatic search for the optimal number of groups and group members without the need to manually specify the number of groups, improves the training accuracy and convergence speed of the global model, reduces communication delays and differences in data distribution, and avoids local optimal solutions. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114372337B_ABST
    Figure CN114372337B_ABST
Patent Text Reader

Abstract

The present invention discloses a grouping optimization method for model aggregation in distributed edge learning. The method comprises the following steps: quantifying the difference between the local data distribution of each device and the global data distribution; calculating the minimum transmission delay of point-to-point transmission between devices; using a heuristic genetic algorithm to encode the possible grouping methods of devices in the network, and automatically searching for the optimal grouping results through genetic operations, and determining the model grouping aggregation method after device grouping; dividing the devices in the network into different groups, and the devices are grouped and trained and grouped according to the acquired grouping methods. The present invention can automatically group the devices in the network according to the data distribution of the nodes in the network and the transmission delay between the nodes without specifying the number of groups in advance, effectively mitigating the impact of the non-independent and identically distributed data distribution between devices on the convergence performance of the global model in distributed edge learning, and improving the training accuracy and convergence speed of the global model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of model performance optimization in distributed edge learning, and in particular to a grouping optimization method for model aggregation in distributed edge learning. Background Art

[0002] With the proliferation of mobile computing and IoT devices, a large number of devices are connected to the Internet and generate a large amount of data at the edge of the network. However, it is impractical to transmit data from the edge to the center to train machine learning models due to privacy and bandwidth limitations. Therefore, it is a general trend to push data-driven artificial intelligence to the edge of the network to unleash the potential of edge big data. To meet this demand, edge intelligence, as an emerging paradigm, has been widely regarded as a promising solution to push artificial intelligence from the center of the network to the edge of the network closer to IoT devices and data sources. In essence, compared with the traditional cloud-based computing paradigm, the physical proximity between the computing source and the information generation source has some benefits, including reduced latency, privacy protection, and lower bandwidth consumption.

[0003] However, since the computing power and data storage capacity of a single edge device cannot meet the requirements of training large machine learning models with huge data, it has become very popular to use highly parallel distributed computer clusters for collaborative learning in edge environments. At present, most distributed machine learning frameworks are centralized structures, in which edge devices use local data to train their own models separately, and the centralized host on the cloud iteratively coordinates the aggregation and update of edge device model parameters, such as federated learning. However, compared with existing distributed machine learning in the cloud, centralized distributed machine learning in edge environments faces some challenges. ① Device data is not independent and identically distributed. The data source in edge computing is generated in real time from edge and / or terminal devices. The data samples on each device are usually non-independent and identically distributed (NoN-IID) data, while existing distributed machine learning in the cloud stores the data source in the cloud in advance. The data source is distributed to a large number of computing nodes for data parallel processing, so that the data samples of each node are independent and identically distributed. Theory and experiments show that this data heterogeneity can significantly affect the convergence time and accuracy of the global model. ② Huge communication overhead. In distributed machine learning in edge environments, the network bandwidth from edge devices to the cloud is limited. A large number of edge devices are connected to the cloud through bandwidth-limited and intermittent wireless networks, and their local models are iteratively transmitted to the cloud until the global model converges. This often requires hundreds to thousands of rounds of communication to achieve the required model accuracy. If the training time is limited, long propagation delays will reduce the performance of the global model. Moreover, if the edge server transmits large models to the cloud, such as R-CNN or U-net, this will also bring immeasurable communication overhead. In existing distributed machine learning in the cloud, learning tasks are completed in cloud clusters, where servers have powerful capabilities and the network connecting the servers has a guaranteed and stable network bandwidth. ③ Backbone network saturation and single point failure. In distributed machine learning in edge environments, the paradigm of thousands of edge devices sending their local models to the cloud for aggregation will bring a heavy burden to the backbone network, and the single point failure caused by the instability of devices in the edge environment makes the global model face the risk of aggregation failure.

[0004] In recent years, some works have conducted in-depth research on the challenges of non-independent and identically distributed edge device data, huge communication overhead, backbone network saturation and single point failure in distributed edge learning, but there are not many studies that address the above three challenges at the same time. Some studies extend the two-layer distributed edge learning framework to a three-layer architecture. These works group edge devices and reduce the communication between edge devices and distant cloud servers through communication between edge devices and group aggregation nodes with close access, thereby reducing the communication overhead between edge devices and clouds in large-scale distributed edge learning. In addition, group communication expands the single-point aggregation mode of centralized distributed learning to multi-point aggregation, which reduces the harm of single point failure and relieves the burden on the backbone network. At present, most of the existing research works only consider network distance and try to divide edge devices with small communication delay into the same group. However, based on distance grouping, the data distribution on the edge devices in the group is very likely to be similar, and the data distribution of the group is still extremely skewed compared to the global. Therefore, such a grouping structure cannot effectively improve the convergence performance of the global model. The latest research proposes a grouping algorithm called FedAvg-IC (Jin-wooLee et al. Accurate and fast federated learning via iid and communication-aware grouping. arXiv preprint arXiv:2012.04857,2020.). Although the algorithm takes the data distribution of edge devices into account when grouping, it is based on the K-means method for grouping, and the K-means-based method requires artificially specifying the number of groups K, which is extremely inflexible in real application scenarios and may be difficult to achieve good clustering results. More specifically, these methods need to execute multiple different k to obtain good clustering results, thus lacking generalization ability. In addition, the clustering results are greatly affected by the initial position of K. Specifically, the random initialization in K-means can easily cause the clustering results to fall into the local optimum, and a good clustering structure may not be obtained, thereby reducing the performance of the global model trained on the clustering structure. Summary of the invention

[0005] In view of the shortcomings of the prior art, the present invention provides a grouping optimization method for model aggregation in distributed edge learning. The present invention optimizes the model aggregation grouping in distributed edge learning, and proposes an automatic grouping method by considering the data distribution of edge devices and the network distance between devices, so that an efficient grouping architecture is obtained for distributed edge learning without manually specifying the number of groups. The grouping architecture includes a determined number of groups and members of each group. The grouping architecture obtained using our method can improve the convergence accuracy and convergence speed of the global model.

[0006] The purpose of the present invention is achieved by at least one of the following technical solutions.

[0007] A grouping optimization method for model aggregation in distributed edge learning includes the following steps:

[0008] S1. The difference between the local model of each device and the initial global model is represented by the difference between the updated gradient obtained by performing multiple rounds of training on the same initial global model using its own local data set and the initial global model gradient, thereby quantifying the difference between the local data distribution of each device and the global data distribution according to the difference between the local model of the device and the initial global model;

[0009] S2. According to the network topology information connecting each device, the connection relationship of the point-to-point transmission between each device and the bandwidth resources between the device links are obtained. At the same time, the minimum transmission delay of the point-to-point transmission between the devices is calculated in combination with the model size of the point-to-point transmission between the devices.

[0010] S3. Based on the minimum transmission delay of point-to-point transmission between devices and the difference between the local data distribution of each device and the global data distribution, a heuristic genetic algorithm is used to encode the possible grouping methods of devices in the network, and the optimal grouping result is automatically searched through genetic operations. The grouping result includes the number of groups and the member devices included in each group, so as to determine the grouping aggregation method of the model after the devices are grouped;

[0011] S4. Divide the devices in the network into different groups according to the model grouping and aggregation method determined in step S3, and perform group training and group model aggregation on the devices according to the obtained grouping method.

[0012] Furthermore, each device has multiple data samples, and the multiple data samples constitute a local data set of each device; and each device performs model training based on gradient descent on its local data set to obtain a local model trained based on the local data set;

[0013] For each device, the data distribution between devices is often not independent and identically distributed, that is, the local data distribution between devices is inconsistent and different from the global data distribution;

[0014] In step S1, in order to represent the difference between the distribution of each device and the global distribution, the difference between the local data distribution of the device and the global data distribution is quantified according to the difference between the updated gradient obtained by performing multiple rounds of training on each device using its own local data set on the same initial global model and the initial global model gradient, which specifically includes the following steps:

[0015] S1.1. Randomly initialize a global model and use the global model as a unified initial model for each device; the global model is a machine learning model specified by a person skilled in the art, including Linear Regression (LR), Multilayer Perceptrons (MLP) or Convolutional Neural Networks (CNN);

[0016] S1.2. Perform multiple rounds of local updates and global aggregation on each device under the framework of decentralized distributed machine learning. That is, after each device uses its complete local data set to perform a round of local model training on the initial model and obtains its corresponding local model, all devices perform weighted average of the obtained local models according to their data volume to obtain a global aggregation model.

[0017] S1.3, send the global aggregate model to each device and use it as the initial model for the next round of local model training of each device, and return to step S1.2;

[0018] S1.4: After the local model training and global model aggregation steps of steps S1.2 to S1.3 are executed in a loop for multiple rounds, the currently acquired global aggregation model is used as the initial global model for measuring the difference between the local model and the global model;

[0019] S1.5. After obtaining the initial global model, each device uses its own complete local data set to continuously perform multiple rounds of local model training in step S1.2 on the initial global model, wherein, for each local device, each local model training round will traverse all local data; and in the process of performing multiple consecutive rounds of local model training, each device will not perform global model aggregation operations, that is, each device uses its own local data set on the initial global model to perform a round of local model training, and after obtaining the local model, it cycles multiple times to perform another round of local model training on the obtained local model, and cycles multiple times to obtain the local model, and then obtains the local model, and then obtains the local model obtained by each device performing local model training on its local data set;

[0020] S1.6. Measuring the difference between the gradient of the initial global model obtained in steps S1.2 to S1.5 and the gradient of the local model of each device by the distance between model gradients. The measurement indicators of the distance between model gradients include cosine distance, Euclidean distance or Manhattan distance. The difference between the local model gradient of each device and the gradient between the initial global model is used to represent the difference between the local data distribution of each device and the global data distribution.

[0021] Furthermore, in step S2, the network topology information includes devices participating in training, links of directly connected devices, and bandwidth resources of links directly connected to each device, and the network topology is stored in a data structure of a weighted undirected graph in the form of devices participating in training as nodes, links as edges, and bandwidth resources of links as edge weights.

[0022] Further, step S2 includes the following steps:

[0023] S2.1. By using a breadth-first search method and a depth-first search method, a transmission path that maximizes the bandwidth of point-to-point transmission between devices is first calculated based on the network topology and the bandwidth resources of the links directly connected to each device. The point-to-point transmission path between devices is composed of at least one link directly connected to the device.

[0024] S2.2. The bandwidth resources available for the point-to-point transmission path between devices are obtained by adding the bandwidth resources on the point-to-point transmission path between devices, and the minimum transmission delay of the point-to-point transmission between devices can be obtained by dividing the model size of the point-to-point transmission between devices by the bandwidth resources available for the point-to-point transmission path between devices according to the bandwidth resources and the size of the point-to-point transmission model between devices;

[0025] The size of a model transmitted point-to-point between devices refers to the number of non-zero parameters in the model.

[0026] Furthermore, in step S3, a heuristic genetic algorithm is used to automatically search for the optimal grouping result as a device grouping training and aggregation method based on the difference between the local data distribution and the global data distribution of each device in the network and the minimum transmission delay of point-to-point transmission between devices without specifying the number of groups in advance, specifically including the following steps:

[0027] S3.1. Use the possible grouping methods of devices in the coding network as the representation of individuals in the genetic algorithm, and combine multiple grouping methods, i.e. different individuals, into a population;

[0028] S3.2, determine the evaluation method and introduce the fitness function to judge the excellence of each grouping method (individual) in the population;

[0029] S3.3. Determine the selection method for individuals in the population. According to the fitness values ​​evaluated by each individual in the population, select the individual with the highest fitness value from the population to directly join the next generation population to participate in the next round of iteration. The probability of other individuals entering the next generation is determined by the ratio of individual fitness to group fitness. Group fitness is the sum of all individual fitnesses.

[0030] Use the optimal individual preservation method to select individuals for the next generation population, as follows:

[0031] For the best individual in the current population, no crossover mutation operation is performed. Instead, the best individual in the current population is directly retained and entered into the next generation population, so that the current optimal grouping situation can be preserved without being destroyed. The probability of other individuals entering the next generation is determined by the ratio of individual fitness to group fitness. In this way, good individuals in the population are always selected instead of being destroyed, which ensures that the population continues to evolve in the best direction, which is conducive to the stable convergence of the population and improves the search speed to obtain better clustering results, thereby stabilizing the convergence of the population and improving the population optimization speed.

[0032] S3.4, determine the genetic operations of crossover and mutation, select two individuals from the selected individuals according to the crossover rate and mutation rate of the current population to participate in the genetic operations of crossover and mutation, so as to produce offspring with higher fitness to join the next generation population and participate in the next round of iteration;

[0033] S3.5. Repeat steps S3.3 and S3.4 until the iteration round reaches a preset threshold, and then select the individual with the highest fitness from the final population as the optimal grouping result, and use it as a way to train and aggregate device groups.

[0034] Furthermore, step S3.1 specifically includes the following steps:

[0035] S3.1.1. Initialize the population and encode the individuals in the population: If there are N devices in the network, number the N devices in the network from 1 to N, and randomly arrange the numbered devices. A full arrangement of N represents an individual in the population of the genetic algorithm. The population includes multiple randomly generated individuals.

[0036] S3.1.2, for one of the individuals in the population in step S3.1.1, a hierarchical clustering mechanism is used to first initialize each device in the individual into a different group;

[0037] S3.1.3. Select a group aggregation node for each group, and select the device in the current group that minimizes the sum of the transmission delays between devices in the group as the group aggregation node of the current group;

[0038] S3.1.4. Traverse each group in the individual from left to right, and compare the network distance between the group aggregation node of the current group and the group aggregation nodes of the two groups to the left and right of the current group, merge the current group with the group with the smaller network distance, set a merging threshold, if the network distance between the group aggregation nodes of the two groups exceeds the merging threshold, the two groups will not be merged, after the merging is completed, the current individual is represented as a grouping method;

[0039] S3.1.5, perform steps S3.1.2 to 3.1.4 for all individuals in the population until all individuals are represented as a grouping method;

[0040] S3.1.6. For each individual grouping result in step S3.1.5, repeat steps S3.1.3 to S3.1.4 until the groups in each individual cannot be merged, and generate a grouping result each time it is repeated;

[0041] S3.1.7. Perform fitness evaluation on the grouping results generated in all repeated steps in step S3.1.6. The grouping result with the highest fitness after evaluation is used as the grouping method represented by the individual. At this time, each individual represents a grouping method, and multiple individuals are combined into a population in the genetic algorithm.

[0042] Furthermore, in step S3.2, according to the grouping result of each individual obtained in step S3.1, the difference between the group aggregation data distribution and the global data distribution of each group in each grouping result, as well as the sum of the transmission delays from each device in each group to the group aggregation node are calculated, and finally the sum of the difference between the group aggregation data distribution and the global data distribution of each group and the sum of the transmission delays are weighted averaged to obtain a weighted average value, and the weighted average value is used as the grouping cost represented by the current grouping method; the larger the grouping cost, the worse the grouping method represented by the individual, and the inverse of the grouping cost is taken as the final fitness, and the larger the fitness corresponding to the individual in the population, the better the grouping effect of the individual;

[0043] The group aggregate data distribution is obtained by performing a weighted average calculation based on the difference between the local data distribution of each device in the group and the global data distribution according to the amount of data on each device in the group.

[0044] Furthermore, in step S3.4, a dynamic crossover rate and mutation rate are used to set different crossover rates and mutation rates for each generation of the population, that is, a crossover rate and mutation rate are selected for the population according to the heterogeneity of the current population, and then each generation of the population selects individuals from the population according to their respective crossover rates and mutation rates for crossover and mutation operations, thereby evolving individuals different from those already existing in the current population, specifically including the following steps:

[0045] S3.4.1. Indicating the similarity of populations: Calculate the difference between the individual with the largest fitness value in the current population and the average fitness value of all individuals in the population, scale the difference to between 0 and 1, and use the scaled difference to indicate the heterogeneity of the current population; Based on the heterogeneity value of the population, 1 minus the heterogeneity value can be used to indicate the similarity of the population. It can be understood that the smaller the scaled difference is, the higher the similarity of the population is; otherwise, the lower the similarity is.

[0046] S3.4.2. Set dynamic crossover rate and mutation rate for the population according to the similarity of the current population: At the beginning of the genetic algorithm, select the initial crossover rate and initial mutation rate for the current population according to the experience of experts in this field, and in each round of population evolution, multiply the initial crossover rate and initial mutation rate by the similarity of the current population to obtain the crossover rate and mutation rate of the current population, and dynamically obtain the crossover rate and mutation rate for each generation of population according to its heterogeneity, where the range of the crossover rate and mutation rate of the population is 0 to 1;

[0047] S3.4.3. Select individuals from the population for crossover and mutation operations based on the crossover rate and mutation rate of the current population: for each individual in the population, randomly generate a random number between 0 and 1, and compare the random number corresponding to the individual with the crossover rate and mutation rate of the current population; if the random number of the individual is less than the crossover rate of the current population, the individual will be selected and enter the crossover pool to wait for the individual's crossover operation; the individuals in the crossover pool are randomly paired as a group of parents to participate in subsequent crossover operations; after the above crossover operation is completed, a group of offspring with the same number of individuals in the crossover pool will be generated; similarly, randomly generate different random numbers between 0 and 1 for the offspring generated by the crossover operation, and compare the random numbers represented by the offspring with the mutation rate of the current population, and select the offspring whose random numbers are less than the population mutation rate to enter the mutation pool to wait for the individual's mutation operation;

[0048] Therefore, dynamically changing the crossover rate and mutation rate of each generation in the population evolution process can be understood. When the current population heterogeneity is low, that is, when the fitness of each individual in the population tends to be the same, dynamically increase the crossover rate and mutation rate of the population to increase the possibility of generating new individuals, thereby helping the population to jump out of the local optimum, avoid premature convergence, and prevent the population from falling into the local optimal solution; when the current population heterogeneity is high, that is, when the fitness of individuals in the population varies greatly, dynamically reduce the crossover rate and mutation rate of the population to reduce the possibility of generating new individuals, so that the population can converge stably and quickly;

[0049] S3.4.4. Perform crossover and mutation operations on the individuals in the crossover pool and mutation pool, and generate new individuals: Perform crossover and mutation operations on a group of paired parents in the crossover pool in step S3.4.3; after the crossover and mutation operations are completed, the generated new individuals will replace the old individuals originally selected to participate in the crossover and mutation, and form a new generation of population with the unselected individuals in the current population to prepare for the next generation of population crossover and mutation operations.

[0050] Furthermore, in step S3.4.4, the crossover method used includes: a two-point crossover method or a multi-point crossover method;

[0051] The mutation method adopted is the basic bit mutation method.

[0052] Furthermore, in step S4, according to the optimal grouping result obtained in step S3, the devices in the network are divided according to the optimal grouping result obtained in step S3, and after each device is grouped, model training is performed in its respective group and participates in group model aggregation, and the group model communicates with the server to participate in global model aggregation; the method of model aggregation and model training is implemented in accordance with the method of model aggregation and training in general decentralized distributed machine learning.

[0053] Compared with the prior art, the present invention has the following beneficial effects:

[0054] (1) The present invention provides a grouping optimization method for model aggregation in distributed edge learning. Considering the huge communication overhead caused by a large number of edge devices communicating with a central server under limited bandwidth resources in distributed edge learning, the devices in the network are grouped for learning, and the network distance between devices is considered when grouping, so that the network distance between devices in each group is as small as possible, so that the grouped devices only need to communicate with the group aggregation devices that are close to them, thereby effectively reducing the delay of the transmission device model.

[0055] (2) The present invention provides a grouping optimization method for model aggregation in distributed edge learning. Considering that the data distribution on devices in distributed edge learning will lead to poor global model training performance when not independently and identically distributed, the devices in the network are grouped for learning, and the differences in data distribution between devices are considered during grouping, so that the difference between the group data distribution and the global data distribution is as small as possible, so that the grouped devices can effectively improve the training accuracy of the global model by communicating with their group aggregation nodes with short transmission delays multiple times in a group similar to the global distribution.

[0056] (3) Most of the existing grouping algorithms that consider both data distribution and communication cost are based on K-means. This type of algorithm requires manual specification of the number of groups and easily causes the grouping results to fall into local optimality. By using a hierarchical clustering mechanism combined with a heuristic genetic algorithm, the present invention can automatically find the optimal number of groups and group members based on the data distribution of the device and the network distance between the devices without manually specifying the number of groups, thus solving some existing problems and defects of the current technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Reference to the accompanying drawings can help understand the technical features and algorithm flows in the embodiments of the present invention.

[0058] Figure 1 It is a schematic diagram of the overall process of a grouping optimization method for model aggregation in distributed edge learning in one embodiment of the present invention;

[0059] Figure 2 is a flow chart of searching for a grouping method using a genetic algorithm in one embodiment of the present invention;

[0060] Figure 3a and Figure 3b is a schematic diagram of a hierarchical clustering mechanism in one embodiment of the present invention;

[0061] Figure 4 is a schematic diagram of a genetic algorithm individual two-point crossover to generate new offspring in one embodiment of the present invention;

[0062] Figure 5 is a schematic diagram of generating new offspring by mutation of individuals in a genetic algorithm in one embodiment of the present invention;

[0063] Figure 6 It is a schematic diagram of the generation of new offspring by multi-point crossover of genetic algorithm individuals in one embodiment of the present invention. DETAILED DESCRIPTION

[0064] The technical solutions in the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. It should be understood that the described embodiments are only for enabling those skilled in the art to better understand and implement the present invention, and are not intended to limit the implementation and scope of the present invention in any way.

[0065] Example:

[0066] A grouping optimization method for model aggregation in distributed edge learning, such as Figure 1 As shown, the following steps are included:

[0067] S1: The difference between the local model of each device and the initial global model is expressed according to the difference between the updated gradient obtained by multiple rounds of training on each device using its own local data set on the same initial global model and the initial global model gradient, thereby quantifying the difference between the local data distribution of each device and the global data distribution according to the difference between the local model of the device and the initial global model;

[0068] Each device has multiple data samples, which constitute the local data set of each device. Each device performs gradient descent-based model training on its local data set to obtain a local model trained based on the local data set.

[0069] For each device, the data distribution between devices is often not independent and identically distributed, that is, the local data distribution between devices is inconsistent and different from the global data distribution;

[0070] In order to express the difference between the distribution of each device and the global distribution, the difference between the local data distribution of the device and the global data distribution is quantified according to the difference between the updated gradient obtained by performing multiple rounds of training on each device using its own local data set on the same initial global model and the initial global model gradient. In this embodiment, the following steps are specifically included:

[0071] S1.1. Randomly initialize a global model and use the global model as a unified initial model for each device; the global model is a machine learning model specified by a person skilled in the art, and LinearRegression (LR) is used in this embodiment;

[0072] In another embodiment, the machine learning model uses Multilayer Perceptrons (MLP);

[0073] In another embodiment, the machine learning model uses Convolutional Neural Networks (CNN);

[0074] S1.2. Perform 10 rounds of local updates and global aggregation on each device under the framework of decentralized distributed machine learning. That is, after each device uses its complete local data set to perform a round of local model training on the initial model and obtains its corresponding local model, all devices perform weighted average of the obtained local models according to their data volume to obtain a global aggregation model.

[0075] S1.3, send the global aggregate model to each device and use it as the initial model for the next round of local model training of each device, and return to step S1.2;

[0076] S1.4: After the local model training and global model aggregation steps of steps S1.2 to S1.3 are looped for 10 rounds, the currently acquired global aggregation model is used as the initial global model for measuring the difference between the local model and the global model;

[0077] S1.5. After obtaining the initial global model, each device uses its own complete local data set to continuously perform three rounds of local model training in step S1.2 on the initial global model, wherein, for each local device, each local model training round will traverse all local data; and in the process of performing three consecutive rounds of local model training, each device will not perform global model aggregation operations. That is, each device uses its own local data set to perform a round of local model training on the initial global model, and after obtaining the local model, it cycles twice to perform another round of local model training on the obtained local model, and cycles twice to obtain the local model, and then obtains the local model obtained by each device performing local model training on its local data set.

[0078] S1.6, measure the difference between the gradient of the initial global model obtained in step S1.2 to step S1.5 and the gradient of the local model of each device by the distance between the model gradients. In this embodiment, the measurement index of the difference between model gradients uses the cosine distance to measure the difference between models. The difference value is between -1 and 1. The closer it is to -1, the smaller the model difference; conversely, the larger it is. The cosine distance between the local model gradient of each device and the gradient between the initial global model represents the difference between the local data distribution of each device and the global data distribution.

[0079] S2: According to the network topology structure connecting each device, the connection relationship of the point-to-point transmission between each device, the bandwidth resources between the device links, and the model size of the point-to-point transmission between the devices are obtained, and the minimum transmission delay of the point-to-point transmission between the devices is calculated;

[0080] The network topology information includes the devices participating in the training, the links of the directly connected devices, and the bandwidth resources of the links directly connected to each device. The network topology is stored in the form of a weighted undirected graph data structure with the devices participating in the training as nodes, the links as edges, and the bandwidth resources of the links as the weights of the edges.

[0081] Step S2 includes the following steps:

[0082] S2.1. By using a breadth-first search method and a greedy strategy, a transmission path that maximizes the bandwidth of point-to-point transmission between devices is first calculated based on the network topology and the bandwidth resources of the links directly connected to each device. The point-to-point transmission path between devices is composed of at least one link directly connected to the device.

[0083] In this embodiment, the specific method is that if it is necessary to calculate the routing path with the maximum bandwidth resources from the first device A to the second device C, first take the inverse of the weight of the edge between the nodes, and convert the path seeking the maximum bandwidth resources into the shortest path problem. That is, starting from the node represented by the first device A in the data structure of the weighted undirected graph of the network topology, based on the greedy strategy search, each time select the third device B that is closest to the first device A and has not yet confirmed the shortest path, and consider the current distance from the first device A to the third device B to be the shortest path from the final first device A to the second device C, and iterate the above process until the target destination, the second device C, is reached. All devices in the search process are combined in order to obtain the routing path with the maximum bandwidth resources from the final first device A to the second device C. At the same time, the transmission path between the acquired devices and the bandwidth resources on the path can be obtained by adding the weights on the transmission path between the devices to obtain the maximum bandwidth resources for point-to-point transmission between the devices.

[0084] S2.2. The bandwidth resources available for the point-to-point transmission path between devices are obtained by adding the bandwidth resources on the point-to-point transmission path between devices. The minimum communication delay for the point-to-point transmission between devices is obtained by dividing the model size of the point-to-point transmission between devices by the bandwidth resources available for the point-to-point transmission path between devices. The minimum transmission delay for the point-to-point transmission between devices is defined by using this delay. At the same time, in order to illustrate the point-to-point network distance between devices, the reciprocal of the maximum bandwidth for the point-to-point transmission between devices is used to represent the point-to-point network distance between devices.

[0085] The size of a model transmitted point-to-point between devices refers to the number of non-zero parameters in the model.

[0086] S3: Based on the minimum transmission delay of point-to-point transmission and the difference between the local data distribution of each device and the global data distribution, a heuristic genetic algorithm is used to encode the possible grouping methods of devices in the network, and the optimal grouping result is automatically searched through genetic operations. The grouping result includes the number of groups and the member devices included in each group, so as to determine the grouping aggregation method of the model after the devices are grouped;

[0087] Those skilled in the art will appreciate that genetic algorithms have several key processes, namely initializing the population and encoding the individuals in the population, setting a suitable fitness function for evaluating individual excellence, designing a selection method to select individuals to enter the next generation, and designing crossover and mutation methods to evolve the population.

[0088] The heuristic genetic algorithm is used to automatically search for the optimal grouping result as a way of device grouping training and aggregation without specifying the number of groups in advance, based on the difference between the local data distribution and the global data distribution of each device in the network, and the minimum transmission delay of point-to-point transmission between devices. Figure 2 As shown, the specific steps include:

[0089] S3.1. Using possible grouping methods of devices in the coding network as representations of individuals in the genetic algorithm, and combining multiple grouping methods, i.e. different individuals, into a population, specifically includes the following steps:

[0090] S3.1.1. Initialize the population POP and encode individuals in the population: In this embodiment, there are 10 devices in the network. The 10 devices in the network are numbered from 0 to 9, and the numbered devices are randomly arranged. A full arrangement from 0 to 9 represents an initial individual in the population in the genetic algorithm. The population includes multiple randomly generated individuals; the initial population size is set to 500, that is, the initial population is composed of 500 individuals;

[0091] Figure 2 The individuals p1 and p2 shown in step 1 in the population initialization stage represent two different full arrangements of 10 devices.

[0092] S3.1.2, if Figure 2 As shown in step 2 of , for one of the individuals in the population in step S3.1.1, Figure 3a and Figure 3b As shown, a hierarchical clustering mechanism is adopted to first initialize each device in the individual into different groups;

[0093] S3.1.3. Select a group aggregation node for each group, and select the device in the current group that minimizes the sum of the transmission delays between devices in the group as the group aggregation node of the current group. Figure 3a As shown by individual p;

[0094] p represents the initialized individual. There are 10 devices in the network, and the device numbers are from 0 to 9. Each device (gene) represents a group, and the group number starts from 0. The number of devices in the network is the number of groups at the initialization. In this example, the network group set is from c0 to c9;

[0095] When there is only one device in the group, the group aggregation node is the current device. For example, for group c0 in p, which contains only one device, the group aggregation node of the group is the second device 2. When there are only two devices in the group, the group aggregation node is the first node. For example, for group c0 in grouping result C0, its group aggregation node is the second device 2.

[0096] S3.1.4, traverse each group in the individual from left to right, and compare the network distance between the group aggregation node of the current group and the group aggregation nodes of the two groups to the left and right of the current group, merge the current group with the group with the smaller network distance, set a merging threshold α, if the network distance between the group aggregation nodes of the two groups exceeds the merging threshold α, the two groups will not be merged, after the merging is completed, the current individual is represented as a grouping method;

[0097] For the initial individual p, Figure 3a As shown, traversal starts from the first group c0. The aggregation node in c0 is the second device 2. The aggregation node is compared with the aggregation node of the group c1 on its right. If the network distance between the two is less than the preset threshold α, the groups c0 and c1 are merged, and the subscript of the merged group is c0. The group subscripts of subsequent groups are modified accordingly, that is, the subscripts are reduced by 1 based on the original value.

[0098] It is worth noting that after the groups are merged, the group aggregation node of the newly generated group needs to be updated according to the mechanism of step S3.1.3.

[0099] For the individual p that has been merged once, the same merging operation is continued on this basis, and the group c1 is sequentially traversed to compare its network distance with the group aggregation nodes of the groups c0 and c2 on the left and right. In this embodiment, the network distance between c1 and the group c2 on its right is smaller, so the groups c1 and c2 are merged, and at the same time, the subscript of the new group after the merger is updated to c1, and the group subscripts of the subsequent groups are modified accordingly, that is, the subscripts are reduced by 1 on the original value. At the same time, the group aggregation node of the merged group c1 needs to be updated.

[0100] For the individual p that has undergone two merge operations as mentioned above, the same merge operation is continued on this basis, and the group c2 is traversed sequentially to compare its network distance with the group aggregation nodes of the left and right groups c1 and c3. In this embodiment, the network distance between c2 and its left and right groups exceeds the preset maximum threshold α allowed for merging, then the group c2 will not be merged, the subscripts of the remaining groups do not need to be changed, and the group aggregation nodes of each group do not need to be updated.

[0101] S3.1.5, perform steps S3.1.2 to 3.1.4 for all individuals in the population until all individuals are represented as a grouping method;

[0102] In this embodiment, Figure 3a C0 represents the grouping method corresponding to individual p in the initial population, where individual p finally divides the 10 devices in the network into 6 groups without specifying the number of groups through iterative steps S3.1.2 to 3.1.4.

[0103] S3.1.6. For each individual grouping result in step S3.1.5, repeat steps S3.1.3 to S3.1.4 until the groups in each individual cannot be merged, and generate a grouping result each time it is repeated;

[0104] Figure 3b In the example, individual p obtains the initial grouping method C0 represented by it through step S3.1.5. In this embodiment, C0 is used as the initial individual, and the individual has 6 groups. Based on the individual C0, steps S3.1.3 to S3.1.4 are iteratively executed, that is, the present invention sequentially traverses 6 groups, and performs possible merging operations in the process of traversing the groups until the last group is traversed. In this embodiment, the grouping form generated by the merge traversal operation based on C0 is C1, and group C1 contains 4 groups.

[0105] Figure 3bIn the present invention, the grouping result C1 is used as the initial individual, and the merge traversal operation described in steps S3.1.3 to S3.1.4 is iteratively performed on the basis of C1 to obtain another possible grouping result C2 represented by individual p;

[0106] Figure 3b In the present invention, the grouping result C M-1 As the initial individual, in C M-1 Based on the iterative execution of the merge traversal operation described in step S3.1.3 to step S3.1.4, in this example, after the traversal merge operation is completed, the grouping result C M-1 Merged into a group, namely C M In the form of, at this point, stop the merge operation.

[0107] It is worth noting that, starting from individual p, by iteratively executing the merge traversal operation, M+1 grouping results that can be represented by individual p are finally generated.

[0108] S3.1.7, perform fitness evaluation on the grouping results generated in all repeated steps in step S3.1.6, and use the grouping result with the highest fitness after evaluation as the grouping method represented by the individual. At this time, each individual represents a grouping method, and multiple individuals are combined into a population in the genetic algorithm;

[0109] Since the rules for generating groups are certain, and the routing paths between devices, that is, the network distances between devices, are obtained through certain rules in step S1, a full arrangement of individuals corresponds one-to-one to the grouping method generated by the hierarchical clustering mechanism, that is, the initial full arrangement of devices can be represented as a grouping method in the network.

[0110] S3.2, determine the evaluation method and introduce the fitness function to judge the excellence of each grouping method (individual) in the population;

[0111] According to the grouping method represented by each individual obtained in step S3.1, calculate the difference between the group aggregate data distribution and the global data distribution of each group m in each grouping method And the transmission delay d of each device in each group to the group aggregation device of its group cluster Finally, the sum of the differences between the group data distribution of each group and the global data distribution is cos global and transmission delay d cluster Perform weighted averaging to obtain the weighted average value V p =cos global +β*d cluster , the weighted average V pAs the grouping cost represented by the current grouping method, β is the transmission delay d from each device in each group to the group aggregation node cluster The weight value of the grouping cost; the larger the grouping cost, the worse the grouping method represented by the individual. The inverse of the grouping cost is taken as the final fitness. The larger the fitness corresponding to the individual in the population, the better the grouping effect of the individual.

[0112] The group aggregate data distribution is obtained by performing a weighted average calculation based on the difference between the local data distribution of each device in the group and the global data distribution according to the amount of data on each device in the group.

[0113] In this embodiment, the difference between the local data distribution of device i in group m and the global data distribution is obtained by the present invention in S1 by performing three consecutive rounds of local model training on the local data set of the device i. Indicates that the data distribution w of group m m The model of the device in the group can be based on the local data volume The amount of data in the group D m Weighted average acquisition, that is The global aggregation model w can be obtained by performing 10 rounds of local updates and global aggregation on all devices in step S1 under the framework of decentralized distributed machine learning and performing weighted average according to the proportion of the data volume of each device to the global data volume D. In this embodiment, the difference between the group aggregate data distribution and the global data distribution is represented by the cosine similarity between the model gradients. global ,in Transmission delay from device i in group m to the aggregation device of group m The network distance between devices calculated in step S1 is represented by the transmission delay d from all devices in group m to the group aggregation device of group m. m The transmission delay through all devices in the group It is expressed as the weighted average of its data volume, that is, At the same time, the transmission delay from the devices in all groups to the group aggregation devices of their respective groups is represented by the weighted average of the transmission delays of all groups according to their group data volume, that is,

[0114] For genetic algorithms, it is generally accepted that the greater the individual fitness, the better the individual. In order to meet this common sense, the reciprocal of the grouping cost value is taken, and in order to scale the value within a controllable range, the exponent e is used as the base. In this embodiment, the individual fitness function is As the final group fitness. Among them, V p The smaller the value, the greater the individual's fitness is, and the better the grouping effect of the individual is.

[0115] S3.3, determine the selection method of individuals in the population P(t). According to the fitness values ​​of the individuals in the current population, select the individual with the highest fitness value from the population to directly join the next generation population to participate in the next round of iteration. The probability of other individuals entering the next generation is determined by the ratio of individual fitness to group fitness. Group fitness is the sum of all individual fitness;

[0116] Use the optimal individual preservation method to select individuals for the next generation population P(t+1), as follows:

[0117] For the best individual in the current population, no crossover mutation operation is performed. Instead, the best individual in the current population is directly retained to enter the next generation population, so that the current optimal grouping situation can be preserved without being destroyed. The probability of other individuals (non-optimal individuals) entering the next generation is the fitness of each individual f p (t) and group fitness ∑ p∈P f p (t), so that good individuals in the population are always selected rather than destroyed, which ensures that the population continues to evolve in the best direction, which is conducive to the stable convergence of the population and improves the search speed to obtain better clustering results, thereby stabilizing the convergence of the population and improving the population optimization speed.

[0118] S3.4, determine the genetic operations of crossover and mutation, select two individuals from the selected individuals according to the crossover rate and mutation rate of the current population to participate in the genetic operations of crossover and mutation, so as to produce offspring with higher fitness to join the next generation population and participate in the next round of iteration;

[0119] Dynamic crossover rate and mutation rate are used to set different crossover rate and mutation rate for each generation of population, that is, the crossover rate and mutation rate are selected for the population according to the heterogeneity of the current population, and then each generation of population selects individuals from the population according to their respective crossover rate and mutation rate for crossover and mutation operations, so as to evolve individuals different from those already existing in the current population. Specifically, the steps are as follows:

[0120] S3.4.1. Representing the similarity of populations: Calculate the difference between the individual with the largest fitness value in the current population and the average fitness value of all individuals in the population, scale the difference to between 0 and 1, and use the scaled difference to represent the heterogeneity of the current population. According to the heterogeneity value of the population, 1 minus the heterogeneity value can represent the similarity of the population. It can be understood that the smaller the scaled difference is, the higher the similarity of the population is; otherwise, the lower it is.

[0121] S3.4.2. Set dynamic crossover rate and mutation rate for the population according to the similarity of the current population: At the beginning of the genetic algorithm, select the initial crossover rate and initial mutation rate for the current population according to the experience of experts in this field, and in each round of population evolution, multiply the initial crossover rate and initial mutation rate by the similarity of the current population to obtain the crossover rate and mutation rate of the current population, and dynamically obtain the crossover rate and mutation rate for each generation of population according to its heterogeneity, where the range of the crossover rate and mutation rate of the population is 0 to 1;

[0122] In this embodiment, Ψ t =1-f(t) to indicate the similarity of the current population P(t), and f(t) indicates the heterogeneity of the population. f(t) max Represents the fitness value of the individual with the maximum fitness in the population P(t), represents the average fitness value of individuals in the population P(t). That is to say, when the value of f(t) is small, it means that the heterogeneity of the current population is small, and the crossover rate and mutation rate should be increased accordingly, so as to improve the heterogeneity of the population and prevent the population from falling into the local optimum. In this embodiment, the dynamic crossover rate cr t and mutation rate mr t As shown below, ini_cr and ini_mr represent the initial crossover and mutation rates, respectively, on which the crossover and mutation rates of each generation of the population are dynamically adjusted as shown below:

[0123] cr t =Ψ t ini_cr;

[0124] mr t =Ψ t ·ini_mr;

[0125] S3.4.3. Select individuals from the population for crossover and mutation operations based on the crossover rate and mutation rate of the current population: for each individual in the population, randomly generate a random number between 0 and 1, and compare the random number corresponding to the individual with the crossover rate and mutation rate of the current population. If the random number of the individual is less than the crossover rate of the current population, the individual will be selected and enter the crossover pool to wait for the individual's crossover operation; the individuals in the crossover pool are randomly paired as a group of parents to participate in subsequent crossover operations; after the crossover operation is completed, a group of offspring with the same number of individuals in the crossover pool will be generated; similarly, randomly generate different random numbers between 0 and 1 for the offspring generated by the crossover operation, and compare the random numbers represented by the offspring with the mutation rate of the current population. The offspring with random numbers less than the population mutation rate are selected to enter the mutation pool to wait for the individual's mutation operation;

[0126] Therefore, dynamically changing the crossover rate and mutation rate of each generation in the population evolution process can be understood. When the current population heterogeneity is low, that is, when the fitness of each individual in the population tends to be the same, dynamically increase the crossover rate and mutation rate of the population to increase the possibility of generating new individuals, thereby helping the population to jump out of the local optimum, avoid premature convergence, and prevent the population from falling into the local optimal solution; when the current population heterogeneity is high, that is, when the fitness of individuals in the population varies greatly, dynamically reduce the crossover rate and mutation rate of the population to reduce the possibility of generating new individuals, so that the population can converge stably and quickly;

[0127] S3.4.4, crossover and mutation operations are performed on the individuals in the crossover pool and mutation pool, and new individuals are generated: crossover and mutation operations are performed on a group of paired parents in the crossover pool in step S3.4.3; in this embodiment, Figure 4 As shown in the figure, the crossover method used is a two-point crossover method, that is, two individuals are randomly selected as parents at the crossover rate obtained from the current population, two crossover points are randomly generated in the two individuals, and some genes between the two crossover points are exchanged to produce two new offspring, as follows:

[0128] The first step is to randomly select two crossover points c1 and c2 from the first parent 1 and the second parent 2 of a pair of individuals to be crossed in the crossover pool. The positions of the crossover points of the two parents are the same.

[0129] In the second step, after selecting the corresponding crossover points, the two parents exchange the genes between c1 and c2 one by one;

[0130] The third step is to perform conflict detection on the exchanged individuals after the exchange of genes, that is, to establish a mapping relationship based on the two sets of exchanged genes, such as Figure 4 As shown, taking the mapping relationship of 1-6-3 as an example, we can see that in the second step, there are two genes 1 in the offspring 1, which are then transformed into gene 3 through the mapping relationship, and so on until there is no conflict;

[0131] Finally, all conflicting genes will be mapped to ensure that the new pair of offspring genes formed are conflict-free.

[0132] In this embodiment, the mutation method used is the multi-point mutation method in the basic position mutation, that is, the mutation operation is performed by selecting the mutable individuals at a certain mutation rate from the offspring generated in the previous step. For the mutable individuals, this example randomly selects two mutation points and exchanges the two mutated genes to generate new offspring.

[0133] This embodiment shows the variation mode of individuals in a population. The individual that produces the variation here is the above-mentioned offspring 1. The variation diagram is as follows: Figure 5 As shown;

[0134] The first step is to randomly select two mutation points in the offspring 1 in the mutation pool. In this example, the selected mutation points are m1 and m2.

[0135] In the second step, after selecting the corresponding mutation points, the two genes at positions m1 and m2 are exchanged.

[0136] After the crossover and mutation operations are completed, the newly generated individuals will replace the old individuals originally selected to participate in the crossover and mutation, and form a new generation of population with the unselected individuals in the current population to prepare for the next generation of population crossover and mutation operations.

[0137] S3.5, if Figure 2 As shown in step 3 in , step S3.3 and step S3.4 are repeated until the iteration round reaches a preset threshold or until the population converges, and then the individual with the highest fitness is selected from the final population as the optimal grouping result as the device grouping training and aggregation method;

[0138] In this embodiment, the maximum number of iterations is set to 1000, and the population convergence means that the optimal individual of the population remains unchanged after 100 consecutive iterations. Then, the individual with the highest fitness is selected from the final population as the optimal grouping result and returned, that is, Figure 2 as shown in step 4 in .

[0139] S4: Divide the devices in the network into different groups according to the model grouping and aggregation method determined in step S3, and perform group training and group model aggregation on the devices according to the obtained grouping method;

[0140] In this embodiment, the devices in the network are grouped according to the optimal grouping result obtained in step S3. In each group, the devices in the group only participate in local model training and communicate with the group aggregation device; the group aggregation device is responsible for aggregating the models of the nodes in its group and communicating with the server; the server only aggregates the models transmitted by the group aggregation model and only communicates with the group aggregation model; relevant technical personnel in this field can know that the model aggregation and training method will be implemented in accordance with the model aggregation and training method in general decentralized distributed machine learning.

[0141] Embodiment 2:

[0142] The difference between this embodiment and embodiment 1 is that the metric standard for measuring the difference between model gradients in this embodiment is the Euclidean distance, that is, the group aggregation model gradient w m The difference with the global model gradient w can be expressed as:

[0143] Embodiment 3:

[0144] The difference between this embodiment and embodiment 1 is that the crossover operation in this embodiment adopts a multi-point crossover mode. The operation diagram is shown in FIG. Figure 6 The specific steps are as follows:

[0145] The first step is to randomly select multiple crossover points from the first parent 1 and the second parent 2 of a pair of individuals to be crossed in the crossover pool. In this embodiment, the number of crossover points selected is 4. The crossover points are c1, c2, c3 and c4, and the positions of the crossover points of the two parents are consistent;

[0146] The second step is to generate the first offspring 1 after selecting the corresponding crossover point, and ensure that the crossover point selected by the offspring is the same as that of the parent, and assign the gene at the crossover point of the parent to the first offspring 1;

[0147] The third step is to find out the position of the gene at the crossover point selected in the first parent generation 1 in the second parent generation 2, and put the remaining genes that do not belong to the first parent generation 1 into the remaining positions of the first child generation 1 generated in the second step in order;

[0148] The fourth step is to exchange the positions of the first parent generation 1 and the second parent generation 2, while ensuring that the selected intersection point is consistent with that in the first step, and then the second child generation 2 can be generated according to steps 1 to 3.

[0149] The above embodiments are only applicable to illustrate the present invention, but not to limit the present invention. Any changes, modifications, substitutions, combinations and simplifications made to the present invention by technicians in the relevant technical field without departing from the spirit and principles of the present disclosure should be equivalent replacement methods and belong to the protection scope of the present invention. The patent protection scope of the present invention should be defined by the claims.

Claims

1. A grouping optimization method for model aggregation in distributed edge learning, characterized in that: The following steps are involved: S1. The difference between the local model of each device and the initial global model is represented by the difference between the updated gradient obtained by performing multiple rounds of training on the same initial global model using its own local data set and the initial global model gradient, thereby quantifying the difference between the local data distribution of each device and the global data distribution according to the difference between the local model of the device and the initial global model; S2. According to the network topology information connecting each device, the connection relationship of the point-to-point transmission between each device and the bandwidth resources between the device links are obtained. At the same time, the minimum transmission delay of the point-to-point transmission between the devices is calculated in combination with the model size of the point-to-point transmission between the devices. S3. Based on the minimum transmission delay of point-to-point transmission between devices and the difference between the local data distribution of each device and the global data distribution, a heuristic genetic algorithm is used to encode the possible grouping methods of devices in the network, and the optimal grouping result is automatically searched through genetic operations. The grouping result includes the number of groups and the member devices included in each group, so as to determine the grouping aggregation method of the model after the devices are grouped; The heuristic genetic algorithm is used to automatically search for the optimal grouping result as a device grouping training and aggregation method based on the difference between the local data distribution and the global data distribution of each device in the network and the minimum transmission delay of point-to-point transmission between devices without specifying the number of groups in advance. The specific steps include: S3.

1. Use the possible grouping methods of devices in the coding network as the representation of individuals in the genetic algorithm, and combine multiple grouping methods, i.e. different individuals, into a population; S3.2, determine the evaluation method and introduce the fitness function to judge the excellence of each grouping method in the population; According to the grouping result of each individual obtained in step S3.1, the difference between the group aggregation data distribution and the global data distribution of each group in each grouping result, as well as the sum of the transmission delays from each device in each group to the group aggregation node are calculated. Finally, the sum of the difference between the group aggregation data distribution and the global data distribution of each group and the sum of the transmission delays are weighted averaged to obtain a weighted average value, which is used as the grouping cost represented by the current grouping method. The larger the grouping cost, the worse the grouping method represented by the individual. The inverse of the grouping cost is taken as the final fitness. The larger the fitness corresponding to the individual in the population, the better the grouping effect of the individual. The group aggregate data distribution is calculated by weighted average of the difference between the local data distribution and the global data distribution of each device in the group according to the amount of data on each device in the group; S3.

3. Determine the selection method for individuals in the population. According to the fitness values ​​evaluated by each individual in the population, select the individual with the highest fitness value from the population to directly join the next generation population to participate in the next round of iteration. The probability of other individuals entering the next generation is determined by the ratio of individual fitness to group fitness. Group fitness is the sum of all individual fitnesses. S3.4, determine the genetic operations of crossover and mutation, select two individuals from the selected individuals according to the crossover rate and mutation rate of the current population to participate in the genetic operations of crossover and mutation, so as to produce offspring with higher fitness to join the next generation population and participate in the next round of iteration; Dynamic crossover rate and mutation rate are used to set different crossover rate and mutation rate for each generation of population, that is, the crossover rate and mutation rate are selected for the population according to the heterogeneity of the current population, and then each generation of population selects individuals from the population according to their respective crossover rate and mutation rate for crossover and mutation operations, so as to evolve individuals different from those already existing in the current population. Specifically, the steps are as follows: S3.4.

1. Indicating the similarity of populations: Calculate the difference between the individual with the largest fitness value in the current population and the average fitness value of all individuals in the population, scale the difference to between 0 and 1, and use the scaled difference to indicate the heterogeneity of the current population; Based on the heterogeneity value of the population, 1 minus the heterogeneity value can indicate the similarity of the population. It can be understood that the smaller the scaled difference is, the higher the similarity of the population is; otherwise, the lower the similarity is; S3.4.

2. Set dynamic crossover rate and mutation rate for the population according to the similarity of the current population: At the beginning of the genetic algorithm, select the initial crossover rate and initial mutation rate for the current population according to the experience of experts in this field, and in each round of population evolution, multiply the initial crossover rate and initial mutation rate by the similarity of the current population to obtain the crossover rate and mutation rate of the current population, and dynamically obtain the crossover rate and mutation rate for each generation of population according to its heterogeneity, where the range of the crossover rate and mutation rate of the population is 0 to 1; S3.4.

3. Select individuals from the population for crossover and mutation operations based on the crossover rate and mutation rate of the current population: for each individual in the population, randomly generate a random number between 0 and 1, and compare the random number corresponding to the individual with the crossover rate and mutation rate of the current population; if the random number of the individual is less than the crossover rate of the current population, the individual will be selected and enter the crossover pool to wait for the individual's crossover operation; the individuals in the crossover pool are randomly paired as a group of parents to participate in subsequent crossover operations; after the above crossover operation is completed, a group of offspring with the same number of individuals in the crossover pool will be generated; similarly, randomly generate different random numbers between 0 and 1 for the offspring generated by the crossover operation, and compare the random numbers represented by the offspring with the mutation rate of the current population, and select the offspring whose random numbers are less than the population mutation rate to enter the mutation pool to wait for the individual's mutation operation; S3.4.4, perform crossover and mutation operations on the individuals in the crossover pool and mutation pool, and generate new individuals: perform crossover and mutation operations on the paired set of parents in the crossover pool in step S3.4.3; after the crossover and mutation operations are completed, the generated new individuals will replace the old individuals originally selected to participate in the crossover and mutation, and form a new generation of population with the unselected individuals in the current population to prepare for the next generation of population crossover and mutation operations; S3.5, repeating steps S3.3 and S3.4 until the number of iterations reaches a preset threshold, and then selecting the individual with the highest fitness from the final population as the optimal grouping result, and using it as a method for device grouping training and aggregation; S4. Divide the devices in the network into different groups according to the model grouping and aggregation method determined in step S3, and perform group training and group model aggregation on the devices according to the obtained grouping method.

2. According to claim 1, a grouping optimization method for model aggregation in distributed edge learning is characterized in that: Each device has multiple data samples, which constitute the local data set of each device. Each device performs gradient descent-based model training on its local data set to obtain a local model trained based on the local data set. For each device, the data distribution between devices is not independent and identically distributed, that is, the local data distribution between devices is inconsistent and different from the global data distribution; In step S1, in order to represent the difference between the distribution of each device and the global distribution, the difference between the local data distribution of the device and the global data distribution is quantified according to the difference between the updated gradient obtained by performing multiple rounds of training on each device using its own local data set on the same initial global model and the initial global model gradient, which specifically includes the following steps: S1.

1. Randomly initialize a global model and use the global model as a unified initial model for each device; the global model is a machine learning model specified by a person skilled in the art, including Linear Regression, Multilayer Perceptrons or Convolutional Neural Networks; S1.

2. Perform multiple rounds of local updates and global aggregation on each device under the framework of decentralized distributed machine learning. That is, after each device uses its complete local data set to perform a round of local model training on the initial model and obtains its corresponding local model, all devices perform weighted average of the obtained local models according to their data volume to obtain a global aggregation model. S1.3, send the global aggregate model to each device and use it as the initial model for the next round of local model training of each device, and return to step S1.2; S1.4: After the local model training and global model aggregation steps of steps S1.2 to S1.3 are executed in a loop for multiple rounds, the currently acquired global aggregation model is used as the initial global model for measuring the difference between the local model and the global model; S1.

5. After obtaining the initial global model, each device uses its own complete local data set to continuously perform multiple rounds of local model training in step S1.2 on the initial global model, wherein, for each local device, each local model training round will traverse all local data; and in the process of performing multiple consecutive rounds of local model training, each device will not perform global model aggregation operations, that is, each device uses its own local data set on the initial global model to perform a round of local model training, and after obtaining the local model, it cycles multiple times to perform another round of local model training on the obtained local model, and cycles multiple times to obtain the local model, and then obtains the local model, and then obtains the local model obtained by each device performing local model training on its local data set; S1.

6. Measuring the difference between the gradient of the initial global model obtained in steps S1.2 to S1.5 and the gradient of the local model of each device by the distance between model gradients. The measurement indicators of the distance between model gradients include cosine distance, Euclidean distance or Manhattan distance. The difference between the local model gradient of each device and the gradient between the initial global model is used to represent the difference between the local data distribution of each device and the global data distribution.

3. According to claim 1, a grouping optimization method for model aggregation in distributed edge learning is characterized in that: In step S2, the network topology information includes the devices participating in the training, the links of the directly connected devices, and the bandwidth resources of the links directly connected to each device. The network topology is stored in a data structure of a weighted undirected graph in the form of the devices participating in the training as nodes, the links as edges, and the bandwidth resources of the links as the weights of the edges.

4. According to claim 3, a grouping optimization method for model aggregation in distributed edge learning is characterized in that: Step S2 includes the following steps: S2.

1. By using a breadth-first search method and a depth-first search method, a transmission path that maximizes the bandwidth of point-to-point transmission between devices is first calculated based on the network topology and the bandwidth resources of the links directly connected to each device. The point-to-point transmission path between devices is composed of at least one link directly connected to the device. S2.

2. The bandwidth resources available for the point-to-point transmission path between devices are obtained by adding the bandwidth resources on the point-to-point transmission path between devices, and the minimum transmission delay of the point-to-point transmission between devices can be obtained by dividing the model size of the point-to-point transmission between devices by the bandwidth resources available for the point-to-point transmission path between devices according to the bandwidth resources and the size of the point-to-point transmission model between devices; The size of a model transmitted point-to-point between devices refers to the number of non-zero parameters in the model.

5. According to claim 1, a grouping optimization method for model aggregation in distributed edge learning is characterized in that: Step S3.1 specifically includes the following steps: S3.1.

1. Initialize the population and encode the individuals in the population: If there are N devices in the network, number the N devices in the network from 1 to N, and randomly arrange the numbered devices. A full arrangement of N represents an individual in the population of the genetic algorithm. The population includes multiple randomly generated individuals. S3.1.2, for one of the individuals in the population in step S3.1.1, a hierarchical clustering mechanism is used to first initialize each device in the individual into a different group; S3.1.3, for the grouping result in step S3.1.2, select a group aggregation node for each group, and select the device in the current group that minimizes the sum of the transmission delays between devices in the group as the group aggregation node of the current group; S3.1.

4. Traverse each group in the individual from left to right, and compare the network distance between the group aggregation node of the current group and the group aggregation nodes of the two groups to the left and right of the current group, merge the current group with the group with the smaller network distance, set a merging threshold, if the network distance between the group aggregation nodes of the two groups exceeds the merging threshold, the two groups will not be merged, after the merging is completed, the current individual is represented as a grouping method; S3.1.5, perform steps S3.1.2 to 3.1.4 for all individuals in the population until all individuals are represented as a grouping method; S3.1.

6. For each individual grouping result in step S3.1.5, repeat steps S3.1.3 to S3.1.4 until the groups in each individual cannot be merged, and generate a grouping result each time it is repeated; S3.1.

7. Perform fitness evaluation on the grouping results generated in all repeated steps in step S3.1.

6. The grouping result with the highest fitness after evaluation is used as the grouping method represented by the individual. At this time, each individual represents a grouping method, and multiple individuals are combined into a population in the genetic algorithm.

6. A grouping optimization method for model aggregation in distributed edge learning according to claim 1, characterized in that: In step S3.4.4, the crossover method used includes: a two-point crossover method or a multi-point crossover method; The mutation method adopted is the basic bit mutation method.

7. A grouping optimization method for model aggregation in distributed edge learning according to any one of claims 1 to 6, characterized in that: In step S4, the devices in the network are divided according to the optimal grouping result obtained in step S3. After each device is grouped, model training is performed in its respective group and group model aggregation is participated in. The group model communicates with the server and participates in global model aggregation.

Citation Information

Patent Citations

  • Method for improving BP (back propagation) neutral network and based on genetic algorithm

    CN103971162A

  • Bayesian network structure learning method and system based on genetic algorithm

    CN112712178A