Federated learning method based on directed acyclic graph (dag) blockchain

CN116777002BActive Publication Date: 2026-06-26STATE GRID LIAONING ELECTRIC POWER CO LTD +2

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
STATE GRID LIAONING ELECTRIC POWER CO LTD
Filing Date
2023-06-15
Publication Date
2026-06-26

Smart Images

  • Figure CN116777002B_ABST
    Figure CN116777002B_ABST
Patent Text Reader

Abstract

The application provides a federated learning method based on a directed acyclic graph (DAG) blockchain, which comprises the following steps: after receiving a continue training instruction sent by a management device, obtaining a current DAG blockchain; determining initial model parameters based on a local data test set and model parameters in a node in the current DAG blockchain; training a preset model with the initial model parameters based on a local data training set to obtain an intermediate model; compressing model parameters of the intermediate model based on model accuracy of the intermediate model to obtain current target model parameters; wherein the current target model parameters are used to update the current DAG blockchain to obtain a new DAG blockchain; and sending the current target model parameters to the management device. The federated learning method based on the DAG blockchain provided by the application is used for saving communication overhead.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication technology, and in particular to a federated learning method based on directed acyclic graph (DAG) blockchain. Background Technology

[0002] Currently, with the rapid development of Artificial Intelligence (AI) and Big Data technologies, data silos have emerged due to privacy protection policies, data regulation policies, and competition among industries. Participants are unwilling to share their data when training models, severely hindering the development of AI and Big Data. To address this issue, Federated Learning (FL) has emerged as a solution.

[0003] In related technologies, federated learning methods include: edge servers constructing a base model; smart devices using local datasets to perform multiple rounds of local training on the base model obtained from the edge server; uploading the trained model to the edge server; the edge server aggregating the trained models to obtain an aggregated model; and stopping model training when the aggregated model reaches the desired accuracy.

[0004] In the aforementioned technologies, smart devices directly upload the trained model to the edge server, which requires a significant amount of communication overhead. Summary of the Invention

[0005] This invention provides a federated learning method based on directed acyclic graph (DAG) blockchain to address the shortcomings of existing technologies in terms of high communication overhead and achieve the goal of saving communication costs.

[0006] This invention provides a federated learning method based on a directed acyclic graph (DAG) blockchain, applied to a training device. The method includes:

[0007] After receiving the command to continue training from the management device, obtain the current DAG blockchain;

[0008] Based on the local data test set and the model parameters within the nodes of the current DAG blockchain, determine the initial model parameters;

[0009] Based on the local data training set, a preset model with the initial model parameters is trained to obtain an intermediate model;

[0010] Based on the model accuracy of the intermediate model, the model parameters of the intermediate model are compressed to obtain the current target model parameters; wherein, the current target model parameters are used to update the current DAG blockchain to obtain a new DAG blockchain;

[0011] Send the current target model parameters to the management device.

[0012] According to the federated learning method based on a directed acyclic graph (DAG) blockchain provided by the present invention, the determination of initial model parameters based on a local test data set and model parameters within nodes of the current DAG blockchain includes:

[0013] Perform N node selection operations to determine N target nodes in the current DAG blockchain; where N is an integer greater than or equal to 2;

[0014] The model parameters within the N target nodes are averaged and aggregated to obtain the initial model parameters.

[0015] The node selection operation includes: for the i-th node in the current DAG blockchain, if the i-th node has no child nodes, then the i-th node is determined as the target node; otherwise, based on the compression ratio calculation model, the scoring calculation model, and the local data test set, the (i+1)-th node is determined from the child nodes of the i-th node; the i-th node is updated to the (i+1)-th node, and this operation is repeated until the target node is obtained; initially, i equals 0, and the 0th node is a node randomly selected in the current DAG blockchain.

[0016] According to the present invention, a federated learning method based on a directed acyclic graph (DAG) blockchain is provided, wherein determining the (i+1)th node among the child nodes of the i-th node based on a compression ratio calculation model, a scoring calculation model, and the local data test set includes:

[0017] For each child node of the i-th node, the model accuracy corresponding to the child node is determined based on the local data test set and the accuracy calculation model; the model clustering parameters within the child node are processed using the compression ratio calculation model to obtain the compression ratio corresponding to the child node; the model accuracy and the compression ratio are processed using the scoring calculation model to obtain the score corresponding to the child node.

[0018] The child node corresponding to the highest score among all the child nodes is determined as the (i+1)th node.

[0019] According to the federated learning method for a directed acyclic graph (DAG) blockchain provided by the present invention, the compression ratio calculation model is as follows:

[0020]

[0021] Where r represents the compression ratio corresponding to the child node, k represents the model clustering parameter within the child node, n represents the total number of model parameters corresponding to the child node, b1 represents the number of bits of the model parameter, and log2(·) represents the logarithmic operation with base 2.

[0022] According to the federated learning method based on directed acyclic graph (DAG) blockchain provided by the present invention, the scoring calculation model is as follows:

[0023] Score = a²·Acc₁·log₂(r·b²)

[0024] Wherein, Score represents the score corresponding to the child node, Acc1 represents the model accuracy corresponding to the child node, r represents the compression ratio corresponding to the child node, a2 represents the preset accuracy adjustment parameter, and b2 represents the preset compression ratio adjustment parameter.

[0025] According to the federated learning method based on a directed acyclic graph (DAG) blockchain provided by the present invention, the step of compressing the model parameters of the intermediate model based on the model accuracy of the intermediate model to obtain the current target model parameters includes:

[0026] Based on the clustering parameter generation model, the model accuracy of the intermediate model is processed to obtain the model clustering parameters corresponding to the intermediate model;

[0027] The K-means clustering algorithm is used to compress the model parameters of the intermediate model based on the model clustering parameters corresponding to the intermediate model, so as to obtain the current target model parameters.

[0028] According to the federated learning method based on a directed acyclic graph (DAG) blockchain provided by the present invention, the step of compressing the model parameters of the intermediate model based on the model accuracy of the intermediate model to obtain the current target model parameters includes:

[0029] Based on the clustering parameter generation model, the model accuracy of the intermediate model is processed M times to obtain M model clustering parameters corresponding to the intermediate model; where M is an integer greater than or equal to 2;

