A method and system for optimizing resource allocation based on federated learning

By adopting a federated learning system based on fog computing in the Internet of Things, combining NOMA technology and alternating iterative algorithms, we optimize resource allocation, and solve the problems of delay and energy consumption caused by cloud computing in the Internet of Things, and realize the privacy of user data Protect.

CN114219354BActive Publication Date: 2025-02-25HANGZHOU DIANZI UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111622829.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-28
Publication Date
2025-02-25
Estimated Expiration
2041-12-28

AI Technical Summary

Technical Problem

In the Internet of Things, traditional cloud computing methods lead to high communication latency and energy consumption, and difficult to protect user data privacy.

Method used

The federated learning system based on fog computing is adopted to optimize the allocation of communication resources and computing resources through non-orthogonal multiple access (NOMA) technology and alternating iterative algorithms to minimize latency and energy consumption and protect user data privacy.

Benefits of technology

It effectively reduces latency and energy consumption, improves system performance and user experience, and ensures the privacy and security of user data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114219354B_ABST
    Figure CN114219354B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for optimizing resource allocation based on federated learning. The method comprises the following steps: S1. Initializing training tasks and global models, and broadcasting them to all users; S2. Users updating local models according to local data; S3. Calculating delay and energy consumption; S4. Determining the optimization objective function; S5. Alternating and iterating to solve the transmission power and calculation frequency; S6. Checking whether the model accuracy meets the requirements or reaches the local maximum number of iterations, if so, executing S7; if not, executing S2; S7. The fog server receives the local model, aggregates all users and generates a new global model, broadcasting it to all users; judging whether the global loss function reaches convergence or reaches the maximum number of global updates, if not, repeating S2-S6; if yes, ending. The present invention uses NOMA technology as a transmission scheme in updating the federated learning model to reduce transmission delay and improve spectrum efficiency. According to actual requirements, the present invention considers the situation of dual users to reduce the decoding complexity of SIC.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of federated learning, and in particular, relates to a method and system for optimizing allocation of communication resources and computing resources of a federated learning system. Background Art

[0002] With the rapid development of the Internet of Things and 5G technology, the Internet of Everything is becoming a reality. It is expected that tens of billions of IoT devices (such as smartphones, smart sensors, and wearable devices) will be connected to the Internet of Things. Due to the limitations of the resources of IoT devices themselves, computing tasks are often transmitted to remote cloud computing, but the huge amount of transmission will cause unacceptable delays in communication links. Fog computing is considered to be a promising computing paradigm. By providing cloud-like services at the edge of the network, it can significantly reduce the delay of data transmission and reduce the probability of link blocking. Compared with the cloud, the energy consumption of fog nodes is also significantly reduced.

[0003] In the Internet of Things, machine learning technology has achieved great success in the field of artificial intelligence. Image recognition and intelligent recommendation have long been deeply rooted in people's lives. Traditionally, service providers collect a large amount of user data and train a large number of samples in the data center to improve the effect of the model. However, user personal data is related to personal privacy and security. Once the data center is attacked or user data is leaked, the consequences will be disastrous. The introduction of federated learning provides a solution to privacy protection. By using user devices to train models with their own data, and then aggregating model parameters into a global model, all user data can be used, and then a global optimization model is obtained to protect data from being leaked. Because fog nodes are close to users, it is considered a promising method to aggregate global models by fog nodes.

[0004] Latency and energy consumption are the key performance of the system. Latency directly affects the stability of the system and the user experience, while energy consumption is related to the life cycle of the device. Traditional technologies only focus on latency or energy consumption, which will affect the overall performance of the system. By weighing the latency and energy consumption, different resource allocation schemes can be provided according to the needs of different users. Non-orthogonal multiple access (Non-Orthogonal Multiple Access) technology is introduced and combined with fog computing to support multiple user services at the same time, further reducing latency and energy consumption. Based on this, the present invention proposes a resource allocation optimization method and system based on federated learning. Summary of the invention

[0005] Based on the above status in the field, the present invention proposes a method and system for optimizing the allocation of communication resources and computing resources based on fog computing-assisted federated learning to minimize the weighted sum of delay and energy consumption. The present invention considers that the end user uploads model parameters to the fog node based on the non-orthogonal multiple access (NOMA) transmission protocol, quantifies the delay and energy consumption in the system, and determines the weighted sum of delay and energy consumption as the optimization target. For the NP-hard problem of the objective function, an alternating iterative algorithm is adopted, and the optimal closed solution of communication resources and computing resources is derived using the convex optimization analysis theory.

[0006] In order to achieve the above purpose, the present invention adopts the following technical solutions:

[0007] The present invention proposes a resource allocation method for federated learning, comprising the following steps:

[0008] S1. Initialize the training task and global model, and broadcast them to all users;

[0009] S2. The user updates the local model based on local data;

[0010] S3. Calculate latency and energy consumption;

[0011] S4. Determine the optimization objective function;

[0012] S5. Alternately iterate to solve the transmission power and calculate the frequency;

[0013] S6. Check whether the model accuracy meets the requirements or reaches the local maximum number of iterations. If yes, execute S7; if not, execute S2;

[0014] S7. The fog server receives the local model, aggregates all users and generates a new global model, which is broadcast to all users; determines whether the global loss function has reached convergence or the maximum number of global updates has been reached. If not, repeat S2-S6; if yes, end.

[0015] As a preference, S1. Local model training: Initialize training tasks and global models. In the initial stage, the fog server determines the task requirements and target applications. Initialize a global model The fog server broadcasts the global model to all local users.

[0016] As a preference, S2. Update the local model: local mobile user i (i∈N) receives the global model parameters (where t is the tth iteration), using local data through local calculation, for a given accuracy θ, the i-th user in the tth iteration seeks to minimize the local loss function The optimal parameters

[0017] As a preferred option, S3. Performance analysis: calculation delay and energy consumption.

[0018] Since the transmission power of fog servers is relatively large and they are generally powered by wires, we ignore the downlink delay and the energy consumption of fog servers, and mainly consider the computing energy consumption and transmission energy consumption of local users. The delay is mainly concentrated in the local computing delay and the uplink delay from the local to the fog server. The local delay can be expressed as:

[0019]

