A semi-asynchronous hierarchical federated learning update method based on timeliness

By adopting semi-asynchronous layered federated learning method in the three-layer network structure of cloud edge terminals, the security risks and delay problems of cloud computing centers are solved, the training efficiency of heterogeneous devices is improved, and personalized services of heterogeneous devices are realized. Efficient data sharing.

CN113988160BActive Publication Date: 2024-11-26WUHAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111202121.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-15
Publication Date
2024-11-26
Estimated Expiration
2041-10-15

AI Technical Summary

Technical Problem

In the prior art, data transmission in cloud computing centers poses security risks, high latency and are unfavorable to real-time decision-making applications. Traditional federated learning methods are not time-efficient in heterogeneous device environments, resulting in waste of resources and low training efficiency.

Method used

Using a semi-asynchronous hierarchical federated learning method based on timeliness, the three-layer network structure of cloud-edge terminals is designed to design data importance and delay device selection methods to realize personalized services of heterogeneous devices, and the layered network architecture and semi-asynchronous Model aggregation method, optimize the communication process between edge nodes and cloud nodes.

Benefits of technology

It improves the service performance of heterogeneous networks, saves equipment training time, provides efficient model training methods, and realizes friendly data sharing and win-win results of heterogeneous devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113988160B_ABST
    Figure CN113988160B_ABST
Patent Text Reader

Abstract

The present invention provides a semi-asynchronous hierarchical federated learning update method based on timeliness, which includes a hierarchical communication architecture for solving data sharing of multiple heterogeneous devices, and realizing heterogeneous connection of a large number of devices; secondly, a semi-asynchronous hierarchical federated learning update method is proposed to realize synchronous and semi-asynchronous model updates under network layering, realize the rational use of computing and communication resources of heterogeneous devices, and ensure the reliability of the federated learning network; finally, in view of the heterogeneity of heterogeneous device data, in order to provide more personalized network services for classified devices, we propose an edge update method to realize model personalized services. Compared with the existing federated learning methods, the semi-asynchronous hierarchical federated learning method based on timeliness proposed by the present invention can better improve the communication and computing performance of heterogeneous networks, and provide a more intelligent distributed learning method for future mobile networks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of mobile Internet technology, and in particular relates to a semi-asynchronous hierarchical federated learning update method based on timeliness. Background Art

[0002] In recent years, there have been nearly 7 billion connected IoT devices and 3 billion smartphones in the world. These devices are equipped with increasingly advanced sensors, computing, and communication capabilities. As a result, they have the potential to be deployed for a variety of crowd sensing tasks, such as for medical purposes and air quality monitoring. With the rise of deep learning, the large amount of data collected by terminal devices has opened up countless possibilities for meaningful research and applications. In the traditional cloud-centric approach, data collected by mobile devices is uploaded and centrally processed in cloud-based servers or data centers. In particular, data collected by IoT devices and smartphones, such as measurements, photos, videos, and location information, are aggregated in data centers. Thereafter, the data is used to provide insights or generate effective inference models. However, this approach leads to the following problems. First, due to the large amount of raw data transmission problems in traditional cloud computing, this large-scale data transmission technology has become increasingly unsafe as countries have gradually begun to provide legislative protection for data privacy. Second, cloud-centric computing methods involve long propagation delays, which can lead to unacceptable delays for applications that must make real-time decisions (such as in autonomous vehicle systems), so cloud computing cannot provide sufficient services for tasks that require low latency. Finally, cloud-centric training is relatively dependent on wireless communications. Transmitting data to the cloud for processing will burden the backbone network, especially in tasks involving unstructured data, such as video analysis tasks. When there is a large amount of data to be transmitted, it will bring a bad communication experience to other users. Therefore, more advanced computing technologies are needed to meet the data processing and analysis problems in the big data era.

[0003] Since today’s data sources are mainly located outside the cloud, mobile edge computing has naturally been proposed as a solution, where the computing and storage capabilities of end devices and edge servers are leveraged to bring model training closer to where the data is generated. However, computation offloading and data processing by edge servers still involves the transmission of potentially sensitive personal data. This prevents privacy-sensitive users from participating in model training and even violates increasingly stringent privacy laws. Recently, in light of increasingly stringent data privacy legislation and growing privacy concerns, the concept of federated learning has been introduced. In federated learning training, end devices use their local data to train the machine learning model required by the server, and then the end devices send the model updates instead of the original data to the server for aggregation. Federated learning can serve as an enabling technology in mobile edge networks because it supports collaborative training of machine learning models and also supports deep learning for mobile edge network optimization. In traditional federated learning methods, synchronous update methods are used. In each round of communication, the training model will be sent to the cloud server after the slowest edge device is trained. However, in large-scale and complex mobile edge networks, due to the presence of a large number of heterogeneous devices, the computing power and communication levels of these devices are very heterogeneous. Therefore, there will be obvious differences in computing power among edge devices, which will have an impact on the timeliness of federated learning training. Many devices with strong computing power cannot bring obvious learning effects from federated learning technology within a certain period of time. Therefore, under the condition of resource constraints, a new update method that can improve the timeliness of federated learning is urgently needed. Summary of the invention