[0030] Using the K-means clustering algorithm, the model parameters of the intermediate model are compressed based on the M model clustering parameters to obtain the compressed model parameters corresponding to each of the M model clustering parameters; and the KL divergence value of each of the M compressed model parameters is determined.

[0031] The compression model parameters corresponding to the minimum KL divergence value are determined as the current target model parameters.

[0032] According to the federated learning method based on directed acyclic graph (DAG) blockchain provided by the present invention, the clustering parameter generation model is as follows:

[0033] k = round(((M) max -M min )·Acc2)+M min )

[0034] Where k represents the clustering parameters of the intermediate model, Acc2 represents the model accuracy of the intermediate model, and M max M represents the maximum preset clustering parameter. min This represents the minimum preset clustering parameter, and round(·) represents the random integer generation operation, which is used to randomly generate integers located between 0 and (M). max -M min Integers between 1 and 2.

[0035] According to a federated learning method based on a directed acyclic graph (DAG) blockchain provided by the present invention, the step of sending the current target model parameters to the management device includes:

[0036] Obtain the loss value of the historical target model parameters; the historical target model parameters are the target model parameters most recently sent by the training device to the management device;

[0037] Based on the local data test set and the loss calculation model, determine the loss value of the current target model parameters;

[0038] If the loss value of the current target model parameter is less than or equal to the loss value of the historical target model, the current target model parameter is sent to the management device.

[0039] According to the present invention, a federated learning method based on a directed acyclic graph (DAG) blockchain is provided, the method further comprising:

[0040] Receive a stop training command sent by the management device; wherein, the stop training command is a command sent by the management device after detecting, based on the management device's local data test set, that there exists a model in the current DAG blockchain with a model accuracy greater than or equal to a first preset accuracy;

[0041] Training is stopped based on the aforementioned stop training instruction.

[0042] This invention provides a federated learning method based on a Directed Acyclic Graph (DAG) blockchain. After receiving a continue training instruction from a management device, the training device acquires the current DAG blockchain; determines initial model parameters based on a local test set and the model parameters within the nodes of the current DAG blockchain; trains a preset model with the initial model parameters using a local training set to obtain an intermediate model; compresses the model parameters of the intermediate model based on its accuracy to obtain the current target model parameters; these current target model parameters are used to update the current DAG blockchain to obtain a new DAG blockchain; and the current target model parameters are sent to the management device without incurring significant communication overhead, thus saving communication costs. Attached Figure Description

[0043] To more clearly illustrate the technical solutions within the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is a schematic diagram of an application scenario provided by the present invention;

[0045] Figure 2 This is a flowchart illustrating the federated learning method based on DAG blockchain provided in an embodiment of the present invention.

[0046] Figure 3 This is a schematic diagram of the DAG blockchain provided in an embodiment of the present invention;

[0047] Figure 4 This is a schematic flowchart of the method for determining initial model parameters provided in an embodiment of the present invention;

[0048] Figure 5 This is a schematic diagram of the node selection operation provided in an embodiment of the present invention;

[0049] Figure 6 This is a schematic flowchart of the method for determining the (i+1)th node provided in an embodiment of the present invention;

[0050] Figure 7 This is a schematic diagram of the compression process of the model parameters of the intermediate model provided in the embodiment of the present invention;

[0051] Figure 8 This is a schematic diagram of a novel power system architecture provided by an embodiment of the present invention;

[0052] Figure 9 This is a schematic diagram of the structure of the DAG blockchain-based federated learning device provided in an embodiment of the present invention;

[0053] Figure 10 This is a schematic diagram of the physical structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0054] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0055] In this invention, the term "comprising" and its variations can refer to a non-limiting inclusion; the term "or" and its variations can refer to "and / or". The terms "first", "second", etc., in this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. In this invention, "at least one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0056] In related technologies, smart devices directly upload trained models to edge servers, which requires a significant amount of communication overhead.

[0057] To reduce communication overhead, this invention provides a federated learning method based on a Directed Acyclic Graph (DAG) blockchain. The following description, in conjunction with specific embodiments, illustrates this federated learning method based on a DAG blockchain.

[0058] Below, in conjunction with Figure 1 The application scenarios of the technical solution shown in this invention will be described.

[0059] Figure 1 This is a schematic diagram illustrating an application scenario provided by the present invention. For example... Figure 1 As shown, this application scenario includes, for example, a Directed Acyclic Graph (DAG) blockchain, a management device, and multiple training devices.

[0060] The management equipment is used to send commands to each training device to continue training and stop training.

[0061] Optionally, the communication resources of multiple training devices can be the same or different.

[0062] Alternatively, multiple training devices can be Internet of Things (IoT) devices or edge intelligent devices.

[0063] Internet of Things (IoT) devices can include, for example, smart substations, smart distribution networks, smart interactive terminals, or smart meters in power systems.

[0064] For each training device, upon receiving a continue training instruction from the management device, the training device determines an initial model based on the local data test set and the models within the nodes of the current DAG blockchain. It then trains the initial model based on the local data training set to obtain an intermediate model. Based on the model accuracy of the intermediate model, it compresses the intermediate model to obtain the current target model and sends the current target model to the management device. The current target model is used to update the current DAG blockchain to obtain a new DAG blockchain. Upon receiving a stop training instruction from the management device, the training device stops training.

[0065] Figure 2 This is a flowchart illustrating the federated learning method based on DAG blockchain provided in an embodiment of the present invention. Figure 2 As shown, the method includes:

[0066] Step 201: After receiving the instruction to continue training from the management device, obtain the current DAG blockchain.

[0067] Optionally, the federated learning method based on DAG blockchain provided by this invention can be implemented by an entity that can be... Figure 1 The training device can also be a DAG-based blockchain-based federated learning device installed within the training device. A DAG-based blockchain-based federated learning device can be implemented through a combination of software and / or hardware.

[0068] Optionally, the management device can be the target device that initiates the training task request for the federated learning task, or it can be the device that receives the training task request sent by the target device.

[0069] Federated learning tasks can include image recognition, traffic prediction, or power generation prediction.

[0070] A training task request may include one or more of the following:

[0071] Preset model;

[0072] First preset precision.

[0073] Optionally, the target device can be one of a plurality of training devices.

