A Dynamic Gradient Tracking Method for Decentralized Federated Learning

CN122578614APending Publication Date: 2026-08-14SOUTH CHINA AGRICULTURAL UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-21
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0005]针对现有技术的不足,本发明旨在解决现有去中心化联邦学习算法在时变网络下因数据异构和拓扑动态变化引发的模型偏移问题,从而改善训练精度和收敛速度;具体而言,现有方法面临三大挑战:其一,客户端数据分布异构(Non-IID)导致本地模型更新方向不一致,产生客户端漂移;其二,移动设备网络拓扑动态变化,而现有梯度追踪方法通常假设拓扑固定,拓扑变化会导致追踪变量累计误差,加剧模型偏移;其三,现有方法多仅支持单步本地更新,通信开销高,或虽支持多步更新但难以适应时变网络,难以兼顾通信效率与训练稳定性

Benefits of technology

[0035]与现有技术相比,本发明提供了一种面向去中心化联邦学习的动态梯度追踪方法,具备以下多方面的有益效果:(1)本发明允许每个客户端在每轮通信中执行K次本地更新,从而降低通信开销;同时,引入基于K步平均梯度的追踪变量用于估计全局梯度,校正因数据异构引起的本地更新漂移。(2)此外,本发明设计了拓扑感知的动态校正参数更新机制,当网络拓扑发生变化时自动重置追踪变量,有效避免历史误差的累积传播。(3)由于去中心化联邦学习的客户端漂移问题,本质上源于局部目标与全局目标的不一致,本发明通过引入梯度追踪变量,每个客户端的本地更新得以向全局梯度靠拢,从而有效校正数据异构导致的优化漂移。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122578614A_ABST
    Figure CN122578614A_ABST
Patent Text Reader

Abstract

This invention discloses a dynamic gradient tracking method for decentralized federated learning, which has the following advantages: (1) This invention allows each client to perform K local updates in each round of communication, thereby reducing communication overhead; at the same time, a tracking variable based on the K-step average gradient is introduced to estimate the global gradient and correct the local update drift caused by data heterogeneity. (2) In addition, this invention designs a topology-aware dynamic correction parameter update mechanism, which automatically resets the tracking variable when the network topology changes, effectively avoiding the cumulative propagation of historical errors. (3) Since the client drift problem in decentralized federated learning is essentially due to the inconsistency between the local target and the global target, this invention introduces a gradient tracking variable, which allows the local updates of each client to move closer to the global gradient, thereby effectively correcting the optimization drift caused by data heterogeneity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of distributed machine learning technology, and particularly to decentralized federated learning for time-varying networks, specifically a dynamic gradient tracking method for decentralized federated learning. Background Technology

[0002] In the field of distributed machine learning, federated learning (FL), as an emerging distributed learning paradigm, allows clients to collaboratively train models without exchanging raw data, offering significant advantages in privacy protection. Traditional federated learning architectures typically rely on a central server to aggregate model updates from each client. However, when the number of clients is large, the server must handle massive amounts of communication, easily leading to latency and bandwidth pressure, thus limiting its practical application in resource-constrained or dynamic environments. To overcome the limitations of centralized federated learning, decentralized federated learning (DFL) is employed. In this architecture, the central server is completely removed, and each client communicates only with its network neighbors, achieving final consensus on the entire network model through local model exchange.

[0003] However, due to the heterogeneity of client data distribution, the update direction of the local model may be inconsistent, leading to slow convergence of the global model or even getting stuck in a suboptimal solution, thus causing client drift. Existing research shows that gradient tracking technology, by maintaining an auxiliary variable to estimate the global gradient in a static network, can alleviate drift caused by data heterogeneity to some extent. However, it usually assumes a static network topology and is difficult to apply directly to decentralized federated learning scenarios. In real-world deployment environments, such as mobile device networks and vehicular ad hoc networks, clients may join or leave the network at any time, and communication links may be interrupted or restored due to signal fluctuations. This time-varying network topology causes the original gradient tracking variable to accumulate errors, further exacerbating client drift and reducing model performance. Summary of the Invention

[0004] (a) Technical problems to be solved