[0020] Where I represents the minimum number of loops under local model convergence, I = llog(1 / ξ), l represents a constant related to the local data type, and ξ represents the preset local precision. The local delay is related to the number of iteration loops, and the higher the preset precision, the more iteration loops, and the greater the local delay. i represents the number of CPU cycles required to process a data sample of the i-th user, D i Indicates the size of the i-th user data, f i Indicates the calculation frequency of the i-th user, which can be adjusted dynamically.

[0021] According to the NOMA theory, the fog server of the base station adopts the successive interference cancellation (SIC) coding technology. is the channel gain from the i-th user to the fog server. Without loss of generality, the channel gain of users is ranked as follows: According to existing research, a block fading channel is used, so the channel state information (CSI) remains unchanged in one resource block, but changes independently in different resource blocks. It is assumed that the base station knows the perfect channel state information of all users. In the uplink NOMA system, users with higher channel gain should be assigned larger transmit power. Therefore, it is assumed that the SIC decoding order is a decreasing sequence related to the channel gain, that is, the fog server first decodes the information transmitted by the Nth user, then decodes the N-1th user, and so on until the first user. Define p i represents the transmission power of the i-th user, then the signal-to-noise ratio (SNR) of the i-th user received by the fog server (the signal S received by the receiving end) 0 With the noise intensity N 0 The ratio of is:

[0022]

[0023] Among them, σ 2 Represents the zero-mean complex white Gaussian noise power (AWGN) in the channel.

[0024] Then the channel rate that can be achieved by the i-th user is:

[0025]

[0026] Therefore, when performing uplink transmission, the total transmission rate is:

[0027]

[0028] The transmission delay at this time is:

[0029]

[0030] Here L i Indicates the size of data transmitted by the i-th user.

[0031] User energy is mainly used for local model training and wireless data transmission. The energy consumption of a single CPU cycle processed by a user is kf i 2 , where k represents the capacitance coefficient, f i represents the computing frequency of the i-th user, so the energy consumption for local computing is expressed as:

[0032]

[0033] Among them, C i D i represents the number of CPU cycles required for one local model training iteration, and I represents the minimum number of cycles under local model convergence. The transmission energy consumption of uploading the i-th user local model parameters to the fog server is expressed as:

[0034]

[0035] Lemma: Consider a NOMA fog network in a single cell, where all users transmit their data to the fog server at the same transmission time.

[0036]

[0037] Proof: First, assume that N users transmit data to the fog server simultaneously through a sub-channel. The receiving end of the fog server adopts serial interference cancellation (SIC) technology and The channel gains are decoded in descending order. Assume that N users transmit their data to the fog server at the same transmission time. That is:

[0038]

[0039] That is:

[0040] because:

[0041]

[0042] Therefore, there are:

[0043]

[0044] therefore:

[0045]

[0046] Because the total transmission rate can be expressed as:

[0047]

[0048] Define the size of the data transferred as The transmission rate is The transmission time is:

[0049]

[0050] Now let N = 1, we can get T = L 1 / R 1 On the one hand, when N = 2, T = (L 1 +L 2 ) / (R 1 +R 2 ). On the other hand, L 1 / R 1 =(L 1 +L 2 ) / (R 1 +R 2 ), so L 1 / R 1 =L 2 / R 2 Similarly, we can get L 1 / R 1 =L 2 / R 2 =…=L N / R N , the proof is complete.

[0051] In existing research work, in order to reduce the decoding complexity of SIC technology, a multi-user grouping method is usually used. Considering that the channel gains of different users are different in actual scenarios, a channel gain interval user combination method with lower complexity is adopted, that is, users are divided based on user channel state information, users with good channel conditions are combined with users with poor channel conditions, and then user grouping is completed according to the binary dislocation principle. Considering that there are N users in the system, they can be divided into Group, where In the present invention, the focus is on the dual-user situation after grouping.

[0052] Therefore, the transmission delay in the dual-user scenario is known to be:

[0053]

[0054] The corresponding transmission energy consumption is:

[0055]

[0056] As a preferred embodiment, S4. Determine the optimization objective function

[0057] Considering the delay energy consumption weight and minimization as the optimization goal, the optimization function is established:

[0058]

[0059] st:(C1):L i p i γ -1 +I*k i D i f i 2 ≤E max i=1,2

[0060]

[0061] (C3):0≤p i ≤p max i=1,2

[0062] (C4):0≤f i ≤f max i=1,2

[0063] Where R 1,2 =Blog 2 (p 1 |h 1 | 2 +p 2 |h 2 | 2 +σ 2 ),

[0064] Among them, C1 represents the maximum energy consumption constraint when the user completes a single local iteration, C2 represents the maximum delay constraint when the user completes a single local iteration, and C3 and C4 indicate that the size of the transmission power and calculation frequency are limited by the user's own resources.

[0065] As a preferred method, S5. Solving the optimization problem

[0066] Considering that P0 is a non-convex problem, it is challenging to solve. Therefore, the present invention proposes to decompose P0 into two sub-problems P1 and P2, and solve the sub-problems in sequence using an alternating optimization solution until the solution converges.

[0067] Further, the step S5 comprises the steps of:

[0068] S5.1: Solve subproblem P1;

[0069] S5.2: Solve subproblem P2.

[0070] And in step S5.1, solve subproblem P1 and find the optimal calculation frequency based on the initial value:

[0071]

[0072]

[0073] (C2):IC i D i (T max -L i R 1,2 -1 )≤f i

[0074] (C3):0≤p i ≤p max

[0075] Lemma 1: P1 is a convex problem.

[0076] Proof: Let us assume that F(f i )=α i I*C i D i f i 2 +(1-α i )IC i D i / f i , taking the second derivative, we can get F”(f i )=2α i IK i D i +2(1-α i )IC i D i / f i 3 >0, so P1 is a convex function.

[0077] According to convex optimization theory, let F'(f i )=2(1-α i )I i D i f i -Iα i C i D i / f i2 =0, we can get:

[0078]

[0079] In step S5.2, the optimal transmission power is obtained by solving problem P2:

[0080]

[0081] st:(C1):p i (L 1 +L 2 )R 1,2 -1 +I*k i D i f i 2 ≤E max i=1,2

[0082]

[0083] (C3):0≤p i ≤p max i=1,2