[0074] When the management device is the target device, before step 201, the federated learning method based on DAG blockchain further includes: the target device sending a training task request to the training device as needed, and sending a preset model and a first preset accuracy to the training device.

[0075] When the management device is the one receiving training task requests, upon receiving the request, it immediately creates the root node of the DAG blockchain and stores the preset model and first preset precision in the root node. After the training device acquires the current DAG blockchain, it can retrieve the preset model and first preset precision from the root node of the current DAG blockchain.

[0076] Alternatively, in this invention, the DAG blockchain is jointly maintained by a management device and multiple training devices.

[0077] The current DAG blockchain is the DAG blockchain acquired by the training device at the current moment.

[0078] The current DAG blockchain includes at least one node.

[0079] Optionally, a node may include one or more of the following:

[0080] Model clustering parameters;

[0081] Preset model parameters;

[0082] The identifiers of each model parameter in the preset model;

[0083] Each model parameter identifies the corresponding container index;

[0084] The parameter values ​​corresponding to each container index;

[0085] Each model parameter is identified by its corresponding model parameter.

[0086] It should be noted that the model parameters of the preset model include the model parameters corresponding to each model parameter identifier.

[0087] When a node includes model parameter identifiers for a preset model, container indices corresponding to each model parameter identifier, and parameter values ​​corresponding to each container index, the model parameters corresponding to each model parameter identifier can be obtained using the following method 1:

[0088] Based on the first mapping relationship shown in Table 1 (i.e., the container index corresponding to each model parameter identifier), the container index corresponding to the model parameter identifier is determined; based on the second mapping relationship shown in Table 2 (the parameter value corresponding to each container index), the parameter value corresponding to the container index is determined, and the parameter value is determined as the model parameter corresponding to the model parameter identifier.

[0089] Table 1

[0090] Model parameter identifier Container Index C1 1 C2 2 C3 1 C4 0 C5 3 C6 2 C7 1 …… ……

[0091] Table 2

[0092] Container Index Parameter value 0 -1.00 1 0.00 2 1.50 3 2.00

[0093] Step 202: Determine the initial model parameters based on the local data test set and the model parameters within the nodes of the current DAG blockchain.

[0094] For example, in the case of image recognition as a federated learning task, the local data test set includes multiple first sample working images of a certain machine and the label information (i.e. fault labeling information) of each first sample working image.

[0095] For example, in a federated learning task where the task is to predict traffic conditions, the local data test set includes multiple first-weather status information sets and label information (traffic flow data) for each first-weather status information set. The multiple first-weather status information sets are weather status data from different first-vehicle detection stations.

[0096] For example, in the case of a federated learning task involving power generation forecasting, the local data test set includes multiple primary power generation information sets and the tag information (i.e., actual power generation) for each primary power generation information set. The primary power generation information sets include weather status information, time information, and equipment information, etc.

[0097] The model parameters within nodes in the current DAG blockchain can be obtained through method 1 described above, which will not be elaborated here.

[0098] Optionally, the initial model parameters can be determined based on the model parameters within the leaf nodes of the current DAG blockchain. The number of leaf nodes can be one or more. If there are multiple leaf nodes, the model parameters within the multiple leaf nodes are averaged and aggregated to obtain the initial model parameters.

[0099] For example, if there are 2 leaf nodes, and each node includes the model parameter identifiers of the preset model (e.g., C1, C2, and C3) and the model parameters corresponding to each model parameter identifier, and if the model parameter corresponding to C1 in one leaf node is D1, the model parameter corresponding to C2 is D2, and the model parameter corresponding to C3 is D3, and the model parameter corresponding to C1 in another leaf node is D4, the model parameter corresponding to C2 is D5, and the model parameter corresponding to C3 is D6, then during the average aggregation process, the average value of D1 and D4, the average value of D2 and D5, and the average value of D3 and D6 will be determined as the initial model parameters.

[0100] Step 203: Based on the local data training set, train the preset model with initial model parameters to obtain the intermediate model.

[0101] For example, in the case of image recognition in federated learning, the local training data set includes multiple second-sample working images from a certain machine and the label information (i.e., fault labeling information) of each second-sample working image. The multiple second-sample working images are different from the multiple first-sample working images.

[0102] In the context of the federated learning task of traffic condition prediction, the local data training set includes multiple second-day weather status information sets and label information (traffic flow data) for each set. These second-day weather status information sets are weather condition data from different second vehicle detection stations. These second vehicle detection stations differ from the first vehicle detection station.

[0103] In the context of federated learning task-oriented power generation forecasting, the local data training set includes multiple secondary power generation information sets and label information for each secondary power generation information set (i.e., actual power generation). The secondary power generation information sets include weather conditions, time information, and equipment information. These secondary power generation information sets differ from the multiple primary power generation information sets.

[0104] Step 204: Based on the model accuracy of the intermediate model, compress the model parameters of the intermediate model to obtain the current target model parameters.

[0105] The current target model parameters are used to update the current DAG blockchain to obtain a new DAG blockchain.

[0106] Step 205: Send the current target model parameters to the management device.

[0107] exist Figure 2 In this embodiment, initial model parameters are determined based on the local data test set and the model parameters within the nodes of the current DAG blockchain. Based on the local data training set, a preset model with initial model parameters is trained to obtain an intermediate model. Based on the model accuracy of the intermediate model, the model parameters of the intermediate model are compressed to obtain the current target model parameters. The current target model parameters are then sent to the management device. Since the current target model parameters are obtained through compression, sending the current target model to the management device saves communication overhead.

[0108] Furthermore, based on the model accuracy of the intermediate model, the model parameters of the intermediate model are compressed to obtain the parameters of the current target model. This can ensure the accuracy of the model while compressing the model parameters, thereby improving the performance of federated learning.

[0109] In this invention, the DAG blockchain includes four types of nodes: Initial Node, Basic Node, Tip Node, and New Node.

[0110] The initial node includes the federated learning task and the model to be trained.

[0111] The basic nodes contain historical models published by the training equipment.

[0112] A special node is a node with no child nodes.

[0113] The new node includes the latest model published by the training device (i.e., the current target model).

[0114] Below, in conjunction with Figure 3 The DAG blockchain provided in the embodiments of the present invention will be described.