[0005] To address the shortcomings of existing technologies, this invention aims to solve the model drift problem caused by data heterogeneity and dynamic topology changes in time-varying networks in existing decentralized federated learning algorithms, thereby improving training accuracy and convergence speed. Specifically, existing methods face three major challenges: First, heterogeneous client data distribution (Non-IID) leads to inconsistent local model update directions, resulting in client drift. Second, mobile device network topology changes dynamically, while existing gradient tracking methods typically assume a fixed topology; topology changes cause accumulated errors in tracking variables, exacerbating model drift. Third, existing methods mostly support only single-step local updates, resulting in high communication overhead, or while supporting multi-step updates, they are difficult to adapt to time-varying networks, making it difficult to balance communication efficiency and training stability. Therefore, this invention proposes a dynamic gradient tracking method for decentralized federated learning, which effectively suppresses client drift, reduces communication overhead, and improves the convergence speed and accuracy of the model in dynamic environments through tracking variables of K-step average gradient and a topology-aware adaptive correction mechanism.

[0006] (II) Technical Solution

[0007] To address the aforementioned technical problems, this invention provides the following technical solution: a dynamic gradient tracking method for decentralized federated learning, comprising the following steps:

[0008] S1. Decentralized knowledge sharing based on dynamic K-step gradient tracking: Taking the client as the main body, decentralized knowledge sharing and global model collaborative optimization are achieved through K-step local gradient iteration and gradient tracking variable construction.

[0009] S2. In the process of decentralized knowledge sharing based on dynamic K-step gradient tracking, a topology-aware dynamic correction parameter update mechanism is introduced to adjust the gradient correction parameters in real time.

[0010] Preferably, decentralized knowledge sharing based on dynamic K-step gradient tracking includes the following three stages: local gradient iteration and correction, global gradient approximation estimation, and decentralized weighted aggregation.

[0011] Preferably, the local gradient iteration and correction includes the following steps S11-S12:

[0012] S11. Initialize local iteration: Client Retrieves the aggregation model obtained after the previous round of communication from local storage. and the gradient correction parameters for the current round. Set the initial values ​​of the local model. ;

[0013] S12, Execute K-step local updates in a loop: For Repeat the following sub-steps S121-S122:

[0014] S121. Sample mini-batch data and calculate stochastic gradients: Client From local dataset Randomly sample a small batch of data Calculate the loss function with respect to the current model parameters. stochastic gradient at The specific process is shown in equation (1) below:

[0015] (1);

[0016] S122, Overlay correction parameters and update the local model: Combine the stochastic gradient with the correction parameters of the current round. Add to compensate for the current local offset; using the learning rate Perform stochastic gradient descent to obtain the local model parameters for k steps; the specific process is shown in equation (2) below:

[0017] (2).

[0018] Preferably, the global gradient approximation includes the following step S13:

[0019] S13. Construct gradient tracking variables: After completing K-step local updates, the client... The model is composed of Updated to The cumulative change is obtained as Divide the cumulative change by Obtain the average gradient over K steps. The specific process is shown in equation (3) below:

[0020] (3).

[0021] Preferably, decentralized weighted aggregation includes the following steps S14-S16:

[0022] S14. Constructing a weight matrix based on network topology: Calculate the mixing matrix using the Metropolis-Hastings rule based on the current network topology. The specific process is shown in equation (4) below:

[0023] (4);

[0024] in, Represents a node The number of neighbors in the current topology;

[0025] S15, Exchange Neighbor Information: Client Update the model locally and gradient tracking variables Send to the current communication round All neighboring nodes At the same time, receive the corresponding model from the neighbor. and gradient tracking variables ;

[0026] S16, Weighted Aggregation: Client Using the received neighbor model and the constructed weight matrix, weighted aggregation is performed to obtain the aggregation model for the next round. The specific process is shown in equation (5) below:

[0027] (5).

[0028] Preferably, the topology-aware dynamic correction parameter update mechanism is divided into the following two strategies according to the changes in network topology: an cumulative update strategy is used when the network topology remains unchanged, and a dynamic reset strategy is used when the network topology changes.

[0029] Preferably, the cumulative update strategy includes: retaining the correction parameters from the previous round and overlaying them with the current round's client data. The deviation information between the gradient estimate and the average gradient estimate of its neighboring nodes is used to update the correction parameters. The specific process is shown in the following equation (6):

