A model training method and device based on federated learning

By employing a federated learning approach that utilizes blockchain and encrypted data distribution information, the problems of malicious nodes and non-independent identical distribution in horizontal federated learning are addressed, thereby improving the training accuracy and adaptability of the model.

CN116502733BActive Publication Date: 2026-07-03CHINA MOBILE COMM LTD RES INST +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA MOBILE COMM LTD RES INST
Filing Date
2022-01-19
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

In existing horizontal federated learning, the data of multiple modeling nodes are not independent and identically distributed, and there are malicious nodes, which leads to low model accuracy.

Method used

By using blockchain technology and encrypted data distribution information, the group information of modeling nodes is determined, and predictions are made based on the target group federated model broadcast on the blockchain. The final prediction result is selected by voting to prevent malicious nodes from affecting model training.

Benefits of technology

It improves the training accuracy of the model, prevents malicious nodes from contaminating the model, and enhances the model's adaptability to non-independent and identically distributed data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116502733B_ABST
    Figure CN116502733B_ABST
Patent Text Reader

Abstract

This invention provides a model training method and apparatus based on federated learning, relating to the field of machine learning technology. The method includes: determining a first federated model based on the local models of a first neighboring node, and transmitting the first federated model to a second neighboring node and a blockchain, wherein the first neighboring node, the second neighboring node, and the first modeling node belong to the same group; receiving a target group federated model broadcast by the blockchain, wherein the target group federated model is determined by the blockchain based on the first federated model and a second federated model of a second modeling node, wherein the second modeling node belongs to a different group than the first modeling node; and predicting target data based on the target group federated model. This invention addresses the problem of low accuracy in horizontal federated models when data from multiple modeling nodes exhibits non-independent and identically distributed characteristics and malicious modeling nodes exist.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine learning technology, and in particular to a model training method and apparatus based on federated learning. Background Technology

[0002] Existing training methods for lateral federated learning rely on honest or semi-honest modeling nodes for training. All modeling nodes train a federated model together. If a malicious modeling node is encountered, the model data may be contaminated during training, leading to a deterioration in model performance and the inability to remove its influence on model weights. Moreover, the modeling nodes on which the model training is based meet the condition of independent and identically distributed (IOD). If the training data is not independent and identically distributed, some normal nodes may have significant differences in gradient and distribution, which can easily lead to misjudgment and a severe decline in model performance after aggregation. Summary of the Invention

[0003] The purpose of this invention is to provide a model training method and apparatus based on federated learning to solve the problem of low accuracy in horizontal federated models when the data of multiple modeling nodes are not independent and identically distributed and malicious nodes exist.

[0004] To address the aforementioned technical problems, the embodiments of the present invention provide the following technical solutions:

[0005] A model training method based on federated learning, applied to the first modeling node participating in a federated task, the method comprising:

[0006] Based on the local model of the first neighboring node, a first federation model is determined, and the first federation model is passed to the second neighboring node and the blockchain. The first neighboring node, the second neighboring node, and the first modeling node belong to the same group.

[0007] The target group federation model broadcast by the blockchain is received. The target group federation model is determined by the blockchain based on the first federation model and the second federation model of the second modeling node, wherein the second modeling node belongs to a different group than the first modeling node.

[0008] The target data is predicted based on the target group federated model.

[0009] Optionally, in the federated learning-based model training method, before determining the first federated model based on the local model of the first neighboring node and passing the first federated model to the second neighboring node and the blockchain, the method further includes:

[0010] Upload the first processor parameter index of the local server to the blockchain;

[0011] Obtain the distribution information of the first encrypted data;

[0012] Upon receiving the coordination notification information broadcast by the blockchain, the third modeling node receives the second encrypted data distribution information transmitted by the third modeling node; wherein the third modeling node is in the same federated task as the first modeling node and is a non-coordination point; the coordination notification information is determined by the blockchain based on the first processor parameter index and the second processor parameter index of the second modeling node;

[0013] Based on the first encrypted data distribution information and the second encrypted data distribution information, determine the subgroup information of the group to which the data belongs.

[0014] Optionally, in the federated learning-based model training method, obtaining the first encrypted data distribution information includes:

[0015] Construct a data distribution vector based on the quartiles of each field in the local data;

[0016] The data distribution vector is encrypted to obtain the first encrypted data distribution information.

[0017] Optionally, in the federated learning-based model training method, determining the subgroup information based on the first encrypted data distribution information and the second encrypted data distribution information includes:

[0018] Calculate the Euclidean distance between the first encrypted data distribution information and the second encrypted data distribution information;

[0019] When the Euclidean distance is less than a preset distance threshold, it is determined that it belongs to the same group as the third modeling node;

[0020] The group information is determined based on the third modeling node.

[0021] Optionally, in the federated learning-based model training method, before determining the first federated model based on the local model of the first neighboring node and passing the first federated model to the second neighboring node and the blockchain, the method further includes:

[0022] Upload the first unilateral model to the blockchain;

[0023] The target unilateral model that receives the blockchain broadcast.

[0024] Optionally, in the federated learning-based model training method, before uploading the first one-sided model to the blockchain, the method further includes:

[0025] The first unilateral model is obtained by iterating the unilateral model using local data.

[0026] Optionally, in the federated learning-based model training method, before receiving the target one-sided model broadcast by the blockchain, the method further includes:

[0027] The second unilateral model of the fourth modeling node that receives the blockchain broadcast, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task;

[0028] Based on the second unilateral model, the first unilateral information is obtained;

[0029] The first unilateral information is uploaded to the blockchain, and the first unilateral information is used by the blockchain to determine the target unilateral model.

[0030] Optionally, in the federated learning-based model training method, determining the first federated model based on the local models of the first neighboring nodes includes:

[0031] The local model gradients of the first adjacent nodes are aggregated to perform federated task iterations to determine the first federated model.

[0032] Optionally, the federated learning-based model training method, wherein the step of aggregating the local model gradients of the first neighboring nodes to perform federated task iterations and determine the first federated model includes:

[0033] The first round of federated mission iterations will be conducted according to the following steps:

[0034] Construct the first local model based on the model weights of the target one-sided model;

[0035] Upload the first state vector of the first local model to the blockchain, and pass the gradient of the first local model to the second neighboring node;

[0036] The second round of federated mission iteration will be conducted according to the following steps:

[0037] Based on the local model gradient obtained by the first neighboring node during the first round of federated task iteration, the first local model is updated to obtain the second local model;

[0038] If the model accuracy of the second local model is greater than or equal to the first accuracy threshold, or if the model accuracy of the second local model is greater than or equal to the model accuracy of the first local model, the second state vector of the second local model is uploaded to the blockchain, and the gradient of the second local model is passed to the second neighboring node, while the second local model is retained.

[0039] If the model accuracy of the second local model is less than the first accuracy threshold, and the model accuracy of the second local model is less than the model accuracy of the first local model, the first state vector of the first local model is uploaded to the blockchain, and the gradient of the first local model is passed to the second neighboring node, and the second local model is not retained.

[0040] Repeat the steps of the second round of federated task iteration until the preset number of iterations is reached or the model accuracy reaches the preset accuracy threshold, then determine the first federated model and end the federated task;

[0041] The first accuracy threshold is determined by the blockchain based on the first state vector.

[0042] Optionally, in the federated learning-based model training method, before receiving the target group federated model broadcast by the blockchain, the method further includes:

[0043] The second group of federated models to which the second modeling node belongs, receiving the blockchain broadcast;

[0044] Based on the second set of federation models, the first federation information is obtained;

[0045] The first federal information is uploaded to the blockchain.

[0046] Optionally, in the federated learning-based model training method, the step of predicting the target data according to the target group federated model includes:

[0047] The target data is input into the target group federated model to obtain at least one output result;

[0048] A voting method is used to select at least one output result to obtain the target prediction result.

[0049] This invention also provides a model training method based on federated learning, applied to blockchain, the method comprising:

[0050] Receive a first federated model uploaded by a first modeling node and a second federated model uploaded by a second modeling node, wherein the first modeling node and the second modeling node belong to different groups;

[0051] Based on the first federation model and the second federation model, determine the target group federation model;

[0052] The target group federated model is broadcast to the first modeling node and the second modeling node, respectively.

[0053] Optionally, in the federated learning-based model training method, before receiving the first federated model uploaded by the first modeling node and the second federated model uploaded by the second modeling node, the method further includes:

[0054] Receive the first processor parameter index of the local server of the first modeling node uploaded by the first modeling node and the second processor parameter index of the local server of the second modeling node uploaded by the second modeling node.

[0055] Based on the first processor parameter index and the second processor parameter index, it is determined whether the first modeling node is a coordination point and whether the third modeling node is a non-coordination point; wherein, the third modeling node and the first modeling node participate in the same federated task.

[0056] When it is determined that the first modeling node belongs to the coordination point, a coordination notification message is broadcast to the first modeling node;

[0057] When it is determined that the third modeling node belongs to the non-coordinated point, a non-coordinated notification message is broadcast to the third modeling node.

[0058] Optionally, in the federated learning-based model training method, before receiving the first federated model uploaded by the first modeling node and the second federated model uploaded by the second modeling node, the method further includes:

[0059] Receive the first unilateral model uploaded by the first modeling node and the second unilateral model uploaded by the fourth modeling node, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task;

[0060] Based on the first unilateral model and the second unilateral model, the target unilateral model is determined.

[0061] Optionally, in the federated learning-based model training method, determining the target one-sided model based on the first one-sided model and the second one-sided model includes:

[0062] Broadcast the second one-sided model to the first modeling node, and broadcast the first one-sided model to the fourth modeling node;

[0063] Receive the first one-sided information obtained by the first modeling node based on the second one-sided model uploaded by the first modeling node, and the second one-sided information obtained by the fourth modeling node based on the first one-sided model uploaded by the fourth modeling node;

[0064] The target unilateral model is determined based on the first unilateral information and the second unilateral information.

[0065] Optionally, in the federated learning-based model training method, before receiving the first federated model uploaded by the first modeling node, the method further includes:

[0066] Receive the state vector of each modeling node in each round of federated task iteration, uploaded by each modeling node in the group to which the first modeling node belongs;

[0067] Based on the state vector of each modeling node, the average model accuracy of the group to which the first modeling node belongs is obtained in each round of federated task iteration;

[0068] The average model accuracy is used as the accuracy threshold and broadcast to the first modeling node.

[0069] Optionally, in the federated learning-based model training method, determining the target group federated model based on the first federated model and the second federated model includes:

[0070] Based on the first federation model, a first group of federation models is determined to belong to the group to which the first modeling node belongs, and based on the second federation model, a second group of federation models is determined to belong to the group to which the second modeling node belongs.

[0071] Broadcast the second set of federated models to the first modeling node, and broadcast the first set of federated models to the second modeling node;

[0072] Receive the first federated information obtained by the first modeling node based on the second set of federated models uploaded by the first modeling node, and receive the second federated information obtained by the second modeling node based on the first set of federated models uploaded by the second modeling node;

[0073] The target group federated model is determined based on the first federated information and the second federated information.

[0074] Optionally, in the federated learning-based model training method, determining the first group of federated models to which the first modeling node belongs based on the first federated model includes:

[0075] Count the number of violations for each modeling node within the group to which the first modeling node belongs;

[0076] The modeling node with the highest number of violations within the group to which the first modeling node belongs is selected as the violating modeling node.

[0077] The first set of federated models is determined based on the first accuracy vector and the second accuracy vector of the violation modeling node;

[0078] The first accuracy vector is determined based on the model accuracy corresponding to the preset number of federated task iteration rounds, and the second accuracy vector is determined based on the model accuracy corresponding to the preset number of unilateral model iteration rounds.

[0079] Optionally, in the federated learning-based model training method, the step of counting the number of violations for each modeling node within the group to which the first modeling node belongs includes:

[0080] The violation count of the first modeling node increases by one for each of the following conditions:

[0081] Within the first preset time period, no first one-sided model uploaded by the first modeling node was received;

[0082] Within the second preset time period, no first unilateral information uploaded by the first modeling node was received;

[0083] Within the third preset time period, the state vector obtained in each round of federated task iteration uploaded by the first modeling node is not received;

[0084] Within a fourth preset time period, it is obtained that the local model gradient of the first modeling node has not been transmitted to the second adjacent node, and the second adjacent node belongs to the same group as the first modeling node.

[0085] Optionally, in the federated learning-based model training method, determining the first set of federated models based on the first and second accuracy vectors of the violating modeling nodes includes:

[0086] Compare the elements at corresponding positions in the first accuracy vector and the second accuracy vector to obtain the first comparison result;

[0087] Based on the first comparison result, the first set of federated models is determined.

[0088] Optionally, in the federated learning-based model training method, determining the first set of federated models based on the first comparison result includes:

[0089] When the first comparison result is less than a preset value, and the element at the first preset position in the first accuracy vector is less than the element at the first preset position in the second accuracy vector, the first group of federated models is determined based on the federated models of each modeling node in the group to which the first modeling node belongs, excluding the first modeling node.

[0090] Optionally, in the federated learning-based model training method, determining the target group federated model based on the first federated information and the second federated information includes:

[0091] The first federated information and the second federated information are compared with the accuracy of the target unilateral model to obtain a second comparison result;

[0092] Based on the second comparison result, the target group federation model is determined.

[0093] This invention also provides an electronic device applied to a first modeling node participating in a federated task, wherein the server includes a processor and a transceiver, wherein:

[0094] The processor is used to determine a first federation model based on the local model of the first neighboring node, and to transmit the first federation model to the second neighboring node and the blockchain, wherein the first neighboring node, the second neighboring node and the first modeling node belong to the same group;

[0095] The transceiver is used to receive the target group federation model broadcast by the blockchain. The target group federation model is determined by the blockchain based on the first federation model and the second federation model of the second modeling node, wherein the second modeling node belongs to a different group than the first modeling node.

[0096] The processor is also configured to predict target data based on the target group federated model.

[0097] Optionally, in the electronic device, the processor is further configured to:

[0098] Upload the first processor parameter index of the local server to the blockchain;

[0099] Obtain the distribution information of the first encrypted data;