[0115] Figure 3 This is a schematic diagram of the DAG blockchain provided in an embodiment of the present invention. Figure 3 As shown, the DAG blockchain includes nodes A0 to A15.

[0116] A0 is the initial node (i.e., the root node).

[0117] A1, A2, A3, A4, A5, A6, A7, A8, A9, and A10 are basic nodes.

[0118] A11, A12, A13, and A14 are special nodes.

[0119] A15 is a new node.

[0120] Optionally, there are parent-child relationships between nodes. For example, for node A2, the child nodes of A2 include A1, A4 and A5. The parent nodes of A1 are A2 and A0, the parent nodes of A4 are A2 and A1, and the parent nodes of A5 are A2 and A3.

[0121] Figure 4 This is a schematic flowchart of the method for determining initial model parameters provided in an embodiment of the present invention. Figure 4 As shown, the method includes:

[0122] Step 401: Perform N node selection operations to determine N target nodes in the current DAG blockchain.

[0123] Where N is an integer greater than or equal to 2.

[0124] The node selection operation includes: for the i-th node in the current DAG blockchain, if the i-th node has no child nodes, then the i-th node is determined as the target node; otherwise, based on the compression ratio calculation model, the scoring calculation model, and the local data test set, the (i+1)-th node is determined from the child nodes of the i-th node; the i-th node is updated to the (i+1)-th node, and this operation is repeated until the target node is obtained; initially, i equals 0, and the 0th node is a node randomly selected in the current DAG blockchain.

[0125] Optionally, the node selection operation can be a node selection operation based on the random walk method.

[0126] Below, in Figure 3 Based on, combined Figure 5 The node selection operation is illustrated by example. Figure 5 This is a schematic diagram of the node selection operation provided in an embodiment of the present invention. For example... Figure 5 As shown, for example, when N is 2, during the first node selection operation, based on the compression ratio calculation model, the scoring calculation model, and the local data test set, a random walk method is used to determine A12 as the first target node in the order of A0→A2→A4→A7→A10→A12; during the second node selection operation, based on the compression ratio calculation model, the scoring calculation model, and the local data test set, a random walk method is used to determine A13 as the second target node in the order of A0→A3→A5→A8→A9→A13.

[0127] Step 402: Perform average aggregation on the model parameters within the N target nodes to obtain the initial model parameters.

[0128] Figure 6 This is a schematic flowchart of the method for determining the (i+1)th node provided in an embodiment of the present invention. Figure 6 As shown, the method includes:

[0129] Execute steps 601 to 603 for each child node of the i-th node.

[0130] Step 601: Determine the model accuracy corresponding to the child node based on the local data test set and the accuracy calculation model.

[0131] Optionally, step 601 specifically includes: determining model parameters based on child nodes; inputting the local data test set into a preset model with the model parameters to obtain test results; and calculating the model accuracy corresponding to the child node based on the test results and accuracy calculation.

[0132] The accuracy calculation model can be either Model 1 or Model 2.

[0133] Model 1 is:

[0134] Where Accuracy represents the model accuracy corresponding to the child node, n correct n represents the correct prediction of a preset model with these model parameters. total This represents the total predictions of the preset model with these model parameters. TP represents the number of samples in the local test data set that were actually positive but were predicted as positive. FP represents the number of samples in the local test data set that were actually negative but were predicted as positive. FN represents the number of samples in the local test data set that were actually positive but were predicted as negative. TN represents the number of samples in the local test data set that were actually negative but were predicted as negative. For example, "actually positive but predicted as positive" means that after inputting positive samples from the local test data set into the preset model with these model parameters, the output is also positive.

[0135] Model 2 is:

[0136] Where Accuracy represents the model accuracy corresponding to the child node, m represents the total number of samples in the local test set, and f x Let y represent the predicted value of the x-th sample. x This represents the label of the x-th sample.

[0137] It should be noted that Model 1 can be applied to classification tasks, while Model 2 can be applied to regression tasks.

[0138] Step 602: Using the compression ratio calculation model, process the model clustering parameters within the child nodes to obtain the compression ratio corresponding to the child nodes.

[0139] The compression ratio corresponding to the child node is the compression ratio of the preset model containing the model parameters within the child node.

[0140] In some embodiments, the compression ratio calculation model is as follows:

[0141]

[0142] Where r represents the compression ratio corresponding to the child node, k represents the model clustering parameters within the child node, n represents the total number of model parameters corresponding to the child node, b1 represents the number of bits of the model parameters, and log2(·) represents the logarithmic operation with base 2.

[0143] Step 603: Using the scoring calculation model, process the model accuracy and compression ratio to obtain the score corresponding to the child node.

[0144] The score corresponding to the child node is the score of the preset model that has the model parameters within the child node.

[0145] In some embodiments, the scoring calculation model is as follows:

[0146] Score=a2·Acc1·log2(r·b2);

[0147] Where Score represents the score corresponding to the child node, Acc1 represents the model accuracy corresponding to the child node, r represents the compression ratio corresponding to the child node, a2 represents the preset accuracy adjustment parameter, and b2 represents the preset compression ratio adjustment parameter.

[0148] a2 is used to adjust the effect of model accuracy on the score, and b2 is used to adjust the effect of compression ratio on the score.

[0149] Step 604: Determine the child node corresponding to the highest score among all child nodes as the (i+1)th node.

[0150] For example, in Figure 5 Based on this, A0 is the i-th node. For each child node A1, A2 and A3 of A0, if the score of A1 is 90, the score of A2 is 70 and the score of A3 is 85 based on the local data test set, the accuracy calculation model, the compression ratio calculation model and the scoring calculation model, then A1 is determined as the (i+1)-th node.

[0151] exist Figure 6 In this embodiment, the compression ratio calculation model is used to process the model clustering parameters within the child nodes to obtain the compression ratio corresponding to the child nodes; the scoring calculation model is used to process the model accuracy and compression ratio to obtain the score corresponding to the child nodes; the child node with the highest score among all child nodes is determined as the (i+1)th node. This takes into account the influence of model accuracy and model size (i.e., compression ratio) on the initial model parameters obtained after average aggregation processing, thereby improving the accuracy of the initial model parameters and thus improving the model accuracy of the preset model with the initial model parameters.