[0004] In order to solve the above technical problems, the present invention proposes a hierarchical semi-asynchronous federated learning method based on the three-layer network structure of cloud-edge-terminal from the perspective of heterogeneous network stratification and edge node selection, realizing synchronous learning between edge and terminal and semi-asynchronous learning between cloud and edge. In semi-asynchronous learning, a device selection method based on data importance and latency is designed to ensure the accuracy of network learning under limited resources. In addition, in order to ensure the personalized needs of edge nodes, an edge elastic update method is designed to realize personalized services for heterogeneous devices and maximize the service performance of heterogeneous networks.

[0005] The technical solution adopted by the present invention provides a semi-asynchronous hierarchical federated learning method based on timeliness, comprising the following steps:

[0006] Step 1: Build a hierarchical network architecture, which includes: cloud nodes, K edge nodes and K*N terminal devices, where the cloud nodes are connected to the K edge nodes in sequence, and each edge node will also be connected to N terminal devices of the same type in sequence;

[0007] Step 2: Based on the above hierarchical network architecture, a corresponding federated learning method is proposed to realize data sharing applications of heterogeneous devices;

[0008] Step 3, after completing the edge node training model weight aggregation task through the cloud node in step 2, the cloud node training model weight described in step 2 and the model weight of the selected edge node k described in step 2 are used to perform model gap calculation to obtain a personalized edge model corresponding to the edge node k, wherein the unselected edge node will perform this process when it is selected;

[0009] Preferably, the step 2 is as follows:

[0010] Step 2.1: This step will build the loss function model in federated learning, and use the stochastic gradient descent method to train the corresponding model to obtain the optimized model weight value, and further calculate the computing time and model gradient value of the terminal device;

[0011] The terminal device set connected to each edge node k is

[0012] The loss function model F of the local device n connected to the edge device k in the federated learning k,n (w k,n ) is expressed as:

[0013]

[0014] Among them, f k,n (x j,k,n ,y j,k,n ,w k,n ) is the loss function of the local device n connected to the edge device k, and the linear regression model expression of the loss function is In addition, w k,n is the weight value of the training model for the local device n connected to the edge device k, and D k,n ={(x j,k,n ,y j,k,n ):j=1,...,|D k,n |} represents the data set stored in the terminal device n connected to the edge node k, |D k,n | represents the size of the data set, x j,k,n represents the jth input sample of the local device n data connected to the edge device k, y j,k,n Represents the output samples associated with the local device n to which the edge device k is connected.

[0015] The corresponding model training by stochastic gradient descent method is as follows:

[0016]

[0017] Among them, t represents the tth iteration process during local training, and η represents the learning efficiency during the training process;

[0018] After a certain number of iterations, the corresponding model training is performed using the stochastic gradient descent method to obtain the optimized training weights of the terminal device n connected to the edge node k.

[0019] Let C k,n The number of CPU cycles required to calculate a data sample for terminal device n connected to edge node k. The calculation time of terminal device n connected to edge node k is expressed as The superscript c indicates the computational meaning:

[0020]

[0021] Among them, |D k,n | represents the size of the data set of terminal device n connected to edge node k, f k,n Represents the computing power of the terminal device n connected to the edge node k.

[0022] Combined with the optimized training weights of the terminal device n connected to the edge node k, the terminal model gradient value g of the terminal device n connected to the edge node k is obtained. k,n for:

[0023]

[0024] Step 2.2, define the transmission model from the terminal device to the edge node connected to it, calculate the transmission rate of the terminal device uploading to the associated edge node, calculate the downlink broadcast rate from the edge node k to the terminal device n connected to it, calculate the uplink transmission time from the terminal device n to the edge node k, calculate the downlink propagation time from the edge node k to the terminal device n, and construct the model aggregation model at the edge node;

[0025] The transmission model defined from the terminal device to the edge node connected to it is:

[0026] First, we define the transmission model from terminal device n to its connected edge node k. Let B k,n is the bandwidth allocated to the terminal device n connected to the edge node k, and the sum of the bandwidths of the edge node k is B k Expressed as

[0027] The transmission rate of the computing terminal device uploading to the associated edge node is:

[0028] The transmission rate from terminal device n to the associated edge node k is:

[0029]

[0030] in represents the upload transmission rate of terminal device n connected to edge node k, P k,n represents the transmission power of terminal device n connected to edge node k, g k,n represents the channel gain of terminal device n connected to edge node k, and N0 represents the noise energy.

[0031] The downlink broadcast rate from edge node k to terminal device n connected to it is calculated as:

[0032] The downlink broadcast rate from edge node k to the terminal device n connected to it is:

[0033]

[0034] in represents the downlink broadcast rate of terminal device n connected to edge node k, P k is the transmission power of edge node k.

[0035] The uplink transmission time from terminal device n to edge node k is calculated as:

[0036] Define the model size as Z, the uplink transmission time from terminal device n to edge node k It can be expressed as, where the superscript u means upload:

[0037]

[0038] The downlink propagation time from edge node k to terminal device n is calculated as:

[0039] Downlink propagation time from edge node k to terminal device n It can be expressed as, where the superscript d indicates the broadcast meaning:

[0040]

[0041] The model aggregation model for constructing the edge node is:

[0042] In the federated learning communication process between the edge node k and the terminal device n connected to it, since the terminal devices connected to each edge node are defined as the same type, the terminal devices of the same type will have similar data computing capabilities and signal transmission capabilities. Therefore, a synchronous aggregation method can be used in the edge node aggregation process of federated learning. In the traditional synchronous aggregation process, due to the heterogeneous types of terminal devices connected to the central node, the central node needs to wait for the slowest terminal device to complete local calculations before it can aggregate the model, which will result in a lot of training time waste. In this design, due to the existence of a hierarchical structure, devices of the same type are connected to the same edge node. The use of a synchronous aggregation method will minimize resource waste while ensuring model accuracy. Therefore, the model weight at the edge node k The aggregation method can be expressed as:

[0043]

[0044] Where |D k | represents the set of all terminal devices connected to edge node k The overall time delay during the communication between the edge node and the terminal device It can be expressed as, where the superscript edge represents an edge node:

[0045]

[0046] Step 2.3, calculate the data transmission rate from edge node k to cloud node, calculate the broadcast data transmission rate between cloud node and edge node k, calculate the upload and broadcast time of communication between cloud node and edge node k respectively, calculate the overall time delay in the communication process between cloud node and edge node, and construct a semi-asynchronous model aggregation model;

[0047] The data transmission rate from the computing edge node k to the cloud node is:

[0048] Data transmission rate from edge node k to cloud node It can be expressed as, where the superscript u means upload:

[0049]

[0050] Among them B c,k is the transmission bandwidth between edge node k and cloud node, P c,k is the transmission energy of the edge node k for uploading communication, g c,k is the channel gain between the cloud node and the edge node k;

[0051] The broadcast data transmission rate between the computing cloud node and the edge node k is:

[0052] The broadcast data transmission rate between cloud node and edge node k is It can be expressed as, where the superscript d indicates the broadcast meaning:

[0053]

[0054] Among them B c represents the sum of the bandwidth when the cloud node communicates with the edge node, P c Transmitting energy to cloud nodes

[0055] The upload and broadcast time of the cloud node and edge node k are calculated as follows:

[0056] Upload time of communication between cloud node and edge node k and broadcast time They can be expressed as,, where the superscript u means uploading, and the superscript d means broadcasting:

[0057]

[0058]

[0059] The overall time delay during the communication between the computing cloud node and the edge node is:

[0060] The overall time delay during the communication between cloud nodes and edge nodes Where cloud represents the cloud node:

[0061]

[0062] The semi-asynchronous model aggregation model is constructed as follows:

[0063] During the communication between edge nodes and cloud nodes, different edge nodes are connected to different terminal devices.

[0064] There is a great deal of heterogeneity in local datasets, and their model update cycles are also different. If a synchronous aggregation model is used, the greater delay of nodes with faster training time is unacceptable. On the contrary, although the delay of each round of the asynchronous method is shorter, it requires several times the number of training rounds of the synchronous method. Therefore, it is extremely necessary to design a semi-asynchronous communication method to solve the problem of device resource waste. Assume that in each round of communication between the cloud node and the edge node, the cloud node will select some edge nodes to participate in the model aggregation task. Let the selected device dataset be Therefore, the weight aggregation method of the semi-asynchronous model can be expressed as:

[0065]

[0066] where w cTrain the model weights for the latest cloud nodes, and Train the model weights for the last cloud node.