[0030] (6);

[0031] in, For nodes The correction parameters for the current round, For neighboring nodes gradient tracking variables, It is a mixed weight matrix.

[0032] Preferably, the dynamic reset strategy includes: recalculating the correction parameters only based on the gradient tracking variables of the current round, as shown in equation (7) below:

[0033] (7).

[0034] (III) Beneficial Effects

[0035] Compared with existing technologies, this invention provides a dynamic gradient tracking method for decentralized federated learning, which has the following advantages: (1) This invention allows each client to perform K local updates in each round of communication, thereby reducing communication overhead; at the same time, a tracking variable based on the K-step average gradient is introduced to estimate the global gradient and correct the local update drift caused by data heterogeneity. (2) In addition, this invention designs a topology-aware dynamic correction parameter update mechanism, which automatically resets the tracking variable when the network topology changes, effectively avoiding the cumulative propagation of historical errors. (3) Since the client drift problem in decentralized federated learning is essentially due to the inconsistency between the local target and the global target, this invention introduces a gradient tracking variable, which allows the local updates of each client to move closer to the global gradient, thereby effectively correcting the optimization drift caused by data heterogeneity. Attached Figure Description

[0036] Figure 1 This is a schematic diagram illustrating the steps of a dynamic gradient tracking method for decentralized federated learning according to the present invention.

[0037] Figure 2 This is a schematic diagram illustrating the steps of the decentralized knowledge sharing method based on dynamic K-step gradient tracing of the present invention;

[0038] Figure 3 This is a schematic diagram illustrating the steps of the topology-aware dynamic correction parameter update mechanism of the present invention.

[0039] Figure 4 A comparison of the global model accuracy with the decentralized federated baseline method under different data distributions and dynamic stochastic topologies;

[0040] Figure 5 This is a comparison chart of the accuracy of the method of this invention and the baseline method with that of the global gradient algorithm;

[0041] Figure 6 A comparison chart showing the impact of the number of local iterations on the training loss;

[0042] Figure 7 A comparison chart showing the impact of communication topology on test accuracy;

[0043] Figure 8 This is a comparison chart of global accuracy under different network change cycles. Detailed Implementation

[0044] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0045] This invention provides a dynamic gradient tracking method for decentralized federated learning, comprising the following steps: S1, decentralized knowledge sharing based on dynamic K-step gradient tracking: with the client as the main body, decentralized knowledge sharing and global model collaborative optimization are achieved through K-step local gradient iteration and gradient tracking variable construction. S2, in the process of decentralized knowledge sharing based on dynamic K-step gradient tracking, a topology-aware dynamic correction parameter update mechanism is introduced to adjust the gradient correction parameters in real time.

[0046] At the start of each round of communication, this invention constructs a weight matrix for the current time-varying network based on Metropolis-Hastings weights to characterize the neighbor relationships and connection strength among clients. Each client uses the previous round's aggregation model as its starting point and performs K-step local gradient updates, where each update incorporates the current gradient correction parameter to counteract local drift caused by data heterogeneity. After completing the local update, the client calculates the K-step average gradient for this round using a gradient tracking method to approximate the global gradient direction and guide subsequent aggregation. Subsequently, each client exchanges its updated local model and gradient tracking variables with its neighbor nodes and performs a weighted average based on the weight matrix to obtain the next round's aggregation model. During this process, the system monitors changes in the network topology in real time. If the topology remains unchanged, the gradient correction parameter is updated using the historical accumulation method; if the topology changes, the gradient correction parameter is reset to avoid accumulated errors affecting training stability. After multiple iterations, a global model with network consensus is finally output, achieving effective optimization for model training in decentralized, Non-IID data, and time-varying topology environments. Through the above approach, this invention can be divided into two key methods: a decentralized knowledge-sharing method based on dynamic K-step gradient tracking, and a dynamic correction parameter update mechanism based on topology awareness; these will be described in detail below.

[0047] Decentralized knowledge-sharing methods based on dynamic K-step gradient tracking:

[0048] The decentralized knowledge-sharing method based on Dynamic K-step Gradient Tracking (DKGT) proposed in this invention introduces K-step average gradient tracking variables and gradient correction parameters, enabling each client to offset model drift caused by data heterogeneity during local updates, while utilizing neighbor communication to achieve decentralized knowledge sharing.

[0049] like Figure 2 As shown, the decentralized knowledge-sharing method based on dynamic K-step gradient tracking includes the following three stages: local gradient iteration and correction, global gradient approximation estimation, and decentralized weighted aggregation. (1) In the local gradient iteration and correction stage, the present invention superimposes correction parameters in the local K-step update to compensate for model drift caused by data heterogeneity. (2) In the global gradient approximation estimation stage, the present invention constructs gradient tracking variables through K-step average gradient to approximate the global gradient direction and guide aggregation. (3) In the decentralized weighted aggregation stage, the present invention fuses the local model and gradient information based on neighbor communication and weight matrix to achieve global consistency. The above stages are described in detail below.

[0050] During the local gradient iteration and correction phase, this invention uses a client-side approach. The previous aggregation model Using the initial values, perform K steps of local gradient iterations and add gradient correction parameters. To compensate for the drift caused by data heterogeneity. Specifically, let the... When round communication begins, the client The initial local model is For the first step First, sample a small batch of local data. Calculate the local stochastic gradient Then update the local model according to formula 1.1:

[0051] 1.1

[0052] in, The learning rate; Used to correct client drift and ensure that the local update direction is consistent with the global gradient direction.

[0053] For the global gradient approximation stage, the aim is to construct gradient tracking variables by processing the accumulated information from each client's K-step local updates. This invention approximates the global gradient direction. Compared to existing traditional gradient tracking algorithms, which typically update the gradient directly using the gradient tracking variable after each local update, for Non-IID data, single-step updates easily add the bias in the local gradient directly to the model parameters, thus amplifying client drift and leading to slow global convergence or deviation from the optimal direction. This invention calculates the average gradient of K local updates to smooth the cumulative changes of K local updates, obtaining a local approximate estimate of the global gradient, which to some extent suppresses the influence of single-step gradient noise.

[0054] Client After K-step local updates, its model from Updated to The total change (i.e., the cumulative change) is From Equation 1.1 above, we can see that the total change is equal to the learning rate. Multiply by the sum of K gradient steps, which include client-local stochastic gradients and gradient correction parameters. The latter is used to offset drift caused by data heterogeneity. This invention divides the total change mentioned above by... The average gradient over K steps is obtained, as detailed in Equation 1.2. In this invention, the gradient tracking variable is defined as:

[0055] 1.2

[0056] Due to correction parameters It remains unchanged over K steps, and its design goal is to compensate for global gradient bias caused by data heterogeneity. It can be regarded as a global gradient This is a local approximation that integrates multiple mini-batch gradient information, resulting in lower variance and a more stable reflection of the global optimization direction compared to single-step gradients. Furthermore, by adjusting the value of K, a balance can be struck between the accuracy of gradient estimation and communication efficiency.

[0057] In the decentralized weighted aggregation phase, this invention achieves the fusion update of the client model through neighbor communication and a weight matrix. Each client first collects the K-step local update model and gradient tracking variables from its neighbor nodes, and then utilizes the weight matrix... Perform weighted aggregation. The overall process of weighted aggregation is shown in Equation 1.3 below:

[0058] 1.3

[0059] in, This represents the set of local models for all clients in this round. For the corresponding set of gradient tracking variables, Used to counteract local drift and correct the aggregation direction; and This is a weight matrix among clients, through which weighted fusion of neighbor information is achieved.

[0060] This invention uses Metropolis-Hastings weights to model the network topology. In each communication round... The network connectivity can be represented as a dynamic hybrid matrix. , of which elements Represents a node and nodes In the round No connection; specifically defined as shown in Equation 1.4:

[0061] 1.4

[0062] in, Indicates the client The number of neighbors in the current topology, i.e. , For the client The set of neighboring nodes; this design makes the matrix row sum equal to 1 and symmetric, ensuring the stability and global consistency of aggregation under multiple iterations.

[0063] Based on the overall matrix form and weight definition, as shown in Equation 1.5 below, the individual client is further obtained. The aggregation update process:

[0064] 1.5

[0065] in, Representing neighboring nodes The model employs a K-step local update approach. Through multiple iterations, the client gradually achieves global consistency across the network.

[0066] Topology-aware dynamic correction parameter update mechanism:

[0067] The above describes how decentralized knowledge sharing is achieved through K-step gradient tracking. However, in time-varying networks, improper updating of gradient correction parameters can lead to accumulated errors, affecting global convergence. This invention will introduce a topology-aware dynamic correction parameter update mechanism for real-time adjustment of gradient correction parameters. This ensures that knowledge sharing can continue stably even when the network topology changes.

[0068] Topology-aware dynamic correction parameter update mechanism, such as Figure 3 As shown, this method employs two strategies based on changes in network topology: a cumulative update strategy when the network topology remains unchanged, and a dynamic reset strategy when the network topology changes.

[0069] If the network topology remains unchanged, meaning the mixing matrix in the current round is the same as in the previous round, In this invention, a cumulative update strategy is employed. Since the network topology remains unchanged, historically accumulated correction information remains valid, and cumulative updates maintain the continuity and stability of the correction parameters. Therefore, this invention superimposes the current round client's correction parameters onto the historical correction parameters. The gradient estimate is obtained by analyzing the deviation between its gradient estimate and the average gradient estimate of its neighboring nodes, thus approximating the global gradient direction. The specific process is shown in Equation 1.6 below:

[0070] 1.6

[0071] in, For nodes The correction parameters for the current round, For neighboring nodes gradient tracking variables, It is a mixed weight matrix.

[0072] When the network topology changes, i.e. the mixing matrix of the current round is different from that of the previous round, In this case, the present invention employs a dynamic reset strategy. At this time, the historically accumulated correction parameters may contain deviation information related to the old topology; continued accumulation and updating could lead to amplified errors in a time-varying environment. Therefore, the present invention resets the correction parameters, directly recalculating them based on the gradient tracking variables of the current round. The specific process is shown in Equation 1.7 below:

[0073] 1.7

[0074] It is understood that this invention discards historical cumulative values ​​and uses only the difference between the average gradient tracking value of the neighbors in the current round and the local value as a new correction parameter, thereby quickly cutting off the error accumulation chain and making the correction parameter adapt to the new network topology.

[0075] The specific embodiments of the present invention are as follows:

[0076] A decentralized knowledge-sharing method based on dynamic K-step gradient tracking: This method takes the client as the main body and realizes decentralized knowledge sharing and global model collaborative optimization through K-step local gradient iteration and gradient tracking variable construction, as detailed below.

[0077] Local gradient iteration and correction includes the following steps S11-S12:

[0078] S11. Initialize local iteration: Client Retrieves the aggregation model obtained after the previous round of communication from local storage. and the gradient correction parameters for the current round. Set the initial values ​​of the local model. The correction parameters remain unchanged in this round of updates to compensate for local update direction offsets caused by data heterogeneity.

[0079] S12, Execute K-step local updates in a loop: For Repeat the following sub-steps S121-S122:

[0080] S121. Sample mini-batch data and calculate stochastic gradients: Client From local dataset Randomly sample a small batch of data Calculate the loss function with respect to the current model parameters. stochastic gradient at The specific process is shown in equation (1) below:

[0081] (1).

[0082] S122, Overlay correction parameters and update the local model: Combine the stochastic gradient with the correction parameters of the current round. Add to compensate for the current local offset; using the learning rate Perform stochastic gradient descent to obtain the local model parameters for k steps; the specific process is shown in equation (2) below:

[0083] (2).

[0084] Global gradient approximation includes the following steps S13:

[0085] S13. Construct gradient tracking variables: After completing K-step local updates, the client... The model is composed of Updated to The cumulative change (i.e., the total change) is obtained as follows: From equation (2) above, we can generalize to obtain the average gradient over K steps (i.e., the average gradient of local updates over K steps). This variable, used as a local estimate of the global gradient, integrates the average information of K stochastic gradients. Compared to single-step gradients, it has lower variance and can more stably reflect the global optimization direction. Simultaneously, the gradient correction parameter... After compensation, the average gradient of the K-step local update Approximately equal to the global gradient A low-bias estimate; that is, dividing the cumulative change by Obtain the average gradient over K steps. The specific process is shown in equation (3) below:

[0086] (3).

[0087] Decentralized weighted aggregation includes the following steps S14-S16:

[0088] S14. Constructing a weight matrix based on network topology: Calculate the mixing matrix using the Metropolis-Hastings rule based on the current network topology. The specific process is shown in equation (4) below:

[0089] (4);

[0090] in, Represents a node The number of neighbors in the current topology.

[0091] S15, Exchange Neighbor Information: Client Update the model locally and gradient tracking variables Send to the current communication round All neighboring nodes At the same time, receive the corresponding model from the neighbor. and gradient tracking variables .

[0092] S16, Weighted Aggregation: Client Using the received neighbor model and the constructed weight matrix, weighted aggregation is performed to obtain the aggregation model for the next round. The specific process is shown in equation (5) below:

[0093] (5).

[0094] Guided by neighbor information and gradient tracking variables, through multiple iterations, the client model gradually reaches a consensus model, forming global consistency.

[0095] A topology-aware dynamic correction parameter update mechanism: In time-varying network environments, connections between clients may change at any time due to node movement, link interruptions, and other issues. If the correction parameters... If the update strategy does not adjust with the topology, the accumulated historical deviation will be propagated back to the new topology, further exacerbating client drift. Therefore, based on the dynamic K-step gradient tracing method proposed above, this invention introduces a topology-aware dynamic correction mechanism to adjust the correction parameters according to the network topology state. To ensure its stability and adaptability, a topology-aware dynamic correction parameter update mechanism detects topology changes and updates the parameters through branching. This mechanism can be divided into the following two cases:

[0096] (1) No change in topology: If the network topology has not changed, i.e. This invention employs a cumulative update strategy. The cumulative update strategy includes: at this point, historical correction information remains valid, the correction parameters from the previous round are retained, and the current round's client data is overlaid. The deviation information between the gradient estimate and the average gradient estimate of its neighboring nodes is used to update the correction parameters. The specific process is shown in the following equation (6):

[0097] (6);

[0098] in, For nodes The correction parameters for the current round, For neighboring nodes gradient tracking variables, It is a mixed weight matrix.

[0099] (2) Change in topology: If the network topology changes, i.e. This invention employs a dynamic reset strategy. The dynamic reset strategy includes: due to topology changes, the accumulated correction parameters under the old topology may introduce errors. Therefore, this invention discards historical values ​​and recalculates the correction parameters only based on the gradient tracking variables of the current round. The specific process is shown in the following equation (7):

[0100] (7).

[0101] It is understandable that the above dynamic reset strategy breaks the error accumulation chain, enabling the correction parameters to quickly adapt to the new network topology and preventing the local model from shifting.

[0102] The following experimental verification and ablation analysis will be conducted:

[0103] To verify the effectiveness of the dynamic gradient tracking method for decentralized federated learning proposed in this invention, comparative and ablation experiments were conducted on the CIFAR-10 and CIFAR-100 datasets. The experiments covered varying degrees of data heterogeneity, including NON-IID parameters. And IID settings, different network change cycles, including ,like This indicates that the network topology is updated every 10 rounds, with the remaining rounds being fixed. It also represents two typical time-varying network scenarios: a dynamic random network where the topology is randomly generated in each round, and a hybrid network where the topology switches between ring, grid, random, and fully connected types.

[0104] Comparative analysis

[0105] (1) Comparison with baseline algorithms for decentralized federated learning

[0106] The method of this invention (DKGT) was compared and analyzed with the current mainstream decentralized federated learning baseline algorithms (DPSGD, DFedAvg, DFedAvgM, LED, LSGT).

[0107] Appendix Figure 4 The accuracy of each method is presented on the CIFAR-10 and CIFAR-100 test sets and various time-varying network topologies. Results show that the proposed DKGT significantly outperforms the comparative algorithms in all settings. On the CIFAR-10 dataset, when... and In dynamic random networks, the accuracy of the method described in this invention is approximately 2.59% higher than the optimal baseline LSGT, while in hybrid networks, the method improves accuracy by approximately 3.93%. For the CIFAR-100 dataset, the accuracy advantage of the method described in this invention is even more pronounced under the same settings. These results fully demonstrate the robustness and superiority of the method described in this invention in handling data heterogeneity and time-varying networks.

