DAG and block chain-based double-layer architecture system and decentralized federated learning method

By adopting a decentralized method of DAG and blockchain dual-layer architecture in federated learning, combined with TIPS selection algorithm and RAFT consensus, the problems of data heterogeneity, privacy protection and training in federated learning are solved, and efficient, secure and personalized model training is achieved.

CN120197672APending Publication Date: 2025-06-24NANJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510268271.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

When existing federated learning technologies face problems such as data heterogeneity, data privacy protection, low model training efficiency and difficult to meet personalized needs, they have problems such as single point failure risk, communication bottlenecks and low consensus efficiency, especially in medical data scenarios, which are difficult to meet multiple needs at the same time.

Method used

The decentralized federated learning method based on the two-layer architecture of DAG and blockchain is adopted, and personalized model training is carried out through the DAG main chain, and the blockchain side chain is aggregated and stored. Combined with the TIPS selection algorithm, RAFT consensus and adaptive reward mechanism, efficient and secure decentralized training is achieved.

Benefits of technology

It improves the security and participation incentives of federated learning, improves model training efficiency and personalized adaptability, reduces system communication overhead and resource monopoly risks, and meets the needs of data privacy protection and model personalization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120197672A_ABST
    Figure CN120197672A_ABST
Patent Text Reader

Abstract

The invention provides a DAG and block chain-based double-layer architecture system and a decentralized federated learning method. The system comprises a DAG main chain and a block chain side chain; the DAG main chain is composed of a plurality of nodes containing a creative century block, and a TIPS selection algorithm based on selection weight and model similarity is adopted to accelerate self-adaptive personalized model training; a block chain side chain is composed of participating nodes and blocks, a cluster model corresponding to cluster aggregation formed based on interaction frequency is adopted based on an RAFT consensus mechanism, and a periodic personalized training result is formed and stored. In addition, the system also adopts an adaptive reward mechanism based on progress, so that high-resource nodes can be stimulated to continuously improve the performance of the model, and a fair development opportunity is provided for resource-limited nodes. According to the invention, through a double-layer architecture design, in combination with the efficient asynchronism of the DAG and the security of the block chain, a federated learning framework which not only protects data privacy but also supports efficient personalized training is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of federated learning, and specifically to a system based on a double-layer architecture of DAG and blockchain and a decentralized federated learning method. Background Art

[0002] With the rapid development of artificial intelligence technology, data privacy and security issues have increasingly become the focus of global attention. Federated Learning (FL), as an emerging privacy computing technology, avoids the direct sharing of raw data by allowing participants to train models locally and upload parameters for aggregation. However, in fields such as healthcare, due to the significant heterogeneity and non-independent and identically distributed (Non-IID) characteristics of data from different institutions, traditional federated learning methods are difficult to ensure the effective generalization of models. To solve this problem, Personalized Federated Learning (PFL) improves model adaptability through two strategies: global model personalization and learning personalized models. The global model personalization strategy aims to overcome the data heterogeneity of different clients and train a robust global model applicable to each client; the learning personalized model strategy allows clients to collaboratively train multiple personalized models, each model for a single client or multiple clients with similar data distributions. However, most existing PFL solutions are based on a centralized architecture, suffering from single-point failure risks and communication bottlenecks. Cluster Federated Learning (CFL) attempts to improve training efficiency by dividing clients with similar data distributions into clusters, but still relies on a central server for cluster division and has the problem of high communication overhead between clusters. The decentralized nature of blockchain can make the training and parameter sharing of models more decentralized and secure, without relying on a single centralized server. Therefore, the combination of blockchain technology and federated learning provides a decentralized solution idea, ensuring the credibility of shared model parameters through the immutable and transparent characteristics of blockchain. However, existing implementations generally suffer from problems such as low consensus efficiency and lack of effective incentive mechanisms. Especially in scenarios where medical data is highly sensitive and extremely unevenly distributed, existing technical solutions are difficult to simultaneously meet multiple requirements such as data privacy protection, model personalization, system scalability, and training efficiency. Therefore, there is an urgent need for a new technical solution to solve the above problems.

[0003] Therefore, the present invention proposes a decentralized federated learning method based on a double-layer architecture of DAG and blockchain, realizing a personalized federated learning method with the flexibility of decentralized federated learning and the adaptability of personalized models, along with its natural asynchrony and low-consumption consensus. Summary of the Invention

[0004] In view of the problems existing in the current federated learning technology, such as data heterogeneity, data privacy protection, and model training efficiency, the present invention proposes a system with a double-layer architecture based on DAG and blockchain and a decentralized federated learning method. The system and method aim to achieve efficient decentralized training while protecting data privacy through a double-layer framework, a TIPS selection algorithm, and a reward mechanism, and solve the problems of data heterogeneity, low model training efficiency, and difficulty in meeting personalized requirements in existing federated learning.

[0005] To solve the above technical problems, the present invention provides the following technical solutions:

[0006] A system with a double-layer architecture based on DAG and blockchain, the system includes a DAG main chain and a blockchain side chain; the DAG main chain is composed of multiple nodes including a genesis block, and is used for the training of personalized models. The blockchain side chain is composed of participating nodes and blocks storing stage models, and is used for the aggregation of cluster models and distributed storage;

[0007] During the training process of the DAG main chain, the TIPS selection algorithm based on selection weight and model similarity is adopted to cluster nodes with similar models and train them on the local dataset. After training, the nodes package and upload the updated model and related metadata to the DAG main chain. During the training process of the DAG main chain, when the mutual selection probability of nodes within any cluster exceeds the preset threshold for the first time, the first interaction with the blockchain side chain is triggered, and the nodes upload the relevant model to the blockchain side chain. After that, the cluster uploads the model once every fixed round preset by the system. The uploaded information includes the model and the corresponding TIPS selection record Map. The model includes model parameters, data volume size, and node performance indicators;