[0067] Step 2.4, calculating the data importance σ of the terminal device n connected to the edge node k according to the terminal model gradient value of the terminal device n connected to the edge node k in step 2.1 k,n , calculate the data importance σ of edge node k k , combined with the overall time delay during the communication between the edge node and the terminal device The overall time delay during the communication between cloud nodes and edge nodes Calculate the total time delay of edge node k and construct whether the edge node selects the optimization target;

[0068] The data importance σ of the terminal device n connected to the edge node k is calculated according to the terminal model gradient value of the terminal device n connected to the edge node k in step 2.1. k,n for:

[0069]

[0070] Among them, |||| represents the L2 norm, g k,n Represents the terminal model gradient value of the terminal device n connected to the edge node k;

[0071] Further calculate the data importance σ of edge node k k for:

[0072]

[0073] in, Represents the number of terminal devices connected to each edge node k.

[0074] The total time delay for calculating edge node k is expressed as:

[0075]

[0076] in, is the overall time delay during the communication between the edge node and the terminal device, It is the overall time delay during the communication between cloud nodes and edge nodes;

[0077] Whether the edge node selects the optimization target as:

[0078]

[0079] Among them, ρ represents a weight balance parameter that determines the distribution ratio of data importance and time delay in the optimization problem, and α k Represents whether the edge node k is selected;

[0080] The alternating selection optimization method is used to solve the above problem to perform the edge node selection task. After completing the edge node selection task, the α of the selected node is k The value is 1, the α of the node is not selected. k The value is 0;

[0081] Preferably, the step 3 is as follows:

[0082] Assume that the model weight distance can represent the gap between the weights of two models, specifically:

[0083]

[0084] Among them, w c Train the model weights for the cloud nodes, w k is the model weight of edge node k;

[0085] Deep learning neural networks are generally composed of multiple layers of networks and each layer of the neural network has different weights; suppose a neural network is composed of

[0086] The difference ε between the cloud node training model weight and the edge node k model weight is expressed as:

[0087]

[0088] in, Representation model composition For different network layers in , the model weight personalization can be expressed as:

[0089] w k ←εw c +(1-ε)w k

[0090] The proposed personalized model service can provide more personalized network services to classification devices in response to the heterogeneity of heterogeneous device data and complete the training tasks corresponding to different devices.

[0091] Compared with the prior art, the beneficial effects of the present invention are as follows: in view of the problem that the existing synchronous federated learning update method has low timeliness, the present invention proposes a federated learning method based on a semi-asynchronous update method, and proposes a hierarchical network structure to solve the problem of network heterogeneity. In addition, a personalized model update method is proposed to provide more suitable machine learning services for heterogeneous devices. Compared with the existing federated learning methods, the semi-asynchronous federated learning update method based on timeliness proposed in the present invention can effectively improve the performance of heterogeneous networks, save device training time, and provide an efficient model training method. The present invention also fully considers the data heterogeneity of heterogeneous devices, provides each device with a network model suitable for its own training data, and realizes friendly data sharing and win-win results in heterogeneous networks. BRIEF DESCRIPTION OF THE DRAWINGS

[0092] Figure 1 : is a flow chart of an embodiment of the present invention. DETAILED DESCRIPTION

[0093] In order to facilitate ordinary technicians in the field to understand and implement the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the implementation examples described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0094] Please see Figure 1 The present invention provides a semi-asynchronous hierarchical federated learning update method based on timeliness. The method provided in the embodiment includes the following steps.

[0095] Step 1: Build a hierarchical network architecture, which includes: cloud nodes, K=10 edge nodes and K*N terminal devices, where the cloud nodes are connected to the K edge nodes in sequence, and each edge node will also be connected to N=10 terminal devices of the same type in sequence;

[0096] Step 2: Based on the above hierarchical network architecture, a corresponding federated learning method is proposed to realize data sharing applications of heterogeneous devices.

[0097] Step 2.1: This step will build the loss function model in federated learning, and use the stochastic gradient descent method to train the corresponding model to obtain the optimized model weight value, and further calculate the computing time and model gradient value of the terminal device;

[0098] The terminal device set connected to each edge node k is

[0099] The loss function model F of the local device n connected to the edge device k in the federated learning k,n (w k,n ) is expressed as:

[0100]

[0101] Among them, f k,n (x j,k,n ,y j,k,n ,w k,n ) is the loss function of the local device n connected to the edge device k, and the linear regression model expression of the loss function is In addition, w k,n is the weight value of the training model for the local device n connected to the edge device k, and D k,n ={(x j,k,n ,y j,k,n ):j=1,...,|D k,n |} represents the data set stored in the terminal device n connected to the edge node k, |D k,n | represents the size of the data set, x j,k,n represents the jth input sample of the local device n data connected to the edge device k, y j,k,n Represents the output samples associated with the local device n to which the edge device k is connected.