[0084] Consider P2 as a non-convex problem, introduce the variable w, and Therefore, P2 can be transformed into P3:

[0085]

[0086] st:(C1):p i (L 1 +L 2 )R 1,2 -1 +I*k i D i f i 2 ≤E max i=1,2

[0087]

[0088] (C3):0≤p i ≤p max i=1,2

[0089] (C4):(L 1 +L 2 )(α 1 p 1 +α 1 p 1 +2-α 1 -α 2 )≤wR1,2

[0090] At this time, the Lagrangian function of problem P3 is:

[0091]

[0092] Among them, λ 1 ,λ 2 ,λ 3 ,λ 4 ,λ 5 represents the Lagrange multiplier. Since it is a convex function and satisfies the Slater condition, the KKT condition is a necessary and sufficient condition for obtaining the optimal solution. Therefore, the necessary condition for obtaining a feasible solution is:

[0093]

[0094]

[0095] Where Q = (p 1 |h 1 | 2 +p 2 |h 2 | 2 +σ 2 )|h i | 2 ln2

[0096] The dual condition is:

[0097] λ 1 (p i (L 1 +L 2 )+R 1,2 (I*kC i D i f i 2 -E max ))=0 (25)

[0098]

[0099] λ 3 p i =0,λ 4 (p i -p max )=0 (27)

[0100] λ 5 ((L 1 +L 2 )(α 1 p 1 +α 2 p 2 +2-α1 -α 2 )-wR 1,2 )=0 (28)

[0101] λ 1 ≥0,λ 2 ≥0,λ 3 ≥0,λ 4 ≥0,λ 5 ≥0 (29)

[0102] The original conditions are:

[0103] p i (L 1 +L 2 )+R 1,2 (I*k i D i f i 2 -E max )≤0 (30)

[0104]

[0105] -p i ≤0,p i -p max ≤0 (32)

[0106] (L 1 +L 2 )(α 1 p 1 +α 2 p 2 +2-α 1 -α 2 )-wR 1,2 ≤0 (33)

[0107] Similarly, from (23) we have λ 5 =1 / (wR 1,2 )≠0, (27) holds true, then (L 1 +L 2 )(α 1 p 1 +α 2 p 2 +2-α 1 -α 2 )-wR 1,2 =0. Because the transmission power p i If λ is not 0, 3 =0. At the same time, it can be seen that when λ 4 When p ≠ 0, i =p max , now discuss λ 4 =0,λ1 ,λ 2 Situation:

[0108] 1) When λ 4 =0,λ 1 ≠0,λ 2 = 0, to satisfy equation (25), that is,

[0109] λ 1 (p i (L 1 +L 2 )+R 1,2 (I*kC i D i f i 2 -E max ))=0 (34)

[0110] Using the Lambert W function, we can solve:

[0111]

[0112] Where a=(L 1 +L 2 ) / B(E max -I*kC i D i f i 2 ), d=p j |h j | 2 +σ 2 ,j=3-i.

[0113] 2) When λ 4 =0,λ 2 ≠0,λ 1 =0, to satisfy equation (27), we can get the following equation:

[0114]

[0115] It can be solved as:

[0116]

[0117] Where τ=(L 1 +L 2 ) / (B(T max -IC i D i / f i )).

[0118] 3) When λ 4 =0,λ 2 =0,λ1 = 0, to satisfy equations (24), (28) at this time p i Satisfy the following formula:

[0119]

[0120] From (28), we can get p 1 =(wBθ -1 -σ 2 -p 2 |h 2 | 2 )(|h 1 | 2 ) -1 , substitute (L 1 +L 2 )(α 1 p 1 +α 2 p 2 +2-α 1 -α 2 )-wR 1,2 =0,

[0121] Then we have:

[0122]

[0123] Where θ=(L 1 +L 2 )α i |h i | 2 ln2, A 1,2 =α 2 |h 1 | 2 -α 1 |h 2 | 2 At this time, p 2 Substituting back into (38) we can obtain p 1 .

[0124] 4) When λ 4 =0,λ 2 ≠0,λ 1 ≠0, which satisfies equations (25), (26), and (27). We can obtain:

[0125] p i =(T max -IC i D i f i -1 )(E max -I*kC i D i fi 2 ) / (L 1 +L 2 ) 2 ,(i=1,2) (40)

[0126] At this time, find the above four solutions respectively, determine whether they meet the constraints, and substitute them into P2. The minimum value is the optimal transmit power. Substitute the minimum transmit power into S5.1 until the optimal value converges.

[0127] As a preferred embodiment, S6: Assume that after the tth local iteration, the model accuracy meets the requirements or reaches the maximum number of iterations x max , user i transmits the tth model parameter Passed to the fog server for global aggregation.

[0128] Preferably, S7: after receiving the local model sent by the user, the fog server performs aggregation and generates an updated global model The latest global model is sent to all participants again. By minimizing the global loss function Repeat S2-S6 until the global loss function Convergence is reached or the termination condition is met.

[0129] The present invention also discloses a resource allocation optimization system based on federated learning, comprising the following modules:

[0130] Initialization module: initializes the training tasks and global model, and broadcasts them to all users;

[0131] Local model update module: users update local models based on local data;

[0132] Computing module: calculates latency and energy consumption;

[0133] Determine function module: determine the optimization objective function;

[0134] Solution module: alternately iterates to solve the transmission power and calculate the frequency;

[0135] Model accuracy judgment module: Check whether the model accuracy meets the requirements or reaches the local maximum number of iterations;

[0136] Global loss function judgment module: The fog server receives the local model, aggregates all users and generates a new global model, which is broadcast to all users; it determines whether the global loss function has reached convergence or reached the maximum number of global updates.

[0137] Compared with the prior art, the present invention has the following technical effects:

[0138] First, the present invention uses NOMA technology as a transmission scheme in the federated learning model update to reduce transmission delay and improve spectrum efficiency. According to actual requirements, the present invention considers the situation of dual users to reduce the decoding complexity of SIC.

[0139] Second, the present invention proposes to minimize the weighted sum of delay and energy consumption as the optimization goal. By adjusting the trade-off factor, the special requirements of different devices for delay or energy consumption can be met. The optimal transmission power and optimal computing frequency are derived using convex optimization theory to obtain the global optimal solution. BRIEF DESCRIPTION OF THE DRAWINGS