[0008] During the aggregation process of the blockchain side chain, an aggregation mechanism based on RAFT consensus is adopted. The participating nodes are divided into leader nodes and follower nodes. The leader nodes receive model transactions from the DAG main chain, construct an association matrix by calculating the association degree between nodes, identify the connected components as clusters, aggregate the weights of the models within each cluster, generate a cluster-level aggregated model and broadcast it to the follower nodes for verification. After obtaining the confirmation of the majority of follower nodes, the aggregated model and Map are stored on the chain in the block;

[0009] New nodes joining the DAG main chain select a model that conforms to local characteristics from the aggregated models stored in the block as the initial model and continue training on the DAG main chain.

[0010] Preferably, the system adopts a cluster recognition algorithm to accelerate the node clustering process in the DAG main chain based on a dynamic probability selection matrix. The information uploaded by the DAG main chain to the blockchain side chain also includes the current state of the probability matrix, which records the selection tendency between nodes.

[0011] Preferably, in the DAG main chain, each node contains a node ID, a device ID, a timestamp, local model parameters, the size of the data volume, information on the set of precursor nodes it references, and TIPS selection records. In the blockchain side chain, the block storing the phased model consists of a block header and a block body. The block header contains the current block version number, the address information of the previous block, the hash value of the current block, the timestamp, and the Merkle root information; the block body stores the model parameter information, the cluster-related data information, and the data volume size information. The block header and the block body construct a Merkle tree to provide a verification function.

[0012] Preferably, after the phased model is stored on the blockchain side chain, the system adopts an adaptive reward mechanism based on progress, and distributes rewards by evaluating three aspects: the progress score of the node, the difficulty factor, and the detection of abnormal behavior.

[0013] Preferably, for the adaptive reward mechanism based on progress, the formula for the progress reward P_Reward is as follows:

[0014] P_Reward(i,t) = μ * P_Score(i,t) * (1 / Difficulty_Factor(i,t)) * (1 - Deviation_Score(i,t))

[0015] μ is the basic reward coefficient, which is a global parameter adjusted by the system and used to control the overall reward scale. The other three parts of the formula evaluate the progress score of the node, the difficulty factor, and the detection of abnormal behavior;

[0016] Progress score:

[0017] P_Score(i,t) = (Q(i,t) - Base_Quality(i,t)) / σ(Q(i,t - N):t - 1)

[0018] Q(i,t) represents the model quality score of node i in the t-th round, Base_Quality(i,t)) represents the benchmark performance, and σ(Q(i,t - N):t - 1) represents the standard deviation of the benchmark performance scores. The system uses a sliding window to calculate the benchmark performance. This window contains the performance in the past N rounds, and the window size N is dynamically adjusted according to the total number of training rounds. The formula for the benchmark performance is:

[0019]

[0020] Difficulty factor:

[0021] Difficulty_Factor(i,t) = 1 + log(1 + Reward_Count(i,t))

[0022] Reward_Count(i,t) records the historical award-winning times of node i. As the number of award-winning times increases, the difficulty coefficient gradually increases.

[0023] Abnormal behavior detection:

[0024] Deviation_Score(i,t) = |Q(i,t) - Predicted_Q(i,t)|

[0025] Among them, Predicted_Q(i,t) is the reasonable performance value predicted based on historical data. The system constructs a performance prediction model based on historical data to calculate the deviation between the actual performance and the expectation. When the performance of the node significantly deviates from the reasonable range predicted by the historical data, the deviation score increases, reducing the final obtained reward.

[0026] A decentralized federated learning method based on a double-layer architecture of DAG and blockchain. Based on the double-layer architecture system, federated learning is achieved through the following steps:

[0027] Step 1, the task publisher publishes the content of the federated learning task, data requirements, and training objectives through the network, and deploys a pre-trained basic model in the genesis block of the DAG main chain as the starting point for subsequent node training.

[0028] Step 2, the nodes that want to participate in the task pay tickets as participation deposits. The system assigns a globally unique identifier ID to them. The nodes obtain the initialization model in the genesis block, and at the same time, the system initializes the interaction records for the new nodes.

[0029] Step 3, the nodes perform personalized model training based on the local dataset, and record the local model parameters, the size of the training data volume, performance metrics, and TIPS selection records.

[0030] Step 4, the nodes perform clustering and selection based on the dynamic probability matrix and model similarity as the main indicators. After each round of training, the system updates the dynamic probability matrix. When the mutual selection probability of nodes within any cluster exceeds the threshold and the number of stable nodes reaches the minimum scale requirement, the relevant model will be triggered to be uploaded to the blockchain side chain for aggregation.

[0031] Step 5, the blockchain side chain selects a leader node based on the RAFT consensus. The leader node constructs an association matrix by calculating the correlation degree between nodes, identifies the connected components as clusters, performs model aggregation on each cluster and broadcasts it to the follower nodes for verification, and stores the verified aggregated model on the chain in the block.

[0032] Step 6, when a new node joins, the system calculates its matching degree with the cluster models stored in the block, selects the cluster model with the best match and assigns it to the new node. If the matching degrees do not exceed the threshold, the genesis block model will be assigned.

[0033] Step 7, the system checks the aggregated data volume, model performance metrics, and the completion of the task objectives. If the requirements are not met, it returns to the local training phase to continue training until the termination condition is reached.

[0034] Preferably, the specific steps of the node cluster in Step 4 are as follows:

[0035] Step 4.1, during the clustering process, the DAG main chain adopts a dynamic probability selection matrix P. This matrix is based on the DAG main chain itself. The element Pij in the matrix represents the probability that node i selects node j as TIPS at the t-th round. The calculation formula is as follows:

[0036] P ij =α*S ij +β*H ij +γ*C ij

[0037] Where: Sij represents the model similarity between nodes i and j, Hij represents the historical interaction frequency, reflecting the long-term cooperation relationship between nodes, Cij represents the contribution degree of node j, including the resource input and data quality of the node; α, β, γ are weight coefficients and α + β + γ = 1;

[0038] Step 4.2, after each round of training, the dynamic probability selection matrix P is updated according to the new interaction information. The calculation formula is as follows:

[0039] P(t + 1) = λP(t) + (1 - λ)P'(t)

[0040] Where: P(t) is the probability matrix at the t-th round, P'(t) is the new interaction information of the current round, λ is a smoothing factor, controlling the retention degree of historical information. When the mutual selection probability P of all nodes in a certain cluster exceeds a pre-set threshold, it is considered that the cluster has been stably formed, and the relevant model set of the nodes is uploaded to the blockchain side chain for aggregation;

[0041] Step 4.3, during the training process of the DAG main chain, when the mutual selection probability of nodes in a certain cluster first exceeds the pre-set threshold, the first interaction with the blockchain side chain is triggered. The nodes upload the models to the side chain for aggregation. Then, a fixed round T is set, and this cluster conducts model upload and aggregation every T rounds. By setting the fixed round T, the communication overhead and the timeliness of the update are balanced.

[0042] Preferably, the aggregation mechanism based on RAFT consensus adopted by the blockchain side chain includes the following steps:

[0043] Step 5.1, cluster identification is performed based on the interaction mode between nodes. For any two nodes i and j, their correlation degree is calculated as follows:

[0044] ClusterAffinity(i, j) = Count(i → j) * Count(j → i) / MaxInteractions

[0045] Where Count(i → j) represents the number of times node i selects j as a TIPS, Count(j → i) represents the number of times node j selects i as a TIPS, and MaxInteractions is the maximum number of interactions between all node pairs observed currently. Based on the calculated affinity, a binary affinity matrix A[i, j] is constructed. When the affinity exceeds a preset threshold, A[i, j] = 1, indicating that these two nodes belong to the same cluster; otherwise, A[i, j] = 0, indicating that these two nodes do not belong to the same cluster;

[0046] Step 5.2, use depth - first search to find connected components in the affinity matrix. Each connected component is a stably formed cluster. Retain the clusters with more than 1 node. For each identified cluster k, the leader node performs weighted model aggregation, and the leader node generates a new cluster Mapk for the aggregation model as follows:

[0047] Mapk = {(ID i , max_count)|ID i ∈ top_K(∪Map i )}

[0048] Where IDi is the node identifier, max_count is the maximum approval count of this node in all Maps of this cluster, and top_K means only select the top K nodes with the highest approval count;

[0049] Step 5.3, the leader node broadcasts the aggregation result to the follower nodes for verification. Each follower node returns information on whether it votes. When the number of positive votes exceeds half of the total number, consensus is reached, and the leader node stores the aggregation model and Map on the chain in the block.

[0050] Preferably, the specific method for the system to select the optimal matching cluster model for the new node is as follows:

[0051] The system evaluates the matching degree between the new node n and the existing cluster k based on three dimensions: data distribution similarity, prediction accuracy, and cluster stability. The calculation formula is as follows:

[0052] Score(n, k) = α * DS(n, k) + β * PA(n, k) + γ * CS(k)

[0053] Data distribution similarity DS(n, k): Calculate the data distribution distance between the new node n and the cluster k using Jensen - Shannon divergence as follows:

[0054] DS(n, k) = 1 - JSD(P_n ∥ P_k)

[0055] A smaller distribution distance indicates that the data characteristics of the new node are closer to those of the cluster;

[0056] Prediction accuracy PA(n, k): Use the model of cluster k to test on the validation set of node n:

[0057] PA(n, k) = ACC_k(X_n)

[0058] A higher accuracy indicates that the cluster model has good generalization ability for the data of the new node;

[0059] Cluster stability CS(k): Evaluate the ratio of the cluster size to the minimum stable size:

[0060] CS(k) = min(1, |C_k| / N_min)

[0061] where |C_k| is the number of nodes in cluster k, and N_min is the minimum stable cluster size preset by the system;

[0062] The weight coefficients α, β, and γ are used to balance the importance of these three dimensions, and α + β + γ = 1. The system calculates the matching scores of the new node with all existing clusters, returns a list of scores scores, selects the cluster model with the highest score and exceeding the preset threshold to assign to the new node. If the matching scores of all clusters do not exceed the threshold, the basic model in the genesis block is assigned.

[0063] Preferably, after the new node uses the selected model, it will feedback to the model contributor according to its training results. If the new node can quickly improve its model performance, the contributor of the original model will receive an additional reward.

[0064] Compared with the prior art, the beneficial effects achieved by the present invention are:

[0065] 1. The double-layer architecture improves the security and participation incentive of federated learning: Through the separation design of the DAG main chain and the blockchain side chain, the functional decoupling of model update and storage is realized. The DAG main chain is responsible for fast and efficient personalized training, and the blockchain side chain is responsible for secure and reliable model storage and distribution, which not only protects data privacy but also improves system throughput.

[0066] 2. The TIPS selection algorithm accelerates cluster formation: The TIPS selection algorithm based on selection weights and model similarity is designed, combined with a dynamic probability selection matrix, enabling clients with similar data distributions to quickly form training clusters. This mechanism significantly improves the training efficiency of personalized models and reduces system communication overhead.