[0108] (2) Comparison with centralized global gradient method

[0109] All baseline methods were compared with global gradient-based methods, including CFEdAvg, CFEdAvgM, Scaffold, and FedPD. To ensure a fair comparison, the server communicated with a maximum of 20 randomly selected clients in each communication round.

[0110] Appendix Figure 5 The test accuracy comparison between all baseline methods and the global gradient method is presented. The results show that when... On the CIFAR-10 and CIFAR-100 datasets, the method of this invention outperforms all baseline methods in both test accuracy and convergence speed. The superior performance of the method can be attributed to its efficient distributed knowledge-sharing approach and topology-aware update mechanism. Although methods such as Scaffold and FedPD introduce global gradients, their effectiveness is limited by bandwidth constraints, which restrict the number of clients that can be integrated in each communication round.

[0111] Ablation analysis

[0112] (1) The effect of the number of local update steps K

[0113] Table 1 and Appendix Figure 6 This demonstrates the impact of different K values ​​on test accuracy and training loss in dynamic random networks. Using the CIFAR-10 dataset, it maintains... and The settings were configured so that the K value varied within the set {2, 3, 4, 5}. Results showed that, except for the LED algorithm, a larger K value resulted in faster convergence and higher test accuracy. However, for the LED algorithm, increasing the K value led to overfitting. Specifically, when... At that time, compared with LSGT, the convergence speed was improved by 3.47%. Furthermore, when... At that time, the test accuracy achieved by the method of the present invention is equivalent to DFedAvgM in The results demonstrate that the algorithm of this invention helps improve model performance.

[0114] Table 1. The impact of different K values ​​on test accuracy in dynamic random networks.

[0115] DPSGD 65.17 65.17 65.17 65.17 DFEDAVG 65.75 70.21 72.38 74.24 DFEDAVGM 77.85 78.72 78.79 78.13 led 78.12 77.90 76.99 76.76 LSGT 77.36 79.09 79.43 79.71 DKGT 79.89 81.49 81.80 82.48

[0116] (2) Impact of network topology

[0117] Table 2 and Appendix Figure 7 The test accuracy of the proposed method (DKGT) and existing methods is demonstrated under four different connectivity topologies. The CIFAR-10 dataset is used to set... In the experiment, the neighbor nodes remained unchanged for each topology. Four topologies were used: Ring, Grid, Random, and Full, with the order of sparse connectivity being: Ring > Grid > Random > Fully Connected. The results show that the test accuracy of all methods improves with increasing connectivity, but the method of this invention remains optimal in all topologies. In particular, in the sparse Ring topology, the accuracy of the method of this invention is 2.53% higher than the baseline best LSGT, indicating that the method of this invention also has good adaptability to weakly connected networks.

[0118] Table 2. Impact of Communication Topology on Test Accuracy

[0119] DPSGD 58.31 61.75 66.02 66.11 DFEDAVG 61.07 68.17 71.55 72.61 DFEDAVGM 63.36 72.87 78.36 79.21 led 64.04 72.60 77.08 77.48 LSGT 66.22 74.77 79.64 79.54 DKGT 68.75 79.86 80.44 82.27

[0120] (3) The impact of network change cycles

[0121] Appendix Figure 8 The test accuracy of each method under different network change cycles is shown. To simulate the time-varying dynamic characteristics of networks, this invention considers two scenarios: Dynamic Random Networks and Mixed Networks, and applies the results to the CIFAR dataset. The values ​​vary within the set {10, 50, 100}. The results show that the dynamic characteristics of the network do indeed affect the model's test accuracy, especially in the case of hybrid networks. Compared to all baseline algorithms, the method of this invention achieves higher test accuracy on the test set. Even for networks with rapid changes, the algorithm proposed in this invention can still effectively improve the overall training performance of the model. These results demonstrate that the algorithm of this invention can adapt well to time-varying networks.

