Federal learning energy consumption optimization method
By clustering and subclustering cluster generation on the client, clients with less energy consumption are selected for federated learning, the problems of high training energy consumption and slow model convergence speed in the existing technology are solved, and energy consumption optimization and The effect of the model's rapid convergence.
Patent Information
- Application Number
- CN202411619211.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-11-13
AI Technical Summary
The current federal learning technology has high energy consumption, slow model convergence speed, and it is difficult to adapt to real-time changing traffic conditions.
By clustering multiple clients, clients with less energy consumption are selected, a collection of minimum energy consumption clients is formed, and two clusters are performed to generate subcluster clusters, and finally using these clients for federated learning. Optimize model parameters.
The energy consumption of federated learning training and the model convergence speed are improved, and it can adapt to real-time changing traffic conditions more quickly.
Smart Images

Figure CN119416913A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and more specifically, to an energy consumption optimization method for federated learning. Background Art
[0002] Nowadays, data is at the core of many applications. However, in areas that are sensitive to privacy and security, data collection, storage, and processing face many challenges. Federated learning, as a new type of machine learning technology, allows training to be performed locally without sharing data, without centralizing data to a central server. This technology avoids the transmission and storage of data to a certain extent, thereby protecting the privacy of the public. Federated learning is widely used in traffic prediction in the transportation field, making intelligent transportation systems more intelligent and bringing new opportunities for the development of self-driving cars.
[0003] In traditional federated learning, data is unevenly distributed due to the different computing capabilities of each client, and the similarity of data between clients is not taken into account. Therefore, overall, the training energy consumption of federated learning is high and the model convergence speed is slow.
[0004] The prior art discloses a highly energy-efficient clustering federated edge learning strategy generation method and device, including: the cloud center initializes the edge access strategy; the edge base station solves the bandwidth resource allocation strategy of its access device and sends its initialization model to the access device; the device calculates the accuracy of the received global model, trains the local model using a hierarchical migration strategy based on the global model and local data, calculates the energy spent on uploading the local model, takes the difference between the test accuracy and the energy consumption as the local benefit, and uploads the local model and the local benefit to the accessed edge base station; the edge base station hierarchically aggregates the local model, calculates the edge benefit by averaging the local benefits of all access devices, and uploads the edge benefit to the cloud center; the cloud center calculates the system benefit based on the feedback information received from the edge base station, and uses a deep reinforcement learning algorithm to adjust the edge access strategy; repeats the above process until convergence. This method adjusts the client allocation strategy through deep reinforcement learning, and the adjustment time is long, which cannot adapt to the real-time changing traffic conditions in traffic prediction. Summary of the invention
[0005] The present invention aims to solve the defects of the prior art of federated learning, namely, high training energy consumption and slow model convergence speed; and provides an energy consumption optimization method for federated learning; the method has low training energy consumption and fast model convergence.
[0006] The primary purpose of the present invention is to solve the above technical problems. The technical solution of the present invention is as follows:
[0007] A method for optimizing energy consumption of federated learning, comprising:
[0008] S1: Cluster multiple clients to obtain K clusters;
[0009] S2: Establish the client's computing model and communication model, and calculate the average energy consumption of each cluster;
[0010] S3: sorting the clusters in ascending order of average energy consumption to obtain K sorted clusters, which are used as the first set, the second set, ..., the Kth set in sequence;
[0011] S4: Determine whether the number of clients in the first set is less than a first threshold; if so, execute step S5; otherwise, execute step S6;
[0012] S5: According to the sorting result, starting from the second set, randomly select clients to add to the first set; wherein, when all clients in the current set have been selected, randomly select clients in the next set until the number of clients in the first set is equal to the first threshold, and use the current clients in the first set to form the current minimum energy consumption client set, and execute step S7;
[0013] S6: directly use the clients in the first set to form the current minimum energy consumption client set, and execute step S7;
[0014] S7: Performing federated learning using the client in the minimum energy consumption client set to obtain a model parameter of the federated learning;
[0015] S8: performing a second clustering on the clients in the current minimum energy consumption client set according to the model parameters of the federated learning to obtain a plurality of sub-clustering clusters;
[0016] S9: Combine the multiple sub-clusters and use the clients in the minimum energy consumption client set to perform federated learning to obtain a final overall model.
[0017] Furthermore, the calculation model of the client is as follows:
[0018] Client C i The local computation delay is:
[0019]
[0020] i represents the sequence number, ω i represents the number of CPU cycles that the i-th client can process per second, θ represents the number of CPU cycles required to process a data sample, |D i | indicates training client C i The amount of local data;
[0021] Client C i The local computing energy consumption is:
[0022]
[0023] i represents the sequence number, ω i represents the number of CPU cycles that the i-th client can process per second, θ represents the number of CPU cycles required to process a data sample, |D i | represents the local data volume of the i-th client; k represents the effective switching capacitance of the chip architecture; Represents the local computing capability of the i-th client.
[0024] Furthermore, the communication model of the client is as follows:
[0025] Client C i The data transfer rate is:
[0026]
[0027] i represents the serial number, B represents the bandwidth, pi represents the transmit power of the complex Gaussian white channel noise of the i-th client, N0 represents the variance of the complex Gaussian white channel noise; h i represents the channel gain between the i-th client and the edge server;
[0028] Client C i The communication delay is:
[0029]
[0030] i represents the sequence number, B represents the bandwidth, M i represents the local model W of the i-th client i The number of bits, p i represents the transmit power of the complex Gaussian white channel noise of the i-th client, N0 represents the variance of the complex Gaussian white channel noise; d i represents the distance between the ith client and the edge server, o i represents the Rayleigh fading parameter;
[0031] Client C i The local communication energy consumption is:
[0032]
[0033] i represents the sequence number, B represents the bandwidth, M i represents the local model W of the i-th client i The number of bits, p i represents the transmit power of the complex Gaussian white channel noise of the i-th client, N0 represents the variance of the complex Gaussian white channel noise; h irepresents the channel gain between the i-th client and the edge server.
[0034] Furthermore, the average energy consumption is:
[0035]
[0036] i represents the sequence number, |C k | indicates the total number of clients, C k Represents the client set, Cost i represents the energy consumption of the i-th client;
[0037] Energy consumption Cost of the i-th client i for:
[0038] Cost i =αE i +βT i
[0039] i represents the sequence number, α represents the delay coefficient, and β represents the energy consumption coefficient;
[0040] Energy consumption E of local training of the i-th client i for:
[0041]
[0042] i represents the sequence number, represents the local communication energy consumption of the i-th client, represents the local computing energy consumption of the i-th client;
[0043] The delay T of local training of the i-th client i for:
[0044]
[0045] i represents the sequence number, represents the communication delay of the i-th client, Represents the local computing delay of the i-th client.
[0046] Furthermore, the clustering in step S1 includes:
[0047] S101: Randomly select K clients as initial centroids to obtain K first centroids;
[0048] S102: Calculate the distance from each client to each first centroid respectively;
[0049] S103: assigning each client to the cluster corresponding to the first centroid closest to the client;
[0050] S104: recalculating the centroid of each cluster to obtain multiple new second centroids;
[0051] S105: Determine whether the position of each second centroid is the same as the corresponding first centroid; if they are the same, take the current cluster as the clustering cluster; otherwise, take the second centroid as the new first centroid and repeat steps S102 to S105.
[0052] Furthermore, the second clustering in step S8 includes:
[0053] S801: Obtain parameters of each client model in the minimum energy consumption client set in federated learning, calculate cosine similarity, and obtain multiple similarity matrices;
[0054] S802: Perform AP clustering on the multiple similarity matrices to obtain multiple sub-clustering clusters.
[0055] Furthermore, in step S801, the cosine similarity is calculated as follows:
[0056]
[0057] i and j represent sequence numbers, t represents the round number, represents the model parameters of the client in the tth round in the i-th minimum energy consumption client set, It represents the change of model parameters of the client in the i-th minimum energy consumption client set in the t+1th round.
[0058] Further, in step S9, using the client in the minimum energy consumption client set to perform federated learning includes:
[0059] S901: Aggregate the client models in each sub-cluster to obtain each sub-cluster model;
[0060] S902: Aggregate the sub-cluster models to obtain an overall model;
[0061] S903: Determine whether the overall model has converged. If the overall model has not converged, perform federated learning again to obtain a new client model for each sub-cluster, and execute steps S901 to S903; otherwise, use the current overall model as the final overall model.
[0062] Furthermore, in step S902, the formula of the overall model is as follows:
[0063]
[0064] k represents the sequence number, Ω k represents the kth sub-cluster model, Φ krepresents the amount of data of the kth sub-cluster, and N represents the number of sub-cluster models;
[0065] In step S901, the formula of the model after client aggregation is as follows:
[0066]
[0067] k, k′ represent the sequence number, Ω k′ k N represents the k′th client federated learning model of the kth sub-cluster, k represents the number of client federated learning models of the kth sub-cluster, Φ k′ k Represents the data volume of the k′th client of the kth sub-cluster.
[0068] An energy consumption optimization device for federated learning, comprising:
[0069] The first clustering module: clusters multiple clients to obtain K clusters;
[0070] Energy consumption calculation module: establish the client's calculation model and communication model, and calculate the average energy consumption of each cluster;
[0071] Cluster selection module: sort the clusters in ascending order according to the average energy consumption, and obtain K sorted clusters, which are used as the first set, the second set, ..., the Kth set in sequence;
[0072] Threshold determination module: determines whether the number of clients in the first set is less than a first threshold;
[0073] Set adding module 1: starting from the second set, randomly selecting clients to add to the first set according to the sorting result; wherein, when all clients in the current set have been selected, clients in the next set are randomly selected until the number of clients in the first set is equal to the first threshold, and the current clients in the first set are used to form the current minimum energy consumption client set;
[0074] Set adding module 2: directly using the clients in the first set to form the current minimum energy consumption client set;
[0075] The first federated learning module: uses the clients in the minimum energy consumption client set to perform federated learning to obtain model parameters of the federated learning;
[0076] The second clustering module: performing a second clustering on the clients in the current minimum energy consumption client set according to the model parameters of the federated learning to obtain a plurality of sub-clustering clusters;
[0077] The second federated learning module: combines the multiple sub-clusters and uses the clients in the minimum energy consumption client set to perform federated learning to obtain a final overall model.
[0078] Compared with the prior art, the present invention has the following beneficial effects:
[0079] The present invention selects clients with low energy consumption through clustering, so that the energy consumption of federated learning training is low. Sub-clustering clusters are generated through the second clustering, so that the federated learning model converges quickly. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] Figure 1 A flowchart of a method for optimizing energy consumption of federated learning provided in Example 1.
[0081] Figure 2 This is a flow chart of clustering provided in Example 1.
[0082] Figure 3 This is a flow chart of the second clustering provided in Example 1.
[0083] Figure 4 Flowchart of federated learning provided for Example 1.
[0084] Figure 5 This is the convergence line graph of the second clustering provided in Example 1.
[0085] Figure 6 A bar chart showing energy consumption comparison of the energy consumption optimization method for federated learning provided in Example 1.
[0086] Figure 7 A line chart showing time comparison of the energy consumption optimization method for federated learning provided in Example 1. DETAILED DESCRIPTION
[0087] The drawings are for illustrative purposes only and should not be construed as limiting the present patent;
[0088] In order to better illustrate the present embodiment, some parts in the drawings may be omitted, enlarged or reduced, and do not represent the size of the actual product;
[0089] It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0090] The technical solution of the present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0091] Example 1
[0092] like Figure 1 As shown, a method for optimizing energy consumption of federated learning includes:
[0093] S1: Cluster multiple clients to obtain K clusters;
[0094] S2: Establish the client's computing model and communication model, and calculate the average energy consumption of each cluster;
[0095] S3: sorting the clusters in ascending order of average energy consumption to obtain K sorted clusters, which are used as the first set, the second set, ..., the Kth set in sequence;
[0096] S4: Determine whether the number of clients in the first set is less than a first threshold; if so, execute step S5; otherwise, execute step S6;
[0097] S5: According to the sorting result, starting from the second set, randomly select clients to add to the first set; wherein, when all clients in the current set have been selected, randomly select clients in the next set until the number of clients in the first set is equal to the first threshold, and use the current clients in the first set to form the current minimum energy consumption client set, and execute step S7;
[0098] S6: directly use the clients in the first set to form the current minimum energy consumption client set, and execute step S7:
[0099] S7: Performing federated learning using the client in the minimum energy consumption client set to obtain a model parameter of the federated learning;
[0100] S8: performing a second clustering on the clients in the current minimum energy consumption client set according to the model parameters of the federated learning to obtain a plurality of sub-clustering clusters;
[0101] S9: Combine the multiple sub-clusters and use the clients in the minimum energy consumption client set to perform federated learning to obtain a final overall model.
[0102] It should be noted that the present invention performs federated learning through two-stage clustering. The first clustering is based on the computing power of the client and its distance from the server, and clients with similar computing power and close geographical locations are classified into one category, thereby reducing the heterogeneity of devices. The second clustering is based on the data similarity between clients, and clients with similar data distribution are grouped to ensure that the model can converge faster.
[0103] In a specific embodiment, the average energy consumption avgCost of the nth cluster is n The calculation formula is as follows:
[0104]
[0105] n, o represent the serial number, F nrepresents the nth cluster, |F n | represents the number of clients in the nth cluster, Cost o represents the energy consumption of the oth client.
[0106] In a specific embodiment, the first clustering adopts K-means algorithm.
[0107] Furthermore, the calculation model of the client is as follows:
[0108] Client C i The local computation delay is:
[0109]
[0110] i represents the sequence number, ω i represents the number of CPU cycles that the i-th client can process per second, θ represents the number of CPU cycles required to process a data sample, |D i | indicates training client C i The amount of local data;
[0111] Client C i The local computing energy consumption is:
[0112]
[0113] i represents the sequence number, ω i represents the number of CPU cycles that the i-th client can process per second, θ represents the number of CPU cycles required to process a data sample, |D i | represents the local data volume of the i-th client; k represents the effective switching capacitance of the chip architecture; Represents the local computing capability of the i-th client.
[0114] Furthermore, the communication model of the client is as follows:
[0115] Client C i The data transfer rate is:
[0116]
[0117] i represents the serial number, B represents the bandwidth, pi represents the transmit power of the complex Gaussian white channel noise of the i-th client, N0 represents the variance of the complex Gaussian white channel noise; h i represents the channel gain between the i-th client and the edge server;
[0118] Client C i The communication delay is:
[0119]
[0120] i represents the sequence number, B represents the bandwidth, M i represents the local model W of the i-th client i The number of bits, p i represents the transmit power of the complex Gaussian white channel noise of the i-th client, N0 represents the variance of the complex Gaussian white channel noise; d i represents the distance between the ith client and the edge server, o i represents the Rayleigh fading parameter;
[0121] Client C i The local communication energy consumption is:
[0122]
[0123] i represents the sequence number, B represents the bandwidth, M i represents the local model W of the i-th client i The number of bits, p i represents the transmit power of the complex Gaussian white channel noise of the i-th client, N0 represents the variance of the complex Gaussian white channel noise; h i represents the channel gain between the i-th client and the edge server.
[0124] Furthermore, the average energy consumption is:
[0125]
[0126] i represents the sequence number, |C k | indicates the total number of clients, C k Represents the client set, Cost i represents the energy consumption of the i-th client;
[0127] Energy consumption Cost of the i-th client i for:
[0128] Cost i =αE i +βT i
[0129] i represents the sequence number, α represents the delay coefficient, and β represents the energy consumption coefficient;
[0130] Energy consumption E of local training of the i-th client i for:
[0131]
[0132] i represents the sequence number, represents the local communication energy consumption of the i-th client, represents the local computing energy consumption of the i-th client;
[0133] The delay T of local training of the i-th client i for:
[0134]
[0135] i represents the sequence number, represents the communication delay of the i-th client, Represents the local computing delay of the i-th client.
[0136] Furthermore, if Figure 2 As shown, the clustering in step S1 includes:
[0137] S101: Randomly select K clients as initial centroids to obtain K first centroids;
[0138] S102: Calculate the distance from each client to each first centroid respectively;
[0139] S103: assigning each client to the cluster corresponding to the first centroid closest to the client;
[0140] S104: recalculating the centroid of each cluster to obtain multiple new second centroids;
[0141] S105: Determine whether the position of each second centroid is the same as the corresponding first centroid; if they are the same, take the current cluster as the clustering cluster; otherwise, take the second centroid as the new first centroid and repeat steps S102 to S105.
[0142] In a specific embodiment, step S102 uses Euclidean distance calculation:
[0143]
[0144] n represents the sequence number, μ n represents the nth centroid, m represents the client serial number, p m represents the computing power of the mth client, p n represents the average computing power of the cluster where the nth centroid is located, d m Indicates the distance from the mth client to the server, d n represents the average distance from the client to the server of the cluster where the nth centroid is located;
[0145] In step S104, the formula for recalculating the centroid is as follows:
[0146]
[0147] n, o represent the serial number, F n represents the nth cluster, |F n| represents the number of clients in the nth cluster, p o represents the computing power of the oth client, d o Indicates the distance from the oth client to the server;
[0148] Furthermore, if Figure 3 As shown, the second clustering in step S8 includes:
[0149] S801: Obtain parameters of each client model in the minimum energy consumption client set in federated learning, calculate cosine similarity, and obtain multiple similarity matrices;
[0150] S802: Perform AP clustering on the multiple similarity matrices to obtain multiple sub-clustering clusters.
[0151] In a specific embodiment, AP clustering uses AffinityPropagation in sklearn.
[0152] Furthermore, in step S801, the cosine similarity is calculated as follows:
[0153]
[0154] i and j represent sequence numbers, t represents the round number, represents the model parameters of the client in the tth round in the i-th minimum energy consumption client set, It represents the change of model parameters of the client in the i-th minimum energy consumption client set in the t+1th round.
[0155] Furthermore, if Figure 4 As shown, in step S9, using the client in the minimum energy consumption client set to perform federated learning includes:
[0156] S901: Aggregate the client models in each sub-cluster to obtain each sub-cluster model;
[0157] S902: Aggregate the sub-cluster models to obtain an overall model;
[0158] S903: Determine whether the overall model has converged. If the overall model has not converged, perform federated learning again to obtain a new client model for each sub-cluster, and execute steps S901 to S903; otherwise, use the current overall model as the final overall model.
[0159] Furthermore, in step S902, the formula of the overall model is as follows:
[0160]
[0161] k represents the sequence number, Ω krepresents the kth sub-cluster model, Φ k represents the amount of data of the kth sub-cluster, and N represents the number of sub-cluster models;
[0162] In step S901, the formula of the model after client aggregation is as follows:
[0163]
[0164] k, k′ represent the sequence number, Ω k′ k N represents the k′th client federated learning model of the kth sub-cluster, k represents the number of client federated learning models of the kth sub-cluster, Φ k′ k Represents the data volume of the k′th client of the kth sub-cluster.
[0165] It should be noted that if Figure 5 As shown, in step S901 and step S902, the client models in each sub-cluster are aggregated first, and then the sub-cluster models are aggregated, which can speed up the convergence speed of federated learning.
[0166] An energy consumption optimization device for federated learning, comprising:
[0167] The first clustering module: clusters multiple clients to obtain K clusters;
[0168] Energy consumption calculation module: establish the client's calculation model and communication model, and calculate the average energy consumption of each cluster;
[0169] Cluster selection module: sort the clusters in ascending order according to the average energy consumption, and obtain K sorted clusters, which are used as the first set, the second set, ..., the Kth set in sequence;
[0170] Threshold determination module: determines whether the number of clients in the first set is less than a first threshold;
[0171] Set adding module 1: starting from the second set, randomly selecting clients to add to the first set according to the sorting result; wherein, when all clients in the current set have been selected, clients in the next set are randomly selected until the number of clients in the first set is equal to the first threshold, and the current clients in the first set are used to form the current minimum energy consumption client set;
[0172] Set adding module 2: directly using the clients in the first set to form the current minimum energy consumption client set;
[0173] The first federated learning module: uses the client in the minimum energy consumption client set to perform federated learning to obtain the model parameters of the federated learning;
[0174] The second clustering module: according to the model parameters of the federated learning, the clients in the current minimum energy consumption client set are clustered for the second time to obtain multiple sub-clustering clusters;
[0175] The second federated learning module: combines the multiple sub-clusters and uses the clients in the minimum energy consumption client set to perform federated learning to obtain a final overall model.
[0176] It should be noted that if Figure 6 As shown in FIG. 1 , compared with the common federated learning algorithm and the greedy algorithm, the method of the present invention has significant advantages in each round. Figure 7 As shown, compared with the common federated learning algorithm, the method of the present invention has a significant advantage in convergence time.
[0177] The same or similar reference numerals correspond to the same or similar components;
[0178] The terms used in the drawings to describe positional relationships are only used for illustrative purposes and should not be construed as limiting this patent;
[0179] Obviously, the above embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the embodiments here. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the claims of the present invention.
Claims
1. A method for optimizing energy consumption of federated learning, characterized in that: include: S1: Cluster multiple clients to obtain K clusters; S2: Establish the client's computing model and communication model, and calculate the average energy consumption of each cluster; S3: sort the clusters in ascending order of average energy consumption to obtain K sorted clusters, which are used as the first set, the second set, ..., the Kth set in sequence; S4: Determine whether the number of clients in the first set is less than a first threshold; if less than the first threshold, execute step S5; Otherwise, execute step S6; S5: According to the sorting result, starting from the second set, randomly select clients to add to the first set; wherein, when all clients in the current set have been selected, randomly select clients in the next set until the number of clients in the first set is equal to the first threshold, and use the current clients in the first set to form the current minimum energy consumption client set, and execute step S7; S6: directly use the clients in the first set to form the current minimum energy consumption client set, and execute step S7; S7: Performing federated learning using the client in the minimum energy consumption client set to obtain a model parameter of the federated learning; S8: performing a second clustering on the clients in the current minimum energy consumption client set according to the model parameters of the federated learning to obtain a plurality of sub-clustering clusters; S9: Combine the multiple sub-clusters and use the clients in the minimum energy consumption client set to perform federated learning to obtain a final overall model.
2. According to claim 1, a method for optimizing energy consumption of federated learning is characterized in that: The calculation model of the client is as follows: Client C i The local computation delay is: i represents the sequence number, ω i represents the number of CPU cycles that the i-th client can process per second, θ represents the number of CPU cycles required to process a data sample, |D i | indicates training client C i The amount of local data; Client C i The local computing energy consumption is: i represents the sequence number, ω i represents the number of CPU cycles that the i-th client can process per second, θ represents the number of CPU cycles required to process a data sample, |D i | represents the local data volume of the i-th client; k represents the effective switching capacitance of the chip architecture; f i 3 Represents the local computing capability of the i-th client.
3. The method for optimizing energy consumption of federated learning according to claim 2, characterized in that: The client's communication model is as follows: Client C i The data transfer rate is: i represents the sequence number, B represents the bandwidth, and p i represents the transmit power of the complex Gaussian white channel noise of the i-th client, and N0 represents the variance of the complex Gaussian white channel noise; h i represents the channel gain between the i-th client and the edge server; Client C i The communication delay is: i represents the sequence number, B represents the bandwidth, M i represents the local model W of the i-th client i The number of bits, p i represents the transmit power of the complex Gaussian white channel noise of the i-th client, and N0 represents the variance of the complex Gaussian white channel noise; d i represents the distance between the ith client and the edge server, o i represents the Rayleigh fading parameter; Client C i The local communication energy consumption is: i represents the sequence number, B represents the bandwidth, M i represents the local model W of the i-th client i The number of bits, p i represents the transmit power of the complex Gaussian white channel noise of the i-th client, N0 represents the variance of the complex Gaussian white channel noise; h i represents the channel gain between the i-th client and the edge server.
4. The method for optimizing energy consumption of federated learning according to claim 3, characterized in that: The average energy consumption is: i represents the sequence number, |C k | indicates the total number of clients, C k Represents the client set, Cost i represents the energy consumption of the i-th client; Energy consumption Cost of the i-th client i for: Cost i =αE i +βT i i represents the sequence number, α represents the delay coefficient, and β represents the energy consumption coefficient; Energy consumption E of local training of the i-th client i for: i represents the sequence number, represents the local communication energy consumption of the i-th client, represents the local computing energy consumption of the i-th client; The delay T of local training of the i-th client i for: i represents the sequence number, represents the communication delay of the i-th client, Represents the local computing delay of the i-th client.
5. The method for optimizing energy consumption of federated learning according to claim 1, characterized in that: The clustering in step S1 includes: S101: Randomly select K clients as initial centroids to obtain K first centroids; S102: Calculate the distance from each client to each first centroid respectively; S103: assigning each client to the cluster corresponding to the first centroid closest to the client; S104: recalculating the centroid of each cluster to obtain multiple new second centroids; S105: Determine whether the position of each second centroid is the same as the corresponding first centroid; if they are the same, take the current cluster as the clustering cluster; otherwise, take the second centroid as the new first centroid and repeat steps S102 to S105.
6. The method for optimizing energy consumption of federated learning according to claim 1, characterized in that: The second clustering in step S8 includes: S801: Obtain parameters of each client model in the minimum energy consumption client set in federated learning, calculate cosine similarity, and obtain multiple similarity matrices; S802: Perform AP clustering on the multiple similarity matrices to obtain multiple sub-clustering clusters.
7. The method for optimizing energy consumption of federated learning according to claim 6, characterized in that: In step S801, the cosine similarity is calculated as follows: i and j represent sequence numbers, t represents the round number, represents the model parameters of the client in the tth round in the i-th minimum energy consumption client set, It represents the change of model parameters of the client in the i-th minimum energy consumption client set in the t+1th round.
8. The method for optimizing energy consumption of federated learning according to claim 1, characterized in that: In step S9, the client in the minimum energy consumption client set is used to perform federated learning, including: S901: Aggregate the client models in each sub-cluster to obtain each sub-cluster model; S902: Aggregate the sub-cluster models to obtain an overall model; S903: Determine whether the overall model has converged. If the overall model has not converged, perform federated learning again to obtain a new client model for each sub-cluster, and execute steps S901 to S903; otherwise, use the current overall model as the final overall model.
9. The method for optimizing energy consumption of federated learning according to claim 8, characterized in that: In step S902, the formula of the overall model is as follows: k represents the sequence number, Ω k represents the kth sub-cluster model, Φ k represents the amount of data of the kth sub-cluster, and N represents the number of sub-cluster models; In step S901, the formula of the model after client aggregation is as follows: k, k′ represent the sequence number, Ω k′ k N represents the k′th client federated learning model of the kth sub-cluster, k represents the number of client federated learning models of the kth sub-cluster, Φ k′ k Represents the data volume of the k′th client of the kth sub-cluster.
10. A federated learning energy consumption optimization device, applied to the optimization method according to any one of claims 1 to 9, characterized in that: include: The first clustering module: clusters multiple clients to obtain K clusters; Energy consumption calculation module: establish the client's calculation model and communication model, and calculate the average energy consumption of each cluster; Cluster selection module: sort the clusters in ascending order according to the average energy consumption, and obtain K sorted clusters, which are used as the first set, the second set, ..., the Kth set in sequence; Threshold determination module: determines whether the number of clients in the first set is less than a first threshold; Set adding module 1: starting from the second set, randomly selecting clients to add to the first set according to the sorting result; wherein, when all clients in the current set have been selected, clients in the next set are randomly selected until the number of clients in the first set is equal to the first threshold, and the current clients in the first set are used to form the current minimum energy consumption client set; Set adding module 2: directly using the clients in the first set to form the current minimum energy consumption client set; The first federated learning module: uses the client in the minimum energy consumption client set to perform federated learning to obtain the model parameters of the federated learning; The second clustering module: according to the model parameters of the federated learning, the clients in the current minimum energy consumption client set are clustered for the second time to obtain multiple sub-clustering clusters; The second federated learning module: combines the multiple sub-clusters and uses the clients in the minimum energy consumption client set to perform federated learning to obtain a final overall model.
Citation Information
Patent Citations
Energy federal learning data selection method and device and energy federal learning system
CN117592580A
Federal learning-based energy consumption modeling and prediction method and system
CN118572668A
Serverless computing resource allocation system for energy consumption optimization
WO2023015788A1