[0140] Figure 1 Network model diagram of a communication resource and computing resource allocation optimization method for a federated learning system.

[0141] Figure 2 A flow chart of a method for optimizing allocation of communication resources and computing resources for a federated learning system.

[0142] Figure 3 A block diagram of a system for optimizing the allocation of communication resources and computing resources for a federated learning system. DETAILED DESCRIPTION

[0143] The following describes the embodiments of the present invention through specific embodiments, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0144] Embodiment 1:

[0145] like Figure 1 As shown, this embodiment is based on the communication resource and computing resource allocation optimization method of the federated learning system with delay-energy consumption trade-off, and based on the fog-assisted Internet of Things scenario, the user uplink transmission power and computing frequency are derived through convex optimization theory.

[0146] The specific steps include:

[0147] S1. Local model training: Initialize training tasks and global models. In the initial stage, the fog server determines the task requirements and target applications. Initialize a global model The fog server broadcasts the global model to all local users.

[0148] S2. Update local model: Local mobile user i (i∈N) receives the global model parameters (where t is the tth iteration), using local data through local calculation, for a given accuracy θ, the i-th user in the tth iteration seeks to minimize the local loss function The optimal parameters

[0149] S3. Performance analysis: calculation latency and energy consumption.

[0150] Since the transmission power of fog servers is relatively large and they are generally powered by wires, we ignore the downlink delay and the energy consumption of fog servers, and mainly consider the computing energy consumption and transmission energy consumption of local users. The delay is mainly concentrated in the local computing delay and the uplink delay from the local to the fog server. The local delay can be expressed as:

[0151]

[0152] Where I represents the minimum number of loops under local model convergence, I = llog(1 / ξ), l represents a constant related to the local data type, and ξ represents the preset local precision. The local delay is related to the number of iteration loops, and the higher the preset precision, the more iteration loops, and the greater the local delay. i represents the number of CPU cycles required to process a data sample of the i-th user, D i Indicates the size of the i-th user data, f i Indicates the calculation frequency of the i-th user, which can be adjusted dynamically.

[0153] According to the NOMA theory, the fog server of the base station adopts the successive interference cancellation (SIC) coding technology. is the channel gain from the i-th user to the fog server. Without loss of generality, the channel gain of users is ranked as follows: According to existing research, a block fading channel is used, so the channel state information (CSI) remains unchanged in one resource block, but changes independently in different resource blocks. It is assumed that the base station knows the perfect channel state information of all users. In the uplink NOMA system, users with higher channel gain should be assigned larger transmit power. Therefore, it is assumed that the SIC decoding order is a decreasing sequence related to the channel gain, that is, the fog server first decodes the information transmitted by the Nth user, then decodes the N-1th user, and so on until the first user. Define p i represents the transmission power of the i-th user, then the signal-to-noise ratio (SNR) of the i-th user received by the fog server (the signal S received by the receiving end) 0 With the noise intensity N 0 The ratio of) is:

[0154]

[0155] Among them, σ 2Represents the zero-mean complex white Gaussian noise power (AWGN) in the channel.

[0156] Then the channel rate that can be achieved by the i-th user is:

[0157]

[0158] Therefore, when performing uplink transmission, the total transmission rate is:

[0159]

[0160] The transmission delay at this time is:

[0161]

[0162] Here L i Indicates the size of data transmitted by the i-th user.

[0163] User energy is mainly used for local model training and wireless data transmission. The energy consumption of a single CPU cycle processed by a user is kf i 2 , where k represents the capacitance coefficient, f i represents the computing frequency of the i-th user, so the energy consumption for local computing is expressed as:

[0164]

[0165] Among them, C i D i represents the number of CPU cycles required for one local model training iteration, and I represents the minimum number of cycles under local model convergence. The transmission energy consumption of uploading the i-th user local model parameters to the fog server is expressed as:

[0166]

[0167] Lemma: Consider a NOMA fog network in a single cell, where all users transmit their data to the fog server at the same transmission time.

[0168]

[0169] Proof: First, assume that N users transmit data to the fog server simultaneously through a sub-channel. The receiving end of the fog server adopts serial interference cancellation (SIC) technology and The channel gains are decoded in descending order. Assume that N users transmit their data to the fog server at the same transmission time. That is:

[0170]

[0171] That is:

[0172] because:

[0173]

[0174] Therefore, there are:

[0175]

[0176] therefore:

[0177]

[0178] Because the total transmission rate can be expressed as:

[0179]

[0180] Define the size of the data transferred as The transmission rate is The transmission time is:

[0181]

[0182] Now let N = 1, we can get T = L 1 / R 1 On the one hand, when N = 2, T = (L 1 +L 2 ) / (R 1 +R 2 ). On the other hand, L 1 / R 1 =(L 1 +L 2 ) / (R 1 +R 2 ), so L 1 / R 1 =L 2 / R 2 Similarly, we can get L 1 / R 1 =L 2 / R 2 =…=L N / R N , the proof is complete.

[0183] In existing research work, in order to reduce the decoding complexity of SIC technology, a multi-user grouping method is usually used. Considering that the channel gains of different users are different in actual scenarios, a channel gain interval user combination method with lower complexity is adopted, that is, users are divided based on user channel state information, users with good channel conditions are combined with users with poor channel conditions, and then user grouping is completed according to the binary dislocation principle. Considering that there are N users in the system, they can be divided into Group, where In the present invention, the focus is on the dual-user situation after grouping.

[0184] Therefore, the transmission delay in the dual-user scenario is known to be:

[0185]

[0186] The corresponding transmission energy consumption is:

[0187]

[0188] S4. Determine the optimization objective function

[0189] Considering the delay energy consumption weight and minimization as the optimization goal, the optimization function is established:

[0190]

[0191] st:(C1):L i p i γ -1 +I*k i D i f i 2 ≤E max i=1,2

[0192]

[0193] (C3):0≤p i ≤p max i=1,2

[0194] (C4):0≤f i ≤f max i=1,2