[0152] Optionally, the pseudocode for the node selection operation is shown below.

[0153] 1) children = getchildren(node ​​i) / / Get the child nodes of the i-th node in the current DAG blockchain;

[0154] 2) j = len(children) / / Get the total number j of child nodes of the i-th node;

[0155] 3) for m = 0: j - 1 do;

[0156] 4) Acc1[m] = EvaluateOnLocalData(child[m]) / / Determine the model accuracy corresponding to child node m;

[0157] 5) / / Get the compression ratio corresponding to child node m;

[0158] 6) Score[m] = a2·Acc1[m]·log2(r[m]·b2) / / Get the score corresponding to child node m;

[0159] 7) end for;

[0160] 8) node i+1 = getMaxScore(0:j-1) / / Determine the (i+1)th node as the child node with the highest score among j child nodes;

[0161] 9) Based on node i+1, repeat steps 1) to 8) until the target node for this node selection operation is obtained.

[0162] Alternatively, step 204 can be achieved through methods 2 and 3 as follows.

[0163] Method 2: Generate a model based on clustering parameters, process the model accuracy of the intermediate model to obtain the model clustering parameters corresponding to the intermediate model; use the K-means clustering algorithm to compress the model parameters of the intermediate model based on the model clustering parameters corresponding to the intermediate model to obtain the current target model parameters.

[0164] The following is combined with Figure 7 This example illustrates the compression process of model parameters in an intermediate model.

[0165] Figure 7 This is a schematic diagram illustrating the compression process of model parameters in the intermediate model provided in this embodiment of the invention. When the model clustering parameter is equal to 4, the K-means clustering algorithm corresponds to 4 containers, with container indices of 0, 1, 2, and 3, as follows: Figure 7 As shown, the parameter value corresponding to container index 0 is -1.00, the parameter value corresponding to container index 1 is 0.00, the parameter value corresponding to container index 2 is 1.50, and the parameter value corresponding to container index 3 is 2.00.

[0166] against Figure 7 The model parameters shown employ a weight-sharing method, placing them into corresponding containers. For example, model parameter 2.09 is placed into the container corresponding to index 3, and model parameter -0.98 is placed into the container corresponding to index 0. Furthermore, the parameter values ​​corresponding to each container index are stored in a specific data structure, thereby converting the model parameters into their corresponding container index values, thus completing the compression of the model parameters.

[0167] For each model parameter identifier in the preset model, if the container index corresponding to the model parameter identifier is the same, the parameter value stored in the container corresponding to the container index can be shared. For example, based on Table 1, model parameter identifiers C1, C3, and C7 share the parameter value 0.00 stored in the container corresponding to container index 1, and model parameter identifiers C2 and C6 share the parameter value 1.50 stored in the container corresponding to container index 21.

[0168] In Method 2, the K-means clustering algorithm is used to compress the model parameters of the intermediate model based on the model clustering parameters corresponding to the intermediate model to obtain the current target model parameters. This reduces the number of bits required to store the model parameters, and the model parameters in the same container share the same parameter value, thus saving communication overhead.

[0169] Unlike related technologies, where K-means clustering algorithms typically use the same manually set model clustering parameters, this invention addresses the issue that intermediate models from different training devices may have different parameters. Setting identical clustering parameters could prevent the model parameters from being compressed to a reasonable range, resulting in poor federated learning performance. Therefore, this invention generates a model based on clustering parameters and processes the accuracy of the intermediate models to obtain their corresponding clustering parameters. This ensures that the model parameters are compressed to a reasonable range, thereby improving the effectiveness of federated learning.

[0170] Building upon Method 2, federated learning methods based on Directed Acyclic Graph (DAG) blockchains also include one or more of the following:

[0171] Send the model clustering parameters corresponding to the intermediate model to the management device;

[0172] At least one container index and its corresponding parameter value obtained during the compression process will be sent to the management device.

[0173] For example, when the management device receives the current target model parameters, model clustering parameters, at least one container index, and the parameter values ​​corresponding to each of the at least one container index, a new node is created. The new node includes the current target model parameters, model clustering parameters, at least one container index, and the parameter values ​​corresponding to each of the at least one container index.

[0174] Method 3: Based on the clustering parameters, the model accuracy of the intermediate model is processed M times to obtain M clustering parameters corresponding to the intermediate model; where M is an integer greater than or equal to 2; using the K-means clustering algorithm, the model parameters of the intermediate model are compressed based on the M clustering parameters to obtain compressed model parameters corresponding to each of the M clustering parameters; the KL divergence value of each of the M compressed model parameters is determined; the compressed model parameter corresponding to the minimum KL divergence value is determined as the current target model parameter.

[0175] The KL divergence value can describe the degree of difference in the distribution of model parameters before and after compression, that is, the degree of information loss in the model parameters before and after compression.

[0176] In this embodiment of the invention, the compressed model parameter with the smallest KL divergence value is determined as the current target model parameter, which minimizes the loss of information in the obtained current target model parameter and improves the compression effect of the model parameter.

[0177] Building upon method 3, federated learning methods based on directed acyclic graph (DAG) blockchains also include one or more of the following:

[0178] Send the model clustering parameter (e.g., denoted as K0) corresponding to the compressed model parameter with the smallest KL divergence value to the management device;

[0179] At least one container index and its corresponding parameter value obtained during the compression process will be sent to the management device.

[0180] For example, when the management device receives the current target model parameter, K0, at least one container index, and the parameter value corresponding to each of the at least one container index, a new node is created. The new node includes the current target model parameter, K0, at least one container index, and the parameter value corresponding to each of the at least one container index.

[0181] Furthermore, after creating a new node, the N target nodes are associated with the new node, making the new node a child node of the N target nodes. For example, in... Figure 3 In the middle, the new node 15 is a child node of the two target nodes (including nodes A12 and A13).

[0182] In some embodiments, the clustering parameter generation model is:

[0183] k = round(((M) max -M min )·Acc2)+M min );

[0184] Where k represents the clustering parameters of the intermediate model, Acc2 represents the model accuracy of the intermediate model, and M... max M represents the maximum preset clustering parameter. min This represents the minimum preset clustering parameters. `round(·)` represents a random integer generation operation, used to randomly generate integers within the range 0 to (M). max -M min Integers between 1 and 2.