[0100] Upon receiving the coordination notification information broadcast by the blockchain, the third modeling node receives the second encrypted data distribution information transmitted by the third modeling node; wherein the third modeling node is in the same federated task as the first modeling node and is a non-coordination point; the coordination notification information is determined by the blockchain based on the first processor parameter index and the second processor parameter index of the second modeling node;

[0101] Based on the first encrypted data distribution information and the second encrypted data distribution information, determine the subgroup information of the group to which the data belongs.

[0102] Optionally, in the electronic device, the processor is specifically used for:

[0103] Construct a data distribution vector based on the quartiles of each field in the local data;

[0104] The data distribution vector is encrypted to obtain the first encrypted data distribution information.

[0105] Optionally, in the electronic device, the processor is specifically used for:

[0106] Calculate the Euclidean distance between the first encrypted data distribution information and the second encrypted data distribution information;

[0107] When the Euclidean distance is less than a preset distance threshold, it is determined that it belongs to the same group as the third modeling node;

[0108] The group information is determined based on the third modeling node.

[0109] Optionally, the electronic device, wherein the transceiver is further configured to:

[0110] Upload the first unilateral model to the blockchain;

[0111] The target unilateral model that receives the blockchain broadcast.

[0112] Optionally, in the electronic device, the processor is specifically used for:

[0113] The first unilateral model is obtained by iterating the unilateral model using local data.

[0114] Optionally, in the electronic device, the processor is further configured to:

[0115] The second unilateral model of the fourth modeling node that receives the blockchain broadcast, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task;

[0116] Based on the second unilateral model, the first unilateral information is obtained;

[0117] The first unilateral information is uploaded to the blockchain, and the first unilateral information is used by the blockchain to determine the target unilateral model.

[0118] Optionally, in the electronic device, the processor is specifically used for:

[0119] The federated model gradients of the first adjacent nodes are aggregated to perform federated task iterations, and the first federated model is determined.

[0120] Optionally, in the electronic device, the processor is specifically used for:

[0121] The first round of federated mission iterations will be conducted according to the following steps:

[0122] Construct the first local model based on the model weights of the target one-sided model;

[0123] Upload the first state vector of the first local model to the blockchain, and pass the gradient of the first local model to the second neighboring node;

[0124] The second round of federated mission iteration will be conducted according to the following steps:

[0125] Based on the local model gradient obtained by the first adjacent node during the first round of federated task iteration, the first local model of the fast search is updated to obtain the second local model.

[0126] If the model accuracy of the second local model is greater than or equal to the first accuracy threshold, or if the model accuracy of the second local model is greater than or equal to the model accuracy of the first local model, the second state vector of the second local model is uploaded to the blockchain, and the gradient of the second local model is passed to the second neighboring node, while the second local model is retained.

[0127] If the model accuracy of the second local model is less than the first accuracy threshold, and the model accuracy of the second local model is less than the model accuracy of the first local model, the first state vector of the first local model is uploaded to the blockchain, and the gradient of the first local model is passed to the second neighboring node, and the second local model is not retained.

[0128] Repeat the steps of the second round of federated task iteration until the preset number of iterations is reached or the model accuracy reaches the preset accuracy threshold, then determine the first federated model and end the federated task;

[0129] The first accuracy threshold is determined by the blockchain based on the first state vector.

[0130] Optionally, in the electronic device, the processor is further configured to:

[0131] The second group of federated models to which the second modeling node belongs, receiving the blockchain broadcast;

[0132] Based on the second set of federation models, the first federation information is obtained;

[0133] The first federal information is uploaded to the blockchain.

[0134] Optionally, in the electronic device, the processor is specifically used for:

[0135] The target data is input into the target group federated model to obtain at least one output result;

[0136] A voting method is used to select at least one output result to obtain the target prediction result.

[0137] This invention also provides a server for blockchain applications, the server comprising a processor and a transceiver, wherein:

[0138] The transceiver is used to receive a first federated model uploaded by a first modeling node and a second federated model uploaded by a second modeling node, wherein the first modeling node and the second modeling node belong to different groups.

[0139] The processor is used to determine a target group federation model based on the first federation model and the second federation model;

[0140] The transceiver is also used to broadcast the target group federated model to the first modeling node and the second modeling node, respectively.

[0141] Optionally, in the server, the processor is further configured to:

[0142] Receive the first processor parameter index of the local server of the first modeling node uploaded by the first modeling node and the second processor parameter index of the local server of the second modeling node uploaded by the second modeling node.

[0143] Based on the first processor parameter index and the second processor parameter index, it is determined whether the first modeling node is a coordination point and whether the third modeling node is a non-coordination point; wherein, the third modeling node and the first modeling node participate in the same federated task.

[0144] When it is determined that the first modeling node belongs to the coordination point, a coordination notification message is broadcast to the first modeling node;

[0145] When it is determined that the third modeling node belongs to the non-coordinated point, a non-coordinated notification message is broadcast to the third modeling node.

[0146] Optionally, in the server, the processor is further configured to:

[0147] Receive the first unilateral model uploaded by the first modeling node and the second unilateral model uploaded by the fourth modeling node, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task;

[0148] Based on the first unilateral model and the second unilateral model, the target unilateral model is determined.

[0149] Optionally, in the server, the processor is specifically used for:

[0150] Broadcast the second one-sided model to the first modeling node, and broadcast the first one-sided model to the fourth modeling node;

[0151] Receive the first one-sided information obtained by the first modeling node based on the second one-sided model uploaded by the first modeling node, and the second one-sided information obtained by the fourth modeling node based on the first one-sided model uploaded by the fourth modeling node;

[0152] The target unilateral model is determined based on the first unilateral information and the second unilateral information.

[0153] Optionally, in the server, the processor is specifically used for:

[0154] Receive the state vector of each modeling node in each federated task iteration uploaded by each modeling node in the group to which the first modeling node belongs;

[0155] Based on the state vector of each modeling node, the average model accuracy of the group to which the first modeling node belongs is obtained in each round of federated task iteration;

[0156] The average model accuracy is used as the accuracy threshold and broadcast to the first modeling node.

[0157] Optionally, in the server, the processor is specifically used for:

[0158] Based on the first federation model, a first group of federation models is determined to belong to the group to which the first modeling node belongs, and based on the second federation model, a second group of federation models is determined to belong to the group to which the second modeling node belongs.

[0159] Broadcast the second set of federated models to the first modeling node, and broadcast the first set of federated models to the second modeling node;

[0160] Receive the first federated information obtained by the first modeling node based on the second set of federated models uploaded by the first modeling node, and receive the second federated information obtained by the second modeling node based on the first set of federated models uploaded by the second modeling node;

[0161] The target group federated model is determined based on the first federated information and the second federated information.

[0162] Optionally, in the server, the processor is specifically used for:

[0163] Count the number of violations for each modeling node within the group to which the first modeling node belongs;

[0164] The modeling node with the highest number of violations within the group to which the first modeling node belongs is selected as the violating modeling node.

[0165] The first set of federated models is determined based on the first accuracy vector and the second accuracy vector of the violation modeling node;

[0166] The first accuracy vector is determined based on the model accuracy corresponding to the preset number of federated task iteration rounds, and the second accuracy vector is determined based on the model accuracy corresponding to the preset number of unilateral model iteration rounds.

[0167] Optionally, in the server, the processor is specifically used for:

[0168] The violation count of the first modeling node increases by one for each of the following conditions:

[0169] Within the first preset time period, no first one-sided model uploaded by the first modeling node was received;

[0170] Within the second preset time period, no first unilateral information uploaded by the first modeling node was received;

[0171] Within the third preset time period, the state vector obtained in each round of federated task iteration uploaded by the first modeling node is not received;

[0172] Within a fourth preset time period, it is obtained that the local model gradient of the first modeling node has not been transmitted to the second adjacent node, and the second adjacent node belongs to the same group as the first modeling node.

[0173] Optionally, in the server, the processor is specifically used for:

[0174] Compare the elements at corresponding positions in the first accuracy vector and the second accuracy vector to obtain the first comparison result;

[0175] Based on the first comparison result, the first set of federated models is determined.

[0176] Optionally, in the server, the processor is specifically used for:

[0177] When the first comparison result is less than a preset value, and the element at the first preset position in the first accuracy vector is less than the element at the first preset position in the second accuracy vector, the first group of federated models is determined based on the federated models of each modeling node in the group to which the first modeling node belongs, excluding the first modeling node.

[0178] Optionally, in the server, the processor is specifically used for:

[0179] The first federated information and the second federated information are compared with the accuracy of the target unilateral model to obtain a second comparison result;

[0180] Based on the second comparison result, the target group federation model is determined.

[0181] This invention also provides a model training device based on federated learning, applied to a first modeling node participating in a federated task, the device comprising:

[0182] The first determining module is used to determine the first federation model based on the local model of the first neighboring node, and to pass the first federation model to the second neighboring node and the blockchain, wherein the first neighboring node, the second neighboring node and the first modeling node belong to the same group;

[0183] The first receiving module is used to receive the target group federation model broadcast by the blockchain. The target group federation model is determined by the blockchain based on the first federation model and the second federation model of the second modeling node. The second modeling node belongs to a different group than the first modeling node.

[0184] The first prediction module is used to predict the target data based on the target group federated model.

[0185] Optionally, the federated learning-based model training apparatus further includes:

[0186] The first upload module is used to upload the first processor parameter indicators of the local server to the blockchain;

[0187] The first acquisition module is used to acquire the first encrypted data distribution information;

[0188] The third receiving module is used to receive second encrypted data distribution information transmitted by the third modeling node when receiving the coordination notification information broadcast by the blockchain; wherein the third modeling node and the first modeling node are in the same federated task and are non-coordinating points; the coordination notification information is determined by the blockchain based on the first processor parameter index and the second processor parameter index of the second modeling node;

[0189] The third determining module is used to determine the subgroup information of the group to which the data belongs based on the first encrypted data distribution information and the second encrypted data distribution information.

[0190] Optionally, in the federated learning-based model training apparatus, the first acquisition module is specifically used for:

[0191] Construct a data distribution vector based on the quartiles of each field in the local data;

[0192] The data distribution vector is encrypted to obtain the first encrypted data distribution information.

[0193] Optionally, in the federated learning-based model training apparatus, the third determining module is specifically used for:

[0194] Calculate the Euclidean distance between the first encrypted data distribution information and the second encrypted data distribution information;

[0195] When the Euclidean distance is less than a preset distance threshold, it is determined that it belongs to the same group as the third modeling node;

[0196] The group information is determined based on the third modeling node.

[0197] Optionally, the federated learning-based model training apparatus further includes:

[0198] The second upload module is used to upload the first one-sided model to the blockchain;

[0199] The fourth receiving module is used to receive the target unilateral model of the blockchain broadcast.

[0200] Optionally, the federated learning-based model training apparatus further includes:

[0201] The first acquisition module is used to perform unilateral model iteration using local data to obtain the first unilateral model.

[0202] Optionally, the federated learning-based model training apparatus further includes:

[0203] The fifth receiving module is used to receive the second unilateral model of the fourth modeling node broadcast by the blockchain, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task;

[0204] Based on the second unilateral model, the first unilateral information is obtained;

[0205] The first unilateral information is uploaded to the blockchain, and the first unilateral information is used by the blockchain to determine the target unilateral model.

[0206] Optionally, in the federated learning-based model training apparatus, the first determining module includes:

[0207] The first determination submodule is used to aggregate the local model gradients of the first adjacent nodes for federated task iteration to determine the first federated model.

[0208] Optionally, in the federated learning-based model training apparatus, the first determining submodule is specifically used for:

[0209] The first round of federated mission iterations will be conducted according to the following steps:

[0210] Construct the first local model based on the model weights of the target one-sided model;

[0211] Upload the first state vector of the first local model to the blockchain, and pass the gradient of the first local model to the second neighboring node;

[0212] The second round of federated mission iteration will be conducted according to the following steps:

[0213] The first local model is updated based on the local model gradient obtained by the first neighboring node during the first round of federated task iteration to obtain the second model;

[0214] If the model accuracy of the second local model is greater than or equal to the first accuracy threshold, or if the model accuracy of the second local model is greater than or equal to the model accuracy of the first local model, the second state vector of the second local model is uploaded to the blockchain, and the gradient of the second local model is passed to the second neighboring node, while the second local model is retained.

[0215] If the model accuracy of the second local model is less than the first accuracy threshold, and the model accuracy of the second local model is less than the model accuracy of the first local model, the first state vector of the first local model is uploaded to the blockchain, and the gradient of the first local model is passed to the second neighboring node, and the second model is not retained.

[0216] Repeat the steps of the second round of federated task iteration until the preset number of iterations is reached or the model accuracy reaches the preset accuracy threshold, then determine the first federated model and end the federated task;

[0217] The first accuracy threshold is determined by the blockchain based on the first state vector.

[0218] Optionally, the federated learning-based model training apparatus further includes:

[0219] The sixth receiving module is used to receive the second group of federated models of the group to which the second modeling node belongs, broadcast by the blockchain.

[0220] The second acquisition module is used to obtain the first federation information based on the second set of federation models;

[0221] The third upload module is used to upload the first federated information to the blockchain.

[0222] Optionally, in the federated learning-based model training apparatus, the first prediction module is specifically used for:

[0223] The target data is input into the target group federated model to obtain at least one output result;

[0224] A voting method is used to select at least one output result to obtain the target prediction result.

[0225] This invention also provides a model training device based on federated learning, applied to blockchain, the device comprising:

[0226] The second receiving module is used to receive the first federated model uploaded by the first modeling node and the second federated model uploaded by the second modeling node, wherein the first modeling node and the second modeling node belong to different groups;

[0227] The second determining module is used to determine the target group federation model based on the first federation model and the second federation model;

[0228] The first broadcast module is used to broadcast the target group federated model to the first modeling node and the second modeling node, respectively.

[0229] Optionally, the federated learning-based model training apparatus further includes:

[0230] The seventh receiving module is used to receive the first processor parameter index of the local server of the first modeling node uploaded by the first modeling node and the second processor parameter index of the local server of the second modeling node uploaded by the second modeling node.

