Hierarchical personalized federated learning method, device and medium in edge computing network
By adopting a hierarchical personalized federated learning method in the edge computing network and weighted clustering based on distribution and resource similarity, efficient training is achieved in resource-constrained environments, solving the negative impact of terminal device heterogeneity and improving model performance and communication efficiency.
Patent Information
- Application Number
- CN202310536782.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-10
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2043-05-10
AI Technical Summary
In resource-constrained mobile edge computing networks, existing federated edge learning methods fail to effectively consider the personalized characteristics and resource differences of terminal devices, resulting in inefficient communication and poor model performance.
A hierarchical personalized federated learning method is adopted to divide the edge computing network into two layers. The first layer is the terminal device layer, and the second layer is the edge cloud layer. Through a clustering mechanism based on distribution similarity and resource similarity weighting, intra-cluster synchronous training and inter-cluster asynchronous training are achieved, retaining personalized features and reducing communication overhead.
It improves training efficiency, reduces communication overhead, enhances the test performance of terminal devices, adapts to heterogeneous environments, and achieves a better balance between personalized feature retention and model generalization.
Smart Images

Figure CN116579417B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of edge computing, and in particular to a hierarchical personalized federated learning method and device in an edge computing network and a medium. BACKGROUND
[0002] Under the promotion of the wide application of the Internet of Things and the continuous updating and iteration of device performance, the demand for intelligent applications in mobile edge computing networks is growing rapidly. Centralized learning is a traditional and common method for training models in intelligent applications, which trains models on a remote central server based on data collected from a large number of users. However, due to the openness and constraints of wireless channels, centralized methods have the risk of privacy leakage and traffic congestion. In addition, independently trained models on terminal devices may not perform well due to data silos. Therefore, a new distributed model training paradigm—federated edge learning has emerged. In federated edge learning, federated learning trains a global model based on local models provided by terminal devices through collaboration, promoting the application of artificial intelligence in mobile edge computing networks. More specifically, federated learning allows user data to be processed locally where it is generated, and only the trained model needs to be transmitted to the central parameter server for aggregation through the wireless channel.
[0003] Due to the large size of machine learning models in mobile edge computing networks and the large number of terminal devices, frequent transmission between terminal devices and parameter servers can lead to low communication efficiency of federated edge learning. In addition, the available resources of terminal devices are also limited, such as computing power and remaining energy. In order to make communication more efficient, existing work mainly focuses on designing wireless resource allocation schemes for resource-constrained federated edge learning. At the same time, by adjusting the aggregation frequency and user selection to achieve partial participation, the trained model is more efficient. In addition, pruning and quantizing the model can reduce the frequency band burden of the source. In recent years, related research has gradually shifted its focus to network topology, i.e., multi-layer network topology. Unlike traditional federated edge learning architecture, hierarchical federated edge learning trains a global general-purpose model through a two-layer network, effectively improving communication efficiency by reducing wireless backhaul transmission.
[0004] In addition, the heterogeneity among terminal devices also has a negative impact on the training efficiency of federated edge learning. Different devices produce different data distributions, have uneven computing capabilities, and have different communication environments. Obviously, all these differences make it impractical for federated edge learning to obtain a universal model applicable to all terminal devices. Because a unified universal model will inevitably destroy the individual characteristics of each terminal user, which can be reflected in the poor test performance of each end device. Wang et al. conducted the first study on considering user individual characteristics in federated learning model training. Since then, this problem has attracted more attention from researchers, and two types of work considering user individual characteristics have emerged. One method is to perform local adaptation based on the global training model to maintain the individual characteristics of the user itself, which includes data enhancement, local loss regularization, etc. The other is to cluster the terminals based on data distribution or other indicators, and each cluster maintains a model that retains individual characteristics.
[0005] However, existing local adaptation and other methods that retain individual characteristics may increase the computational burden of terminal devices, as they require additional local iterations on top of the global model to add individual characteristics to the global model. The fact that additional computational burden is added contradicts the resource-constrained settings of edge devices. In addition, the parameter server under the clustering federated learning mechanism needs to maintain multiple models simultaneously. The number of terminal devices in each cluster is inconsistent, and the data volume of the cluster with fewer devices will be smaller, which will result in poor model performance. In addition, most algorithms do not consider the resource differences between terminal devices when clustering devices. In addition, existing resource-efficient federated edge learning schemes ignore the user distribution as an individual characteristic, which will lead to poor model performance when using test performance of each terminal device as an evaluation indicator. Therefore, how to design a training scheme that is individual characteristic-aware and resource-aware in a resource-constrained mobile edge computing network is still a problem to be solved. SUMMARY
[0006] The purpose of the present application is to provide a hierarchical individualized federated learning method, device and medium in an edge computing network, which clusters all terminal devices according to a weighted indicator composed of distribution and resource similarity, naturally forming a two-layer hierarchical federated edge learning architecture. In addition, each cluster has a terminal device acting as a cluster head responsible for aggregating the global model within the cluster, and transmitting the processed model to the edge server for inter-cluster aggregation to form a global model, thereby balancing the trade-off between individual characteristic preservation and model generalization, reducing communication overhead, and achieving efficient federated learning.
[0007] The purpose of the present application can be achieved by the following technical solutions:
[0008] A hierarchical personalized federated learning method in an edge computing network, comprising the following steps:
[0009] The edge computing network is divided into two layers, the first layer being a terminal device layer including a plurality of clusters formed by clustering a plurality of terminal devices, and the second layer being an edge cloud layer in which cluster head nodes of the clusters communicate with edge servers;
[0010] Determine terminal devices in the edge computing network to be communicated;
[0011] Cluster the terminal devices based on a distribution similarity and a resource similarity weighted metric;
[0012] Train the edge computing network to implement double-layer personalized federated edge learning, wherein the training process includes intra-cluster training and inter-cluster training, the intra-cluster training adopts a synchronous mechanism, all terminal devices simultaneously communicate with a cluster head node through an orthogonal channel, each node sends all model parameters to the cluster head node, and the cluster head node is responsible for aggregating all parameters; the inter-cluster training is a global model fusion process between the cluster head nodes and the edge servers, adopts an asynchronous mechanism, and each cluster head node only fuses part of the parameters when performing inter-cluster fusion to retain personalized features.
[0013] The clustering of the terminal devices based on the distribution similarity and the resource similarity weighted metric is specifically: according to a distribution similarity matrix DSM and a resource similarity matrix RSM, a decision factor of a hierarchical personalized federated learning clustering mechanism, i.e., a similarity SM between terminal devices, is obtained by weighting the two:
[0014] SM(h,g)=w1DSM(h,g)+w2RSM(h,g)
[0015] wherein w1 is a weight occupied by the distribution similarity, w2 is a weight occupied by the resource similarity, and w1+w2=1; SM(h,g) represents a similarity between local models of a terminal device h and a terminal device g, and the smaller the value, the higher the similarity;
[0016] A similarity matrix composed of the similarity SM between each terminal device, by setting a threshold value v∈(0,1), i.e., limiting the similarity difference between terminal devices in the same cluster, determines the number of clusters and the model in each cluster, and realizes clustering.
[0017] The generation process of the distribution similarity matrix includes three steps of distribution information generation, probability distribution generation, and distribution similarity matrix calculation,
[0018] Distribution information generation: fuse the local models uploaded by the terminal devices into a global model, save the global model in the edge server as a pre-training model, input noise into the pre-training model, and output distribution information similar to the data;
[0019] Probability distribution generation: input the distribution information into all local models to generate the probability distribution vector of each local model, one terminal device corresponds to one probability distribution vector;
[0020] Distribution similarity matrix calculation: based on the probability distribution vector, the distance of the distribution of each terminal device is calculated by using the KL divergence, let V h and V g respectively represent the probability distribution vector of the local model of terminal device h and terminal device g, and the KL divergence between the local model of terminal device h and the local model of terminal device g is:
[0021] DSM(h,g)=D KL (V h ||V g )
[0022] By calculating the KL divergence between the local models of each terminal device, a distribution similarity matrix DSM with a size of N×N is obtained, wherein N is the number of terminal devices, and DSM(h,g) represents the distribution similarity between the local models of terminal device h and terminal device g, and the smaller the value of DSM(h,g) is, the greater the similarity between the local models of terminal device h and terminal device g is.
[0023] The resource similarity is composed of the computing power and the residual energy similarity of the terminal device, and the attributes of each device are represented by a state vector, let the state vector of device h be RS h =(cs h ,es h ), there are two elements cs h and es h in the state vector, cs h represents the computing power of the device, and es h represents the residual energy value of the device; the cosine similarity is used to calculate the resource similarity between the terminal devices:
[0024]
[0025] By calculating the cosine similarity between the local models of each terminal device, a resource similarity matrix RSM with a size of N×N is obtained, wherein N is the number of terminal devices, and RSM(h,g) represents the resource similarity between the local models of terminal device h and terminal device g, and the smaller the value of RSM(h,g) is, the greater the similarity between the local models of terminal device h and terminal device g is.
[0026] The intra-cluster training adopts a traditional federated training FedAvg algorithm, and the training process includes three stages of global model distribution, local model training and global model fusion When the local model of each terminal device reaches the predefined accuracy , the local model is uploaded to the cluster head node for aggregation; assuming that there are I clusters in total, and denotes the set of all cluster head nodes, and for the i-th (i∈[0,I]) cluster, use denotes the set of all devices included in the i-th cluster, and in the local training, the gradient descent method is adopted, and the local iterative update formula is:
[0027]
[0028] h h h h h h h h h
[0029]
[0030] *
[0031] In the inter-cluster training, in order to preserve the individual characteristics of each intra-cluster model, the edge server adopts a partial aggregation method, and the cluster head uploads part of the local model to the edge server, specifically, use i to represent the intra-cluster global model obtained by the cluster head node of the i-th cluster through intra-cluster aggregation, and represent it in the form of a functional layer of a neural network as:
[0032]
[0033] where θ represents the shared layer to be transmitted to the edge server for global aggregation, and the shared layer is updated according to the global aggregation model; ω represents the private layer, which is kept private by the cluster head and is not globally fused.
[0034] The inter-cluster training adopts an asynchronous fusion manner, once the cluster head node completes the intra-cluster training, the local model is immediately sent to the edge server, the sending time between each device is not restricted, but the edge server only allows the model of one cluster head node to participate in each round of fusion, and the inter-cluster global model updating formula is represented as:
[0035] z t = (1 - K) z t-1 + K z new
[0036] Wherein, t represents the global fusion round, z t is the global model at the edge server, z new is the model received by the edge server from the cluster head node in the tth round of global fusion and used for global fusion, and K is the model fusion weight.
[0037] The method for training the edge computing network and realizing the double-layer personalized federated edge learning comprises the following steps:
[0038] S1: initializing a global model;
[0039] S2: for each cluster head node, downloading the global model parameters and updating the shared layer parameters of the cluster head node based on the global model parameters, thereby updating the intra-cluster global model;
[0040] S3: each cluster head node downloads the latest parameters of the intra-cluster global model and updates the local model parameters of the terminal device based on the parameters of the intra-cluster global model;
[0041] S4: based on the intra-cluster training, the local model parameters of the terminal device are iterated to obtain the trained local model of the terminal device and send it to the cluster head node;
[0042] S5: the cluster head node performs intra-cluster aggregation, updates the intra-cluster global model, and sends the shared layer parameters in the intra-cluster global model to the edge server for asynchronous inter-cluster training;
[0043] S6: updating the global model.
[0044] A layered personalized federated learning device in an edge computing network is used to realize the method described above, comprising:
[0045] The edge computing network construction module divides the edge computing network into two layers, the first layer is a terminal device layer, comprising a plurality of clusters formed by clustering a plurality of terminal devices, and the second layer is an edge cloud layer, which communicates with the cluster head node of each cluster and the edge server;
[0046] The terminal device determination module is used to determine the terminal device to be communicated in the edge computing network.
[0047] a terminal device clustering module configured to cluster the terminal devices based on a distribution similarity and a resource similarity weighted metric;
[0048] a training module configured to train the edge computing network to implement the double-layer personalized federated edge learning, wherein the training process comprises intra-cluster training and inter-cluster training, the intra-cluster training adopts a synchronous mechanism, all the terminal devices simultaneously communicate with the cluster head node through an orthogonal channel, each node sends all the model parameters to the cluster head node, and the cluster head node is responsible for aggregating all the parameters; the inter-cluster training is a global model fusion process between the cluster head nodes and the edge server, adopts an asynchronous mechanism, and each cluster head node only fuses part of the parameters when performing inter-cluster fusion to preserve the personalized features.
[0049] A layered personalized federated learning device in an edge computing network, comprising a memory, a processor, and a program stored in the memory, wherein the processor implements the method as described above when executing the program.
[0050] A storage medium having a program stored thereon, wherein the program implements the method as described above when executed.
[0051] Compared with the prior art, the present application has the following beneficial effects:
[0052] (1) In the case of resource limitation, the present application proposes a double-layer federated edge learning training method based on distribution and resource similarity weighted metric to alleviate the negative effects of terminal device heterogeneity and improve training efficiency.
[0053] (2) The present application adopts two aggregation strategies of intra-cluster aggregation and inter-cluster aggregation, in order to balance the training speed of different clusters, the intra-cluster aggregation and the inter-cluster aggregation adopt synchronous and asynchronous aggregation respectively. In intra-cluster aggregation, each node sends all the model parameters to the cluster head node, and the cluster head node is responsible for aggregating all the parameters, and the intra-cluster wireless communication transmission can be carried out on the D2D (device-to-device) link, which can reuse the wireless channel between the cluster head and the parameter server, thereby improving the communication efficiency.
[0054] (3) The present application proposes a partial aggregation mechanism for protecting personalized features for inter-cluster aggregation, that is, each cluster head maintains the privacy of the private layer, and only uploads the parameters of the shared layer to the edge server, the generalization in intra-cluster aggregation and the personalization in inter-cluster aggregation realize the trade-off between generalization and personalization, and can further reduce the communication overhead.
[0055] (4) Compared with the baseline algorithm, the present application has better test performance of the terminal device and better adaptability to different heterogeneous environments due to considering the personalized features. BRIEF DESCRIPTION OF DRAWINGS
[0056] Figure 1 A method flowchart of the present application;
[0057] Figure 2 A structure and communication process diagram of the edge computing network of the present application;
[0058] Figure 3 A flowchart of constructing a distribution similarity matrix based on KL distance in an embodiment;
[0059] Figure 4 A similarity matrix construction method diagram in an embodiment;
[0060] Figure 5 A cluster-to-cluster training process diagram in an embodiment;
[0061] Figure 6 A statistical heterogeneity adaptability analysis result diagram in an embodiment;
[0062] Figure 7 A system heterogeneity adaptability analysis result diagram in an embodiment;
[0063] Figure 8 A model performance impact result diagram of energy constraints in an embodiment. DETAILED DESCRIPTION
[0064] The present application will be described in detail below with reference to the accompanying drawings and specific embodiments. The present embodiment is implemented on the premise of the technical solution of the present application, and gives a detailed implementation and specific operation process, but the protection scope of the present application is not limited to the following embodiments.
[0065] The present embodiment provides a hierarchical personalized federated learning method in an edge computing network, as shown in Figure 1 , including the following steps:
[0066] S1: The edge computing network is divided into two layers, the first layer is a terminal device layer, including a plurality of clusters formed by clustering a plurality of terminal devices, and the second layer is an edge cloud layer, in which the cluster head nodes of each cluster communicate with the edge server.
[0067] Specifically, as shown in Figure 2 , the cluster head node of each cluster in the terminal device layer is also played by a terminal device. In addition, each cluster performs a federated training process called intra-cluster training, and the intra-cluster devices interact with the cluster head node through D2D communication. That is, in the intra-cluster training process, all terminal devices communicate with the cluster head node through an orthogonal channel at the same time. For simplicity, this embodiment only considers a scenario in which one edge server provides services, and in other embodiments, it can be extended to a scenario with multiple servers. The model fusion process between the cluster head and the edge server is called inter-cluster training.
[0068] S2: determining terminal devices to be communicated in the edge computing network.
[0069] S3: clustering the terminal devices based on a weighted metric of the distribution similarity and the resource similarity.
[0070] The existing clustering method only considers the distribution similarity between different devices, which is not suitable for mobile edge computing networks with limited terminal device resources and changing network resources. It is known that federated learning is a distributed machine learning whose time overhead is determined by the slowest device. Therefore, the present embodiment will consider both the distribution and resource similarity between terminal devices to provide a more systematic and comprehensive solution to improve training efficiency.
[0071] Specifically, all terminal devices are clustered according to the weighted index composed of distribution similarity and resource similarity, naturally forming a two-layer hierarchical federated edge learning architecture as shown in Figure 2 In addition, each cluster has a device acting as a cluster head responsible for aggregating the global model within the cluster, and then transmitting the processed model to the parameter server for inter-cluster aggregation to form a global model. Intra-cluster wireless communication transmission can be performed on the D2D (device-to-device) link, which can reuse the wireless channel between the cluster head and the parameter server, thereby improving communication efficiency.
[0072] Specifically, S3 includes the following steps:
[0073] S31: calculating a distribution similarity matrix.
[0074] The generation process of the distribution similarity matrix includes three steps of distribution information generation, probability distribution generation, and distribution similarity matrix calculation, as shown in Figure 3
[0075] Distribution information generation: fuse the local model uploaded by the terminal device into a global model and save it in the edge server as a pre-trained model, input noise into the pre-trained model, and output distribution information similar to the data;
[0076] Probability distribution generation: input the distribution information into all local models to generate a probability distribution vector for each local model, with one terminal device corresponding to one probability distribution vector;
[0077] Distribution similarity matrix calculation: based on the probability distribution vector, the present embodiment calculates the distance of the distribution of each terminal device using Kullback-Leibler (KL) divergence, and let V h and V g They represent the probability distribution vectors of the local models of terminal devices h and g respectively. The KL divergence between the local model of terminal device h and the local model of terminal device g is:
[0078] DSM(h,g)=D KL (V h ||V g ) (1)
[0079] By calculating the KL divergence between the local models of each terminal device, we obtain an N×N distribution similarity matrix (DSM), where N is the number of terminal devices. DSM(h,g) represents the distribution similarity between the local models of terminal devices h and g. Specifically, smaller DSM(h,g) values indicate greater similarity between the local models of terminal devices h and g.
[0080] S32: Calculate resource similarity matrix.
[0081] Resource similarity is composed of the computing power and residual energy similarity of the terminal device. This embodiment evaluates the ability of the device to participate in training by measuring its current computing power and residual energy to reduce the negative impact of the lag effect. For each device, a state vector is used to represent its attributes. For example, the state vector of device h can be represented as RS h =(cs h ,es h ), there are two elements cs in the state vector h and es h ,cs h Represents the computing power of the device, es h Represents the remaining energy value of the device; cosine similarity is used to calculate the resource similarity between terminal devices. Cosine similarity is independent of the length of the vector and is only related to the direction of the vector. The calculation formula is as follows:
[0082]
[0083] By calculating the cosine similarity between the local models of each terminal device, we obtain an N×N resource similarity matrix (RSM), where N is the number of terminal devices. RSM(h,g) represents the resource similarity between the local models of terminal devices h and g. Specifically, smaller RSM(h,g) values indicate greater similarity between the local models of terminal devices h and g.
[0084] S33: Based on the distribution similarity matrix DSM and the resource similarity matrix RSM, the decision factor of the clustering mechanism of hierarchical personalized federated learning is obtained by weighting the two, that is, the similarity SM between terminal devices, such as Figure 4 As shown:
[0085] SM(h,g) = w1DSM(h,g) + w2RSM(h,g) (3)
[0086] where w1 is the weight of distribution similarity, w2 is the weight of resource similarity, and w1 + w2 = 1. SM(h,g) represents the similarity between the local model of terminal device h and terminal device g, and the smaller the value, the higher the similarity.
[0087] Based on the similarity matrix composed of the similarity SM between each terminal device, by setting a threshold v e (0, 1), that is, limiting the similarity difference between the terminal devices in the same cluster, the number of clusters and the model in each cluster can be easily determined, clustering is realized, and complex and inaccurate manual work is avoided. Although the specific information of the user (terminal device) and the resource state cannot be known, the manual threshold is always effective because the calculated similarity matrix has clearly described the difference between the models.
[0088] S4: training the edge computing network to realize double-layer personalized federated edge learning, wherein the training process includes intra-cluster training and inter-cluster training, the intra-cluster training adopts a synchronous mechanism, all terminal devices simultaneously communicate with the cluster head node through an orthogonal channel, each node sends all model parameters to the cluster head node, and the cluster head node is responsible for aggregating all parameters; the inter-cluster training is a global model fusion process between the cluster head node and the edge server, adopts an asynchronous mechanism, and each cluster head node only fuses part of the parameters when performing inter-cluster fusion to preserve the personalized features.
[0089] (I) Intra-cluster training
[0090] The intra-cluster training adopts the traditional federated training FedAvg algorithm, and the training process includes three stages of global model distribution, local model training and global model fusion. However, the traditional federated training FedAvg algorithm is adjusted in part in this embodiment, that is: the local model of each terminal device needs to reach a predefined accuracy Then the local model can be uploaded to the cluster head node for aggregation.
[0091] Suppose there are I clusters in total, and the set of all cluster head nodes is denoted as , and take the i-th (i e [0, I]) cluster as an example, the set of all terminal devices contained in the i-th cluster is denoted as . Gradient descent method is adopted in local training, and the local iterative update formula is:
[0092] y h (l+1) = y h (l) + a▽G h (y h (l)) (4)
[0093] Among them, y h (l) represents the local model of the h-th terminal device, G h is the local loss function of the h-th terminal device, which satisfies L-Lipschitz continuity and η-strong convexity, l is the local iteration round indicator, α is the learning rate, ▽G h Represents the updated gradient. Since the gradient descent method is used, the local model can be obtained through convergence analysis to achieve the desired accuracy. The upper bound num on the number of iterations required h , num h satisfy:
[0094]
[0095] in, y0 is the local initial model of the terminal device, y * is the local optimal model of the terminal device, and L is the Lipschitz coefficient.
[0096] The upper bound of the number of iterations above is num h The satisfying conditions are derived as follows:
[0097] Since the function G(y) satisfies L-Lipschitz continuity, we can get:
[0098]
[0099] The local iterative update formula is:
[0100] y(l+1)=y(l)+α▽G(y(l)) (7)
[0101] Formula (6) can be further written as:
[0102]
[0103] Take the step length Formula (8) can be further written as:
[0104]
[0105] Since the function G(y) is strongly convex, we have:
[0106]
[0107] Substituting the local iteration formula in formula (7) into formula (10) yields:
[0108]
[0109] Take the step length Formula (11) can be further written as:
[0110]
[0111] Combining formula (9) and formula (12), we can get:
[0112]
[0113] Replace the left half of ||▽G(y l )|| 2 , we can get the relationship between the difference of the objective function of adjacent iterations as follows:
[0114]
[0115] After num h iterations, there are:
[0116]
[0117] Need to achieve The accuracy of the iteration process must be The error must satisfy:
[0118]
[0119] Therefore, the number of local iterations must satisfy:
[0120]
[0121] In this embodiment,
[0122] Therefore, the energy consumption of the hth terminal device for local iteration within the cluster is:
[0123]
[0124] Among them, β h represents the effective capacitance conversion efficiency of the terminal device h, C h Indicates the number of CPU cycles required to process one data sample, f h Indicates the CPU frequency of each device, D h is the local sample size.
[0125] Considering that all devices communicate with the cluster head simultaneously through orthogonal channels during cluster training, this chapter will use OFDMA technology to enable different devices to transmit local models on orthogonal channels. Therefore, the energy consumed by the hth device to transmit the cluster model to the cluster head node can be calculated as:
[0126]
[0127] Among them, P h is the transmission power of the hth device, s h is the size of the local model data. h Represents the achievable transmission rate of the communication link between the terminal device and the cluster head node. h The specific expression can be further expressed as:
[0128]
[0129] Among them, h h and b h Represent the channel gain and bandwidth from the hth terminal device to the cluster head node respectively. N0 is Gaussian white noise with a mean of 0. Once the terminal device completes the local iteration, it immediately sends the final model y h (num h ) is sent to the cluster head. Subsequently, the cluster head aggregates the models of all mobile devices in the cluster to form a global cluster model as follows:
[0130]
[0131] In this chapter, we assume that each cluster performs Γ rounds of intra-cluster training. After the intra-cluster training is completed, the cluster head continues to join the inter-cluster federated learning training. Therefore, the total energy consumption of the hth device in one round of intra-cluster training can be derived as:
[0132]
[0133] (2) Inter-cluster training
[0134] Inter-cluster training consists of two parts: first, in order to maintain the individual characteristics of all clusters, each cluster head node only considers partial parameter fusion during inter-cluster training; second, when cluster head parameters are fused at the edge server, an asynchronous fusion method is considered.
[0135] 1. Partial fusion:
[0136] In inter-cluster training, in order to preserve the individual characteristics of the model in each cluster, the edge server adopts a partial aggregation method, and the cluster head uploads part of the local model to the edge server. The hierarchical structure of the neural network makes this idea possible. More specifically, the neural network consists of an input layer, a hidden layer, and an output layer. Usually, different hidden layers have different functions. For example, for a classic convolutional neural network, the hidden layer consists of a convolutional layer, a BN layer, a maximum pooling layer, a fully connected layer, etc. According to previous research, it is very useful to keep the BN layer private but share other layers. Therefore, this embodiment uses x iThe cluster head node representing the ith cluster obtains the intra-cluster global model through intra-cluster aggregation, and represents it in the form of a functional layer of a neural network as:
[0137]
[0138] wherein θ represents a shared layer to be transmitted to the edge server for global aggregation, and the shared layer is updated according to the global aggregation model; ω represents a private layer, which is kept private by the cluster head and does not undergo global fusion.
[0139] To more clearly explain this principle, the present embodiment demonstrates a simple example containing two terminal devices and an edge server. Figure 5 In the example, each cluster head node uploads only part of the parameters to the parameter server for inter-cluster global fusion, and keeps the batch normalization (BN) layer as a private parameter. The BN layer is originally used to solve the problem of internal covariate shift when training a deep neural network. In addition, the statistical characteristics of the BN layer should be closely related to the label information of the local data of each terminal device, and can represent the characteristics of the local model parameters of the terminal device. Therefore, it is reasonable to keep the BN layer as a private layer to maintain individuality. That is, in the present embodiment, the BN layer is set as a private layer because they contain the statistical information of the model. Only the shared layers, such as the fully connected layer, the convolutional layer and the maximum pooling layer, are uploaded to the edge server for inter-cluster global fusion.
[0140] 2. Asynchronous fusion
[0141] Under the asynchronous fusion mode, each cluster head node immediately sends the local model to the edge server as soon as the intra-cluster training is completed, and the sending time between each device is not restricted, but the edge server only allows the model of one cluster head node to participate in each round of fusion. Therefore, the inter-cluster global model update formula is represented as:
[0142]
[0143] wherein t represents the global fusion round, z t is the global model at the edge server, z new is the model received by the edge server from the cluster head node for global fusion in the tth round of global fusion, and κ is the model fusion weight.
[0144] It is worth noting that, unlike synchronous fusion, asynchronous fusion only has the model of one cluster participating in each fusion.
[0145] Therefore, only one cluster head node exists communication energy consumption in each global iteration, and the energy consumption for device n is:
[0146]
[0147] where P n is the transmit power of device n, s n is the size of the local model data. R h represents the transmission rate that can be achieved by the communication link between the terminal device and the cluster head node. In addition, the embodiment uses an indicator to record the number of times each device participates in global iteration as a cluster head node, in order to calculate the energy consumption.
[0148] Based on the above intra-cluster training and inter-cluster training methods, the edge computing network is trained to realize the double-layer personalized federated edge learning, including the following steps:
[0149] S1: initializing a global model;
[0150] S2: for each cluster head node, downloading the global model parameters, and updating the shared layer parameters of the cluster head node based on the global model parameters, thereby updating the intra-cluster global model;
[0151] S3: downloading the latest parameters of the intra-cluster global model for all terminal device local models in the cluster corresponding to each cluster head node, and updating the terminal device local model parameters based on the parameters of the intra-cluster global model;
[0152] S4: based on the intra-cluster training, iteratively updating the terminal device local model parameters to obtain the trained terminal device local model and sending it to the cluster head node;
[0153] S5: the cluster head node performs intra-cluster aggregation, updates the intra-cluster global model, and sends the shared layer parameters in the intra-cluster global model to the edge server for asynchronous inter-cluster training;
[0154] S6: updating the global model.
[0155] For convenience, the layered personalized federated learning method proposed in the present application is referred to as AsynPFL algorithm, and the pseudo code thereof is shown in Table 1.
[0156] Table 1 Pseudo code of AsynPFL algorithm
[0157]
[0158] This part analyzes the convergence of the layered personalized federated learning.
[0159] First, consider the convergence analysis of intra-cluster training. Since the same gradient descent algorithm is used in each cluster, the mathematical symbol ignores the identifier of the cluster. Let G(y h,l ) be the loss function of terminal device h at the lth local iteration, and G(y * ) be the loss function of the intra-cluster iteration optimal point. Moreover, G(yh,l ) is L-Lipschitz smooth and η-strongly convex. Then,
[0160]
[0161] Since for any y, we have Equation (26) can be further written as:
[0162]
[0163] After I h local iterations at terminal device h, we have We can get:
[0164]
[0165] Since and
[0166]
[0167] After I h local iterations at terminal device h, we have
[0168]
[0169] Therefore,
[0170]
[0171] Substituting the result in equation (29) into equation (31), we have:
[0172]
[0173] Since the final goal of intra-cluster iteration and inter-cluster iteration is the same, we have * = y * We can further derive:
[0174]
[0175] Where A can be further derived:
[0176]
[0177] Combining equations (33) and (34), we have:
[0178]
[0179] To evaluate the performance of the proposed asynchronous hierarchical personalized federated learning method (AsynPFL) in solving user heterogeneity and adaptability to network resource constraints, the embodiment performs experiments in a simulation environment of Python 3.0, based on a server with 4 GeForce GTX 2080Ti GPUs, 48 Intel Xeon CPUs and 128GB of memory, and uses the PyTorch framework for all experiments. Specifically, the embodiment simulates an edge computing environment with multiple users (i.e., terminal devices) and an edge server, and these users all have local data sets and perform local model training based on these data sets. As shown in Table 1, the performance improvement of the embodiment's experiment process mainly uses three real data sets (CIFAR-10, MNIST and Office-Home) and three synthetic data sets (Synthetic-iid, Synthetic(0.5, 0.5) and Synthetic(1, 1)) on three models, including a 2-layer CNN, a VGGNet and a ResNet. For specific data set division, see Table 2.
[0180] CIFAR-10 data set: This data set contains 10 classes of color images, with a total of 60,000. Of these, 50,000 are used for training and 10,000 are used for testing. Each color image has a size of 32*32. In addition, the embodiment trains a CNN model on this data set.
[0181] MNIST data set: MNIST is a data set containing 70,000 handwritten digital images. Of these, 60,000 are used for training and 10,000 are used for testing.
[0182] Office-Home data set: Contains 15,500 images, divided into four different domains: Artistic images (Ar), Clip Art images (Cl), Product images (Pr) and Real-World images (Rw). Each domain has 65 identical object classes, but different backgrounds.
[0183] Synthetic data set: The embodiment uses Synthetic-iid, Synthetic(0.5, 0.5) and Synthetic(1, 1) to depict the training performance that can be achieved by different algorithms under different statistical heterogeneity. The degree of data distribution heterogeneity between users is: Synthetic(1, 1)> Synthetic(0.5, 0.5)> Synthetic-iid.
[0184] Table 2 Simulation settings for different data sets
[0185]
[0186] In addition, the embodiments will take FedAvg, K-Cluster and DistFL as reference algorithms for performance comparison.
[0187] FedAvg is the earliest federated learning training scheme, which realizes efficient communication by introducing local training and iteration mechanism.
[0188] K-Cluster aims to cluster the uploaded model based on the loss value of each client.
[0189] DistFL extracts and compares distribution knowledge from the uploaded model to realize clustering, which can realize automatic and accurate distributed perception in an economical and efficient way.
[0190] Based on the above experimental settings, the embodiments first analyze the performance in the class imbalance scenario.
[0191] In this scenario, different clients may hold different classes according to user preferences. For example, one client may have many "dog" images, while another client prefers to collect "cat" images. CIFAR-10 and MNIST datasets are used to simulate this situation. The CIFAR-10 dataset contains 10 different image categories, and the MNIST dataset contains handwritten digits from 0 to 9. Considering that the data that the clients may have is limited, only part of the samples in the dataset are selected to participate in model training and testing, and are distributed to 100 clients, of which every 20 clients belong to the same group distribution. Therefore, the embodiments have a total of 5 different types of distribution, each of which contains two unrelated categories. In this scenario, the embodiments use the VGG-11 model, and the experimental results are shown in Table 3. Table 3 shows that under the same time constraint and energy constraint, the test performance of the AsynPFL algorithm proposed in the embodiments is better than that of FedAvg, K-Cluster and DistFL algorithms on the MNIST and CIFAR-10 datasets. Each result in the table is the average value of the test accuracy on this group of data. This is because in the experimental settings of this experiment, devices that run out of energy during training are withdrawn from training, which will cause the test performance to be unable to further improve. In addition, when the training time reaches the preset value, all devices immediately stop training. The results in Table 3 also show that the AsynPFL algorithm proposed in the embodiments considers both distribution and resource similarity when clustering, which improves the model training performance.
[0192] Table 3 Model accuracy of different algorithms in the class imbalance scenario (same energy constraint)
[0193]
[0194] Secondly, the statistical heterogeneity adaptability analysis is performed in this embodiment.
[0195] Figure 6 The performance comparison of different algorithms on different distribution data sets, i.e., different statistical heterogeneity, is given. In addition, to exclude the influence of other factors, all users in this experiment have the same energy constraint. Among them, the diagonal column represents FedAvg, the solid color column represents K-Cluster, the lattice column represents DistFL, and the spot column represents AsynPFL. It is worth emphasizing that the degree of heterogeneity of data distribution among users is: Synthetic(1, 1)> Synthetic(0.5, 0.5)> Synthetic-iid. It can be seen that on the Synthetic-iid data set, i.e., the data distribution among users obeys independent and identical distribution, the accuracy of FedAvg is the best, and the effect is the best. This is because when the data among users obeys independent and identical distribution, the clustering process in K-Cluster, DistFL and AsynPFL algorithms is actually redundant, which consumes more energy and affects the performance of the algorithm. With the increase of statistical heterogeneity, the accuracy of FedAvg decreases sharply, K-Cluster decreases partially, and DistFL and AsynPFL remain stable. This represents that the traditional FL algorithm which aims to obtain a general model is not suitable for the adaptability of large statistical heterogeneity. In addition, the clustering mechanism based on loss value adopted by K-Cluster is not as good as the distribution-aware clustering mechanism adopted by DistFL and AsynPFL.
[0196] Next, the system heterogeneity adaptability analysis is performed in this embodiment.
[0197] Figure 7 The system heterogeneity adaptability analysis of FedAvg, K-Cluster, DistFL and AsynPFL algorithm proposed in this chapter is given. In this embodiment, the system heterogeneity is represented by the variance of computing power of all users. The value of computing power variance is 0, which represents that all users have the same computing power and there is no difference. The larger the computing power variance value, the greater the system heterogeneity among users. In order to exclude the influence of statistical heterogeneity, this experiment uses independent and identically distributed synthetic data Synthetic-iid for model training. In addition, the energy values of all users are also set to be the same, so as to exclude the influence of energy constraint on the training performance.
[0198] As Figure 7As shown, the square-marked line represents FedAvg, the triangle-marked line represents K-Cluster, the circle-marked line represents DistFL, and the diamond-marked line represents AsynPFL. Overall, the achievable test accuracy of all algorithms decreases as the variance value increases. This is because the greater the variance value, the greater the energy consumption and time gap required for different users to complete local training, the more users drop out of training early, the fewer training samples, and the lower the accuracy of the model. However, FedAvg, K-Cluster, and DistFL decrease sharply, and DistFL only decreases slightly, because the clustering algorithm used by DistFL includes the resource similarity index and uses an asynchronous global fusion method. In this way, DistFL can group users according to their computing capabilities during training, thereby maximizing the number of users participating in the entire training process and increasing the adaptability of the global model to data.
[0199] Finally, the influence of energy constraints on model performance is explored.
[0200] Figure 8 The influence of energy constraints on the accuracy of models obtained by FedAvg, K-Cluster, DistFL, and AsynPFL algorithms is given. In this experiment, the data set used is the synthetic data set Synthetic(0.5, 0.5). As can be seen from the figure, as the energy constraint increases, the accuracy of the models of all algorithms shows an upward trend, and the upward trend gradually slows down. This shows that better performance cannot be achieved by infinitely increasing the energy constraint. In addition, except for the initial point, the performance of the AsynPFL algorithm is always better than the other three algorithms under other energy constraints. This is because the clustering mechanism of AsynPFL not only focuses on the distribution difference between users, but also considers the factor of user remaining energy. Although all algorithms use the same initial energy constraint, the energy consumption of each user at each global iteration is different, resulting in different remaining energies. AsynPFL has better adaptability to this phenomenon. In addition, the FedAvg algorithm performs best at the initial point, which may be because the clustering process of K-Cluster, DistFL, and AsynPFL has certain energy consumption, which affects the total energy used in the training process. In particular, when the total energy is small, the impact is greater. As the energy constraint gradually increases, the advantages of the clustering mechanisms of the other three algorithms gradually emerge, achieving better performance.
[0201] In summary, the application studies a new personalized perception hierarchical federated edge learning training framework, which considers the trade-off between personalization and generalization in the federated edge learning training process, and clusters all terminal devices according to a weighted index composed of distribution and resource similarity, forming a two-layer hierarchical federated edge learning architecture, and proposes a clustering mechanism based on distribution and resource similarity weighted measurement to assist the federated edge learning training process. In order to balance the training speed of different clusters, synchronous and asynchronous aggregation mechanisms are used for intra-cluster fusion and inter-cluster aggregation respectively. In theory, this framework can alleviate the negative effects of terminal device heterogeneity and improve training performance. In addition, the convergence of the training process is theoretically proved. Simulation experiments compare the performance of the proposed algorithm AsynPFL with FedAvg, K-Cluster and DistFL in terms of class imbalance, statistical heterogeneity, system heterogeneity and energy constraints. The experimental results prove that the performance of the proposed algorithm AsynPFL is the best, and it has better adaptability to different heterogeneous environments.
[0202] The above functions, if realized in the form of software function units and sold or used as independent products, can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the application or the part of the prior art that essentially contributes or the part of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium and includes instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various program code storage media.
[0203] The above detailed the preferred embodiments of the application. It should be understood that those skilled in the art can make many modifications and changes without creative labor according to the concept of the application. Therefore, any technical solution obtained by logical analysis, reasoning or limited experiment by those skilled in the art on the basis of the prior art according to the concept of the application shall be within the protection scope determined by the claims.
Claims
1. A hierarchical personalized federated learning method in an edge computing network, characterized in that: The following steps are involved: The edge computing network is divided into two layers. The first layer is the terminal device layer, which includes multiple clusters formed by multiple terminal devices. The second layer is the edge cloud layer, where the cluster head nodes of each cluster communicate with the edge server. Determine the terminal devices to be communicated in the edge computing network; Clustering terminal devices based on distribution similarity and resource similarity weighted metrics; The edge computing network is trained to implement two-layer personalized federated edge learning. The training process includes intra-cluster training and inter-cluster training. Intra-cluster training uses a synchronous mechanism. All terminal devices communicate with the cluster head node simultaneously through orthogonal channels. Each node sends all model parameters to the cluster head node, which is responsible for aggregating all parameters. Inter-cluster training is a global model fusion process between the cluster head node and the edge server. It uses an asynchronous mechanism. Each cluster head node only fuses some parameters during inter-cluster fusion to retain personalized features. The generation process of distribution similarity includes three steps: distribution information generation, probability distribution generation and distribution similarity matrix calculation. Distribution information generation: The local models uploaded by the terminal devices are integrated into a global model, which is stored in the edge server as a pre-trained model. Noise is input into the pre-trained model, and distribution information of similar data is output. Probability distribution generation: The distribution information is input into all local models to generate the probability distribution vector of each local model. Each terminal device corresponds to one probability distribution vector. Distribution similarity matrix calculation: Based on the probability distribution vector, KL divergence is used to calculate the distance between the terminal devices. and Represents terminal devices With terminal equipment Probability distribution vector of local model, terminal device Local model and terminal device The KL divergence between the local models is: By calculating the KL divergence between the local models of each terminal device, a size of Distribution similarity matrix ,in, N is the number of terminal devices, Indicates terminal device With terminal equipment The distribution similarity between local models, The smaller the value, the better the terminal device With terminal equipment The greater the similarity between local models; The resource similarity is composed of the computing power and residual energy similarity of the terminal devices. For each device, a state vector is used to represent its attributes. The state vector of , there are two elements in the state vector and , Represents the computing power of the device, Represents the remaining energy value of the device; cosine similarity is used to calculate the resource similarity between terminal devices: By calculating the cosine similarity between the local models of each terminal device, we can get a Resource Similarity Matrix ,in, N is the number of terminal devices, Indicates terminal device With terminal equipment Resource similarity between local models, The smaller the value, the better the terminal device With terminal equipment The greater the similarity between local models.
2. A hierarchical personalized federated learning method in an edge computing network according to claim 1, characterized in that: The clustering of terminal devices based on the weighted measurement of distribution similarity and resource similarity is specifically as follows: according to the distribution similarity matrix and resource similarity matrix , weighting the two to obtain the decision factor of the clustering mechanism of hierarchical personalized federated learning, that is, the similarity between terminal devices SM : in, is the weight of distribution similarity, is the weight of resource similarity, and ; Indicates terminal device With terminal equipment The similarity between local models, the smaller the value, the higher the similarity; Based on the similarity between each terminal device SM The similarity matrix is constructed by setting a threshold , that is, limiting the similarity difference between terminal devices in the same cluster, determining the number of clusters and the models in each cluster, and realizing clustering.
3. The hierarchical personalized federated learning method in an edge computing network according to claim 1, characterized in that: The cluster training adopts the traditional federated training FedAvg algorithm. The training process includes three stages: global model distribution, local model training and global model fusion. The local model of each terminal device reaches the predefined accuracy. When , the local model is uploaded to the cluster head node for aggregation; assuming that there are clusters, and use Represents the set of all cluster head nodes, with ( ) clusters as an example, using Indicates the The set of all devices contained in a cluster uses the gradient descent method in local training, and the local iterative update formula is: in, Representative local model of each terminal device, , It is The local loss function of the terminal device satisfies -Lipschitz continuous and -strong convexity, is the local iteration round indicator, is the learning rate, Represents the updated gradient; the local model achieves accuracy through convergence analysis Upper bound on the number of iterations required , satisfy: in, , , is the local initial model of the terminal device, is the local optimal model of the terminal device, is the Lipschitz coefficient.
4. The hierarchical personalized federated learning method in an edge computing network according to claim 1, characterized in that: In the inter-cluster training, in order to retain the individual characteristics of the model in each cluster, the edge server adopts a partial aggregation method, and the cluster head uploads part of the local model to the edge server. Specifically, Indicates the The cluster head node of each cluster obtains the global model within the cluster through cluster aggregation, and expresses it in the form of a neural network functional layer as follows: in, Represents the shared layer that will be transmitted to the edge server for global aggregation. The shared layer is updated according to the global aggregation model; It represents the private layer, which is kept private by the cluster head and not globally integrated.
5. The hierarchical personalized federated learning method in an edge computing network according to claim 1, characterized in that: The inter-cluster training adopts an asynchronous fusion method. Once each cluster head node completes the intra-cluster training, it immediately sends the local model to the edge server. The transmission time between devices is not restricted. However, the edge server only allows the model of one cluster head node to participate in each round of fusion. The inter-cluster global model update formula is expressed as: in, represents the global fusion round, is the global model at the edge server, It is The model that the global fusion edge server receives from the cluster head node and uses for global fusion, is the model fusion weight.
6. The hierarchical personalized federated learning method in an edge computing network according to claim 1, characterized in that: Training the edge computing network to implement two-layer personalized federated edge learning includes the following steps: S1: Initialize the global model; S2: For each cluster head node, download the global model parameters and update the shared layer parameters of the cluster head node based on the global model parameters, thereby updating the global model within the cluster; S3: Each cluster head node corresponds to the local models of all terminal devices in the cluster, downloads the latest parameters of the global model in the cluster, and updates the local model parameters of the terminal devices based on the parameters of the global model in the cluster; S4: Iterate the local model parameters of the terminal device based on the in-cluster training, obtain the trained local model of the terminal device and send it to the cluster head node; S5: The cluster head node performs intra-cluster aggregation, updates the intra-cluster global model, and sends the shared layer parameters in the intra-cluster global model to the edge server for asynchronous inter-cluster training. S6: Update the global model.
7. A hierarchical personalized federated learning device in an edge computing network, used to implement the method according to any one of claims 1 to 6, characterized in that: include: The edge computing network construction module divides the edge computing network into two layers. The first layer is the terminal device layer, which includes multiple clusters formed by multiple terminal devices. The second layer is the edge cloud layer, where the cluster head nodes of each cluster communicate with the edge server. A terminal device determination module is used to determine the terminal device to be communicated in the edge computing network; A terminal device clustering module is used to cluster terminal devices based on weighted metrics of distribution similarity and resource similarity; The training module is used to train the edge computing network and realize two-layer personalized federated edge learning. The training process includes intra-cluster training and inter-cluster training. The intra-cluster training adopts a synchronous mechanism. All terminal devices communicate with the cluster head node simultaneously through orthogonal channels. Each node sends all model parameters to the cluster head node, and the cluster head node is responsible for aggregating all parameters. Inter-cluster training is a global model fusion process between the cluster head node and the edge server. It adopts an asynchronous mechanism, and each cluster head node only fuses some parameters during inter-cluster fusion to retain personalized features.
8. A hierarchical personalized federated learning device in an edge computing network, comprising a memory, a processor, and a program stored in the memory, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
9. A storage medium having a program stored thereon, characterized in that: When the program is executed, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Federated learning communication optimization method and system based on computing resource logic layering
CN113919512A
Cluster federal learning method based on coalition game
CN115118591A