[0185] Optionally, M max The possible values ​​are 1024 and M. min The value of can be 4.

[0186] Alternatively, the current target model can be obtained through the following pseudocode.

[0187] 1) Initialize M = 4, M max =1024, M min =4;

[0188] 2) for j = 0: M - 1 do;

[0189] 3) k[j]=round(((M) max -M min )·Acc2[j])+M min )

[0190] 4) end for / / Generate a model based on clustering parameters, process the model accuracy of the intermediate model M times, and obtain the M model clustering parameters corresponding to the intermediate model;

[0191] 6) for j = 0: M - 1 do;

[0192] 7) When the model clustering parameter is k[j], get W[j] / / get the compressed model parameter W[j] corresponding to the model clustering parameter k[j];

[0193] 8)end for / / Using the K-means clustering algorithm, the model parameters of the intermediate model are compressed based on the M model clustering parameters respectively, to obtain the compressed model parameters corresponding to each of the M model clustering parameters;

[0194] 9) for j = 0: M-1do;

[0195] 10) Determine the KL divergence value of W[j];

[0196] 12) end for;

[0197] 13) The compression model parameter with the smallest KL divergence value is determined as the current target model parameter.

[0198] In some embodiments, sending the current target model parameters to the management device includes:

[0199] Obtain the loss value of the historical target model parameters; the historical target model parameters are the target model parameters most recently sent by the training device to the management device; determine the loss value of the current target model parameters based on the local data test set and the loss calculation model; if the loss value of the current target model parameters is less than or equal to the loss value of the historical target model, send the current target model parameters to the management device.

[0200] The loss calculation models are Model 3 and Model 4 as follows.

[0201] Model 3 is:

[0202] Where Loss represents the loss value, m represents the total number of samples in the local test set, and f x Let y represent the predicted value of the x-th sample. x This represents the label of the x-th sample.

[0203] Model 4 is:

[0204] Where Loss represents the loss value, n represents the total number of samples in the local test set, x represents the sample in the local test set, y represents the label corresponding to x, and a represents the predicted value corresponding to x.

[0205] It should be noted that Model 3 can be applied to classification tasks, while Model 4 can be applied to regression tasks.

[0206] For example, if the loss value of the historical target model parameters is S1 and the loss value of the current target model parameters is S2, and if S2≤S1, then the current target model parameters are sent to the management device.

[0207] In some embodiments, the federated learning method further includes:

[0208] Receive a stop training command sent by the management device; wherein, the stop training command is a command sent by the management device after detecting that there is a model in the current DAG blockchain with a model accuracy greater than or equal to a first preset accuracy based on the local data test set of the management device;

[0209] Training is stopped based on the stop training command.

[0210] The federated learning method based on directed acyclic graph (DAG) blockchain provided in this invention is applicable to power services in new power systems, such as demand-side response, source-grid interaction, and intelligent dispatching, and can solve the problem of secure data sharing between different entity systems in the above-mentioned power services.

[0211] Figure 8 This is a schematic diagram of a novel power system architecture provided by an embodiment of the present invention. Figure 8 As shown, it includes: perception layer, platform layer and application layer.

[0212] The perception layer includes various edge intelligent devices in the smart grid, which are used to collect corresponding information, such as weather status information, time information, and electrical equipment information. The training device in this invention can be one of these edge intelligent devices.

[0213] The platform layer includes platforms for various different businesses, such as management devices for various different businesses.

[0214] The application layer includes various application devices for different services, such as devices that initiate federated learning requests.

[0215] Optionally, the new power system also includes a network layer, which comprises various network devices such as switches or base stations. The network layer is used for communication between the perception layer, platform layer, and application layer.

[0216] The beneficial effects of the embodiments of the present invention will be compared and explained below with reference to the following existing technical solutions 1 to 3.

[0217] Existing technical solution 1: The main fog node selects devices with high reputation values ​​to participate in the local training task. Then, the devices participating in local training download the global model from their respective fog nodes. The devices participating in local training randomly select some unverified tips on their local DAG to verify the global model, and select the local models with high accuracy for local aggregation. They then train new local models using the local dataset and send the trained local models to their respective fog nodes.

[0218] In the existing technical solution 1, the device participating in local training uses the local dataset to train a new local model and sends the trained local model to its fog node, resulting in a large communication overhead between the device participating in local training and its fog node.

[0219] Existing technical solution 2: First, each client uploads its trained local model and data quality indicators. If the weight update conditions are met, the cloud server receives the local models uploaded by each client and calculates the contribution score for each client based on the client's data quality, model accuracy, and model difference indicators. This score is then used as a weight to perform a weighted average of the received local models to generate a global model.

[0220] In the existing technical solution 2, the client sends the trained partial model to the cloud server, resulting in a large communication overhead between the client and the cloud server.

[0221] Existing technical solution 3: First, an external agent, acting as the task initiator, publishes the model. The edge server retrieves tips from the DAG blockchain and distributes them to smart devices within its coverage area. Smart devices use local datasets for local training and upload the updated model to the edge server. Subsequently, the uploaded models are aggregated by the edge server. Simultaneously, the received smart device information and the aggregated model update edge server reputation value are packaged and uploaded together, forming tips that are then uploaded to the DAG blockchain. The external agent periodically pulls tips from the DAG blockchain and verifies whether the model has reached the desired accuracy. If the target is met, the model training task is stopped.

[0222] Existing technical solution 3 treats multiple edge nodes as a whole to jointly maintain the aggregation of the model. With the era of big data, models are becoming increasingly large, and their communication overhead is also increasing. However, the federated learning method provided in this embodiment of the invention trains a preset model with initial model parameters based on a local data training set to obtain an intermediate model. Based on the model accuracy of the intermediate model, the model parameters of the intermediate model are compressed to obtain the current target model parameters, which are then sent to the management device. Since the current target model parameters are obtained through compression, sending the current target model to the management device saves communication overhead.

[0223] The federated learning device based on a directed acyclic graph (DAG) blockchain provided by this invention is described below. The federated learning device described below can execute the above-mentioned federated learning method based on a directed acyclic graph (DAG) blockchain. The federated learning device and the federated learning method can be referred to each other accordingly.