[0231] The fourth determining module is used to determine whether the first modeling node belongs to a coordination point and whether the third modeling node belongs to a non-coordination point based on the first processor parameter index and the second processor parameter index; wherein the third modeling node and the first modeling node participate in the same federated task; the second broadcasting module is used to broadcast coordination notification information to the first modeling node when it is determined that the first modeling node belongs to the coordination point.

[0232] The third broadcast module is used to broadcast non-coordination notification information to the third modeling node when it is determined that the third modeling node belongs to the non-coordination point.

[0233] Optionally, the federated learning-based model training apparatus further includes:

[0234] The eighth receiving module is used to receive the first unilateral model uploaded by the first modeling node and the second unilateral model uploaded by the fourth modeling node, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task.

[0235] The fifth determining module is used to determine the target unilateral model based on the first unilateral model and the second unilateral model.

[0236] Optionally, in the federated learning-based model training apparatus, the fifth determining module is specifically used for:

[0237] Broadcast the second one-sided model to the first modeling node, and broadcast the first one-sided model to the fourth modeling node;

[0238] Receive the first one-sided information obtained by the first modeling node based on the second one-sided model uploaded by the first modeling node, and the second one-sided information obtained by the fourth modeling node based on the first one-sided model uploaded by the fourth modeling node;

[0239] The target unilateral model is determined based on the first unilateral information and the second unilateral information.

[0240] Optionally, the federated learning-based model training apparatus further includes:

[0241] The ninth receiving module is used to receive the state vector of each modeling node in each round of federated task iteration uploaded by each modeling node in the group to which the first modeling node belongs;

[0242] The third acquisition module is used to obtain the average model accuracy of the group to which the first modeling node belongs in each round of federated task iteration based on the state vector of each modeling node.

[0243] The fourth broadcast module is used to use the average model accuracy as an accuracy threshold and broadcast it to the first modeling node.

[0244] Optionally, in the federated learning-based model training apparatus, the second determining module includes:

[0245] The second determining submodule is used to determine, based on the first federated model, a first group of federated models to which the first modeling node belongs, and based on the second federated model, a second group of federated models to which the second modeling node belongs.

[0246] The first broadcast submodule is used to broadcast the second set of federated models to the first modeling node, and to broadcast the first set of federated models to the second modeling node;

[0247] The first receiving submodule is used to receive the first federated information obtained by the first modeling node based on the second set of federated models uploaded by the first modeling node, and to receive the second federated information obtained by the second modeling node based on the first set of federated models uploaded by the second modeling node.

[0248] The third determining submodule is used to determine the target group federated model based on the first federated information and the second federated information.

[0249] Optionally, in the federated learning-based model training apparatus, the second determining submodule includes:

[0250] The statistics unit is used to count the number of violations for each modeling node within the group to which the first modeling node belongs;

[0251] The selection unit is used to select the modeling node with the highest number of violations within the group to which the first modeling node belongs as the violating modeling node.

[0252] The determining unit is configured to determine the first set of federated models based on the first accuracy vector and the second accuracy vector of the violation modeling node.

[0253] The first accuracy vector is determined based on the model accuracy corresponding to the preset number of federated task iteration rounds, and the second accuracy vector is determined based on the model accuracy corresponding to the preset number of unilateral model iteration rounds.

[0254] Optionally, in the federated learning-based model training apparatus, the statistical unit is specifically used for:

[0255] The violation count of the first modeling node increases by one for each of the following conditions:

[0256] Within the first preset time period, no first one-sided model uploaded by the first modeling node was received;

[0257] Within the second preset time period, no first unilateral information uploaded by the first modeling node was received;

[0258] Within the third preset time period, the state vector obtained in each round of federated task iteration uploaded by the first modeling node is not received;

[0259] Within a fourth preset time period, it is obtained that the local model gradient of the first modeling node has not been transmitted to the second adjacent node, and the second adjacent node belongs to the same group as the first modeling node.

[0260] Optionally, in the federated learning-based model training apparatus, the determining unit includes:

[0261] The comparison subunit is used to compare the elements at corresponding positions in the first accuracy vector and the second accuracy vector to obtain a first comparison result;

[0262] A sub-unit is defined for determining the first set of federated models based on the first comparison result.

[0263] Optionally, in the federated learning-based model training apparatus, the determining subunit is specifically used for:

[0264] When the first comparison result is less than a preset value, and the element at the first preset position in the first accuracy vector is less than the element at the first preset position in the second accuracy vector, the first group of federated models is determined based on the federated models of each modeling node in the group to which the first modeling node belongs, excluding the first modeling node.

[0265] Optionally, in the federated learning-based model training apparatus, the third determining submodule is specifically used for:

[0266] The first federated information and the second federated information are compared with the accuracy of the target unilateral model to obtain a second comparison result;

[0267] Based on the second comparison result, the target group federation model is determined.

[0268] This invention also provides an electronic device, including: a transceiver, a processor, a memory, and a program or instructions stored in the memory and executable on the processor; when the processor executes the program or instructions, it implements the steps of the federated learning-based model training method as described in any of the preceding embodiments.

[0269] This invention also provides a server, including: a transceiver, a processor, a memory, and a program or instructions stored in the memory and executable on the processor; when the processor executes the program or instructions, it implements the steps of the federated learning-based model training method as described in any of the preceding embodiments.

[0270] This invention also provides a readable storage medium storing a program or instructions thereon, which, when executed by a processor, implement the steps of the federated learning-based model training method as described in any of the preceding embodiments.

[0271] The beneficial effects of the above-described technical solution of the present invention are as follows:

[0272] The present invention determines a first federated model based on the local model of a first neighboring node, and transmits the first federated model to a second neighboring node and the blockchain. The first neighboring node, the second neighboring node, and the first modeling node belong to the same group. The first modeling node receives a target group federated model broadcast by the blockchain. The target group federated model is determined by the blockchain based on the first federated model and the second federated model of the second modeling node. The second modeling node belongs to a different group than the first modeling node. The target data is predicted according to the target group federated model. Grouping technology is used to control the influence range of the modeling nodes, reduce the influence range of malicious modeling nodes, eliminate poor federated models and group federated models, and improve the model training effect. Attached Figure Description

[0273] Figure 1 One of the flowcharts for a model training method based on federated learning provided in an embodiment of the present invention;

[0274] Figure 2 A flowchart illustrating the process of determining a target unilateral model provided in an embodiment of the present invention;

[0275] Figure 3 A schematic diagram of the process of federal task iteration provided in an embodiment of the present invention;

[0276] Figure 4 A flowchart illustrating the process of determining the target group federation model provided in an embodiment of the present invention;

[0277] Figure 5 The second flowchart illustrates the model training method based on federated learning provided in this embodiment of the invention.

[0278] Figure 6 This is one of the structural schematic diagrams of the electronic device provided in the embodiments of the present invention;

[0279] Figure 7 This is one of the structural schematic diagrams of a server provided in an embodiment of the present invention;

[0280] Figure 8 One of the schematic diagrams of a model training device based on federated learning provided in an embodiment of the present invention;

[0281] Figure 9 A second schematic diagram of the structure of a model training device based on federated learning provided in an embodiment of the present invention;

[0282] Figure 10 This is a second schematic diagram of the structure of the electronic device provided in an embodiment of the present invention;

[0283] Figure 11 This is a second schematic diagram of the server structure provided in an embodiment of the present invention. Detailed Implementation

[0284] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.

[0285] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the invention. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.

[0286] In various embodiments of the present invention, it should be understood that the sequence number of each process described below does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0287] In addition, the terms "system" and "network" are often used interchangeably in this article.

[0288] In the embodiments provided in this application, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information.

[0289] To address the issue of low accuracy in horizontal federated models when multiple modeling nodes exhibit non-independent and identically distributed data and malicious nodes are present, this invention provides a model training method based on federated learning. A first federated model is determined based on the local model of a first neighboring node, and this first federated model is then transmitted to a second neighboring node and the blockchain. The first neighboring node, the second neighboring node, and the first modeling node belong to the same group. The first group federated model, determined by the blockchain based on the first federated model and the second federated model of the second modeling node, is then received by the blockchain. The second modeling node belongs to a different group than the first modeling node. The target data is predicted based on the target group federated model. Grouping techniques are used to control the influence range of modeling nodes, reduce the influence range of malicious modeling nodes, eliminate poorly performing federated models and group federated models, and improve model training performance.

[0290] In this embodiment of the invention, blockchain is used to distribute federated tasks and determine the participating modeling nodes. The specific steps are as follows:

[0291] Step 1: The federated system consists of several modeling nodes. Each modeling node trains a model using local data and shares parameters through the Swarm (cluster management) network application API. Newly added modeling nodes are registered through a blockchain smart contract and can only participate in federated tasks after registration is completed.

[0292] It should be noted that each modeling node includes a middleware layer and an application layer. The application environment includes a machine learning platform, blockchain, containerized Swarm API, NTP, and middleware plugins, while the application layer includes the model.

[0293] Step 2: The blockchain publishes federated tasks through smart contracts. These federated tasks mainly include: task execution plan, task model parameters, aggregation method, and data format.

[0294] Step 3: Only registered modeling nodes can obtain federated tasks issued by the blockchain via smart contracts. If a modeling node meets the data format requirements of the federated task, it can choose to participate in that task.

[0295] It's important to note that participating in a specific task involves calling a method in the smart contract to bind the modeling node to the federated task. After participating in the task, the modeling node can participate in the iteration of the federated task and obtain the task execution plan, among other things.

[0296] like Figure 1 As shown, this embodiment of the invention provides a model training method based on federated learning, applied to the first modeling node participating in a federated task. The method includes:

[0297] Step S101: Based on the local model of the first neighboring node, determine the first federation model and pass the first federation model to the second neighboring node and the blockchain. The first neighboring node, the second neighboring node and the first modeling node belong to the same group.

[0298] It should be noted that the N modeling nodes participating in the federated task are divided into Q groups, with at least two modeling nodes in each group logically forming a ring. Therefore, each modeling node is numbered, and time synchronization is performed using NTP (Network Time Protocol). The numbers of the first adjacent node and the second adjacent node are both immediately adjacent to the number of the first modeling node. Preferably, the number of the first adjacent node is less than the number of the first modeling node, and the change in the number of the second adjacent node is greater than the change in the number of the second modeling node. That is, the first adjacent node is the modeling node to the left of the first modeling node, and the second adjacent node is the modeling node to the right of the first modeling node.

[0299] In this embodiment of the invention, a decentralized networking approach is used for training. The first modeling node is trained using neighboring modeling nodes in its group, controlling the influence range of each modeling node and thus reducing the influence range of poorly performing modeling nodes. Furthermore, the model passed from neighboring nodes is used for screening, thereby improving the accuracy of the federated model and reducing the impact of data non-independent and identically distributed characteristics.

[0300] Step S102: Receive the target group federation model broadcast by the blockchain. The target group federation model is determined by the blockchain based on the first federation model and the second federation model of the second modeling node. The second modeling node belongs to a different group than the first modeling node.

[0301] It should be noted that the number of target group federated models is at least one, and is determined by the blockchain based on the federated model of each modeling node (i.e., the first modeling node and the second modeling node) participating in the federated task.

[0302] Using blockchain can achieve the effect of joint supervision and prevent the existence of cheating modeling nodes.

[0303] Step S103: Predict the target data based on the target group federated model.

[0304] In this embodiment of the invention, when the N modeling nodes participating in the federated task finish the federated training task and receive the target group federated model broadcast by the blockchain, the target group federated model can be used to predict the target data, and the target prediction results obtained by the target group federated model have a high accuracy.

[0305] In this embodiment of the invention, a first federated model is determined based on the local model of a first neighboring node, and the first federated model is transmitted to a second neighboring node and the blockchain. The first neighboring node, the second neighboring node, and the first modeling node belong to the same group. The first modeling node receives a target group federated model broadcast by the blockchain. The target group federated model is determined by the blockchain based on the first federated model and the second federated model of the second modeling node. The second modeling node belongs to a different group than the first modeling node. The target data is predicted based on the target group federated model. Grouping technology is used to control the influence range of the modeling nodes, reduce the influence range of malicious modeling nodes, eliminate poor federated models and group federated models, and improve the model training effect.

[0306] Optionally, in the federated learning-based model training method, before step S101: determining the first federated model based on the local model of the first neighboring node and passing the first federated model to the second neighboring node and the blockchain, the method further includes:

[0307] Upload the first processor parameter index of the local server to the blockchain;

[0308] Obtain the distribution information of the first encrypted data;

[0309] Upon receiving the coordination notification information broadcast by the blockchain, the third modeling node receives the second encrypted data distribution information transmitted by the third modeling node; wherein the third modeling node participates in the same federated task as the first modeling node, and the third modeling node is a non-coordination point; the coordination notification information is determined by the blockchain based on the first processor parameter index and the second processor parameter index of the second modeling node;

[0310] Based on the first encrypted data distribution information and the second encrypted data distribution information, determine the subgroup information of the group to which the data belongs;

[0311] In this embodiment of the invention, processor parameters include the number of CPU cores, unallocated memory, CPU utilization, and the number of exchanges between threads in the system. The blockchain receives processor parameter metrics uploaded by each modeling node participating in the federated task. Using a smart contract, it comprehensively sorts the processor parameter metrics of each modeling node, obtaining the top-ranked modeling nodes as coordination points. Specifically, the top two or three ranked modeling nodes are designated as coordination points, and the remaining modeling nodes are classified as non-coordination points. If there are three modeling nodes participating in the federated task, then there is one coordination point. After obtaining the coordination point information, the blockchain sends coordination notification information to the coordination point and non-coordination notification information to the non-coordination points; or, after obtaining the coordination point information, the modeling node that receives the coordination notification information is designated as a coordination point, and the modeling node that does not receive the coordination notification information is designated as a non-coordination point.

[0312] If the first modeling node receives the coordination notification information, then the first modeling node belongs to the coordination point. Each coordination point stores the distribution information of the second encrypted data transmitted by non-coordination points within a specified time period, where S is equal to the number of modeling nodes N participating in the federated task divided by the number of coordination points.