[0195] Where R 1,2 =Blog 2 (p 1 |h 1 | 2 +p 2 |h 2 | 2 +σ 2 ), C1 represents the maximum energy consumption constraint when a user completes a single local iteration, C2 represents the maximum delay constraint when a user completes a single local iteration, and C3 and C4 indicate that the transmission power and computing frequency are limited by the user's own resources.

[0196] S5. Solving optimization problems

[0197] Considering that P0 is a non-convex problem, it is challenging to solve. Therefore, the present invention proposes to decompose P0 into two sub-problems P1 and P2, and solve the sub-problems in sequence using an alternating optimization solution until the solution converges.

[0198] Further, the step S5 comprises the steps of:

[0199] S5.1: Solve subproblem P1;

[0200] S5.2: Solve subproblem P2.

[0201] And in step S5.1, solve subproblem P1 and find the optimal calculation frequency based on the initial value:

[0202]

[0203]

[0204] (C2):IC i D i (T max -L i R 1,2 -1 )≤f i

[0205] (C3):0≤p i ≤p max

[0206] Lemma 1: P1 is a convex problem.

[0207] Proof: Assume that F(f i )=α i I*C i D i f i 2 +(1-α i )IC i D i / f i , taking the second derivative, we can get F”(f i )=2α i IK i D i +2(1-α i )IC i D i / f i 3 >0, so P1 is a convex function.

[0208] According to convex optimization theory, let F'(f i )=2(1-α i )Ii D i f i -Iα i C i D i / f i 2 =0, we can get:

[0209]

[0210] In step S5.2, the optimal transmission power is obtained by solving problem P2:

[0211]

[0212] st:(C1):p i (L 1 +L 2 )R 1,2 -1 +I*k i D i f i 2 ≤E max i=1,2

[0213]

[0214] (C3):0≤p i ≤p max i=1,2

[0215] Consider P2 as a non-convex problem, introduce w, and Therefore, P2 can be transformed into P3:

[0216]

[0217] st:(C1):p i (L 1 +L 2 )R 1,2 -1 +I*k i D i f i 2 ≤E max i=1,2

[0218]

[0219] (C3):0≤p i ≤p max i=1,2

[0220] (C4):(L 1 +L 2)(α 1 p 1 +α 1 p 1 +2-α 1 -α 2 )≤wR 1,2

[0221] At this time, the Lagrangian function of problem P3 is:

[0222]

[0223] Among them, λ 1 ,λ 2 ,λ 3 ,λ 4 ,λ 5 represents the Lagrange multiplier. Since it is a convex function and satisfies the Slater condition, the KKT condition is a necessary and sufficient condition for obtaining the optimal solution. Therefore, the necessary condition for obtaining a feasible solution is:

[0224]

[0225]

[0226] Where Q = (p 1 |h 1 | 2 +p 2 |h 2 | 2 +σ 2 )|h i | 2 ln2

[0227] The dual condition is:

[0228] λ 1 (p i (L 1 +L 2 )+R 1,2 (I*k i D i f i 2 -E max ))=0 (25)

[0229]

[0230] λ 3 p i =0,λ 4 (p i -p max )=0 (27)

[0231] λ 5((L 1 +L 2 )(α 1 p 1 +α 2 p 2 +2-α 1 -α 2 )-wR 1,2 )=0 (28)

[0232] λ 1 ≥0,λ 2 ≥0,λ 3 ≥0,λ 4 ≥0,λ 5 ≥0 (29)

[0233] The original conditions are:

[0234] p i (L 1 +L 2 )+R 1,2 (I*k i D i f i 2 -E max )≤0 (30)

[0235]

[0236] -p i ≤0,p i -p max ≤0 (32)

[0237] (L 1 +L 2 )(α 1 p 1 +α 2 p 2 +2-α 1 -α 2 )-wR 1,2 ≤0 (33)

[0238] Similarly, according to formula (23), we can get λ 5 =1 / (wR 1,2 )≠0; in this case, to satisfy (27), we can get (L 1 +L 2 )(α 1 p 1 +α 2 p 2 +2-α 1 -α 2 )-wR 1,2 =0. Because the transmission power p icannot be 0, so to satisfy equation (27), λ 3 = 0. At the same time, it can be seen that when λ 4 When p ≠ 0, i =p max , now discuss λ 4 =0,λ 1 ,λ 2 Situation:

[0239] 1) When λ 4 =0,λ 1 ≠0,λ 2 = 0, to satisfy equation (25), that is,

[0240] λ 1 (p i (L 1 +L 2 )+R 1,2 (I*k i D i f i 2 -E max ))=0 (34)

[0241] Using the Lambert W function, we can solve:

[0242]

[0243] Where a=(L 1 +L 2 ) / B(E max -I*kC i D i f i 2 ), d=p j |h j | 2 +σ 2 ,j=3-i.

[0244] 2) When λ 4 =0,λ 2 ≠0,λ 1 =0, to satisfy equation (27), we can get the following equation:

[0245]

[0246] It can be solved as:

[0247]

[0248] Where τ=(L 1 +L 2 ) / (B(T max -ICi D i / f i )).

[0249] 3) When λ 4 =0,λ 2 =0,λ 1 = 0, to satisfy equations (24), (28) at this time p i Satisfy the following formula:

[0250]

[0251] From formula (28), we can get p 1 =(wBθ -1 -σ 2 -p 2 |h 2 v 2 )(|h 1 | 2 ) -1 , substitute (L 1 +L 2 )(α 1 p 1 +α 2 p 2 +2-α 1 -α 2 )-wR 1,2 =0,

[0252] After finishing, we get:

[0253]

[0254] Where θ=(L 1 +L 2 )α i |h i | 2 ln2, A 1,2 =α 2 |h 1 | 2 -α 1 |h 2 | 2 At this time, p 2 Substituting back into (38) we can obtain p 1 .

[0255] 4) When λ 4 =0,λ 2 ≠0,λ 1 ≠0, which satisfies equations (25), (26), and (27). We can obtain:

[0256] p i =(T max -ICi D i f i -1 )(E max -I*kC i D i f i 2 ) / (L 1 +L 2 ) 2 ,(i=1,2) (40)

[0257] At this time, find the above four solutions respectively, determine whether they meet the constraints, and substitute them into P2. The minimum value is the optimal transmit power. Substitute the minimum transmit power into S5.1 until the optimal value converges.