[0122] In summary, this invention proposes a Dynamic K-step Gradient Tracking (DKGT) method for decentralized federated learning, which improves the client drift problem caused by data heterogeneity in dynamic network environments. Furthermore, experimental results on the CIFAR-10 and CIFAR-100 datasets demonstrate that this invention outperforms existing mainstream decentralized federated learning algorithms in both test accuracy and convergence speed under various time-varying network topologies and heterogeneous data distributions, verifying its excellent generalization performance and robustness.

[0123] It should be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0124] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A dynamic gradient tracking method for decentralized federated learning, characterized in that, Includes the following steps: S1. Decentralized knowledge sharing based on dynamic K-step gradient tracking: Taking the client as the main body, decentralized knowledge sharing and global model collaborative optimization are achieved through K-step local gradient iteration and gradient tracking variable construction. S2. In the process of decentralized knowledge sharing based on dynamic K-step gradient tracking, a topology-aware dynamic correction parameter update mechanism is introduced to adjust the gradient correction parameters in real time.

2. The dynamic gradient tracking method for decentralized federated learning according to claim 1, characterized in that: The decentralized knowledge sharing based on dynamic K-step gradient tracking includes the following three stages: local gradient iteration and correction, global gradient approximation estimation, and decentralized weighted aggregation.

3. The dynamic gradient tracking method for decentralized federated learning according to claim 2, characterized in that: The local gradient iteration and correction includes the following steps S11-S12: S11. Initialize local iteration: Client Retrieves the aggregation model obtained after the previous round of communication from local storage. and the gradient correction parameters for the current round. Set the initial values ​​of the local model. ; S12, Execute K-step local updates in a loop: For Repeat the following sub-steps S121-S122: S121. Sample small batches of data and calculate stochastic gradients: The client... From local dataset Randomly sample a small batch of data Calculate the loss function with respect to the current model parameters. stochastic gradient at ... The specific process is shown in equation (1) below: (1); S122, Overlay correction parameters and update the local model: Combine the stochastic gradient with the correction parameters of the current round. Add them together to compensate for the current local offset; With learning rate Perform stochastic gradient descent to obtain the local model parameters for k steps; the specific process is shown in equation (2) below: (2)。 4. The dynamic gradient tracking method for decentralized federated learning according to claim 3, characterized in that: The global gradient approximation includes the following step S13: S13. Construct gradient tracking variables: After completing K-step local updates, the client... The model is composed of Updated to The cumulative change is obtained as Divide the cumulative change by Obtain the average gradient over K steps. The specific process is shown in equation (3) below: (3)。 5. The dynamic gradient tracking method for decentralized federated learning according to claim 4, characterized in that: The decentralized weighted aggregation includes the following steps S14-S16: S14. Constructing a weight matrix based on network topology: Calculate the mixing matrix using the Metropolis-Hastings rule based on the current network topology. The specific process is shown in equation (4) below: (4); in, Represents a node The number of neighbors in the current topology; S15. Exchange neighbor information: The client Update the model locally and gradient tracking variables Send to the current communication round All neighboring nodes At the same time, it receives the corresponding model from the neighbor. and gradient tracking variables ; S16, Weighted Aggregation: The client Using the received neighbor model and the constructed weight matrix, weighted aggregation is performed to obtain the aggregation model for the next round. The specific process is shown in equation (5) below: (5)。 6. The dynamic gradient tracking method for decentralized federated learning according to claim 5, characterized in that: The topology-aware dynamic correction parameter update mechanism is divided into two strategies based on changes in network topology: an cumulative update strategy when the network topology remains unchanged, and a dynamic reset strategy when the network topology changes.

7. The dynamic gradient tracking method for decentralized federated learning according to claim 6, characterized in that: The cumulative update strategy includes: retaining the correction parameters from the previous round and overlaying them with the current round's client data. The deviation information between the gradient estimate and the average gradient estimate of its neighboring nodes is used to update the correction parameters. The specific process is shown in the following equation (6): (6); in, For nodes The correction parameters for the current round, For neighboring nodes gradient tracking variables, It is a mixed weight matrix.

8. The dynamic gradient tracking method for decentralized federated learning according to claim 7, characterized in that: The dynamic reset strategy includes: recalculating the correction parameters based only on the gradient tracking variables of the current round, as shown in equation (7) below: (7)。