[0224] Figure 9 This is a schematic diagram of the structure of a DAG-based federated learning device provided in an embodiment of the present invention. Figure 9 As shown, the device includes:

[0225] The acquisition module 910 is used to acquire the current DAG blockchain after receiving the continue training instruction sent by the management device;

[0226] Module 920 is used to determine the initial model parameters based on the local data test set and the model parameters within the nodes of the current DAG blockchain.

[0227] Training module 930 is used to train a preset model with initial model parameters based on a local data training set to obtain an intermediate model;

[0228] Compression module 940 is used to compress the model parameters of the intermediate model based on the model accuracy of the intermediate model to obtain the current target model parameters;

[0229] The sending module 950 is used to send the current target model parameters to the management device.

[0230] It should be noted that the federated learning device provided in this embodiment of the invention can implement all the method steps implemented in the above method embodiment and can achieve the same technical effect. Therefore, the parts and beneficial effects that are the same as those in the method embodiment will not be described in detail here.

[0231] According to a federated learning device provided by the present invention, the determining module 920 is specifically used for:

[0232] Perform N node selection operations to determine N target nodes in the current DAG blockchain; where N is an integer greater than or equal to 2.

[0233] The model parameters within the N target nodes are averaged and aggregated to obtain the initial model parameters.

[0234] The node selection operation includes: for the i-th node in the current DAG blockchain, if the i-th node has no child nodes, then the i-th node is determined as the target node; otherwise, based on the compression ratio calculation model, the scoring calculation model, and the local data test set, the (i+1)-th node is determined from the child nodes of the i-th node; the i-th node is updated to the (i+1)-th node, and this operation is repeated until the target node is obtained; initially, i equals 0, and the 0th node is a node randomly selected in the current DAG blockchain.

[0235] According to a federated learning device provided by the present invention, the determining module 920 is specifically used for:

[0236] For each child node of the i-th node, the model accuracy corresponding to the child node is determined based on the local data test set and the accuracy calculation model; the model clustering parameters within the child node are processed through the compression ratio calculation model to obtain the compression ratio corresponding to the child node; the model accuracy and compression ratio are processed through the scoring calculation model to obtain the score corresponding to the child node.

[0237] The child node corresponding to the highest score among all child nodes is determined as the (i+1)th node.

[0238] According to the federated learning device provided by the present invention, the compression ratio calculation model is as follows:

[0239]

[0240] Where r represents the compression ratio corresponding to the child node, k represents the model clustering parameters within the child node, n represents the total number of model parameters corresponding to the child node, b1 represents the number of bits of the model parameters, and log2(·) represents the logarithmic operation with base 2.

[0241] According to the federated learning device provided by the present invention, the scoring calculation model is as follows:

[0242] Score = a²·Acc₁·log₂(r·b²)

[0243] Where Score represents the score corresponding to the child node, Acc1 represents the model accuracy corresponding to the child node, r represents the compression ratio corresponding to the child node, a2 represents the preset accuracy adjustment parameter, and b2 represents the preset compression ratio adjustment parameter.

[0244] According to a federated learning device provided by the present invention, the compression module 940 is specifically used for:

[0245] Based on the clustering parameter generation model, the model accuracy of the intermediate model is processed to obtain the model clustering parameters corresponding to the intermediate model;

[0246] By using the K-means clustering algorithm, the model parameters of the intermediate model are compressed based on the model clustering parameters corresponding to the intermediate model to obtain the parameters of the current target model.

[0247] According to a federated learning device provided by the present invention, the compression module 940 is specifically used for:

[0248] Based on the clustering parameter generation model, the model accuracy of the intermediate model is processed M times to obtain M model clustering parameters corresponding to the intermediate model; where M is an integer greater than or equal to 2.

[0249] Using the K-means clustering algorithm, the model parameters of the intermediate model are compressed based on M model clustering parameters to obtain the compressed model parameters corresponding to each of the M model clustering parameters; and the KL divergence value of each of the M compressed model parameters is determined.

[0250] The compression model parameters corresponding to the minimum KL divergence value are determined as the current target model parameters.

[0251] According to the federated learning device provided by the present invention, the clustering parameter generation model is as follows:

[0252] k = round(((M) max -M min )·Acc2)+M min )

[0253] Where k represents the clustering parameters of the intermediate model, Acc2 represents the model accuracy of the intermediate model, and M... max M represents the maximum preset clustering parameter. min This represents the minimum preset clustering parameters. `round(·)` represents a random integer generation operation, used to randomly generate integers within the range 0 to (M). max -Mmin Integers between 1 and 2.

[0254] According to a federated learning device provided by the present invention, the sending module 950 is specifically used for:

[0255] Obtain the loss value of the historical target model parameters; the historical target model parameters are the target model parameters most recently sent by the training device to the management device;

[0256] Based on the local data test set and the loss calculation model, determine the loss value of the current target model parameters;

[0257] If the loss value of the current target model parameters is less than or equal to the loss value of the historical target model, the current target model parameters are sent to the management device.

[0258] According to a federated learning device provided by the present invention, the training device further includes a receiving module:

[0259] The receiving module is used to receive a stop training command sent by the management device; wherein, the stop training command is a command sent by the management device after detecting that there is a model in the current DAG blockchain with a model accuracy greater than or equal to a first preset accuracy based on the local data test set of the management device; and the training is stopped based on the stop training command.

[0260] Figure 10 This is a schematic diagram of the physical structure of an electronic device provided in an embodiment of the present invention, such as... Figure 10 As shown, the electronic device may include: a processor 1010, a communications interface 1020, a memory 1030, and a communication bus 1040. The processor 1010, communications interface 1020, and memory 1030 communicate with each other via the communication bus 1040. The processor 1010 can call logical instructions in the memory 1030 to execute a federated learning method based on a directed acyclic graph (DAG) blockchain. This method includes: after receiving a continue training instruction from a management device, obtaining the current DAG blockchain; determining initial model parameters based on a local test data set and model parameters within nodes of the current DAG blockchain; training a preset model with the initial model parameters based on a local training data set to obtain an intermediate model; compressing the model parameters of the intermediate model based on its accuracy to obtain current target model parameters; wherein the current target model parameters are used to update the current DAG blockchain to obtain a new DAG blockchain; and sending the current target model parameters to the management device.