[0258] S6: Assume that after the tth local iteration, the model accuracy meets the requirements or reaches the maximum number of iterations χ max , user i transmits the tth model parameter Passed to the fog server for global aggregation.

[0259] S7: After receiving the local model sent by the user, the fog server performs aggregation and generates an updated global model The latest global model is sent to all participants again. By minimizing the global loss function Repeat S2-S6 until the global loss function Convergence is reached or the termination condition is met.

[0260] Embodiment 2

[0261] like Figure 3 As shown, a resource allocation optimization system based on federated learning includes the following modules:

[0262] Initialization module: initializes the training tasks and global model, and broadcasts them to all users;

[0263] Local model update module: users update local models based on local data;

[0264] Computing module: calculates latency and energy consumption;

[0265] Determine function module: determine the optimization objective function;

[0266] Solution module: alternately iterates to solve the transmission power and calculate the frequency;

[0267] Model accuracy judgment module: Check whether the model accuracy meets the requirements or reaches the local maximum number of iterations;

[0268] Global loss function judgment module: The fog server receives the local model, aggregates all users and generates a new global model, which is broadcast to all users; it determines whether the global loss function has reached convergence or reached the maximum number of global updates.

[0269] The above description is only a detailed description of the preferred embodiments and principles of the present invention. For ordinary technicians in this field, according to the ideas provided by the present invention, there will be changes in the specific implementation methods, and these changes should also be regarded as the protection scope of the present invention.

Claims

1. A method for optimizing resource allocation based on federated learning, characterized by Follow these steps: S1. Initialize the training task and global model, and broadcast them to all users; S2. The user updates the local model based on local data; S3. Calculate latency and energy consumption; S4. Determine the optimization objective function; S5. Alternately iterate to solve the transmission power and calculate the frequency; S6. Check whether the model accuracy meets the requirements or reaches the local maximum number of iterations. If so, execute step S7; if not, execute step S2; S7. The fog server receives the local model, aggregates all users and generates a new global model, which is broadcast to all users; determines whether the global loss function has reached convergence or the maximum number of global updates has been reached. If not, repeats steps S2-S6; if yes, ends; Step S1 is as follows: In the initial stage, the fog server determines the task requirements and target applications; initializes a global model The fog server broadcasts the global model to all local users; Step S2 is as follows: local mobile user i receives the global model parameters Where i∈N, t is the tth iteration, using local data through local calculation, for a given accuracy θ, the i-th user seeks to minimize the local loss function The optimal parameters Step S3 is as follows: The delay is mainly concentrated in the local computing delay and the uplink delay from the local to the fog server. The local delay is expressed as: Where I represents the minimum number of loops under local model convergence, I = llog(1 / ξ), l represents a constant related to the local data type, and ξ represents the preset local precision; the local delay is related to the number of iteration loops, and the higher the preset precision, the more iteration loops, and the greater the local delay; C i represents the number of CPU cycles required to process a data sample of the i-th user, D i Indicates the size of the i-th user data, f i Indicates the calculation frequency of the i-th user, which can be adjusted dynamically; definition is the channel gain from the i-th user to the fog server. Without loss of generality, the channel gain of users is ranked as follows: Assume that the SIC decoding order is a decreasing sequence related to the channel gain, that is, the fog server first decodes the information transmitted by the Nth user, then decodes the N-1th user, and so on until the first user; define p i represents the transmission power of the i-th user, then the signal-to-noise ratio of the i-th user received by the fog server is: Among them, σ 2 represents the zero-mean complex white Gaussian noise power in the channel; The channel rate achieved by the i-th user is: When performing uplink transmission, the total transmission rate is: The transmission delay at this time is: User energy is mainly used for local model training and wireless data transmission. The energy consumption of a single CPU cycle processed by a user is kf i 2 , where k represents the capacitance coefficient, so the energy consumption for local calculation is expressed as: Among them, C i D i Represents the number of CPU cycles required for one local model training iteration; the transmission energy consumption of uploading local model parameters to the fog server is expressed as: Consider a NOMA fog network in a single cell, where all users transmit their data to the fog server at the same transmission time, i.e.: Assume that N users transmit data to the fog server simultaneously through a sub-channel. The channel gains are decoded in the order of decreasing gain; suppose N users transmit their data to the fog server at the same transmission time, that is: That is: because: Therefore, there are: therefore: Since the total transfer rate is expressed as: Define the size of the data transferred as The transmission rate is The transmission time is: At this time, let N = 1, and we get T = L1 / R1; on the one hand, when N = 2, T = (L1+L2) / (R1+R2); on the other hand, L1 / R1=(L1+L2) / (R1+R2), so L1 / R1=L2 / R2; similarly, L1 / R1=L2 / R2=…=L N / R N ; It is known that the transmission delay in the dual-user scenario is: The corresponding transmission energy consumption is: Step S4 is specifically as follows: Considering the delay energy consumption weight and minimization as the optimization goal, the optimization function is established: st:(C1):L i p i γ -1 +I*kC i D i f i 2 ≤E max i=1,2 (C2): (C3):0≤p i ≤p max i=1,2 (C4):0≤f i ≤f max i=1,2 Among them, R 1,2 =Blog2(p1|h1| 2 +p2|h2| 2 +σ 2 ), C1 represents the maximum energy consumption constraint when a user completes a single local iteration, C2 represents the maximum delay constraint when a user completes a single local iteration, and C3 and C4 represent that the transmission power and computing frequency are limited by the user's own resources. Step S5 is specifically as follows: S5.1, solve subproblem P1, and find the optimal calculation frequency based on the initial value: (C2):IC i D i (T max -L i R 1,2 -1 )≤f i (C3):0≤p i ≤p max P1 is a convex problem; Let F(f i )=α i IK i D i f i 2 +(1-α i )IC i D i / f i , then F”(f i )=2α i IK i D i +2(1-α i )IC i D i / f i 3 >0, so P1 is a convex function; According to convex optimization theory, let F'(f i )=2(1-α i )I*kC i D i f i -Iα i C i D i / f i 2 =0, and we get: S5.2, the optimal transmission power is obtained by solving problem P2: st:(C1):p i (L1+L2)R 1,2 -1 +I*kC i D i f i 2 ≤E max i=1,2 (C2): (C3):0≤p i ≤p max i=1,2 Consider P2 as a non-convex problem, introduce w, and So convert P2 to P3: st:(C1):p i (L1+L2)R 1,2 -1 +I*kC i D i f i 2 ≤E max i=1,2 (C2): (C3):0≤p i ≤p max i=1,2 (C4):(L1+L2)(α1p1+α1p1+2-α1-α2)≤wR 1,2 At this time, the Lagrangian function of problem P3 is: Among them, λ1,λ2,λ3,λ4,λ5 represent Lagrange multipliers. Since it is a convex function and satisfies the Slater condition, the KKT condition is a necessary and sufficient condition for obtaining the optimal solution. Therefore, the necessary condition for obtaining a feasible solution is: Where Q = (p1|h1| 2 +p2|h2| 2 +σ 2 )|h i | 2 ln2; The dual condition is: λ1(p i (L1+L2)+R 1,2 (IkC i D i f i 2 -E max ))=0 (25) λ3p i =0,λ4(p i -p max )=0 (27) λ5((L1+L2)(α1p1+α2p2+2-α1-α2)-wR 1,2 )=0 (28) λ1≥0,λ2≥0,λ3≥0,λ4≥0,λ5≥0 (29) The original conditions are: p i (L1+L2)+R 1,2 (I*kC i D i f i 2 -E max )≤0 (30) -p i ≤0,p i -p max ≤0 (32)(L1+L2) (α1p1+α2p2+2-α1-α2)-wR 1,2 ≤0 (33) Similarly, according to formula (23), λ5=1 / (wR 1,2 )≠0; in this case, to satisfy equation (27), we get (L1+L2)(α1p1+α2p2+2-α1-α2)-wR 1,2 =0, because the transmission power p i It is impossible to be 0, so to satisfy equation (27), λ3=0. At the same time, we know that when λ4≠0, p i =p max , now let’s discuss the case where λ4=0,λ1,λ2: 1) When λ4=0,λ1≠0,λ2=0, to satisfy equation (25), that is: λ1(p i (L1+L2)+R 1,2 (IkC i D i f i 2 -E max ))=0 (34) Using Lambert's W function, we can get: Where a = (L1 + L2) / B (E max -IkC i D i f i 2 ), d=p j |h j | 2 +σ 2 ,(j=3-i); 2) When λ4=0,λ2≠0,λ1=0, to satisfy equation (27), the following equation is obtained: The solution is: Where τ=(L1+L2) / (B(T max -IC i D i / f i )); 3) When λ4=0,λ2=0,λ1=0, to satisfy equations (24) and (28), p i Satisfy the following formula: From equation (28), we have p1 = (wBθ -1 -σ 2 -p2|h2| 2 )(|h1| 2 ) -1 , substitute (L1+L2)(α1p1+α2p2+2-α1-α2)-wR 1,2 =0, we get: Where θ = (L1 + L2)α i |h i | 2 ln2, A 1,2 =α2|h1| 2 -α1|h2| 2 ; Now substitute p2 back into (38) to obtain p1; 4) When λ4=0,λ2≠0,λ1≠0, in order to satisfy equations (25), (26), (27), we can obtain: p i =(T max -IC i D i f i -1 )(E max -IkC i D i f i 2 ) / (L1+L2) 2 ,(i=1,2) (40) Calculate the above four solutions respectively, determine whether they meet the constraints, and substitute them into P2. The minimum value is the optimal transmit power. Substitute the minimum transmit power into step S5.1 until the optimal value converges.