[0067] 3. RAFT-based Model Aggregation and Cold Start Optimization: Innovatively apply the RAFT consensus to the cluster model aggregation of the side chain, and complete model verification and storage through the lead node. At the same time, a model distribution mechanism based on multi-dimensional matching is designed to effectively solve the cold start problem of new nodes and provide customized learning paths for nodes with different resource levels.

[0068] 4. Progressive Adaptive Reward Mechanism: Innovatively design a comprehensive reward mechanism that combines dynamic window evaluation, difficulty adaptation, and deviation monitoring. It not only encourages resource-rich nodes to continuously optimize but also provides development space for resource-constrained nodes. Through the difficulty factor of the logarithmic function and historical data deviation monitoring, ensure the fairness of reward distribution and the sustainable development of the system, and effectively avoid resource monopolies. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] The drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation to the present invention. In the drawings:

[0070] Figure 1 is the overall framework diagram of the DAG and blockchain double-layer architecture system of the present invention;

[0071] Figure 2 is the overall flowchart of the decentralized federated learning method of the present invention;

[0072] Figure 3 is the structural diagram of the nodes in the DAG main chain of the present invention;

[0073] Figure 4 is the structural diagram of the blocks in the blockchain side chain of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0074] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0075] Please refer to Figures 1-4 , the present invention provides the following technical solutions:

[0076] Embodiment 1:

[0077] Based on the DAG and blockchain double-layer architecture system, as Figure 1As shown in the figure, it includes a DAG main chain and a blockchain side chain; the DAG main chain is composed of multiple nodes including a genesis block, and is used for the training of personalized models. The blockchain side chain is composed of participating nodes and blocks storing staged models, and is used for the aggregation of cluster models and distributed storage.

[0078] As Figure 3 shown, in the DAG main chain, each node includes a node ID, a device ID, a timestamp, local model parameters, the size of the data volume, information on the set of referenced predecessor nodes, and a TIPS selection record.

[0079] As Figure 4 shown, in the blockchain side chain, the block storing the staged model is composed of a block header and a block body. The block header includes the current block version number, the address information of the previous block, the hash value of the current block, the timestamp, and the Merkle root information; the block body stores model parameter information, cluster-related data information, and data volume size information. The block header and the block body construct a Merkle tree to provide a verification function.

[0080] During the training process of the DAG main chain, each transaction needs to go through four processes: model evaluation, model selection, model training, and model packaging and uploading. When a new model transaction needs to be uploaded, the node selects TIPS on the DAG and aggregates them to form the initial model for the next training. This embodiment adopts a TIPS selection algorithm based on selection weights and model similarity, enabling nodes with similar models to cluster and train on the local dataset, accelerating the training of the adaptive personalized model. After training, the node packages and uploads the updated model and related metadata to the DAG main chain. During the training process of the DAG main chain, when the mutual selection probability of any nodes within a cluster exceeds the preset threshold for the first time, the first interaction with the blockchain side chain is triggered, and the node uploads the relevant model to the blockchain side chain. After that, the cluster performs a model upload every fixed number of rounds preset by the system. In this way, the communication overhead and the timeliness of updates can be balanced through the preset number of rounds. The uploaded information includes the model and the corresponding Map of TIPS selection records. The model includes model parameters, the size of the data volume, and node performance indicators.

[0081] Specifically, on the DAG, using the improved TIPS selection algorithm, the nodes in the DAG network will select and aggregate those models with high correlation and performance. This process includes evaluating the effectiveness of each model and its compatibility with the existing cluster to dynamically form a model cluster with similar data distribution and high performance. The selection algorithm not only considers the immediate performance of the model but also combines the interaction history between nodes to ensure that the aggregated models maximize the learning efficiency and effect of the device personalized network. After the nodes complete training on the local dataset, the nodes will package the updated models and related metadata (such as the performance metrics of the models, the feature summary of the training data, and model-related information) and upload them to the DAG. These uploaded models will be processed as transactions. The following is a specific example:

[0082] If the new uploaded transaction T of node D wants to approve several TIPS, it will collect the numbers of the nodes corresponding to these TIPS (the collection method uses the Map format, with the node number as the key and the approval times as the value). After several rounds of communication, the cluster is roughly formed. Then the node set DS uploads the model set M and the corresponding Map to the side chain, and the side chain performs the aggregation and distribution operations. At the same time, since a probability selection matrix will be designed during the cluster recognition process, the nodes will preferentially select models according to this matrix. The Map maintained by each node will dynamically change the probability selection matrix to help accelerate the cluster recognition. In the DAG network, the transaction T generated by each node can be represented as a six-tuple as follows:

[0083] T = (ID, M, D, R, P, Map)

[0084] Where: ID is the unique identifier of the node, M is the model parameters trained locally, D is the amount of training data used, R is the computing resource metric, P is the performance metric (including training time, upload time, etc.), and Map is the TIPS selection record. The specific form is Map = {(IDi, Ci)}, where Ci represents the number of selections for the node with ID id.

[0085] Furthermore, this embodiment also adopts a cluster recognition algorithm to accelerate the node clustering process in the DAG main chain based on the dynamic probability selection matrix, thereby accelerating the training process. The information uploaded from the DAG main chain to the blockchain side chain also includes the current state of the probability matrix, which records the selection tendency between nodes.