[0313] When the first modeling node receives the second encrypted data distribution information transmitted by the third modeling node, it obtains the time of the second encrypted data distribution information and the corresponding number information of the third modeling node that sent the second encrypted data distribution information, and stops receiving the second encrypted data distribution information after a specified time.

[0314] Furthermore, the first modeling node determines its group information based on its own first encrypted data distribution information and the received second encrypted data distribution information, specifically including the numbering information of each modeling node in the group.

[0315] It should be noted that if the first modeling node does not receive the coordination notification information, or receives non-coordination notification information, then the first modeling node is a non-coordination point and transmits the first encrypted data distribution information to the coordination point.

[0316] It should also be noted that each modeling node can belong to more than two groups.

[0317] Optionally, in the federated learning-based model training method, obtaining the first encrypted data distribution information includes:

[0318] Construct a data distribution vector based on the quartiles of each field in the local data;

[0319] The data distribution vector is encrypted to obtain the first encrypted data distribution information.

[0320] In this embodiment of the invention, the data distribution vector comprises the first quartile (Q1), the second quartile (Q2), and the third quartile (Q3) of each field. Here, the data distribution vector is homomorphically encrypted to obtain the first encrypted data distribution information.

[0321] It should be noted that each modeling node participating in the federated task can use the above steps to obtain the corresponding encrypted data distribution information.

[0322] Optionally, in the federated learning-based model training method, determining the subgroup information based on the first encrypted data distribution information and the second encrypted data distribution information includes:

[0323] Calculate the Euclidean distance between the first encrypted data distribution information and the second encrypted data distribution information;

[0324] When the Euclidean distance is less than a preset distance threshold, it is determined that it belongs to the same group as the third modeling node;

[0325] The group information is determined based on the third modeling node.

[0326] In this embodiment of the invention, since the number of the third modeling nodes is at least one, the number of the second encrypted data distribution information is also at least one. Here, the first modeling node calculates the Euclidean distance between the first encrypted data distribution information and the second encrypted data distribution information based on the first encrypted data distribution information and the second encrypted data distribution information, and calculates the Euclidean distance between at least one second encrypted data distribution information. When the Euclidean distance is less than a preset distance threshold, the modeling nodes corresponding to the encrypted data distribution vectors are grouped together, and the third modeling nodes in the same group as the first modeling node are determined, thereby determining the group information.

[0327] Optionally, in the federated learning-based model training method, before step S101: determining the first federated model based on the local model of the first neighboring node and passing the first federated model to the second neighboring node and the blockchain, the method further includes:

[0328] Upload the first unilateral model to the blockchain;

[0329] The target unilateral model that receives the blockchain broadcast.

[0330] It should be noted that the blockchain receives the unilateral model of each modeling node participating in the federated task, and determines the target unilateral model, as well as the model weight, model number and model accuracy of the target unilateral model based on the unilateral model of each modeling node.

[0331] Optionally, in the federated learning-based model training method, before uploading the first one-sided model to the blockchain, the method further includes:

[0332] The first unilateral model is obtained by iterating the unilateral model using local data.

[0333] It should be noted that each modeling node participating in the federated task constructs a one-sided model using local data. During the iteration process, each modeling node records a string containing the iteration number, cumulative duration, and model accuracy for each iteration. After each iteration is completed, the string and the resulting one-sided model are uploaded to the blockchain. If a modeling node fails to upload within a first preset duration, the blockchain increments the incomplete count for that node by one, and the blockchain no longer waits to receive the string and one-sided model from that node. Here, the string format is exemplified as follows: {Iteration Round 1: {Cumulative Iteration Duration 2 seconds, Model Accuracy 0.1}, Iteration Round 2: {Cumulative Iteration Duration 3 seconds, Model Accuracy 0.01}...}. The model corresponding to the preset number of iteration rounds is the one-sided model corresponding to the one-sided iteration completed by that modeling node.

[0334] Optionally, in the federated learning-based model training method, before receiving the target one-sided model broadcast by the blockchain, the method further includes:

[0335] The second unilateral model of the fourth modeling node that receives the blockchain broadcast, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task;

[0336] Based on the second one-sided model, first one-sided information is obtained; wherein, the first one-sided information includes the one-sided model number and the model accuracy.

[0337] The first unilateral information is uploaded to the blockchain, and the first unilateral information is used by the blockchain to determine the target unilateral model.

[0338] In this embodiment of the invention, the first modeling node obtains the second one-sided model of the fourth modeling node through the blockchain. Since the number of the fourth modeling node is at least one, the number of the second one-sided models is also at least one. Local data is substituted into at least one second one-sided model to obtain at least one first one-sided information. The first one-sided information corresponding to the one-sided model number with the highest model accuracy among the at least one first one-sided information is uploaded to the blockchain.

[0339] Here, the fourth modeling node receives the first one-sided model broadcast by the blockchain, and obtains the second one-sided information based on the first one-sided model, and uploads the second one-sided information to the blockchain; wherein, the method by which the fourth modeling node obtains the second one-sided information is the same as the method by which the first modeling node obtains the first one-sided information.

[0340] Furthermore, the blockchain receives unilateral information uploaded by each modeling node participating in the federated task and records the model number with the highest number of votes, thereby determining the target unilateral model and broadcasting the target unilateral model and its model number to each modeling node.

[0341] It should be noted that if the blockchain does not receive the first unilateral information from the modeling node within the second preset time period, the number of incomplete steps for that modeling node will be increased by one.

[0342] The following is combined Figure 2 This section details the process for determining the target unilateral model.

[0343] Each modeling node participating in the federated task (e.g. Figure 2 Modeling nodes 1, 2, 3, ..., n in the modeling ... Figure 2The blockchain collects and distributes the unilateral models (modeling nodes n, including unilateral model 1, unilateral model 2, unilateral model 3, ... n), and uploads the unilateral models to the blockchain.

[0344] Each modeling node receives a unilateral model from other modeling nodes participating in the federated task, broadcast by the blockchain.

[0345] Each modeling node substitutes its local data into the one-sided models of other modeling nodes to obtain at least one-sided information. It then selects the one-sided model with the highest accuracy among the at least one-sided information and uploads the model number and one-sided information of that model to the blockchain.

[0346] The blockchain receives unilateral information uploaded by each modeling node and records the model number with the highest number of votes, thereby determining the target unilateral model and broadcasting the target unilateral model and its model number to each modeling node.

[0347] Here, the weights of the target unilateral model are used as the initial weights of the model in the following federated task iterations.

[0348] Optionally, in the federated learning-based model training method, step S101: determining the first federated model based on the local models of the first neighboring nodes includes:

[0349] The local model gradients of the first adjacent nodes are aggregated to perform federated task iterations to determine the first federated model.

[0350] Here, when the first modeling node is iterating in the current round of the federated task, it aggregates the local model gradients of the first neighboring node in the previous round to determine the first federated model.

[0351] In this embodiment of the invention, a decentralized networking approach is used for federated task iteration. During the current round of federated task iteration, each modeling node in the group obtains the model accuracy of the current round of federated task iteration based on the information of the local model of the modeling node to its left in the group from the previous round, and verifies whether the accuracy of the current round is higher than the accuracy of the previous round. If it is higher, it is updated; if it is lower, it is not updated and the accuracy of the previous round is retained. This process continues until, after multiple rounds of federated task iteration, the accuracy reaches a preset accuracy threshold, the accuracy stabilizes, or the preset number of iterations is reached, at which point the iteration stops, and the model corresponding to the current round is determined, which is the first federated model.

[0352] Optionally, the federated learning-based model training method, wherein the step of aggregating the local model gradients of the first neighboring nodes to perform federated task iterations and determine the first federated model includes:

[0353] The first round of federated mission iterations will be conducted according to the following steps:

[0354] Construct the first local model based on the model weights of the target one-sided model;

[0355] Upload the first state vector of the first local model to the blockchain, and pass the gradient of the first local model to the second neighboring node;

[0356] The second round of federated mission iteration will be conducted according to the following steps:

[0357] Based on the local model gradient obtained by the first neighboring node during the first round of federated task iteration, the first local model is updated to obtain the second local model;

[0358] If the model accuracy of the second local model is greater than or equal to the first accuracy threshold, or if the model accuracy of the second local model is greater than or equal to the model accuracy of the first local model, the second state vector of the second local model is uploaded to the blockchain, and the gradient of the second local model is passed to the second neighboring node, while the second local model is retained.

[0359] If the model accuracy of the second local model is less than the first accuracy threshold, and the model accuracy of the second local model is less than the model accuracy of the first local model, the first state vector of the first local model is uploaded to the blockchain, and the local gradient of the first local model is passed to the second neighboring node, and the second local model is not retained.

[0360] Repeat the steps of the second round of federated task iteration until the preset number of iterations is reached or the model accuracy reaches the preset accuracy threshold, then determine the first federated model and end the federated task;

[0361] The first accuracy threshold is determined by the blockchain based on the first state vector.

[0362] In this embodiment of the invention, combined with Figure 3 This section provides a detailed explanation of the process for iterating federal missions.

[0363] First round of Federation mission iteration:

[0364] The first modeling node (belonging to the i-th group, such as...) Figure 3 Modeling nodes 1, 2, ..., n in the modeling ... Local training duration And the model accuracy of the first local model corresponding to the local data. etc., as the first state vector Uploaded to the blockchain, and the gradient of the first local model is... Pass it to the second adjacent node (the right modeling node).

[0365] Furthermore, after receiving the state vector uploaded by each modeling node in the group to which the first modeling node belongs during the first round of federated task iteration, the blockchain calculates the average model accuracy of the group during this round of iteration, which is used as the first accuracy threshold for the group.

[0366] Second round of Federation mission iteration:

[0367] The first modeling node receives the gradient passed by the first neighboring node (the left modeling node) when it completes the first round of federated task iteration. And based on this gradient The first local model weights are obtained using the following formula.

[0368]

[0369] Where η is the preset model learning rate;

[0370] Based on the first local model weights Using local data, update the first local model, construct a second local model, and assign the local data to the model accuracy of the second local model. Compared with the first accuracy threshold Alternatively, the model accuracy of the first local model can be compared with local data. If a comparison is made, or Then the weights of the first local model in the second local model will be adjusted. Local training duration And the model accuracy of the second local model corresponding to the local data. etc., as the second state vector Uploaded to the blockchain, and the second local model is retained locally. The second local model is then updated to the first federated model, and the gradient of the second local model is... Pass it to the second adjacent node (the right modeling node).

[0371] Furthermore, after receiving the state vector uploaded by each modeling node in the group to which the first modeling node belongs during the second round of federated task iteration, the blockchain calculates the average model accuracy of the group during this round of iteration, which is used as the second accuracy threshold for the group.

[0372] The process of iterating through the second round of federated tasks is repeated until the preset number of iterations is reached, the model accuracy reaches the preset accuracy threshold, or the model accuracy stabilizes. Then, the iteration stops, and the model at the end of the current round is the first federated model, thus ending the federated task.

[0373] It should be noted that within the third preset time period, if the blockchain fails to receive the state vector obtained from each round of federated task iteration uploaded by the modeling node, the count of incomplete tasks for that modeling node is increased by one; and within the fourth preset time period, if the blockchain fails to obtain the model gradient of the first modeling node and transmit it to the second adjacent node, the count of non-transmission for that modeling node is increased by one. The counts of incomplete tasks and non-transmissions are collectively referred to as the violation count.

[0374] Optionally, in the federated learning-based model training method, before receiving the target group federated model broadcast by the blockchain, the method further includes:

[0375] The second group of federated models to which the second modeling node belongs, receiving the blockchain broadcast;

[0376] Based on the second set of federation models, the first federation information is obtained;

[0377] Upload the first federal information to the blockchain;

[0378] The first federated information includes the model accuracy of the second set of federated models corresponding to local data.

[0379] In this embodiment of the invention, combined with Figure 4 This section details the process for determining the target group federation model.

[0380] The blockchain receives each modeling node (e.g., participating in the federated task) Figure 4 The federated models uploaded by each modeling node in group 1, group 2, ..., group i) determine the group federated model to which each modeling node belongs and broadcast it to each modeling node.

[0381] The first modeling node obtains the second set of federated models through the blockchain. Since there is at least one second modeling node, there is also at least one second set of federated models. The local data is substituted into at least one second set of federated models to obtain at least one first federated information corresponding to at least one second set of federated models, and at least one first federated information is uploaded to the blockchain.

[0382] Furthermore, the blockchain receives at least one first federation information corresponding to at least one second group of federation models uploaded by each modeling node participating in the federation task, calculates the average model accuracy of each group of federation models, and if there is a group of federation models whose average model accuracy is lower than the model accuracy of the target unilateral model, then the group of federation models is deleted, and the remaining group of federation models, i.e. the target group of federation models, is broadcast to each modeling node.

[0383] Optionally, in the federated learning-based model training method, the step of predicting the target data according to the target group federated model includes:

[0384] The target data is input into the target group federated model to obtain at least one output result;

[0385] A voting method is used to select at least one output result to obtain the target prediction result.

[0386] It should be noted that there is at least one target group federated model. The target data is input into at least one target group federated model to obtain at least one output result. A voting method is used to select the output result with the highest number of votes as the target prediction result.

[0387] In summary, the federated learning-based model training method of this invention has the following beneficial effects:

[0388] 1. Group the modeling nodes and control the influence range of each modeling node to reduce the influence range of malicious modeling nodes and improve the accuracy of the horizontal model;

[0389] 2. During the iteration of the federated task, the model gradients of other modeling nodes are used for identification to improve the model accuracy of the federated model and reduce the impact of data non-independent and identically distributed.

[0390] 3. Eliminate federated models with poor performance to prevent contamination of the federated model group;

[0391] 4. Eliminate group federation models with poor performance to prevent contamination of the target group federation model;

[0392] 5. Use blockchain to achieve joint supervision and prevent the existence of cheating modeling nodes.

[0393] like Figure 5 As shown, this embodiment of the invention also provides a model training method based on federated learning, applied to blockchain, the method comprising:

[0394] Step S501: Receive the first federated model uploaded by the first modeling node and the second federated model uploaded by the second modeling node, wherein the first modeling node and the second modeling node belong to different groups;