2. The method for optimizing resource allocation based on federated learning as claimed in claim 1, characterized in that: Step S6 is as follows: Assume that after the tth local iteration, the model accuracy meets the requirement or reaches the maximum number of iterations x max , user i transmits the tth model parameter Passed to the fog server for global aggregation.

3. The method for optimizing resource allocation based on federated learning as claimed in claim 2, characterized in that: Step S7 is as follows: After receiving the local model sent by the user, the fog server performs aggregation and generates an updated global model The latest global model is sent to all participants again; by minimizing the global loss function Repeat steps S2-S6 until the global loss function Convergence is reached or the termination condition is met.

4. A resource allocation optimization system based on federated learning, characterized by Includes the following modules: Initialization module: initializes the training tasks and global model, and broadcasts them to all users; Local model update module: users update local models based on local data; Computing module: calculates latency and energy consumption; Determine function module: determine the optimization objective function; Solution module: alternately iterates to solve the transmission power and calculate the frequency; Model accuracy judgment module: Check whether the model accuracy meets the requirements or reaches the local maximum number of iterations; Global loss function judgment module: The fog server receives the local model, aggregates all users and generates a new global model, which is broadcast to all users; it judges whether the global loss function has reached convergence or reached the maximum number of global updates; The initialization module is as follows: In the initial stage, the fog server determines the task requirements and target applications; initializes a global model The fog server broadcasts the global model to all local users; The local model update module is as follows: local mobile user i receives the global model parameters Where i∈N, t is the tth iteration, using local data through local calculation, for a given accuracy θ, the i-th user seeks to minimize the local loss function The optimal parameters The calculation modules are as follows: The delay is mainly concentrated in the local computing delay and the uplink delay from the local to the fog server. The local delay is expressed as: Where I represents the minimum number of loops under local model convergence, I = elog (1 / ξ), l represents a constant related to the local data type, and ξ represents the preset local precision; the local delay is related to the number of iteration loops, and the higher the preset precision, the more iteration loops, and the greater the local delay; C i represents the number of CPU cycles required to process a data sample of the i-th user, D i Indicates the size of the i-th user data, f i Indicates the calculation frequency of the i-th user, which can be adjusted dynamically; definition is the channel gain from the i-th user to the fog server. Without loss of generality, the channel gain of users is ranked as follows: Assume that the SIC decoding order is a decreasing sequence related to the channel gain, that is, the fog server first decodes the information transmitted by the Nth user, then decodes the N-1th user, and so on until the first user; define p i represents the transmission power of the i-th user, then the signal-to-noise ratio of the i-th user received by the fog server is: Among them, σ 2 represents the zero-mean complex white Gaussian noise power in the channel; The channel rate achieved by the i-th user is: When performing uplink transmission, the total transmission rate is: The transmission delay at this time is: User energy is mainly used for local model training and wireless data transmission. The energy consumption of a single CPU cycle processed by a user is kf i 2 , where k represents the capacitance coefficient, so the energy consumption for local calculation is expressed as: Among them, C i D i Represents the number of CPU cycles required for one local model training iteration; the transmission energy consumption of uploading local model parameters to the fog server is expressed as: Consider a NOMA fog network in a single cell, where all users transmit their data to the fog server at the same transmission time, i.e.: Assume that N users transmit data to the fog server simultaneously through a sub-channel. The channel gains are decoded in the order of decreasing gain; suppose N users transmit their data to the fog server at the same transmission time, that is: That is: because: Therefore, there are: therefore: Since the total transfer rate is expressed as: Define the size of the data transferred as The transmission rate is The transmission time is: At this time, let N = 1, and we get T = L1 / R1; on the one hand, when N = 2, T = (L1+L2) / (R1+R2); on the other hand, L1 / R1 = (L1+L2) / (R1+R2), so L1 / R1 = L2 / R2; similarly, we get L1 / R1 = L2 / R2 = ... = L N / R N ; It is known that the transmission delay in the dual-user scenario is: The corresponding transmission energy consumption is: Determine the function module as follows: Considering the delay energy consumption weight and minimization as the optimization goal, the optimization function is established: st:(C1):L i p i γ -1 +I*kC i D i f i 2 ≤E max i=1,2 (C2): (C3):0≤p i ≤p max i=1,2 (C4):0≤f i ≤f max i=1,2 Among them, R 1,2 =Blog2(p1|h1| 2 +p2|h2| 2 +σ 2 ), C1 represents the maximum energy consumption constraint when a user completes a single local iteration, C2 represents the maximum delay constraint when a user completes a single local iteration, and C3 and C4 represent that the transmission power and computing frequency are limited by the user's own resources. The solution modules are as follows: S5.1, solve subproblem P1, and find the optimal calculation frequency based on the initial value: (C2):IC i D i (T max -L i R 1,2 -1 )≤f i (C3):0≤p i ≤p max P1 is a convex problem; Let F(f i )=α i IK i D i f i 2 +(1-α i )IC i D i / f i , then F”(f i )=2α i IK i D i +2(1-α i )IC i D i / f i 3 >0, so P1 is a convex function; According to convex optimization theory, let F'(f i )=2(1-α i )I*kC i D i f i -Iα i C i D i / f i 2 =0, and we get: S5.2, the optimal transmission power is obtained by solving problem P2: st:(C1):p i (L1+L2)R 1,2 -1 +I*kC i D i f i 2 ≤E max i=1,2 (C2): (C3):0≤p i ≤p max i=1,2 Consider P2 as a non-convex problem, introduce w, and So convert P2 to P3: st:(C1):p i (L1+L2)R 1,2 -1 +I*kC i D i f i 2 ≤E max i=1,2 (C2): (C3):0≤p i ≤p max i=1,2 (C4):(L1+L2)(α1p1+α1p1+2-α1-α2)≤wR 1,2 At this time, the Lagrangian function of problem P3 is: Among them, λ1,λ2,λ3,λ4,λ5 represent Lagrange multipliers. Since it is a convex function and satisfies the Slater condition, the KKT condition is a necessary and sufficient condition for obtaining the optimal solution. Therefore, the necessary condition for obtaining a feasible solution is: Where Q = (p1|h1| 2 +p2|h2| 2 +σ 2 )|h i | 2 ln2; The dual condition is: λ1(p i (L1+L2)+R 1,2 (IkC i D i f i 2 -E max ))=0 (25) λ3p i =0,λ4(p i -p max )=0 (27) λ5((L1+L2)(α1p1+α2p2+2-α1-α2)-wR 1,2 )=0 (28) λ1≥0,λ2≥0,λ3≥0,λ4≥0,λ5≥0 (29) The original conditions are: p i (L1+L2)+R 1,2 (I*kC i D i f i 2 -E max )≤0 (30) -p i ≤0,p i -p max ≤0 (32) (L1+L2)(α1p1+α2p2+2-α1-α2)-wR 1,2 ≤0 (33) Similarly, according to formula (23), λ5=1 / (wR 1,2 )≠0; in this case, to satisfy equation (27), we get (L1+L2)(α1p1+α2p2+2-α1-α2)-wR 1,2 =0, because the transmission power p i It is impossible to be 0, so to satisfy equation (27), λ3=0. At the same time, we know that when λ4≠0, p i =p max , now let’s discuss the case where λ4=0,λ1,λ2: 1) When λ4=0,λ1≠0,λ2=0, to satisfy equation (25), that is: λ1(p i (L1+L2)+R 1,2 (IkC i D i f i 2 -E max ))=0 (34) Using Lambert's W function, we can get: Where a = (L1 + L2) / B (E max -IkC i D i f i 2 ), d=p j |h j | 2 +σ 2 ,(j=3-i); 2) When λ4=0,λ2≠0,λ1=0, to satisfy equation (27), the following equation is obtained: The solution is: Where τ=(L1+L2) / (B(T max -IC i D i / f i )); 3) When λ4=0,λ2=0,λ1=0, to satisfy equations (24) and (28), p i Satisfy the following formula: From equation (28), we have p1 = (wBθ -1 -σ 2 -p2|h2| 2 )(|h1| 2 ) -1 , substitute (L1+L2)(α1p1+α2p2+2-α1-α2)-wR 1,2 =0, we get: Where θ = (L1 + L2)α i |h i | 2 ln2, A 1,2 =α2|h1| 2 -α1|h2| 2 ; Now substitute p2 back into (38) to obtain p1; 4) When λ4=0,λ2≠0,λ1≠0, in order to satisfy equations (25), (26), (27), we can obtain: p i =(T max -IC i D i f i -1 )(E max -IkC i D i f i 2 ) / (L1+L2) 2 ,(i=1,2) (40) Calculate the above four solutions respectively, determine whether they meet the constraints, and substitute them into P2. The minimum value is the optimal transmit power. Substitute the minimum transmit power into step S5.1 until the optimal value converges.

Citation Information

Patent Citations

  • User selection and resource allocation method based on federated learning

    CN111866954A