[0086] During the aggregation process of the blockchain side chain, an aggregation mechanism based on the RAFT (fault-tolerant replication algorithm) consensus is adopted. Participating nodes are divided into leader nodes and follower nodes. The leader node receives model transactions from the DAG main chain, constructs an association matrix by calculating the inter-node association degree, identifies connected components as clusters, aggregates the weights of models within each cluster, generates a cluster-level aggregated model and broadcasts it to the follower nodes for verification. After obtaining the confirmation of the majority of follower nodes, the aggregated model and the Map are stored on the chain and stored in the block.

[0087] Nodes newly joining the DAG main chain select a model that matches the local characteristics from the aggregated models stored in the block as the initial model and continue to train on the DAG main chain to solve the cold start problem. In addition, the side chain also constructs the concept of a model market, enhancing the dynamics and interactivity of the federated learning framework, and providing a platform for devices with different capabilities and resources to trade personalized models and model updates.

[0088] In summary, the blockchain side chain not only serves as the infrastructure for model storage and distribution, but also constructs a dynamic "model market". In this market, the aggregated and verified cluster models are marked with complete performance indicators (such as accuracy, resource consumption, applicable scenarios, etc.) for newly joining nodes to choose. This market mechanism provides personalized model selection paths for nodes with different computing capabilities and data characteristics, and also reserves room for expansion for the subsequent introduction of more complex model trading mechanisms (such as model pricing, credit assessment, etc.).

[0089] After the stage model is stored on the blockchain side chain, the system adopts an adaptive reward mechanism based on progress to allocate rewards by evaluating the progress score, difficulty factor, and abnormal behavior detection of nodes. It can not only accurately measure the continuous optimization ability of nodes with rich resources, but also provide development space for resource-constrained nodes.

[0090] For the adaptive reward mechanism based on progress, the calculation formula for the progress reward P_Reward is as follows:

[0091] P_Reward(i,t)=μ*P_Score(i,t)*(1 / Difficulty_Factor(i,t))*(1-Deviation_Score(i,t))

[0092] μ is the basic reward coefficient, which is a global parameter adjusted by the system and used to control the overall reward scale. The other three parts of the formula evaluate the progress score, difficulty factor, and abnormal behavior detection of nodes.

[0093] Progress score:

[0094] P_Score(i,t) = (Q(i,t) - Base_Quality(i,t)) / σ(Q(i,t - N):t - 1)

[0095] Q(i,t) represents the model quality score of node i in the t-th round, Base_Quality(i,t)) represents the baseline performance, and σ(Q(i,t - N):t - 1) represents the standard deviation of the baseline performance scores. The system uses a sliding window to calculate the baseline performance, and this window contains the performance of the past N rounds. The window size N is dynamically adjusted according to the total number of training rounds. The formula for calculating the baseline performance is as follows:

[0096]

[0097] This design normalizes the performance fluctuations through the standard deviation σ, making the evaluation more objective. For nodes with large performance fluctuations, a more significant improvement is required to obtain the same progress score, thus encouraging the improvement of stability.

[0098] Difficulty factor:

[0099] Difficulty_Factor(i,t) = 1 + log(1 + Reward_Count(i,t))

[0100] Reward_Count(i,t) records the historical number of awards of node i. As the number of awards increases, the difficulty coefficient gradually increases. The logarithmic function is used to design the difficulty increase curve to ensure that the difficulty increases gradually rather than linearly, which not only avoids the decline of node enthusiasm caused by the rapid depreciation of rewards but also prevents a single node from monopolizing rewards for a long time.

[0101] Abnormal behavior detection:

[0102] Deviation_Score(i,t) = |Q(i,t) - Predicted_Q(i,t)|

[0103] Where Predicted_Q(i,t) is the reasonable performance value predicted based on historical data. The system constructs a performance prediction model based on historical data to calculate the deviation between the actual performance and the expectation. When the performance of the node significantly deviates from the reasonable range predicted by the historical data, the deviation score increases, reducing the final obtained reward.

[0104] This multi-dimensional reward calculation method constructs a fair and effective incentive system through methods such as standardization, dynamic adjustment, and abnormal detection. This mechanism can not only accurately evaluate the actual progress of nodes but also maintain the long-term stability of the system and promote various nodes to continuously improve their model performance.

[0105] Example 2

[0106] A decentralized federated learning method based on a double-layer architecture of DAG and blockchain. Based on the double-layer architecture system, as Figure 2 shown, federated learning is achieved through the following steps:

[0107] Step 1, the task publisher publishes the content of the federated learning task, data requirements, and training objectives through the network, and deploys a pre-trained basic model in the genesis block of the DAG main chain as the starting point for subsequent node training;

[0108] Step 2, nodes that want to participate in the task pay tickets as participation guarantees, the system assigns them a globally unique identifier ID, the nodes obtain the initialization model in the genesis block, and at the same time the system initializes the interaction records for the new nodes;

[0109] Step 3, the nodes perform personalized model training based on the local dataset, and record the local model parameters, the size of the training data volume, performance metrics, and TIPS selection records;

[0110] Step 4, the nodes cluster and select based on the dynamic probability matrix and model similarity as the main indicators. After each round of training, the system updates the dynamic probability matrix. When the mutual selection probability of nodes within any cluster exceeds the threshold and the number of stable nodes reaches the minimum scale requirement, the relevant model will be triggered to be uploaded to the blockchain side chain for aggregation;

[0111] Step 5, the blockchain side chain selects a leader node based on the RAFT consensus. The leader node constructs an association matrix by calculating the inter-node association degree, identifies the connected components as clusters, performs model aggregation on each cluster and broadcasts it to the follower nodes for verification, and stores the verified aggregated model on the chain in the block;

[0112] Step 6, when a new node joins, the system calculates its matching degree with the cluster models stored in the block, selects the optimally matched cluster model and assigns it to the new node. If the matching degrees do not exceed the threshold, the genesis block model will be assigned;