[0261] Furthermore, the logical instructions within the aforementioned memory 1030 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0262] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the federated learning method based on a directed acyclic graph (DAG) blockchain provided by the above methods. The method includes: after receiving a continue training instruction sent by a management device, obtaining the current DAG blockchain; determining initial model parameters based on a local data test set and model parameters within nodes in the current DAG blockchain; training a preset model with initial model parameters based on a local data training set to obtain an intermediate model; compressing the model parameters of the intermediate model based on the model accuracy of the intermediate model to obtain current target model parameters; wherein the current target model parameters are used to update the current DAG blockchain to obtain a new DAG blockchain; and sending the current target model parameters to the management device.

[0263] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the federated learning method based on a directed acyclic graph (DAG) blockchain provided by the above methods. This method includes: after receiving a continue training instruction sent by a management device, obtaining the current DAG blockchain; determining initial model parameters based on a local data test set and model parameters within nodes of the current DAG blockchain; training a preset model with the initial model parameters based on a local data training set to obtain an intermediate model; compressing the model parameters of the intermediate model based on the model accuracy of the intermediate model to obtain current target model parameters; wherein the current target model parameters are used to update the current DAG blockchain to obtain a new DAG blockchain; and sending the current target model parameters to the management device.

[0264] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the models within can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0265] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0266] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A federated learning method based on directed acyclic graph (DAG) blockchain, characterized in that, include: After receiving the command to continue training from the management device, obtain the current DAG blockchain; Based on the local data test set and the model parameters within the nodes of the current DAG blockchain, determine the initial model parameters; Based on the local data training set, a preset model with the initial model parameters is trained to obtain an intermediate model; Based on the model accuracy of the intermediate model, the model parameters of the intermediate model are compressed to obtain the current target model parameters; wherein, the current target model parameters are used to update the current DAG blockchain to obtain a new DAG blockchain; the current target model parameters are sent to the management device; the step of compressing the model parameters of the intermediate model based on the model accuracy of the intermediate model to obtain the current target model parameters includes: generating a model based on clustering parameters, processing the model accuracy of the intermediate model to obtain the model clustering parameters corresponding to the intermediate model; and compressing the model parameters of the intermediate model based on the model clustering parameters corresponding to the intermediate model using the K-means clustering algorithm to obtain the current target model parameters.

2. The federated learning method according to claim 1, characterized in that, The determination of initial model parameters based on the local data test set and the model parameters within the nodes of the current DAG blockchain includes: Perform N node selection operations to determine N target nodes in the current DAG blockchain; where N is an integer greater than or equal to 2; The model parameters within the N target nodes are averaged and aggregated to obtain the initial model parameters. The node selection operation includes: for the i-th node in the current DAG blockchain, if the i-th node has no child nodes, then the i-th node is determined as the target node; otherwise, based on the compression ratio calculation model, the scoring calculation model, and the local data test set, the (i+1)-th node is determined from the child nodes of the i-th node; the i-th node is updated to the (i+1)-th node, and this operation is repeated until the target node is obtained; initially, i equals 0, and the 0th node is a node randomly selected in the current DAG blockchain.

3. The federated learning method according to claim 2, characterized in that, The determination of the (i+1)th node among the child nodes of the i-th node, based on the compression ratio calculation model, the scoring calculation model, and the local data test set, includes: For each child node of the i-th node, the model accuracy corresponding to the child node is determined based on the local data test set and the accuracy calculation model; the model clustering parameters within the child node are processed using the compression ratio calculation model to obtain the compression ratio corresponding to the child node; the model accuracy and the compression ratio are processed using the scoring calculation model to obtain the score corresponding to the child node. The child node corresponding to the highest score among all the child nodes is determined as the (i+1)th node.

4. The federated learning method according to claim 3, characterized in that, The compression ratio calculation model is as follows: ; in, This indicates the compression ratio corresponding to the child node. This represents the model clustering parameters within the child node. This indicates the total number of model parameters corresponding to the child node. This indicates the number of bits in the model parameters. It represents a logarithmic operation with base 2.

5. The federated learning method according to claim 3, characterized in that, The scoring calculation model is as follows: ; in, This represents the score corresponding to the child node. 1 indicates the model precision corresponding to the child node. This indicates the compression ratio corresponding to the child node. This indicates the preset precision adjustment parameter. This indicates the preset compression ratio adjustment parameter.

6. The federated learning method according to any one of claims 1 to 5, characterized in that, The process of compressing the model parameters of the intermediate model based on its accuracy to obtain the current target model parameters includes: Based on the clustering parameter generation model, the model accuracy of the intermediate model is processed M times to obtain M model clustering parameters corresponding to the intermediate model; where M is an integer greater than or equal to 2; Using the K-means clustering algorithm, the model parameters of the intermediate model are compressed based on the M model clustering parameters to obtain the compressed model parameters corresponding to each of the M model clustering parameters; and the KL divergence value of each of the M compressed model parameters is determined. The compression model parameters corresponding to the minimum KL divergence value are determined as the current target model parameters.

7. The federated learning method according to claim 1 or 6, characterized in that, The clustering parameter generation model is as follows: ; in, This represents the model clustering parameters corresponding to the intermediate model. This indicates the model accuracy of the intermediate model. Indicates the maximum preset clustering parameter. This represents the minimum preset clustering parameters. This represents a random integer generation operation, which is used to randomly generate integers between 0 and... Integers between [a certain range].

8. The federated learning method according to any one of claims 1 to 5, characterized in that, Sending the current target model parameters to the management device includes: Obtain the loss value of the historical target model parameters; the historical target model parameters are the target model parameters most recently sent to the management device; Based on the local data test set and the loss calculation model, determine the loss value of the current target model parameters; If the loss value of the current target model parameter is less than or equal to the loss value of the historical target model, the current target model parameter is sent to the management device.

9. The federated learning method according to any one of claims 1 to 5, characterized in that, The method further includes: Receive a stop training command sent by the management device; wherein, the stop training command is a command sent by the management device after detecting, based on the management device's local data test set, that there exists a model in the current DAG blockchain with a model accuracy greater than or equal to a first preset accuracy; Training is stopped based on the aforementioned stop training instruction.