[0395] In this embodiment of the invention, the first modeling node and the second modeling node are trained using adjacent modeling nodes in their respective groups to obtain the first federated model and the second federated model, respectively. This controls the influence range of each modeling node, thereby reducing the influence range of malicious modeling nodes. Furthermore, the model passed from adjacent nodes is used for screening, thereby improving the accuracy of the federated model and reducing the impact of data non-independent and identically distributed characteristics.

[0396] Step S502: Based on the first federation model and the second federation model, determine the target group federation model;

[0397] It should be noted that the blockchain can achieve a joint supervision effect, preventing cheating by modeling nodes participating in the federated task. Here, the number of target group federated models is at least one, determined by the blockchain based on the federated model of each modeling node participating in the federated task.

[0398] Step S503: Broadcast the target group federated model to the first modeling node and the second modeling node respectively.

[0399] In this embodiment of the invention, the target group federated model is broadcast to each modeling node participating in the federated task. Each modeling node can predict the target data based on the target group federated model, thereby improving the prediction accuracy.

[0400] In this embodiment of the invention, a target group federated model is determined based on the first federated model and the second federated model uploaded by a first modeling node and a second federated model uploaded by a second modeling node, wherein the first modeling node and the second modeling node belong to different groups. The target group federated model is then broadcast to the first modeling node and the second modeling node respectively. This grouping technique controls the influence range of the modeling nodes, reduces the influence range of malicious modeling nodes, eliminates poor-performing federated models and group federated models, and improves the model training effect.

[0401] Optionally, in the federated learning-based model training method, before step S501: receiving the first federated model uploaded by the first modeling node and the second federated model uploaded by the second modeling node, the method further includes:

[0402] Receive the first processor parameter index of the local server of the first modeling node uploaded by the first modeling node and the second processor parameter index of the local server of the second modeling node uploaded by the second modeling node.

[0403] Based on the first processor parameter index and the second processor parameter index, it is determined whether the first modeling node is a coordination point and whether the third modeling node is a non-coordination point; wherein, the third modeling node and the first modeling node participate in the same federated task.

[0404] When it is determined that the first modeling node belongs to the coordination point, a coordination notification message is broadcast to the first modeling node;

[0405] When it is determined that the third modeling node belongs to the non-coordinated point, a non-coordinated notification message is broadcast to the third modeling node.

[0406] In this embodiment of the invention, processor parameters include the number of CPU cores, unallocated memory, CPU utilization, and the number of exchanges between threads in the system. The blockchain receives processor parameter metrics uploaded by each modeling node participating in the federated task. Using a smart contract, it comprehensively sorts the processor parameter metrics of each modeling node, obtaining the top-ranked modeling nodes as coordination points. Specifically, the top two or three ranked modeling nodes are designated as coordination points, and the remaining modeling nodes are classified as non-coordination points. If there are three modeling nodes participating in the federated task, then there is one coordination point. After obtaining the coordination point information, the blockchain sends the coordination notification information to the coordination point and the non-coordination notification information to the non-coordination points; or, it sends the coordination notification information to the coordination point but does not send any information to the non-coordination points.

[0407] Optionally, in the federated learning-based model training method, before step S501: receiving the first federated model uploaded by the first modeling node and the second federated model uploaded by the second modeling node, the method further includes:

[0408] Receive the first unilateral model uploaded by the first modeling node and the second unilateral model uploaded by the fourth modeling node, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task;

[0409] Based on the first unilateral model and the second unilateral model, the target unilateral model is determined.

[0410] It should be noted that the methods for obtaining the first unilateral model and the second unilateral model are detailed in the above-described method for applying to the first modeling node participating in federated tasks, and will not be repeated here.

[0411] Optionally, in the federated learning-based model training method, determining the target one-sided model based on the first one-sided model and the second one-sided model includes:

[0412] Broadcast the second one-sided model to the first modeling node, and broadcast the first one-sided model to the fourth modeling node;

[0413] Receive the first one-sided information obtained by the first modeling node based on the second one-sided model uploaded by the first modeling node, and the second one-sided information obtained by the fourth modeling node based on the first one-sided model uploaded by the fourth modeling node;

[0414] The target unilateral model is determined based on the first unilateral information and the second unilateral information.

[0415] It should be noted that the methods for obtaining the first unilateral information and the second unilateral information are detailed in the above-described method for the first modeling node participating in federated tasks, and will not be repeated here.

[0416] Furthermore, the blockchain receives unilateral information (i.e., the first unilateral information and the second unilateral information) uploaded by each modeling node participating in the federated task, and records the model number with the highest number of votes, thereby determining the target unilateral model.

[0417] Optionally, in the federated learning-based model training method, before step S501: receiving the first federated model uploaded by the first modeling node, the method further includes:

[0418] Receive the state vector of each modeling node in each round of federated task iteration, uploaded by each modeling node in the group to which the first modeling node belongs;

[0419] Based on the state vector of each modeling node, the average model accuracy of the group to which the first modeling node belongs is obtained in each round of federated task iteration;

[0420] The average model accuracy is used as the accuracy threshold and broadcast to the first modeling node.

[0421] It should be noted that the method for obtaining the state vector for each modeling node in each round of federated task iteration is detailed in the method applied to the first modeling node participating in the federated task described above, and will not be repeated here.

[0422] In this embodiment of the invention, the blockchain determines the average model accuracy of each group in each round of federated task iteration based on the model accuracy of each modeling node in the same round of federated task iteration, and uses it as the accuracy threshold for each group in that round, and broadcasts it to each modeling node in the group.

[0423] Optionally, in the federated learning-based model training method, step S502: determining the target group federated model based on the first federated model and the second federated model includes:

[0424] Based on the first federation model, a first group of federation models is determined to belong to the group to which the first modeling node belongs, and based on the second federation model, a second group of federation models is determined to belong to the group to which the second modeling node belongs.

[0425] Broadcast the second set of federated models to the first modeling node, and broadcast the first set of federated models to the second modeling node;

[0426] Receive the first federated information obtained by the first modeling node based on the second set of federated models uploaded by the first modeling node, and receive the second federated information obtained by the second modeling node based on the first set of federated models uploaded by the second modeling node;

[0427] The target group federated model is determined based on the first federated information and the second federated information.

[0428] It should be noted that the methods for obtaining the first federation information and the second federation information are detailed in the above-described method applied to the first modeling node participating in federation tasks, and will not be repeated here.

[0429] Optionally, in the federated learning-based model training method, determining the first group of federated models to which the first modeling node belongs based on the first federated model includes:

[0430] Count the number of violations for each modeling node within the group to which the first modeling node belongs;

[0431] The modeling node with the highest number of violations within the group to which the first modeling node belongs is selected as the violating modeling node.

[0432] The first set of federated models is determined based on the first accuracy vector and the second accuracy vector of the violation modeling node;

[0433] The first accuracy vector is determined based on the model accuracy corresponding to the preset number of federated task iteration rounds, and the second accuracy vector is determined based on the model accuracy corresponding to the preset number of unilateral model iteration rounds.

[0434] It should be noted that the first accuracy vector v1 = [pre_fed1, pre_fed2, pre_fed3], where pre_fed1 is the first... The model accuracy corresponding to each round of federated task iteration; pre_fed2 is the accuracy of the first round of federated task iteration. The model accuracy corresponding to the Lth round of federated task iteration; pre_fed3 is the model accuracy corresponding to the Lth round of federated task iteration; L represents the total number of federated task iterations for this non-compliant modeling node.

[0435] The second accuracy vector v2 = [pre1, pre2, pre3], where pre1 is the first... The model accuracy corresponding to the single-sided model iteration in round 2; pre2 is the accuracy of the first iteration. The model accuracy corresponding to the Mth round of unilateral model iteration; pre3 is the model accuracy corresponding to the Mth round of unilateral model iteration; M represents the total number of unilateral model iterations for the non-compliant modeling node.

[0436] In this embodiment of the invention, the number of violations includes the number of non-transmissions and the number of incompletes in the method applied to the first modeling node participating in the federated task as described above.

[0437] Optionally, in the federated learning-based model training method, the step of counting the number of violations for each modeling node within the group to which the first modeling node belongs includes:

[0438] The violation count of the first modeling node increases by one for each of the following conditions:

[0439] Within the first preset time period, no first one-sided model uploaded by the first modeling node was received;

[0440] Within the second preset time period, no first unilateral information uploaded by the first modeling node was received;

[0441] Within the third preset time period, the state vector obtained in each round of federated task iteration uploaded by the first modeling node is not received;

[0442] Within a fourth preset time period, it is obtained that the local model gradient of the first modeling node has not been transmitted to the second adjacent node, and the second adjacent node belongs to the same group as the first modeling node.

[0443] In this embodiment of the invention, taking the first modeling node as an example, it is explained that each modeling node needs to increase the number of violations once when the above-mentioned condition is met. Specifically, the timing of the violation count is as described above in the method applied to the first modeling node participating in the federated task, and will not be repeated here.

[0444] It should be noted that the first preset duration, the second preset duration, the third preset duration, and the fourth preset duration are determined according to the configuration and are not specifically limited.

[0445] Optionally, in the federated learning-based model training method, determining the first set of federated models based on the first and second accuracy vectors of the violating modeling nodes includes:

[0446] Compare the elements at the corresponding positions in the first accuracy vector and the second accuracy vector to obtain a first comparison result;

[0447] Determine the first group of federated models according to the first comparison result.

[0448] It should be noted that the first comparison result is the number of elements in the first accuracy vector whose values are greater than the elements at the same positions in the second accuracy vector.

[0449] Optionally, in the model training method based on federated learning, wherein the determining the first group of federated models according to the first comparison result includes:

[0450] When the first comparison result is less than a preset value and the element at the first preset position in the first accuracy vector is less than the element at the first preset position in the second accuracy vector, determine the first group of federated models according to the federated models of each modeling node in the group to which the first modeling node belongs except the first modeling node.

[0451] In the embodiment of the present invention, the preset value is 3; when the element at the first preset position in the first accuracy vector is less than the element at the first preset position in the second accuracy vector, that is, pre_fed3 < pre3, the first modeling node is excluded, and the first group of federated models is determined according to the average value of the federated models of each modeling node in the group to which the first modeling node belongs except the first modeling node.

[0452] It should be noted that the method for determining the second group of federated models of the group to which the second modeling node belongs is the same as that of the first group of federated models, and will not be elaborated here.

[0453] Optionally, in the model training method based on federated learning, wherein the determining the target group of federated models according to the first federated information and the second federated information includes:

[0454] Compare the first federated information and the second federated information with the model accuracy of the target unilateral model respectively to obtain a second comparison result;

[0455] Determine the target group of federated models according to the second comparison result.

[0456] In the embodiment of the present invention, delete the group of federated models corresponding to the federated information whose model accuracy is lower than the model accuracy of the target unilateral model, and the remaining group of federated models is used as the target group of federated models and broadcast to each modeling node participating in the federated task.

[0457] It should be noted that the federated learning-based model training method of the present invention can implement all the steps of the first modeling node participating in the federated task in the above-described method embodiment of the federated learning-based model training method, and can achieve the same or similar technical effects, which will not be repeated here.

[0458] like Figure 6 As shown, this embodiment of the invention also provides an electronic device 600, applied to a first modeling node participating in a federated task. The server includes a processor 601 and a transceiver 602, wherein:

[0459] The processor 601 is used to determine a first federation model based on the local model of the first neighboring node, and to transmit the first federation model to the second neighboring node and the blockchain, wherein the first neighboring node, the second neighboring node and the first modeling node belong to the same group.

[0460] The transceiver 602 is used to receive the target group federation model broadcast by the blockchain. The target group federation model is determined by the blockchain based on the first federation model and the second federation model of the second modeling node, wherein the second modeling node belongs to a different group than the first modeling node.

[0461] The processor 601 is further configured to predict target data based on the target group federated model.

[0462] In this embodiment of the invention, a first federated model is determined based on the local model of a first neighboring node, and the first federated model is transmitted to a second neighboring node and the blockchain. The first neighboring node, the second neighboring node, and the first modeling node belong to the same group. The first modeling node receives a target group federated model broadcast by the blockchain. The target group federated model is determined by the blockchain based on the first federated model and the second federated model of the second modeling node. The second modeling node belongs to a different group than the first modeling node. The target data is predicted based on the target group federated model. Grouping technology is used to control the influence range of the modeling nodes, reduce the influence range of malicious modeling nodes, eliminate poor federated models and group federated models, and improve the model training effect.

[0463] Optionally, in the electronic device 600, the processor 601 is further configured to:

[0464] Upload the first processor parameter index of the local server to the blockchain;

[0465] Obtain the distribution information of the first encrypted data;

[0466] Upon receiving the coordination notification information broadcast by the blockchain, the third modeling node receives the second encrypted data distribution information transmitted by the third modeling node; wherein the third modeling node is in the same federated task as the first modeling node and is a non-coordination point; the coordination notification information is determined by the blockchain based on the first processor parameter index and the second processor parameter index of the second modeling node;

[0467] Based on the first encrypted data distribution information and the second encrypted data distribution information, determine the subgroup information of the group to which the data belongs.

[0468] Optionally, in the electronic device 600, the processor 601 is specifically used for:

[0469] Construct a data distribution vector based on the quartiles of each field in the local data;

[0470] The data distribution vector is encrypted to obtain the first encrypted data distribution information.

[0471] Optionally, in the electronic device 600, the processor 601 is specifically used for:

[0472] Calculate the Euclidean distance between the first encrypted data distribution information and the second encrypted data distribution information;

[0473] When the Euclidean distance is less than a preset distance threshold, it is determined that it belongs to the same group as the third modeling node;

[0474] The group information is determined based on the third modeling node.

[0475] Optionally, in the electronic device 600, the transceiver 602 is further configured to:

[0476] Upload the first unilateral model to the blockchain;

[0477] The target unilateral model that receives the blockchain broadcast.

[0478] Optionally, in the electronic device 600, the processor 601 is specifically used for:

[0479] The first unilateral model is obtained by iterating the unilateral model using local data.

[0480] Optionally, in the electronic device 600, the processor 601 is further configured to:

[0481] The second unilateral model of the fourth modeling node that receives the blockchain broadcast, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task;