[0113] Step 7, the system checks the aggregated data volume, model performance metrics, and the completion of the task objectives. If the requirements are not met, it will return to the local training stage and continue training until the termination condition is reached.

[0114] Specifically, the cluster identification algorithm described in Embodiment 1 is adopted in Step 4. The specific steps are as follows:

[0115] Step 4.1, during the clustering process, the DAG main chain adopts a dynamic probability selection matrix P. This matrix is based on the DAG main chain itself. The element Pij in the matrix represents the probability that node i selects node j as TIPS at the t-th round. The calculation formula is as follows:

[0116] Pij = α * S ij + β * H ij + γ * C ij

[0117] Where: Sij represents the model similarity between nodes i and j, Hij represents the historical interaction frequency, reflecting the long-term cooperation relationship between nodes, and Cij represents the contribution degree of node j, including the resource input and data quality of the node; α, β, and γ are weight coefficients and α + β + γ = 1;

[0118] Step 4.2, after each round of training, the dynamic probability selection matrix P is updated according to the new interaction information, and the calculation formula is as follows:

[0119] P(t + 1) = λP(t) + (1 - λ)P'(t)

[0120] Where: P(t) is the probability matrix at the t-th round, P'(t) is the new interaction information at the current round, and λ is the smoothing factor, which controls the retention degree of historical information. When the mutual selection probability P of all nodes in a certain cluster exceeds a pre-set threshold, it is considered that the cluster has been stably formed, and the relevant model set of the nodes is uploaded to the side chain of the blockchain for aggregation;

[0121] Step 4.3, during the training process of the DAG main chain, when the mutual selection probability of the nodes in a certain cluster exceeds the pre-set threshold for the first time, the first interaction with the side chain of the blockchain is triggered, and the nodes upload the models to the side chain for aggregation. After that, a fixed round T is set, and the cluster performs model upload and aggregation every T rounds, balancing the communication overhead and the timeliness of updates by setting the fixed round T.

[0122] Continuing with the example in Step 4, the aggregation mechanism based on RAFT consensus adopted by the side chain of the blockchain in Step 5 is as follows:

[0123] Step 5.1, cluster identification is performed based on the interaction mode between nodes. For any two nodes i and j, their association degree is calculated as follows:

[0124] ClusterAffinity(i,j) = Count(i→j) * Count(j→i) / MaxInteractions

[0125] Among them, Count(i→j) represents the number of times node i selects j as TIPS, Count(j→i) represents the number of times node j selects i as TIPS, and MaxInteractions is the maximum number of interactions between all node pairs observed currently. Based on the calculated correlation degree, a binary correlation matrix A[i,j] is constructed. When the correlation degree exceeds the preset threshold, A[i,j] = 1, indicating that these two nodes belong to the same cluster; otherwise, A[i,j] = 0, indicating that these two nodes do not belong to the same cluster.

[0126] Step 5.2, Use depth - first search to find connected components in the correlation matrix. Each connected component is a stably formed cluster. Retain the clusters with the number of nodes greater than 1. For each identified cluster k, the leading node performs weighted model aggregation, and the leading node generates a new cluster Mapk for the aggregation model as follows:

[0127] Mapk = {(ID i ,max_count)|ID i ∈top_K(∪Map i )}

[0128] Where IDi is the node identifier, max_count is the maximum approval count of this node in all Maps in this cluster, and top_K means only select the top K nodes with the highest approval counts;

[0129] Step 5.3, The leading node broadcasts the aggregation result to the follower nodes for verification. Each follower node returns information on whether it votes. When the number of positive votes exceeds half of the total number, the consensus is reached, and the leading node stores the aggregation model and Map on the chain in the block.

[0130] The above - mentioned method uses the natural selection behavior of DAG main - chain nodes for cluster division, ensures the model quality through weighted aggregation, and ensures the system reliability through distributed consensus. At the same time, the generation mechanism of the cluster Map maintains the continuity of the association between nodes, which helps the stability of subsequent training.

[0131] In step 6, when a new node joins the task midway, it will enter the model distribution. The design of the model distribution stage aims to use the high - quality models that have been aggregated and passed the consensus to provide a solid starting point for the newly added devices, thereby shortening their training cycles and improving their initial learning efficiency. The system evaluates the matching degree between the new node n and the existing cluster k based on three dimensions: data distribution similarity, prediction accuracy, and cluster stability. The calculation formula is as follows:

[0132] Score(n,k) = α*DS(n,k)+β*PA(n,k)+γ*CS(k)

[0133] Data distribution similarity DS(n,k): Calculate the data distribution distance between the new node n and the cluster k using Jensen-Shannon divergence as follows:

[0134] DS(n,k) = 1 - JSD(P_n ∥ P_k)

[0135] A smaller distribution distance indicates that the data characteristics of the new node are closer to those of the cluster;

[0136] Prediction accuracy PA(n,k): Test the model of cluster k on the validation set of node n:

[0137] PA(n,k) = ACC_k(X_n)

[0138] A higher accuracy indicates that the cluster model has good generalization ability for the data of the new node;

[0139] Cluster stability CS(k): Evaluate the ratio of the cluster size to the minimum stable size:

[0140] CS(k) = min(1, |C_k| / N_min)

[0141] where |C_k| is the number of nodes in cluster k and N_min is the minimum stable cluster size preset by the system;

[0142] The weight coefficients α, β, and γ are used to balance the importance of these three dimensions, and α + β + γ = 1. The system calculates the matching scores of the new node with all existing clusters, returns a list of scores scores, selects the cluster model with the highest score and exceeding the preset threshold to be assigned to the new node. If the matching scores of all clusters do not exceed the threshold, the basic model in the genesis block is assigned.

