A method for energy consumption optimization of federated learning
By performing two clustering screenings on the clients and optimizing client selection, the problems of high energy consumption and slow convergence in federated learning are solved, and model training with low energy consumption and fast convergence is achieved.
Patent Information
- Application Number
- CN202411619211.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-11-13
AI Technical Summary
In existing federated learning, due to the different computing capabilities of each client and uneven data distribution, training energy consumption is high, model convergence is slow, and it cannot adapt to real-time changes in traffic flow prediction conditions.
By clustering multiple clients twice, we first screen out the minimum energy consumption client set based on computing power and geographic location, and then perform sub-clustering based on data similarity to optimize the client selection and model training process and reduce heterogeneity and data inhomogeneity.
The energy consumption of federated learning is reduced and the model convergence speed is accelerated to adapt to the needs of real-time traffic changes.
Smart Images

Figure CN119416913B_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 sensitive to privacy and security, data collection, storage, and processing face numerous challenges. Federated learning, a new machine learning technology, allows for local training without sharing data, eliminating the need to centralize data on a central server. This technology avoids data transmission and storage, thereby protecting public privacy. Federated learning is widely used in traffic flow prediction, making intelligent transportation systems more intelligent and bringing new opportunities for the development of autonomous vehicles.
[0003] Traditional federated learning suffers from uneven data distribution due to varying computing power across clients, and also fails to account for data similarities across clients. As a result, overall, federated learning training consumes high energy and results in slow model convergence.
[0004] The prior art discloses a highly energy-efficient clustered federated edge learning strategy generation method and device, including: a cloud center initializes the edge access strategy; an edge base station solves the bandwidth resource allocation strategy for its access device and sends its initialization model to the access device; the device calculates the accuracy of the received global model, trains a local model using a hierarchical migration strategy based on the global model and local data, calculates the energy consumed by uploading the local model, uses the difference between the test accuracy and energy consumption as the local benefit, and uploads the local model and local benefit to the connected 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 stations and adjusts the edge access strategy using a deep reinforcement learning algorithm; and the above process is repeated until convergence. This method uses deep reinforcement learning to adjust the client allocation strategy, but the adjustment time is long and cannot adapt to the real-time changing traffic conditions used in traffic prediction. Summary of the Invention
[0005] The present invention addresses the defects of the prior art of federated learning, such as high training energy consumption and slow model convergence, 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, and the technical solutions of the present invention are as follows:
[0007] A method for optimizing energy consumption in 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: 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, ..., and 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: Starting from the second set, clients are randomly selected and added to the first set according to the sorting result. 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 reaches a first threshold. The current minimum energy consumption client set is formed using the clients currently in the first set, and step S7 is executed.
[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 model parameters of the federated learning;
[0015] S8: performing a second clustering of 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-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 one 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 one 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 transmission 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 i-th 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 idenotes the channel gain between the i-th client and the edge server.
[0034] Further, the average energy consumption is:
[0035]
[0036] i denotes the serial number, |C k | denotes the total number of clients, C k denotes the client set, Cost i denotes the energy consumption of the i-th client;
[0037] The energy consumption Cost i of the i-th client is:
[0038] Cost i = aE i + bT i
[0039] i denotes the serial number, a denotes the delay coefficient, and b denotes the energy consumption coefficient;
[0040] The energy consumption E i of the local training of the i-th client is:
[0041]
[0042] i denotes the serial number, denotes the local communication energy consumption of the i-th client, denotes the local computing energy consumption of the i-th client;
[0043] The delay T i of the local training of the i-th client is:
[0044]
[0045] i denotes the serial number, denotes the communication delay of the i-th client, denotes the local computing delay of the i-th client.
[0046] Further, 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: Assign each client to the cluster corresponding to the nearest first centroid;
[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, use the current cluster as the clustering cluster; otherwise, use 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-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] Furthermore, in step S9, the client in the minimum energy consumption client set is used to perform federated learning, including:
[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 not, 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 serial number, Ω k represents the kth sub-cluster model, Φ kN represents the number of sub-cluster models, and k represents the sequence number of the sub-cluster model;
[0065] In step S901, the formula of the aggregated model of the client is as follows:
[0066]
[0067] k and k' represent the sequence number, and Ω k′ k k' represents the sequence number of the sub-cluster model, and N represents the number of sub-cluster models. k k represents the sequence number of the sub-cluster model, and N represents the number of sub-cluster models. k′ k k' represents the sequence number of the sub-cluster model, and N represents the number of sub-cluster models.
[0068] An energy consumption optimization device for federated learning, comprising:
[0069] A first clustering module: clustering a plurality of clients to obtain K clusters;
[0070] An energy consumption calculation module: establishing a calculation model and a communication model of the client, and calculating the average energy consumption of each cluster;
[0071] A cluster selection module: sorting the clusters according to the order from small to large average energy consumption, obtaining the sorted K clusters as a first set, a second set, …, and a Kth set;
[0072] A threshold judgment module: judging whether the number of clients in the first set is less than a first threshold value;
[0073] A first set adding module: according to the sorting result, starting from the second set, randomly selecting clients to join the first set; wherein when all the clients in the current set are selected, the clients in the next set are randomly selected until the number of clients in the first set is equal to the first threshold value, and the current minimum energy consumption client set is composed of the clients in the first set;
[0074] A second set adding module: directly using the clients in the first set to compose the current minimum energy consumption client set;
[0075] A first federated learning module: using the clients in the minimum energy consumption client set to perform federated learning to obtain model parameters of federated learning;
[0076] A second clustering module: performing a second clustering on the clients in the current minimum energy consumption client set according to the model parameters of federated learning to obtain a plurality of sub-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, thereby reducing the energy consumption of federated learning training. The second clustering generates sub-clusters, which makes the federated learning model converge quickly. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] Figure 1 This is a flowchart of a method for optimizing energy consumption in 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 flowchart of the second clustering provided in Example 1.
[0083] Figure 4 Flowchart of federated learning provided in Example 1.
[0084] Figure 5 This is the convergence line chart of the second clustering provided in Example 1.
[0085] Figure 6 A bar chart comparing the energy consumption 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 accompanying drawings are for illustrative purposes only and are not to be construed as limiting this patent;
[0088] In order to better illustrate this embodiment, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product size;
[0089] It is understandable to those skilled in the art that some well-known structures and descriptions thereof may be omitted in the drawings.
[0090] The technical solution of the present invention is further described below with reference to the accompanying drawings and embodiments.
[0091] Example 1
[0092] like Figure 1 As shown in FIG, 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: 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, ..., and 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: Starting from the second set, clients are randomly selected and added to the first set according to the sorting result. 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 reaches a first threshold. The current minimum energy consumption client set is formed using the clients currently in the first set, and step S7 is executed.
[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 model parameters of the federated learning;
[0100] S8: performing a second clustering of 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-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 a two-stage clustering process. The first clustering is based on the client's computing power and its distance from the server, grouping clients with similar computing power and geographical proximity into one category, thereby reducing device heterogeneity. The second clustering is based on the data similarity between clients, grouping clients with similar data distributions to ensure faster model convergence.
[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 the 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 one 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 one 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 transmission 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 denotes the serial number, B denotes bandwidth, M i denotes the local model of the i-th client W i denotes the number of bits, p i denotes the transmit power of the complex Gaussian white channel noise of the i-th client, N0 denotes the variance of the complex Gaussian white channel noise; d i denotes the distance between the i-th client and the edge server, o i denotes the Rayleigh fading parameter;
[0121] client C i The local communication energy consumption of the client is:
[0122]
[0123] i denotes the serial number, B denotes bandwidth, M i denotes the local model of the i-th client W i denotes the number of bits, p i denotes the transmit power of the complex Gaussian white channel noise of the i-th client, N0 denotes the variance of the complex Gaussian white channel noise; h i denotes the channel gain between the i-th client and the edge server.
[0124] Further, the average energy consumption is:
[0125]
[0126] i denotes the serial number, |C k | denotes the total number of clients, C k denotes the client set, Cost i denotes the energy consumption of the i-th client;
[0127] The energy consumption Cost i of the i-th client is:
[0128] Cost i = αE i + βT i
[0129] i denotes the serial number, α denotes the delay coefficient, β denotes the energy consumption coefficient;
[0130] The energy consumption E i of the local training of the i-th client is:
[0131]
[0132] i denotes the serial number, denotes the local communication energy consumption of the i-th client, denotes the local computing energy consumption of the i-th client;
[0133] the local training time delay of the i-th client T i is:
[0134]
[0135] i represents a serial number, represents the communication time delay of the i-th client, represents the local computing time delay of the i-th client.
[0136] Further, as shown in the step S1, the clustering includes: Figure 2
[0137] S101: randomly selecting K clients as initial centroids to obtain K first centroids;
[0138] S102: calculating the distance from each client to each first centroid respectively;
[0139] S103: assigning each client to the cluster corresponding to the nearest first centroid;
[0140] S104: recalculating the centroid of each cluster to obtain a plurality of new second centroids;
[0141] S105: judging whether each second centroid is the same as the corresponding first centroid; if yes, the current cluster is taken as the clustering cluster; otherwise, the second centroid is taken as the new first centroid, and the steps S102-S105 are repeated.
[0142] In one specific embodiment, the step S102 adopts the Euclidean distance calculation:
[0143]
[0144] n represents a serial number, μ n represents the n-th centroid, m represents the serial number of the client, p m represents the computing capability of the m-th client, p n represents the average computing capability of the cluster where the n-th centroid is located, d m represents the distance from the m-th client to the server, d n represents the average distance from the clients of the cluster where the n-th centroid is located to the server;
[0145] In the step S104, the formula for recalculating the centroid is as follows:
[0146]
[0147] n, o represent serial numbers, F n represents the n-th cluster, |F n | represents the number of clients in the nth cluster, p o Indicates 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-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 clients 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 not, 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 in 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 first aggregated, and then the sub-cluster models are aggregated, which can speed up the convergence speed of federated learning.
[0166] A device for optimizing energy consumption of 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 of average energy consumption, and obtain the sorted K clusters, which are used as the first set, the second set, ..., and 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 selects clients to add to the first set according to the sorting result; when all clients in the current set have been selected, randomly selects clients from the next set until the number of clients in the first set reaches a first threshold, and then uses the current clients in the first set to form the current minimum energy consumption client set;
[0172] Set adding module 2: directly use the clients in the first set to form the current minimum energy consumption client set;
[0173] A first federated learning module: performing federated learning using the clients in the minimum energy consumption client set to obtain federated learning model parameters;
[0174] A 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 multiple sub-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 Figure 2, compared with the common federated learning algorithm and 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 significant advantages 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 for illustrative purposes only and should not be construed as limiting this patent;
[0179] Obviously, the above embodiments of the present invention are merely examples for the purpose of clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. Those skilled in the art will appreciate that other variations or modifications can be made based on the above description. It is not necessary and impossible to enumerate all embodiments here. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention shall be included within the scope of protection of the claims of the present invention.
Claims
1. A method for optimizing energy consumption in 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, ..., and the Kth set in sequence; S4: Determine whether the number of clients in the first set is less than a first threshold; if so, proceed to step S5; Otherwise, execute step S6; S5: Starting from the second set, clients are randomly selected and added to the first set according to the sorting result. 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 reaches a first threshold. The current minimum energy consumption client set is formed using the clients currently in the first set, and step S7 is executed. 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 model parameters of the federated learning; S8: performing a second clustering of 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-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. The method for optimizing energy consumption of federated learning according to claim 1, 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 one 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 one 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 transmission rate is: i represents the sequence number, B represents the bandwidth, 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 i-th 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, wherein: The average energy consumption is: i represents the serial number, |C k | represents 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 client i 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 for local training of the i-th client i for: i represents the serial number, represents the local communication energy consumption of the i-th client, represents the local computing energy consumption of the i-th client; The local training delay T of the i-th client i for: i represents the serial number, represents the communication delay of the i-th client, Represents the local computation delay of the i-th client.
5. The method for optimizing energy consumption of federated learning according to claim 1, wherein: 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: assign 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, use the current cluster as the clustering cluster; otherwise, use 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-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, wherein: 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 not, 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 serial 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 in 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 of average energy consumption, and obtain the sorted K clusters, which are used as the first set, the second set, ..., and 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 selects clients to add to the first set according to the sorting result; when all clients in the current set have been selected, randomly selects clients from the next set until the number of clients in the first set reaches a first threshold, and then uses the current clients in the first set to form the current minimum energy consumption client set; Set adding module 2: directly use the clients in the first set to form the current minimum energy consumption client set; A first federated learning module: performing federated learning using the clients in the minimum energy consumption client set to obtain federated learning model parameters; A 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 multiple sub-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