[0102] The corresponding model training by stochastic gradient descent method is as follows:

[0103]

[0104] Where t represents the tth iteration process during local training, and η = 0.001 represents the learning efficiency during the training process;

[0105] After a certain number of iterations, the corresponding model training is performed using the stochastic gradient descent method to obtain the optimized training weights of the terminal device n connected to the edge node k.

[0106] Let C k,n The number of CPU cycles required to calculate a data sample for terminal device n connected to edge node k. The calculation time of terminal device n connected to edge node k is expressed as The superscript c indicates the computational meaning:

[0107]

[0108] Among them, |D k,n | represents the size of the data set of terminal device n connected to edge node k, f k,n Represents the computing power of the terminal device n connected to the edge node k.

[0109] Combined with the optimized training weights of the terminal device n connected to the edge node k, the terminal model gradient value g of the terminal device n connected to the edge node k is obtained.k,n for:

[0110]

[0111] Step 2.2, define the transmission model from the terminal device to the edge node connected to it, calculate the transmission rate of the terminal device uploading to the associated edge node, calculate the downlink broadcast rate from the edge node k to the terminal device n connected to it, calculate the uplink transmission time from the terminal device n to the edge node k, calculate the downlink propagation time from the edge node k to the terminal device n, and construct the model aggregation model at the edge node;

[0112] The transmission model defined from the terminal device to the edge node connected to it is:

[0113] First, we define the transmission model from terminal device n to its connected edge node k. Let B k,n is the bandwidth allocated to the terminal device n connected to the edge node k, and the sum of the bandwidths of the edge node k is B k Expressed as

[0114] The transmission rate of the computing terminal device uploading to the associated edge node is:

[0115] The transmission rate from terminal device n to the associated edge node k is:

[0116]

[0117] in represents the upload transmission rate of terminal device n connected to edge node k, P k,n represents the transmission power of terminal device n connected to edge node k, g k,n represents the channel gain of terminal device n connected to edge node k, and N0 represents the noise energy.

[0118] The downlink broadcast rate from edge node k to terminal device n connected to it is calculated as:

[0119] The downlink broadcast rate from edge node k to the terminal device n connected to it is:

[0120]

[0121] in represents the downlink broadcast rate of terminal device n connected to edge node k, P k is the transmission power of edge node k.

[0122] The uplink transmission time from terminal device n to edge node k is calculated as:

[0123] Define the model size as Z, the uplink transmission time from terminal device n to edge node k It can be expressed as, where the superscript u means upload:

[0124]

[0125] The downlink propagation time from edge node k to terminal device n is calculated as:

[0126] Downlink propagation time from edge node k to terminal device n It can be expressed as, where the superscript d indicates the broadcast meaning:

[0127]

[0128] The model aggregation model for constructing the edge node is:

[0129] In the federated learning communication process between the edge node k and the terminal device n connected to it, since the terminal devices connected to each edge node are defined as the same type, the terminal devices of the same type will have similar data computing capabilities and signal transmission capabilities. Therefore, a synchronous aggregation method can be used in the edge node aggregation process of federated learning. In the traditional synchronous aggregation process, due to the heterogeneous types of terminal devices connected to the central node, the central node needs to wait for the slowest terminal device to complete local calculations before it can aggregate the model, which will result in a lot of training time waste. In this design, due to the existence of a hierarchical structure, devices of the same type are connected to the same edge node. The use of a synchronous aggregation method will minimize resource waste while ensuring model accuracy. Therefore, the model weight at the edge node k The aggregation method can be expressed as:

[0130]

[0131] Where |D k | represents the set of all terminal devices connected to edge node k The overall time delay during the communication between the edge node and the terminal device It can be expressed as, where the superscript edge represents an edge node:

[0132]

[0133] Step 2.3, calculate the data transmission rate from edge node k to cloud node, calculate the broadcast data transmission rate between cloud node and edge node k, calculate the upload and broadcast time of communication between cloud node and edge node k respectively, calculate the overall time delay in the communication process between cloud node and edge node, and construct a semi-asynchronous model aggregation model;

[0134] The data transmission rate from the computing edge node k to the cloud node is:

[0135] Data transmission rate from edge node k to cloud node It can be expressed as, where the superscript u means upload:

[0136]

[0137] Among them B c,k is the transmission bandwidth between edge node k and cloud node, P c,k is the transmission energy of the edge node k for uploading communication, g c,k is the channel gain between the cloud node and the edge node k;

[0138] The broadcast data transmission rate between the computing cloud node and the edge node k is:

[0139] The broadcast data transmission rate between cloud node and edge node k is It can be expressed as, where the superscript d indicates the broadcast meaning:

[0140]

[0141] Among them B c represents the sum of the bandwidth when the cloud node communicates with the edge node, P c Transmitting energy to cloud nodes

[0142] The upload and broadcast time of the cloud node and edge node k are calculated as follows:

[0143] Upload time of communication between cloud node and edge node k and broadcast time They can be expressed as,, where the superscript u means uploading, and the superscript d means broadcasting:

[0144]

[0145]

[0146] The overall time delay during the communication between the computing cloud node and the edge node is:

[0147] The overall time delay during the communication between cloud nodes and edge nodes Where cloud represents the cloud node:

[0148]

[0149] The semi-asynchronous model aggregation model is constructed as follows:

[0150] During the communication between edge nodes and cloud nodes, different edge nodes are connected to different terminal devices.

[0151] There is a great deal of heterogeneity in local datasets, and their model update cycles are also different. If a synchronous aggregation model is used, the greater delay of nodes with faster training time is unacceptable. On the contrary, although the delay of each round of the asynchronous method is shorter, it requires several times the number of training rounds of the synchronous method. Therefore, it is extremely necessary to design a semi-asynchronous communication method to solve the problem of device resource waste. Assume that in each round of communication between the cloud node and the edge node, the cloud node will select some edge nodes to participate in the model aggregation task. Let the selected device dataset be Therefore, the weight aggregation method of the semi-asynchronous model can be expressed as:

[0152]

[0153] where w c Train the model weights for the latest cloud nodes, and Train the model weights for the last cloud node.

[0154] Step 2.4, calculating the data importance σ of the terminal device n connected to the edge node k according to the terminal model gradient value of the terminal device n connected to the edge node k in step 2.1 k,n , calculate the data importance σ of edge node k k , combined with the overall time delay during the communication between the edge node and the terminal device The overall time delay during the communication between cloud nodes and edge nodes Calculate the total time delay of edge node k and construct whether the edge node selects the optimization target;

[0155] The data importance σ of the terminal device n connected to the edge node k is calculated according to the terminal model gradient value of the terminal device n connected to the edge node k in step 2.1. k,n for:

[0156]

[0157] Among them, || || represents the L2 norm, g k,n Represents the terminal model gradient value of the terminal device n connected to the edge node k;

[0158] Further calculate the data importance σ of edge node k k for:

[0159]

[0160] in, Represents the number of terminal devices connected to each edge node k.

[0161] The total time delay for calculating edge node k is expressed as:

[0162]

[0163] in, is the overall time delay during the communication between the edge node and the terminal device, It is the overall time delay during the communication between cloud nodes and edge nodes;

[0164] Whether the edge node selects the optimization target as:

[0165]

[0166] Among them, ρ represents a weight balance parameter that determines the distribution ratio of data importance and time delay in the optimization problem, and α k Represents whether the edge node k is selected;

[0167] The alternating selection optimization method is used to solve the above problem to perform the edge node selection task. After completing the edge node selection task, the α of the selected node is k The value is 1, the α of the node is not selected. k The value is 0;

[0168] Step 3, after completing the edge node training model weight aggregation task through the cloud node in step 2, the cloud node training model weight described in step 2 and the model weight of the selected edge node k described in step 2 are used to perform model gap calculation to obtain a personalized edge model corresponding to edge node k, wherein the unselected edge node will perform this process when it is selected;

[0169] Assume that the model weight distance can represent the gap between the weights of two models, specifically:

[0170]

[0171] Among them, w c Train the model weights for the cloud nodes, w k is the model weight of edge node k;

[0172] Deep learning neural networks are generally composed of multiple layers of networks and each layer of the neural network has different weights; suppose a neural network is composed of

[0173] The difference ε between the cloud node training model weight and the edge node k model weight is expressed as:

[0174]

[0175] in Representation model composition For different network layers in , the model weight personalization can be expressed as:

[0176] w k ←εw c +(1-ε)w k

[0177] The personalized model service we proposed can provide more personalized network services to classification devices to address the heterogeneity of heterogeneous device data and complete the training tasks corresponding to different devices.

[0178] It should be understood that parts not elaborated in detail in this specification belong to the prior art.

[0179] It should be understood that the above description of the preferred embodiment is relatively detailed and cannot be regarded as limiting the scope of patent protection of the present invention. Under the enlightenment of the present invention, ordinary technicians in this field can also make substitutions or modifications without departing from the scope of protection of the claims of the present invention, which all fall within the scope of protection of the present invention. The scope of protection requested for the present invention shall be based on the attached claims.

Claims