[0143] After the new node uses the selected model, it will provide feedback to the model contributor based on its training results. If the new node can quickly improve the performance of its model, the contributor of the original model will receive an additional reward.

[0144] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. Based on the DAG and blockchain two-layer architecture system, it is characterized by: The system includes a DAG main chain and a blockchain side chain; the DAG main chain is composed of multiple nodes including a genesis block, which is used for training personalized models, and the blockchain side chain is composed of participating nodes and blocks storing phased models, which is used for aggregation and distributed storage of cluster models; During the training process, the DAG main chain adopts the TIPS selection algorithm based on selection weight and model similarity to cluster nodes with similar models and perform training on the local data set. After the training is completed, the node packages the updated model and related metadata and uploads it to the DAG main chain. During the DAG main chain training process, when the mutual selection probability of nodes in any cluster exceeds the preset threshold for the first time, the first interaction with the blockchain side chain is triggered, and the node uploads the relevant model to the blockchain side chain. After that, the cluster uploads the model once every fixed round preset by the system. The uploaded information includes the model and the corresponding TIPS selection record Map. The model includes model parameters, data volume and node performance indicators. During the aggregation process, the blockchain side chain adopts an aggregation mechanism based on RAFT consensus. Participating nodes are divided into leading nodes and following nodes. The leading node receives model transactions from the DAG main chain, builds an association matrix by calculating the association between nodes, identifies connected components as clusters, and performs weighted aggregation on the models in each cluster. The cluster-level aggregation model is generated and broadcast to the following nodes for verification. After obtaining confirmation from the majority of the following nodes, the aggregation model and the Map are stored on the chain in the block; The node newly added to the DAG main chain selects a model that meets the local characteristics from the aggregated models stored in the block as the initial model, and continues training on the DAG main chain.

2. According to claim 1, the DAG and blockchain two-layer architecture system is characterized in that: The system adopts a cluster identification algorithm to accelerate the node clustering process in the DAG main chain based on a dynamic probability selection matrix. The information uploaded by the DAG main chain to the blockchain side chain also includes the current probability matrix status, which records the selection tendency between nodes.

3. According to claim 2, the DAG and blockchain two-layer architecture system is characterized in that: In the DAG main chain, each node contains node ID, device ID, timestamp, local model parameters, data size, referenced predecessor node set information and TIPS selection record; in the blockchain side chain, the block storing the phased model consists of a block header and a block body. The block header contains the current block version number, the previous block address information, the current block hash value, timestamp and Merkle root information; the block body stores model parameter information, cluster-related data information and data size information. The block header and block body construct a Merkle tree to provide verification function.

4. The DAG and blockchain based dual-layer architecture system according to claim 2 is characterized in that: After the staged model is stored on the blockchain sidechain, the system adopts a progress-based adaptive reward mechanism to distribute rewards by evaluating the node's progress score, difficulty factor, and abnormal behavior detection.

5. According to claim 4, the DAG and blockchain based dual-layer architecture system is characterized in that: The above-mentioned progress-based adaptive reward mechanism has a calculation formula for the progress reward P_Reward as follows: P_Reward(i,t)=μ*P_Score(i,t)*(1 / Difficulty_Factor(i,t))*(1-Deviation_Score(i,t)) μ is the base reward coefficient, which is a global parameter adjusted by the system to control the overall reward scale. The other three parts of the formula evaluate the node's progress score, difficulty factor, and abnormal behavior detection; Progress Score: P_Score(i,t)=(Q(i,t)-Base_Quality(i,t)) / σ(Q(i,tN):t-1) Q(i,t) represents the model quality score of node i in round t, Base_Quality(i,t) represents the baseline performance, σ(Q(i,tN):t-1) represents the standard deviation of the baseline performance score. The system uses a sliding window to calculate the baseline performance. The window contains the performance of the past N rounds. The window size N is dynamically adjusted according to the total number of training rounds. The baseline performance calculation formula is: Difficulty Factor: Difficulty_Factor(i,t)=1+log(1+Reward_Count(i,t)) Reward_Count(i,t) records the number of historical awards won by node i. As the number of awards increases, the difficulty coefficient gradually increases. Abnormal behavior detection: Deviation_Score(i,t)=|Q(i,t)-Predicted_Q(i,t)| Predicted_Q(i,t) is a reasonable performance value predicted based on historical data. The system builds a performance prediction model based on historical data and calculates the deviation between actual performance and expectations. When the node performance deviates significantly from the reasonable range predicted by historical data, the deviation score increases, reducing the final reward.

6. A decentralized federated learning method based on a dual-layer architecture of DAG and blockchain, characterized in that: Based on the two-layer architecture system described in any one of claims 1 to 5, federated learning is implemented through the following steps: Step 1: The task publisher publishes the federated learning task content, data requirements, and training objectives through the network, and deploys the pre-trained basic model in the genesis block of the DAG main chain as the starting point for subsequent node training; Step 2: The node that wants to participate in the task pays the ticket as a participation deposit. The system assigns a globally unique identification ID to it. The node obtains the initialization model in the genesis block, and the system initializes the interaction record for the new node. Step 3: The node performs personalized model training based on the local data set, and records the local model parameters, training data size, performance indicators, and TIPS selection records; Step 4: Nodes are clustered and selected based on the dynamic probability matrix and model similarity as the main indicators. The system updates the dynamic probability matrix after each round of training. When the mutual selection probability of nodes in any cluster exceeds the threshold and the number of stable nodes reaches the minimum scale requirement, the relevant model will be triggered to be uploaded to the blockchain side chain for aggregation; Step 5: The blockchain sidechain selects a leader node based on the RAFT consensus. The leader node constructs a correlation matrix by calculating the correlation between nodes, identifies connected components as clusters, performs model aggregation on each cluster, and broadcasts it to the follower nodes for verification. The verified aggregation model is stored on the chain in the block; Step 6: When a new node joins, the system calculates its matching degree with each cluster model stored in the block, selects the best matching cluster model and assigns it to the new node. If the matching degree does not exceed the threshold, the Genesis block model is assigned; In step 7, the system checks the amount of aggregated data, model performance indicators, and task target completion. If the requirements are not met, it returns to the local training stage to continue training until the termination condition is reached.