[0482] Based on the second unilateral model, the first unilateral information is obtained;

[0483] The first unilateral information is uploaded to the blockchain, and the first unilateral information is used by the blockchain to determine the target unilateral model.

[0484] Optionally, in the electronic device 600, the processor 601 is specifically used for:

[0485] The local model gradients of the first adjacent nodes are aggregated to perform federated task iterations to determine the first federated model.

[0486] Optionally, in the electronic device 600, the processor 601 is specifically used for:

[0487] The first round of federated mission iterations will be conducted according to the following steps:

[0488] Construct the first local model based on the model weights of the target one-sided model;

[0489] Upload the first state vector of the first local model to the blockchain, and pass the gradient of the first local model to the second neighboring node;

[0490] The second round of federated mission iteration will be conducted according to the following steps:

[0491] The first local model is updated based on the local model gradient obtained by the first neighboring node during the first round of federated task iteration to obtain the second local model;

[0492] If the model accuracy of the second local model is greater than or equal to the first accuracy threshold, or if the model accuracy of the second local model is greater than or equal to the model accuracy of the first local model, the second state vector of the second local model is uploaded to the blockchain, and the gradient of the second local model is passed to the second neighboring node, while the second local model is retained.

[0493] If the model accuracy of the second local model is less than the first accuracy threshold, and the model accuracy of the second local model is less than the model accuracy of the first local model, the first state vector of the first local model is uploaded to the blockchain, and the gradient of the first local model is passed to the second neighboring node, and the second local model is not retained.

[0494] Repeat the steps of the second round of federated task iteration until the preset number of iterations is reached or the model accuracy reaches the preset accuracy threshold, then determine the first federated model and end the federated task;

[0495] The first accuracy threshold is determined by the blockchain based on the first state vector.

[0496] Optionally, in the electronic device 600, the processor 601 is further configured to:

[0497] The second group of federated models to which the second modeling node belongs, receiving the blockchain broadcast;

[0498] Based on the second set of federation models, the first federation information is obtained;

[0499] The first federal information is uploaded to the blockchain.

[0500] Optionally, in the electronic device 600, the processor 601 is specifically used for:

[0501] The target data is input into the target group federated model to obtain at least one output result;

[0502] A voting method is used to select at least one output result to obtain the target prediction result.

[0503] It should be noted that the electronic device provided in the embodiments of the present invention can implement all the method steps implemented in the above embodiment of the federated learning-based model training method applied to the first modeling node participating in the federated task, and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.

[0504] like Figure 7 As shown, this embodiment of the invention also provides a server 700 applied to blockchain, the server including a processor 701 and a transceiver 702, wherein:

[0505] The transceiver 702 is used to receive a first federated model uploaded by a first modeling node and a second federated model uploaded by a second modeling node, wherein the first modeling node and the second modeling node belong to different groups.

[0506] The processor 701 is used to determine a target group federation model based on the first federation model and the second federation model;

[0507] The transceiver 702 is further configured to broadcast the target group federated model to the first modeling node and the second modeling node, respectively.

[0508] In this embodiment of the invention, a target group federated model is determined based on the first federated model and the second federated model uploaded by a first modeling node and a second federated model uploaded by a second modeling node, wherein the first modeling node and the second modeling node belong to different groups. The target group federated model is then broadcast to the first modeling node and the second modeling node respectively. This grouping technique controls the influence range of the modeling nodes, reduces the influence range of malicious modeling nodes, eliminates poor-performing federated models and group federated models, and improves the model training effect.

[0509] Optionally, in the server 700, the processor 701 is further configured to:

[0510] Receive the first processor parameter index of the local server of the first modeling node uploaded by the first modeling node and the second processor parameter index of the local server of the second modeling node uploaded by the second modeling node.

[0511] Based on the first processor parameter index and the second processor parameter index, it is determined whether the first modeling node is a coordination point and whether the third modeling node is a non-coordination point; wherein, the third modeling node and the first modeling node participate in the same federated task.

[0512] When it is determined that the first modeling node belongs to the coordination point, a coordination notification message is broadcast to the first modeling node;

[0513] When it is determined that the third modeling node belongs to the non-coordinated point, a non-coordinated notification message is broadcast to the third modeling node.

[0514] Optionally, in the server 700, the processor 701 is further configured to:

[0515] Receive the first unilateral model uploaded by the first modeling node and the second unilateral model uploaded by the fourth modeling node, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task;

[0516] Based on the first unilateral model and the second unilateral model, the target unilateral model is determined.

[0517] Optionally, in the server 700, the processor 701 is specifically used for:

[0518] Broadcast the second one-sided model to the first modeling node, and broadcast the first one-sided model to the fourth modeling node;

[0519] Receive the first one-sided information obtained by the first modeling node based on the second one-sided model uploaded by the first modeling node, and the second one-sided information obtained by the fourth modeling node based on the first one-sided model uploaded by the fourth modeling node;

[0520] The target unilateral model is determined based on the first unilateral information and the second unilateral information.

[0521] Optionally, in the server 700, the processor 701 is specifically used for:

[0522] Receive the state vector of each modeling node in each round of federated task iteration, uploaded by each modeling node in the group to which the first modeling node belongs;

[0523] Based on the state vector of each modeling node, the average model accuracy of the group to which the first modeling node belongs is obtained in each round of federated task iteration;

[0524] The average model accuracy is used as the accuracy threshold and broadcast to the first modeling node.

[0525] Optionally, in the server 700, the processor 701 is specifically used for:

[0526] Based on the first federation model, a first group of federation models is determined to belong to the group to which the first modeling node belongs, and based on the second federation model, a second group of federation models is determined to belong to the group to which the second modeling node belongs.

[0527] Broadcast the second set of federated models to the first modeling node, and broadcast the first set of federated models to the second modeling node;

[0528] Receive the first federated information obtained by the first modeling node based on the second set of federated models uploaded by the first modeling node, and receive the second federated information obtained by the second modeling node based on the first set of federated models uploaded by the second modeling node;

[0529] The target group federated model is determined based on the first federated information and the second federated information.

[0530] Optionally, in the server 700, the processor 701 is specifically used for:

[0531] Count the number of violations for each modeling node within the group to which the first modeling node belongs;

[0532] The modeling node with the highest number of violations within the group to which the first modeling node belongs is selected as the violating modeling node.

[0533] The first set of federated models is determined based on the first accuracy vector and the second accuracy vector of the violation modeling node;

[0534] The first accuracy vector is determined based on the model accuracy corresponding to the preset number of federated task iteration rounds, and the second accuracy vector is determined based on the model accuracy corresponding to the preset number of unilateral model iteration rounds.

[0535] Optionally, in the server 700, the processor 701 is specifically used for:

[0536] The violation count of the first modeling node increases by one for each of the following conditions:

[0537] Within the first preset time period, no first one-sided model uploaded by the first modeling node was received;

[0538] Within the second preset time period, no first unilateral information uploaded by the first modeling node was received;

[0539] Within the third preset time period, the state vector obtained in each round of federated task iteration uploaded by the first modeling node is not received;

[0540] Within a fourth preset time period, it is obtained that the local model gradient of the first modeling node has not been transmitted to the second adjacent node, and the second adjacent node belongs to the same group as the first modeling node.

[0541] Optionally, in the server 700, the processor 701 is specifically used for:

[0542] Compare the elements at corresponding positions in the first accuracy vector and the second accuracy vector to obtain the first comparison result;

[0543] Based on the first comparison result, the first set of federated models is determined.

[0544] Optionally, in the server, the processor 701 is specifically used for:

[0545] When the first comparison result is less than a preset value, and the element at the first preset position in the first accuracy vector is less than the element at the first preset position in the second accuracy vector, the first group of federated models is determined based on the federated models of each modeling node in the group to which the first modeling node belongs, excluding the first modeling node.

[0546] Optionally, in the server 700, the processor 701 is specifically used for:

[0547] The first federated information and the second federated information are compared with the accuracy of the target unilateral model to obtain a second comparison result;

[0548] Based on the second comparison result, the target group federation model is determined.

[0549] It should be noted that the server provided in the embodiments of the present invention can implement all the method steps implemented in the above embodiments of the model training method based on federated learning applied to blockchain, and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiments and the beneficial effects will not be described in detail.

[0550] like Figure 8 As shown, this embodiment of the invention also provides a model training device based on federated learning, applied to a first modeling node participating in a federated task, the device comprising:

[0551] The first determining module 801 is used to determine the first federation model based on the local model of the first neighboring node, and to pass the first federation model to the second neighboring node and the blockchain, wherein the first neighboring node, the second neighboring node and the first modeling node belong to the same group;

[0552] The first receiving module 802 is used to receive the target group federation model broadcast by the blockchain. The target group federation model is determined by the blockchain based on the first federation model and the second federation model of the second modeling node. The second modeling node belongs to a different group than the first modeling node.

[0553] The first prediction module 803 is used to predict the target data based on the target group federated model.

[0554] In this embodiment of the invention, a first federated model is determined based on the local model of a first neighboring node, and the first federated model is transmitted to a second neighboring node and the blockchain. The first neighboring node, the second neighboring node, and the first modeling node belong to the same group. The first modeling node receives a target group federated model broadcast by the blockchain. The target group federated model is determined by the blockchain based on the first federated model and the second federated model of the second modeling node. The second modeling node belongs to a different group than the first modeling node. The target data is predicted based on the target group federated model. Grouping technology is used to control the influence range of the modeling nodes, reduce the influence range of malicious modeling nodes, eliminate poor federated models and group federated models, and improve the model training effect.

[0555] Optionally, the federated learning-based model training apparatus further includes:

[0556] The first upload module is used to upload the first processor parameter indicators of the local server to the blockchain;

[0557] The first acquisition module is used to acquire the first encrypted data distribution information;

[0558] The third receiving module is used to receive second encrypted data distribution information transmitted by the third modeling node when receiving the coordination notification information broadcast by the blockchain; wherein the third modeling node and the first modeling node are in the same federated task and are non-coordinating points; the coordination notification information is determined by the blockchain based on the first processor parameter index and the second processor parameter index of the second modeling node;

[0559] The third determining module is used to determine the subgroup information of the group to which the data belongs based on the first encrypted data distribution information and the second encrypted data distribution information.

[0560] Optionally, in the federated learning-based model training apparatus, the first acquisition module is specifically used for:

[0561] Construct a data distribution vector based on the quartiles of each field in the local data;

[0562] The data distribution vector is encrypted to obtain the first encrypted data distribution information.

[0563] Optionally, in the federated learning-based model training apparatus, the third determining module is specifically used for:

[0564] Calculate the Euclidean distance between the first encrypted data distribution information and the second encrypted data distribution information;

[0565] When the Euclidean distance is less than a preset distance threshold, it is determined that it belongs to the same group as the third modeling node;

[0566] The group information is determined based on the third modeling node.

[0567] Optionally, the federated learning-based model training apparatus further includes:

[0568] The second upload module is used to upload the first one-sided model to the blockchain;

[0569] The fourth receiving module is used to receive the target unilateral model of the blockchain broadcast.

[0570] Optionally, the federated learning-based model training apparatus further includes:

[0571] The first acquisition module is used to perform unilateral model iteration using local data to obtain the first unilateral model.

[0572] Optionally, the federated learning-based model training apparatus further includes:

[0573] The fifth receiving module is used to receive the second unilateral model of the fourth modeling node broadcast by the blockchain, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task;

[0574] Based on the second unilateral model, the first unilateral information is obtained;

[0575] The first unilateral information is uploaded to the blockchain, and the first unilateral information is used by the blockchain to determine the target unilateral model.

[0576] Optionally, in the federated learning-based model training apparatus, the first determining module 801 includes:

[0577] The first determination submodule is used to aggregate the local model gradients of the first adjacent nodes for federated task iteration to determine the first federated model.

[0578] Optionally, in the federated learning-based model training apparatus, the first determining submodule is specifically used for:

[0579] The first round of federated mission iterations will be conducted according to the following steps:

[0580] Construct the first local model based on the model weights of the target one-sided model;

[0581] Upload the first state vector of the first local model to the blockchain, and pass the gradient of the first local model to the second neighboring node;

[0582] The second round of federated mission iteration will be conducted according to the following steps:

[0583] Based on the local model gradient obtained by the first neighboring node during the first federated task iteration, the first local model is updated to obtain the second local model.

[0584] If the model accuracy of the second local model is greater than or equal to the first accuracy threshold, or if the model accuracy of the second local model is greater than or equal to the model accuracy of the first local model, the second state vector of the second local model is uploaded to the blockchain, and the gradient of the second local model is passed to the second neighboring node, while the second local model is retained.

[0585] If the model accuracy of the second local model is less than the first accuracy threshold, and the model accuracy of the second local model is less than the model accuracy of the first local model, the first state vector of the first local model is uploaded to the blockchain, and the gradient of the first local model is passed to the second neighboring node, and the second local model is not retained.

[0586] Repeat the steps of the second round of federated task iteration until the preset number of iterations is reached or the model accuracy reaches the preset accuracy threshold, then determine the first federated model and end the federated task;

[0587] The first accuracy threshold is determined by the blockchain based on the first state vector.

[0588] Optionally, the federated learning-based model training apparatus further includes:

[0589] The sixth receiving module is used to receive the second group of federated models of the group to which the second modeling node belongs, broadcast by the blockchain.

[0590] The second acquisition module is used to obtain the first federation information based on the second set of federation models;

[0591] The third upload module is used to upload the first federated information to the blockchain.

[0592] Optionally, in the federated learning-based model training apparatus, the first prediction module 803 is specifically used for:

[0593] The target data is input into the target group federated model to obtain at least one output result;

[0594] A voting method is used to select at least one output result to obtain the target prediction result.

[0595] It should be noted that the apparatus provided in the embodiments of the present invention can implement all the method steps implemented in the above embodiments of the federated learning-based model training method applied to the first modeling node participating in the federated task, and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiments and the beneficial effects will not be described in detail.

[0596] like Figure 9 As shown, this embodiment of the invention also provides a model training device based on federated learning, applied to blockchain, the device comprising:

[0597] The second receiving module 901 is used to receive the first federated model uploaded by the first modeling node and the second federated model uploaded by the second modeling node, wherein the first modeling node and the second modeling node belong to different groups.

[0598] The second determining module 901 is used to determine the target group federation model based on the first federation model and the second federation model;

[0599] The first broadcast module 903 is used to broadcast the target group federated model to the first modeling node and the second modeling node respectively.

[0600] In this embodiment of the invention, a target group federated model is determined based on the first federated model and the second federated model uploaded by a first modeling node and a second federated model uploaded by a second modeling node, wherein the first modeling node and the second modeling node belong to different groups. The target group federated model is then broadcast to the first modeling node and the second modeling node respectively. This grouping technique controls the influence range of the modeling nodes, reduces the influence range of malicious modeling nodes, eliminates poor-performing federated models and group federated models, and improves the model training effect.

[0601] Optionally, the federated learning-based model training apparatus further includes:

[0602] The seventh receiving module is used to receive the first processor parameter index of the local server of the first modeling node uploaded by the first modeling node and the second processor parameter index of the local server of the second modeling node uploaded by the second modeling node.

[0603] The fourth determining module is used to determine whether the first modeling node belongs to a coordination point and whether the third modeling node belongs to a non-coordination point based on the first processor parameter index and the second processor parameter index; wherein the third modeling node and the first modeling node participate in the same federated task; the second broadcasting module is used to broadcast coordination notification information to the first modeling node when it is determined that the first modeling node belongs to the coordination point.

[0604] The third broadcast module is used to broadcast non-coordination notification information to the third modeling node when it is determined that the third modeling node belongs to the non-coordination point.

[0605] Optionally, the federated learning-based model training apparatus further includes:

[0606] The eighth receiving module is used to receive the first unilateral model uploaded by the first modeling node and the second unilateral model uploaded by the fourth modeling node, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task.

[0607] The fifth determining module is used to determine the target unilateral model based on the first unilateral model and the second unilateral model.

[0608] Optionally, in the federated learning-based model training apparatus, the fifth determining module is specifically used for:

[0609] Broadcast the second one-sided model to the first modeling node, and broadcast the first one-sided model to the fourth modeling node;

[0610] Receive the first one-sided information obtained by the first modeling node based on the second one-sided model uploaded by the first modeling node, and the second one-sided information obtained by the fourth modeling node based on the first one-sided model uploaded by the fourth modeling node;

[0611] The target unilateral model is determined based on the first unilateral information and the second unilateral information.

[0612] Optionally, the federated learning-based model training apparatus further includes:

[0613] The ninth receiving module is used to receive the state vector of each modeling node in each round of federated task iteration uploaded by each modeling node in the group to which the first modeling node belongs;

[0614] The third acquisition module is used to obtain the average model accuracy of the group to which the first modeling node belongs in each round of federated task iteration based on the state vector of each modeling node.

[0615] The fourth broadcast module is used to use the average model accuracy as an accuracy threshold and broadcast it to the first modeling node.

[0616] Optionally, in the federated learning-based model training apparatus, the second determining module 902 includes:

[0617] The second determining submodule is used to determine, based on the first federated model, a first group of federated models to which the first modeling node belongs, and based on the second federated model, a second group of federated models to which the second modeling node belongs.

[0618] The first broadcast submodule is used to broadcast the second set of federated models to the first modeling node, and to broadcast the first set of federated models to the second modeling node;

[0619] The first receiving submodule is used to receive the first federated information obtained by the first modeling node based on the second set of federated models uploaded by the first modeling node, and to receive the second federated information obtained by the second modeling node based on the first set of federated models uploaded by the second modeling node.

[0620] The third determining submodule is used to determine the target group federated model based on the first federated information and the second federated information.

[0621] Optionally, in the federated learning-based model training apparatus, the second determining submodule includes:

[0622] The statistics unit is used to count the number of violations for each modeling node within the group to which the first modeling node belongs;

[0623] The selection unit is used to select the modeling node with the highest number of violations within the group to which the first modeling node belongs as the violating modeling node.

[0624] The determining unit is configured to determine the first set of federated models based on the first accuracy vector and the second accuracy vector of the violation modeling node.

[0625] The first accuracy vector is determined based on the model accuracy corresponding to the preset number of federated task iteration rounds, and the second accuracy vector is determined based on the model accuracy corresponding to the preset number of unilateral model iteration rounds.

[0626] Optionally, in the federated learning-based model training apparatus, the statistical unit is specifically used for:

[0627] The violation count of the first modeling node increases by one for each of the following conditions:

[0628] Within the first preset time period, no first one-sided model uploaded by the first modeling node was received;

[0629] Within the second preset time period, no first unilateral information uploaded by the first modeling node was received;

[0630] Within the third preset time period, the state vector obtained in each round of federated task iteration uploaded by the first modeling node is not received;

[0631] Within a fourth preset time period, it is obtained that the local model gradient of the first modeling node has not been transmitted to the second adjacent node, and the second adjacent node belongs to the same group as the first modeling node.

[0632] Optionally, in the federated learning-based model training apparatus, the determining unit includes:

[0633] The comparison subunit is used to compare the elements at corresponding positions in the first accuracy vector and the second accuracy vector to obtain a first comparison result;

[0634] A sub-unit is defined for determining the first set of federated models based on the first comparison result.

[0635] Optionally, in the federated learning-based model training apparatus, the determining subunit is specifically used for:

[0636] When the first comparison result is less than a preset value, and the element at the first preset position in the first accuracy vector is less than the element at the first preset position in the second accuracy vector, the first group of federated models is determined based on the federated models of each modeling node in the group to which the first modeling node belongs, excluding the first modeling node.

[0637] Optionally, in the federated learning-based model training apparatus, the third determining submodule is specifically used for:

[0638] The first federated information and the second federated information are compared with the accuracy of the target unilateral model to obtain a second comparison result;

[0639] Based on the second comparison result, the target group federation model is determined.

[0640] It should be noted that the apparatus provided in the embodiments of the present invention can implement all the method steps implemented in the above embodiments of the model training method based on federated learning applied to blockchain, and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiments and the beneficial effects will not be described in detail.

[0641] This invention also provides an electronic device, such as... Figure 10 As shown, there is a processor 1001; and a memory 1003 connected to the processor 1001 via a bus interface 1002. The memory 1003 is used to store the programs and data used by the processor 1001 when performing operations. The processor 1001 calls and executes the programs and data stored in the memory 1003.

[0642] The transceiver 1004 is connected to the bus interface 1002 and is used to receive and send data under the control of the processor 1001.

[0643] Among them, Figure 10In this context, the bus architecture may include any number of interconnected buses and bridges, specifically linking various circuits together, represented by one or more processors (processor 1001) and memory (memory 1003). The bus architecture may also link together various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides an interface. The transceiver 1004 may be multiple elements, including transmitters and receivers, providing a unit for communicating with various other devices over a transmission medium. The processor 1001 is responsible for managing the bus architecture and general processing, and the memory 1003 may store data used by the processor 1001 during operation.

[0644] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing the relevant hardware to implement them. The program includes instructions to perform some or all of the steps of the above methods; and the program can be stored in a readable storage medium, which can be any form of storage medium.

[0645] This invention also provides a server, such as... Figure 11 As shown, there is a processor 1101; and a memory 1103 connected to the processor 1101 via a bus interface 1102. The memory 1103 is used to store the programs and data used by the processor 1101 when performing operations. The processor 1101 calls and executes the programs and data stored in the memory 1103.

[0646] The transceiver 1104 is connected to the bus interface 1102 and is used to receive and send data under the control of the processor 1101.

[0647] Among them, Figure 11 In this context, the bus architecture may include any number of interconnected buses and bridges, specifically linking various circuits together, represented by one or more processors (processor 1101) and memory (memory 1103). The bus architecture may also link together various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. The bus interface provides an interface. The transceiver 1104 may be multiple elements, including transmitters and receivers, providing a unit for communicating with various other devices over a transmission medium. Processor 1101 is responsible for managing the bus architecture and general processing, and memory 1103 may store data used by processor 1101 during operation.

[0648] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing the relevant hardware to implement them. The program includes instructions to perform some or all of the steps of the above methods; and the program can be stored in a readable storage medium, which can be any form of storage medium.

[0649] This invention also provides a readable storage medium storing a program or instructions thereon, which, when executed by a processor, implement the steps of the federated learning-based model training method as described in any of the preceding embodiments.

[0650] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0651] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can be physically comprised separately, or two or more units can be integrated into one unit. The integrated unit described above can be implemented in hardware or in the form of hardware plus software functional units.

[0652] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions that cause a computer device (which may be a personal computer, server, or network device, etc.) to execute some steps of the transmission and reception methods described in the various embodiments of this 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.

[0653] The above describes the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also within the scope of protection of the present invention.

Claims

1. A model training method based on federated learning, characterized in that, The method, applied to the first modeling node participating in a federated mission, includes: Based on the local model of the first neighboring node, a first federated model is determined, and the first federated model is passed to the second neighboring node and the blockchain. The first neighboring node, the second neighboring node, and the first modeling node belong to the same group, and the first neighboring node is the left modeling node of the first modeling node, and the second neighboring node is the right modeling node of the first modeling node. The target group federation model broadcast by the blockchain is received. The target group federation model is determined by the blockchain based on the first federation model and the second federation model of the second modeling node, wherein the second modeling node belongs to a different group than the first modeling node. Predict the target data based on the target group federated model; The step of determining the first federation model based on the local model of the first neighboring node includes: The first round of federated mission iterations will be conducted according to the following steps: Construct the first local model based on the model weights of the target one-sided model; Upload the first state vector of the first local model to the blockchain, and pass the gradient of the first local model to the second neighboring node; The second round of federated mission iteration will be conducted according to the following steps: Based on the local model gradient obtained by the first neighboring node during the first round of local task iteration, the first local model is updated to obtain the second local model; If the model accuracy of the second local model is greater than or equal to the first accuracy threshold, or if the model accuracy of the second local model is greater than or equal to the model accuracy of the first local model, the second state vector of the second local model is uploaded to the blockchain, and the gradient of the second local model is passed to the second neighboring node, while the second local model is retained. If the model accuracy of the second local model is less than the first accuracy threshold, and the model accuracy of the second local model is less than the model accuracy of the first local model, the first state vector of the first local model is uploaded to the blockchain, and the gradient of the first local model is passed to the second neighboring node, and the second local model is not retained. Repeat the steps of the second round of federated task iteration until the preset number of iterations is reached or the model accuracy reaches the preset accuracy threshold, then determine the first federated model and end the federated task; The first accuracy threshold is determined by the blockchain based on the first state vector.

2. The model training method based on federated learning according to claim 1, characterized in that, Before determining the first federation model based on the local model of the first neighboring node and passing the first federation model to the second neighboring node and the blockchain, the method further includes: Upload the first processor parameter index of the local server to the blockchain; Obtain the distribution information of the first encrypted data; Upon receiving the coordination notification information broadcast by the blockchain, the third modeling node receives the second encrypted data distribution information transmitted by the third modeling node; wherein the third modeling node is in the same federated task as the first modeling node and is a non-coordination point; the coordination notification information is determined by the blockchain based on the first processor parameter index and the second processor parameter index of the second modeling node; Based on the first encrypted data distribution information and the second encrypted data distribution information, determine the subgroup information of the group to which the data belongs.

3. The model training method based on federated learning according to claim 2, characterized in that, The step of obtaining the first encrypted data distribution information includes: Construct a data distribution vector based on the quartiles of each field in the local data; The data distribution vector is encrypted to obtain the first encrypted data distribution information.

4. The model training method based on federated learning according to claim 2, characterized in that, The step of determining the group information based on the first encrypted data distribution information and the second encrypted data distribution information includes: Calculate the Euclidean distance between the first encrypted data distribution information and the second encrypted data distribution information; When the Euclidean distance is less than a preset distance threshold, it is determined that it belongs to the same group as the third modeling node; The group information is determined based on the third modeling node.

5. The model training method based on federated learning according to claim 1, characterized in that, Before determining the first federation model based on the local model of the first neighboring node and passing the first federation model to the second neighboring node and the blockchain, the method further includes: Upload the first unilateral model to the blockchain; The target unilateral model that receives the blockchain broadcast.

6. The model training method based on federated learning according to claim 5, characterized in that, Before uploading the first unilateral model to the blockchain, the method further includes: The first unilateral model is obtained by iterating the unilateral model using local data.

7. The model training method based on federated learning according to claim 5, characterized in that, Before receiving the target unilateral model of the blockchain broadcast, the method further includes: The second unilateral model of the fourth modeling node that receives the blockchain broadcast, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task; Based on the second unilateral model, the first unilateral information is obtained; The first unilateral information is uploaded to the blockchain, and the first unilateral information is used by the blockchain to determine the target unilateral model.

8. The model training method based on federated learning according to claim 1, characterized in that, Prior to receiving the target group federated model of the blockchain broadcast, the method further includes: The second group of federated models to which the second modeling node belongs, receiving the blockchain broadcast; Based on the second set of federation models, the first federation information is obtained; The first federal information is uploaded to the blockchain.

9. The model training method based on federated learning according to claim 1, characterized in that, The step of predicting the target data based on the target group federated model includes: The target data is input into the target group federated model to obtain at least one output result; A voting method is used to select at least one output result to obtain the target prediction result.