1. A semi-asynchronous hierarchical federated learning method based on timeliness, characterized by: The following steps are involved: Step 1: Build a hierarchical network architecture, which includes: cloud nodes, K edge nodes, and K*N terminal devices, where the cloud nodes are connected to the K edge nodes in sequence, and each edge node is also connected to N terminal devices of the same type in sequence; Step 2: Based on the above layered network architecture, a corresponding federated learning method is proposed to realize data sharing applications of heterogeneous devices; Step 3: After the edge node training model weight aggregation task is completed by the cloud node in step 2, the model gap calculation is performed using the cloud node training model weight described in step 2 and the model weight of the selected edge node k described in step 2 to obtain the personalized edge model corresponding to edge node k. The unselected edge nodes will perform this process when they are selected. The step 2 is specifically as follows: Step 2.1: This step constructs the loss function model used in federated learning and uses stochastic gradient descent to train the model to obtain the optimized model weights. The computation time and model gradient values ​​of the terminal device are then calculated. The terminal device set connected to each edge node k is The loss function model F of the local device n connected to the edge device k in the federated learning k,n (w k,n ) is expressed as: Among them, f k,n (x j,k,n ,y j,k,n ,w k,n ) is the loss function of the local device n connected to the edge device k, and the linear regression model expression of the loss function is In addition, w k,n is the weight value of the training model for the local device n connected to the edge device k, and D k,n ={(x j,k,n ,y j,k,n ):j=1,...,|D k,n |} represents the data set stored by the terminal device n connected to the edge node k, |D k,n | represents the size of the dataset, x j,k,n represents the jth input sample of the local device n data connected to the edge device k, y j,k,n represents the output sample associated with the local device n connected to the edge device k; The corresponding model training is performed by the stochastic gradient descent method as follows: Where t represents the tth iteration process during local training, and η represents the learning efficiency during training; After a certain number of iterations, the corresponding model training is performed using the stochastic gradient descent method to obtain the optimized training weights of the terminal device n connected to the edge node k. Let C k,n The number of CPU cycles required to calculate a data sample for terminal device n connected to edge node k. The computation time of terminal device n connected to edge node k is expressed as , where the superscript c indicates the computational meaning: Among them, |D k,n | represents the size of the data set of terminal device n connected to edge node k, f k,n represents the computing power of the terminal device n connected to the edge node k; Combined with the optimized training weight of the terminal device n connected to the edge node k, the terminal model gradient value g of the terminal device n connected to the edge node k is obtained k,n for: Step 2.2: Define the transmission model from the terminal device to its connected edge node, calculate the transmission rate of the terminal device uploading to the associated edge node, calculate the downlink broadcast rate from edge node k to the terminal device n connected to it, calculate the uplink transmission time from terminal device n to edge node k, calculate the downlink transmission time from edge node k to terminal device n, and construct the model aggregation model at the edge node; The transmission model from a terminal device to its connected edge node is defined as: First, define the transmission model from terminal device n to its connected edge node k, and let B k,n is the bandwidth allocated to the terminal device n connected to the edge node k, and the sum of the bandwidth of the edge node k is B k Expressed as The transmission rate of the computing terminal device uploading to the associated edge node is: The transmission rate from terminal device n to the associated edge node k is: in represents the upload transmission rate of the terminal device n connected to the edge node k, P k,n represents the transmission power of the terminal device n connected to the edge node k, g k,n represents the channel gain of terminal device n connected to edge node k, and N0 represents the noise energy; The downlink broadcast rate from edge node k to terminal device n connected to it is calculated as: The downlink broadcast rate from edge node k to the terminal device n connected to it is: in represents the downlink broadcast rate of terminal device n connected to edge node k, P k is the transmission power of edge node k; The uplink transmission time from terminal device n to edge node k is calculated as: Define the model size as Z, the uplink transmission time from terminal device n to edge node k It can be expressed as, where the superscript u means upload: The downlink propagation time from edge node k to terminal device n is calculated as: Downlink propagation time from edge node k to terminal device n It can be expressed as, where the superscript d indicates the broadcast meaning: The model aggregation model for constructing the edge node is: In the federated learning communication process between the edge node k and the terminal device n connected to it, since the terminal devices connected to each edge node are defined as the same type, the terminal devices of the same type will have similar data computing capabilities and signal transmission capabilities. Therefore, a synchronous aggregation method can be used in the edge node aggregation process of federated learning. In the traditional synchronous aggregation process, since the terminal devices connected to the central node are of heterogeneous types, the central node needs to wait for the slowest terminal device to complete local calculations before it can aggregate the model, which will result in a lot of training time waste. In this design, due to the existence of a hierarchical structure, devices of the same type are connected to the same edge node. The use of a synchronous aggregation method will minimize resource waste while ensuring model accuracy. Therefore, the model weight at the edge node k is The aggregation method can be expressed as: where |D k | represents the set of all terminal devices connected to edge node k The sum of the data; the overall time delay during the communication between the edge node and the terminal device It can be expressed as, where the superscript edge represents an edge node: Step 2.3, calculate the data transmission rate from edge node k to cloud node, calculate the broadcast data transmission rate between cloud node and edge node k, calculate the upload and broadcast time of communication between cloud node and edge node k respectively, calculate the overall time delay in the communication process between cloud node and edge node, and construct a semi-asynchronous model aggregation model; The data transmission rate from the edge node k to the cloud node is calculated as: Data transmission rate from edge node k to cloud node It can be expressed as, where the superscript u means upload: Among them B c,k is the transmission bandwidth for communication between edge node k and cloud node, P c,k is the transmission energy of the edge node k for uploading communication, g c,k is the channel gain between the cloud node and edge node k; The broadcast data transmission rate between the computing cloud node and the edge node k is: The broadcast data transmission rate between cloud node and edge node k is It can be expressed as, where the superscript d indicates the broadcast meaning: Among them B c represents the sum of the bandwidth when cloud nodes communicate with edge nodes, P c Transmitting energy to cloud nodes The upload and broadcast time of the communication between the cloud node and the edge node k are calculated as follows: Upload time for communication between cloud node and edge node k and broadcast time They can be expressed as,, where the superscript u means uploading and the superscript d means broadcasting: The overall time delay during the communication between the computing cloud node and the edge node is: The overall time delay during the communication between cloud nodes and edge nodes Where cloud represents the cloud node: The semi-asynchronous model aggregation model is constructed as follows: During the communication between edge nodes and cloud nodes, different edge nodes are connected to different terminal devices. There is a great deal of heterogeneity in local datasets, and their model update cycles are also different. If a synchronous aggregation model is used, the greater delay of nodes with faster training time is unacceptable. On the contrary, although the delay of each round of the asynchronous method is shorter, it requires several times the training rounds of the synchronous method. Therefore, it is extremely necessary to design a semi-asynchronous communication method to solve the problem of device resource waste. Assume that in each round of communication between cloud nodes and edge nodes, the cloud node will select some edge nodes to participate in the model aggregation task. Let the selected device dataset be Therefore, the weight aggregation method of the semi-asynchronous model can be expressed as: where w c Train the model weights for the latest cloud nodes, and Train the model weights for the last cloud node; Step 2.4, calculating the data importance σ of the terminal device n connected to the edge node k according to the terminal model gradient value of the terminal device n connected to the edge node k in step 2.1 k,n , calculate the data importance σ of edge node k k , combined with the overall time delay during the communication between the edge node and the terminal device The overall time delay during the communication between cloud nodes and edge nodes Calculate the total time delay of edge node k and construct whether the edge node selects the optimization target; Calculate the data importance σ of terminal device n connected to edge node k according to the terminal model gradient value of terminal device n connected to edge node k in step 2.1 k,n for: Among them, || || represents the L2 norm, g k,n Represents the terminal model gradient value of the terminal device n connected to the edge node k; Further calculate the data importance σ of edge node k k for: in, represents the number of terminal devices connected to each edge node k; The total time delay of calculating edge node k is expressed as: in, is the overall time delay during the communication between the edge node and the terminal device, It is the overall time delay during the communication between cloud nodes and edge nodes; Whether the edge node selects the optimization target as: Among them, ρ represents a weight balance parameter that determines the distribution ratio of data importance and time delay in the optimization problem, α k Indicates whether the edge node k is selected; The alternating selection optimization method is used to solve the above problem to perform the edge node selection task. After completing the edge node selection task, the α of the selected node is k The value is 1, and the α of the node is not selected. k The value is 0.

2. The time-effective semi-asynchronous hierarchical federated learning method according to claim 1 is characterized in that: The step 3 is specifically as follows: Assume that the model weight distance can represent the gap between the weights of two models, specifically: Among them, w c Training model weights for cloud nodes, w k is the model weight of edge node k; Deep learning neural networks are generally composed of multiple layers of networks and each layer of the neural network contains different weights; Assume that a neural network consists of The difference ε between the cloud node training model weight and the edge node k model weight is expressed as: Among them, l represents the model composition For different network layers in , the model weight personalization can be expressed as: w k ←εw c +(1-ε)w k The proposed personalized model service can address the heterogeneity of heterogeneous device data, provide more personalized network services to classification devices, and complete the training tasks corresponding to different devices.