7. The decentralized federated learning method based on the DAG and blockchain double-layer architecture according to claim 6 is characterized in that: The specific steps for the node cluster in step 4 are: Step 4.1: During the clustering process, the DAG main chain uses a dynamic probability selection matrix P, which is based on the DAG main chain itself. The elements in the matrix P ij It represents the probability that node i chooses node j as TIPS in round t. The calculation formula is as follows: P ij =α*S ij +β*H ij +γ*C ij Where: S ij represents the model similarity between nodes i and j, H ij represents the historical interaction frequency, reflecting the long-term cooperative relationship between nodes, C ij represents the contribution of node j, including the resource input and data quality of the node; α, β, γ are weight coefficients and α+β+γ=1; Step 4.2, after each round of training, the dynamic probability selection matrix P is updated according to the new interaction information, and the calculation formula is as follows: P(t+1)=λP(t)+(1-λ)P'(t) Where: P(t) is the probability matrix of round t, P'(t) is the new interaction information of the current round, λ is the smoothing factor, which controls the degree of retention of historical information. When the mutual selection probability P of all nodes in a cluster exceeds the preset threshold, the cluster is considered to have been stably formed, and the relevant model set of the node is uploaded to the blockchain side chain for aggregation; Step 4.3: During the DAG main chain training process, when the mutual selection probability of nodes in a cluster exceeds the preset threshold for the first time, the first interaction with the blockchain side chain is triggered, and the node uploads the model to the side chain for aggregation. After that, a fixed round T is set. The cluster uploads and aggregates the model every T rounds, and balances the communication overhead and the timeliness of the update by setting a fixed round T.

8. The decentralized federated learning method based on the DAG and blockchain double-layer architecture according to claim 6 is characterized in that: The RAFT consensus-based aggregation mechanism adopted by the blockchain sidechain includes the following steps: Step 5.1: Cluster identification is performed based on the interaction pattern between nodes. For any two nodes i and j, their association degree is calculated as follows: ClusterAffinity(i,j)=Count(i→j)*Count(j→i) / MaxInteractions Where Count(i→j) represents the number of times node i selects j as TIPS, Count(j→i) represents the number of times node j selects i as TIPS, MaxInteractions is the maximum number of interactions between all node pairs currently observed, and a binary association matrix A[i,j] is constructed based on the calculated association degree. When the association degree exceeds the preset threshold, A[i,j]=1, indicating that the two nodes belong to the same cluster; otherwise, A[i,j]=0, indicating that the two nodes do not belong to the same cluster. Step 5.2, use depth-first search to find connected components in the association matrix. Each connected component is a stably formed cluster. Clusters with more than 1 nodes are retained. For each identified cluster k, the leader node performs weighted model aggregation. The leader node generates a new cluster Mapk for the aggregation model as follows: Mapk={(ID i ,max_count)|ID i ∈top_K(∪Map i )} Where ID i is the node identifier, max_count is the maximum number of times the node appears in all maps in the cluster, and top_K means only selecting the K nodes with the highest number of approvals; In step 5.3, the leader node broadcasts the aggregation results to the follower nodes for verification. Each follower node returns information on whether to vote. When the number of positive votes exceeds half of the total, consensus is reached and the leader node stores the aggregation model and Map on the chain into the block.

9. The decentralized federated learning method based on the DAG and blockchain double-layer architecture according to claim 6 is characterized in that: The specific method by which the system selects the best matching cluster model to assign to the new node is: The system evaluates the matching degree between the new node n and the existing cluster k based on three dimensions: data distribution similarity, prediction accuracy, and cluster stability. The calculation formula is as follows: Score(n,k)=α*DS(n,k)+β*PA(n,k)+γ*CS(k) Data distribution similarity DS(n,k): The data distribution distance between the new node n and cluster k is calculated using Jensen-Shannon divergence as follows: DS(n,k)=1-JSD(P_n∥P_k) A smaller distribution distance indicates that the data characteristics of the new node are closer to the cluster; Prediction accuracy PA(n,k): Use the model of cluster k to test on the validation set of node n: PA(n,k)=ACC_k(X_n) The higher accuracy indicates that the cluster model has good generalization ability for new node data; Cluster stability CS(k): evaluates the ratio of cluster size to the minimum stable size: CS(k)=min(1,|C_k| / N_min) Where |C_k| is the number of nodes in cluster k, and N_min is the minimum stable cluster size preset by the system; The weight coefficients α, β, and γ are used to balance the importance of these three dimensions and satisfy α+β+γ=1. The system calculates the matching score of the new node with all existing clusters, returns a score list scores, and selects the cluster model with the highest score that exceeds the preset threshold to assign to the new node. If the matching scores of all clusters do not exceed the threshold, the basic model in the genesis block is assigned.

10. The decentralized federated learning method based on the DAG and blockchain double-layer architecture according to claim 9 is characterized in that: After using the selected model, the new node will provide feedback to the model contributor based on its training results. If the new node can quickly improve its model performance, the contributor of the original model will receive additional rewards.