10. A model training method based on federated learning, characterized in that, Applied to blockchain, the method includes: The system receives a first federated model uploaded by a first modeling node and a second federated model uploaded by a second modeling node, wherein the first modeling node and the second modeling node belong to different groups; the first federated model is determined by the first modeling node based on the local model of the first neighboring node, and the first federated model is transmitted to the second neighboring node and the blockchain; the first neighboring node, the second neighboring node, and the first modeling node belong to the same group, and the first neighboring node is the left modeling node of the first modeling node, and the second neighboring node is the right modeling node of the first modeling node; Based on the first federation model and the second federation model, determine the target group federation model; The target group federated model is broadcast to the first modeling node and the second modeling node respectively; The first modeling node is used to perform the first round of federated task iteration according to the following steps: Construct the first local model based on the model weights of the target one-sided model; Upload the first state vector of the first local model to the blockchain, and pass the gradient of the first local model to the second neighboring node; The second round of federated mission iteration will be conducted according to the following steps: Based on the local model gradient obtained by the first neighboring node during the first round of local task iteration, the first local model is updated to obtain the second local model; If the model accuracy of the second local model is greater than or equal to the first accuracy threshold, or if the model accuracy of the second local model is greater than or equal to the model accuracy of the first local model, the second state vector of the second local model is uploaded to the blockchain, and the gradient of the second local model is passed to the second neighboring node, while the second local model is retained. If the model accuracy of the second local model is less than the first accuracy threshold, and the model accuracy of the second local model is less than the model accuracy of the first local model, the first state vector of the first local model is uploaded to the blockchain, and the gradient of the first local model is passed to the second neighboring node, and the second local model is not retained. Repeat the steps of the second round of federated task iteration until the preset number of iterations is reached or the model accuracy reaches the preset accuracy threshold, then determine the first federated model and end the federated task; The first accuracy threshold is determined by the blockchain based on the first state vector.

11. The model training method based on federated learning according to claim 10, characterized in that, Before receiving the first federated model uploaded by the first modeling node and the second federated model uploaded by the second modeling node, the method further includes: Receive the first processor parameter index of the local server of the first modeling node uploaded by the first modeling node and the second processor parameter index of the local server of the second modeling node uploaded by the second modeling node. Based on the first processor parameter index and the second processor parameter index, it is determined whether the first modeling node is a coordination point and whether the third modeling node is a non-coordination point; wherein, the third modeling node and the first modeling node participate in the same federated task; When it is determined that the first modeling node belongs to the coordination point, a coordination notification message is broadcast to the first modeling node; When it is determined that the third modeling node belongs to the non-coordinated point, a non-coordinated notification message is broadcast to the third modeling node.

12. The model training method based on federated learning according to claim 10, characterized in that, Before receiving the first federated model uploaded by the first modeling node and the second federated model uploaded by the second modeling node, the method further includes: Receive the first unilateral model uploaded by the first modeling node and the second unilateral model uploaded by the fourth modeling node, wherein the fourth modeling node is a modeling node other than the first modeling node participating in the federated task; Based on the first unilateral model and the second unilateral model, the target unilateral model is determined.

13. The model training method based on federated learning according to claim 12, characterized in that, The step of determining the target unilateral model based on the first unilateral model and the second unilateral model includes: Broadcast the second one-sided model to the first modeling node, and broadcast the first one-sided model to the fourth modeling node; Receive the first one-sided information obtained by the first modeling node based on the second one-sided model uploaded by the first modeling node, and the second one-sided information obtained by the fourth modeling node based on the first one-sided model uploaded by the fourth modeling node; The target unilateral model is determined based on the first unilateral information and the second unilateral information.

14. The model training method based on federated learning according to claim 10, characterized in that, Before receiving the first federated model uploaded by the first modeling node, the method further includes: Receive the state vector of each modeling node in each round of federated task iteration, uploaded by each modeling node in the group to which the first modeling node belongs; Based on the state vector of each modeling node, the average model accuracy of the group to which the first modeling node belongs is obtained in each round of federated task iteration; The average model accuracy is used as the accuracy threshold and broadcast to the first modeling node.

15. The model training method based on federated learning according to claim 10, characterized in that, The step of determining the target group federation model based on the first federation model and the second federation model includes: Based on the first federated model, a first group of federated models is determined to belong to the group to which the first modeling node belongs, and based on the second federated model, a second group of federated models is determined to belong to the group to which the second modeling node belongs. Broadcast the second set of federated models to the first modeling node, and broadcast the first set of federated models to the second modeling node; Receive the first federated information obtained by the first modeling node based on the second set of federated models uploaded by the first modeling node, and receive the second federated information obtained by the second modeling node based on the first set of federated models uploaded by the second modeling node; The target group federated model is determined based on the first federated information and the second federated information.

16. The model training method based on federated learning according to claim 15, characterized in that, The step of determining the first group of federated models to which the first modeling node belongs based on the first federated model includes: Count the number of violations for each modeling node within the group to which the first modeling node belongs; The modeling node with the highest number of violations within the group to which the first modeling node belongs is selected as the violating modeling node. The first set of federated models is determined based on the first accuracy vector and the second accuracy vector of the violation modeling node; The first accuracy vector is determined based on the model accuracy corresponding to the preset number of federated task iteration rounds, and the second accuracy vector is determined based on the model accuracy corresponding to the preset number of unilateral model iteration rounds.

17. The model training method based on federated learning according to claim 16, characterized in that, The counting of violations for each modeling node within the group to which the first modeling node belongs includes: The violation count of the first modeling node increases by one for each of the following conditions: Within the first preset time period, no first one-sided model uploaded by the first modeling node was received; Within the second preset time period, no first unilateral information uploaded by the first modeling node was received; Within the third preset time period, the state vector obtained in each round of federated task iteration uploaded by the first modeling node is not received; Within a fourth preset time period, it is obtained that the local model gradient of the first modeling node has not been transmitted to the second adjacent node, and the second adjacent node belongs to the same group as the first modeling node.

18. The model training method based on federated learning according to claim 16, characterized in that, The step of determining the first set of federated models based on the first accuracy vector and the second accuracy vector of the non-compliant modeling nodes includes: Compare the elements at corresponding positions in the first accuracy vector and the second accuracy vector to obtain the first comparison result; Based on the first comparison result, the first set of federated models is determined.

19. The model training method based on federated learning according to claim 18, characterized in that, Determining the first set of federated models based on the first comparison result includes: When the first comparison result is less than a preset value, and the element at the first preset position in the first accuracy vector is less than the element at the first preset position in the second accuracy vector, the first group of federated models is determined based on the federated models of each modeling node in the group to which the first modeling node belongs, excluding the first modeling node.

20. The model training method based on federated learning according to claim 15, characterized in that, Determining the target group federated model based on the first federated information and the second federated information includes: The first federated information and the second federated information are compared with the accuracy of the target unilateral model to obtain a second comparison result; Based on the second comparison result, the target group federation model is determined.

21. An electronic device, comprising a processor and a transceiver, characterized in that: The processor is used to determine a first federated model based on the local model of the first neighboring node, and to transmit the first federated model to the second neighboring node and the blockchain. The first neighboring node, the second neighboring node and the first modeling node belong to the same group, and the first neighboring node is the left modeling node of the first modeling node, and the second neighboring node is the right modeling node of the first modeling node. The transceiver is used to receive the target group federation model broadcast by the blockchain. The target group federation model is determined by the blockchain based on the first federation model and the second federation model of the second modeling node, wherein the second modeling node belongs to a different group than the first modeling node. The processor is further configured to predict target data based on the target group federated model; Specifically, the processor is used to perform the first round of federated task iteration according to the following steps: Construct the first local model based on the model weights of the target one-sided model; Upload the first state vector of the first local model to the blockchain, and pass the gradient of the first local model to the second neighboring node; The second round of federated mission iteration will be conducted according to the following steps: Based on the local model gradient obtained by the first neighboring node during the first round of local task iteration, the first local model is updated to obtain the second local model; If the model accuracy of the second local model is greater than or equal to the first accuracy threshold, or if the model accuracy of the second local model is greater than or equal to the model accuracy of the first local model, the second state vector of the second local model is uploaded to the blockchain, and the gradient of the second local model is passed to the second neighboring node, while the second local model is retained. If the model accuracy of the second local model is less than the first accuracy threshold, and the model accuracy of the second local model is less than the model accuracy of the first local model, the first state vector of the first local model is uploaded to the blockchain, and the gradient of the first local model is passed to the second neighboring node, and the second local model is not retained. Repeat the steps of the second round of federated task iteration until the preset number of iterations is reached or the model accuracy reaches the preset accuracy threshold, then determine the first federated model and end the federated task; The first accuracy threshold is determined by the blockchain based on the first state vector.

22. A server, comprising a processor and a transceiver, characterized in that: The transceiver is used to receive a first federated model uploaded by a first modeling node and a second federated model uploaded by a second modeling node, wherein the first modeling node and the second modeling node belong to different groups. The first federated model is determined by the first modeling node based on the local model of the first neighboring node, and the first federated model is passed to the second neighboring node and the blockchain; The first adjacent node, the second adjacent node, and the first modeling node belong to the same group, and the first adjacent node is the left modeling node of the first modeling node, and the second adjacent node is the right modeling node of the first modeling node. The processor is used to determine a target group federation model based on the first federation model and the second federation model; The transceiver is also used to broadcast the target group federated model to the first modeling node and the second modeling node respectively; The first modeling node is used to perform the first round of federated task iteration according to the following steps: Construct the first local model based on the model weights of the target one-sided model; Upload the first state vector of the first local model to the blockchain, and pass the gradient of the first local model to the second neighboring node; The second round of federated mission iteration will be conducted according to the following steps: Based on the local model gradient obtained by the first neighboring node during the first round of local task iteration, the first local model is updated to obtain the second local model; If the model accuracy of the second local model is greater than or equal to the first accuracy threshold, or if the model accuracy of the second local model is greater than or equal to the model accuracy of the first local model, the second state vector of the second local model is uploaded to the blockchain, and the gradient of the second local model is passed to the second neighboring node, while the second local model is retained. If the model accuracy of the second local model is less than the first accuracy threshold, and the model accuracy of the second local model is less than the model accuracy of the first local model, the first state vector of the first local model is uploaded to the blockchain, and the gradient of the first local model is passed to the second neighboring node, and the second local model is not retained. Repeat the steps of the second round of federated task iteration until the preset number of iterations is reached or the model accuracy reaches the preset accuracy threshold, then determine the first federated model and end the federated task; The first accuracy threshold is determined by the blockchain based on the first state vector.

23. A model training device based on federated learning, characterized in that, include: The first determining module is used to determine the first federated model based on the local model of the first adjacent node, and to pass the first federated model to the second adjacent node and the blockchain. The first adjacent node, the second adjacent node and the first modeling node belong to the same group, and the first adjacent node is the left modeling node of the first modeling node, and the second adjacent node is the right modeling node of the first modeling node. The first receiving module is used to receive the target group federation model broadcast by the blockchain. The target group federation model is determined by the blockchain based on the first federation model and the second federation model of the second modeling node. The second modeling node belongs to a different group than the first modeling node. The first prediction module is used to predict the target data based on the target group federated model; The first determining module includes a first determining submodule, specifically used for: The first round of federated mission iterations will be conducted according to the following steps: Construct the first local model based on the model weights of the target one-sided model; Upload the first state vector of the first local model to the blockchain, and pass the gradient of the first local model to the second neighboring node; The second round of federated mission iteration will be conducted according to the following steps: Based on the local model gradient obtained by the first neighboring node during the first round of local task iteration, the first local model is updated to obtain the second local model; If the model accuracy of the second local model is greater than or equal to the first accuracy threshold, or if the model accuracy of the second local model is greater than or equal to the model accuracy of the first local model, the second state vector of the second local model is uploaded to the blockchain, and the gradient of the second local model is passed to the second neighboring node, while the second local model is retained. If the model accuracy of the second local model is less than the first accuracy threshold, and the model accuracy of the second local model is less than the model accuracy of the first local model, the first state vector of the first local model is uploaded to the blockchain, and the gradient of the first local model is passed to the second neighboring node, and the second local model is not retained. Repeat the steps of the second round of federated task iteration until the preset number of iterations is reached or the model accuracy reaches the preset accuracy threshold, then determine the first federated model and end the federated task; The first accuracy threshold is determined by the blockchain based on the first state vector.

24. A model training device based on federated learning, characterized in that, include: The second receiving module is used to receive the first federated model uploaded by the first modeling node and the second federated model uploaded by the second modeling node, wherein the first modeling node and the second modeling node belong to different groups; The first federated model is determined by the first modeling node based on the local model of the first neighboring node, and the first federated model is passed to the second neighboring node and the blockchain; The first adjacent node, the second adjacent node, and the first modeling node belong to the same group, and the first adjacent node is the left modeling node of the first modeling node, and the second adjacent node is the right modeling node of the first modeling node. The second determining module is used to determine the target group federation model based on the first federation model and the second federation model; The first broadcast module is used to broadcast the target group federated model to the first modeling node and the second modeling node respectively; The first modeling node is used to perform the first round of federated task iteration according to the following steps: Construct the first local model based on the model weights of the target one-sided model; Upload the first state vector of the first local model to the blockchain, and pass the gradient of the first local model to the second neighboring node; The second round of federated mission iteration will be conducted according to the following steps: Based on the local model gradient obtained by the first neighboring node during the first round of local task iteration, the first local model is updated to obtain the second local model; If the model accuracy of the second local model is greater than or equal to the first accuracy threshold, or if the model accuracy of the second local model is greater than or equal to the model accuracy of the first local model, the second state vector of the second local model is uploaded to the blockchain, and the gradient of the second local model is passed to the second neighboring node, while the second local model is retained. If the model accuracy of the second local model is less than the first accuracy threshold, and the model accuracy of the second local model is less than the model accuracy of the first local model, the first state vector of the first local model is uploaded to the blockchain, and the gradient of the first local model is passed to the second neighboring node, and the second local model is not retained. Repeat the steps of the second round of federated task iteration until the preset number of iterations is reached or the model accuracy reaches the preset accuracy threshold, then determine the first federated model and end the federated task; The first accuracy threshold is determined by the blockchain based on the first state vector.

25. An electronic device, comprising: A transceiver, a processor, a memory, and a program or instructions stored in the memory and executable on the processor; characterized in that, when the processor executes the program or instructions, it implements the steps of the model training method based on federated learning as described in any one of claims 1 to 9.

26. A server, comprising: A transceiver, a processor, a memory, and a program or instructions stored in the memory and executable on the processor; characterized in that, when the processor executes the program or instructions, it implements the steps of the model training method based on federated learning as described in any one of claims 10 to 20.

27. A readable storage medium having a program or instructions stored thereon, characterized in that, When the program or instructions are executed by the processor, they implement the steps of the federated learning-based model training method as described in any one of claims 1 to 9, or implement the steps of the federated learning-based model training method as described in any one of claims 10 to 20.