A Federated Learning Model Update Method and System

By generating hash values ​​and comparing and verifying transaction blocks in the federated learning system, the problem of client model updates being tampered with is solved, achieving highly reliable data integrity verification and dynamic management, and improving the generalization performance of the global model.

CN123117397APending Publication Date: 2026-11-17DEYANG CITY WISDOM HEART INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611361490.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-03
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In federated learning systems, clients may be vulnerable to external attacks that could lead to tampering with model updates. Existing technologies struggle to accurately identify abnormal updates, impacting global model performance and generalization performance.

Method used

The client generates hash values ​​and packages them into transaction blocks after training locally. The server compares the hash values ​​to verify the integrity of the updated gradient. Combined with distributed ledger records, dynamic management is achieved to prevent tampering and dynamically adjust the client's access control mechanism.

Benefits of technology

It achieves highly reliable data integrity verification, protects client privacy, improves the generalization performance of the global model and the practicality of the system, and avoids the problem of normal clients being permanently removed due to a single misjudgment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123117397A_ABST
    Figure CN123117397A_ABST
Patent Text Reader

Abstract

This invention discloses a federated learning model update method and system, relating to the field of machine learning technology, and solves the problem that a single determination that a client is a malicious node affects the generalization of the global federated learning system. The method includes: a first client completing model training using local data and obtaining the update gradient of the global model; the first client performing a hash calculation on the update gradient to generate a first gradient hash value; the first client packaging the first gradient hash value to generate a transaction block, storing it in a local ledger, and broadcasting the transaction block to a second client and a server; the second client achieving consensus on the transaction block and storing the transaction block in its local ledger; the clients uploading their respective update gradients to the server; the server reading the first gradient hash value from the local ledger, performing a hash calculation on the update gradient to generate a second gradient hash value; and performing an aggregation calculation based on the comparison result of the first gradient hash value and the second gradient hash value.
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 federated learning model update method and system. Background Technology

[0002] Federated Learning (FL) is a distributed machine learning paradigm that allows multiple clients to collaboratively train a global model without sharing the original training data. In a federated learning framework, each client trains its model using local data, uploads updates (such as gradients or model parameters) to the server, and the server aggregates these updates to obtain the updated global model.

[0003] However, in the architecture of federated learning, clients may be vulnerable to external attackers. An attacked client might be tampered with during local training, causing it to submit incorrect model updates to the server, such as toxic gradients. If the server fails to recognize these anomalous model updates and still uses them for aggregation calculations, it will lead to a decline in global model performance and a deviation in the convergence direction.

[0004] To improve the security of federated learning systems, various solutions have been proposed in existing technologies. For example, anomalous updates can be identified by detecting deviations between the model update and the global reference direction; robust aggregation, outlier filtering, dynamic threshold adjustment, adaptive learning rate adjustment, or malicious node isolation can be employed to mitigate the impact of anomalous model updates on the global model.

[0005] However, in real-world federated learning scenarios, the local data held by each client typically exhibits significant distributional differences. Some legitimate clients, due to imbalanced data categories, limited sample sizes, differences in collection environments, or varying device computing capabilities, may experience continuous deviations in their local model update direction. Such deviations are, in most cases, normal manifestations of data heterogeneity and should not be directly equated with malicious behavior. If exclusion is based solely on the directional deviation of a single update, isolated trust indicators, or fixed discrimination thresholds, it is highly likely that legitimate clients with unusual data distributions will be misjudged as malicious nodes. This weakens the federated learning system's ability to model real heterogeneous data distributions, impacting the generalization performance and practicality of the global model. Summary of the Invention

[0006] In view of this, this application provides a federated learning model update method and system. The client completes a model update in the current training round, generates a hash value for the updated model, and packages the hash value to generate a transaction block. Each client can then add a transaction block to its local ledger. The server can also read the hash value from its local ledger and compare it with the content uploaded by the client to determine the client's trustworthiness. The packaging and verification process generates a verification block, which is stored in the local ledger by both the server and each client, forming an immutable record. The server and client jointly maintain this record to achieve hierarchical control and recovery verification of the client. This dynamic management of the client through maintaining a distributed ledger solves the problem of a single judgment defining a client as a malicious node affecting the generalization of the federated learning system.

[0007] This application provides a federated learning model update method, the method comprising:

[0008] After the first client completes model training using local data, it obtains the update gradient of the global model.

[0009] The first client performs a hash calculation on the update gradient to generate the first gradient hash value;

[0010] The first client packages the first gradient hash value, generates a transaction block, stores it in the local ledger, and broadcasts the transaction block to at least one second client and server;

[0011] After the second client reaches a consensus on the transaction block, it stores the transaction block in its local ledger.

[0012] The first and second clients upload their respective update gradients to the server.

[0013] The server reads the first gradient hash value from the local ledger, performs hash calculation on the update gradient, and generates the second gradient hash value.

[0014] Based on the comparison results of the first gradient hash value and the second gradient hash value, an aggregation calculation is performed.

[0015] In one possible implementation, based on the comparison result of the first gradient hash value and the second gradient hash value, an aggregation calculation is performed using the update gradient, including:

[0016] When the first gradient hash value and the second gradient hash value are the same, the updated gradient uploaded by the second client is input into the aggregation calculation model;

[0017] When the first gradient hash value and the second gradient hash value are inconsistent, the server generates a verification block, stores the verification block in the local ledger, and broadcasts the verification block to the at least one second client.

[0018] In one possible implementation, the server generates a verification block and stores the verification block in a local ledger, including:

[0019] The first client's ID, federated learning round identifier, timestamp of the verification event, and verification data are packaged together to generate the verification block;

[0020] When the first gradient hash value and the second gradient hash value are inconsistent, the method further includes:

[0021] Read historical data from the ledger uploaded by the second client, and query the historical verification block corresponding to the first client based on the identifier;

[0022] Read the federated learning round identifier, the timestamp of the verification occurrence, and the verification data from the historical verification block;

[0023] Based on the federated learning round identifier, the timestamp of the recorded verification, and the verification data, determine the setting method for the first client to upload and update the gradient in the current execution of the aggregation calculation.

[0024] In one possible implementation, before the server reads the first gradient hash value from the local ledger, performs hash calculation on the update gradient, and generates the second gradient hash value, the method further includes:

[0025] The server reads blocks within a preset round from the local ledger according to the round identifier through the physical layer;

[0026] If a verification block is detected, extract the client identifier from the verification block;

[0027] The application layer does not write the update gradient uploaded by the same client corresponding to the detected client identifier.

[0028] In one possible implementation, if a verification block is detected, the method further includes:

[0029] The first gradient hash value is read from the target client's most recent transaction block in the local ledger at the application layer; the target client is the client that verifies the block.

[0030] Perform a hash calculation on the updated gradient to generate a second gradient hash value;

[0031] The second gradient hash value is compared with the first gradient hash value. If the first gradient hash value and the second gradient hash value are consistent, an update block is generated and the update block is broadcast to the first client and the second client.

[0032] When the execution server reads blocks within a preset round from the local ledger according to the round identifier at the physical layer in the next round, it also performs the following process:

[0033] If an update block is detected, the application layer writes the detected specific local ledger and the update gradient of the same client corresponding to the specific local ledger.

[0034] A second aspect of this application provides a federated learning model update system, the system comprising:

[0035] The update module, set on the client, is used to obtain the update gradient of the global model after completing model training with local data; the first client performs a hash calculation on the update gradient to generate the first gradient hash value;

[0036] A block generation module, located on the client, is used to package the first gradient hash value, generate transaction blocks, store them in the local ledger, and broadcast the transaction blocks to at least one second client and server;

[0037] The consensus module, located on the client side, is used to store the transaction block to the local ledger after consensus is reached on the transaction block.

[0038] The upload module, set up on the client side, is used to upload the respective update gradients to the server;

[0039] The hash calculation module, located on the server, is used to read the first gradient hash value from the local ledger, perform hash calculation on the updated gradient, and generate the second gradient hash value.

[0040] An aggregation training module, located on the server, is used to perform aggregation calculations based on the comparison results of the first gradient hash value and the second gradient hash value.

[0041] In one possible implementation, the aggregation training module includes:

[0042] The model training submodule is used to input the updated gradient uploaded by the second client into the aggregation calculation model when the first gradient hash value and the second gradient hash value are consistent.

[0043] The block generation submodule is used to generate a verification block when the first gradient hash value and the second gradient hash value are inconsistent, store the verification block in the local ledger, and broadcast the verification block to the at least one second client.

[0044] In one possible implementation, the block generation submodule is specifically used to package the ID identifier of the first client, the federated learning round identifier, the timestamp of the verification occurrence, and the verification data to generate the verification block;

[0045] The aggregated training module also includes:

[0046] The reading submodule is used to read historical data from the ledger uploaded by the second client, query the historical verification block corresponding to the first client based on the identifier, and read the federated learning round identifier, the timestamp of the verification occurrence, and the verification data in the historical verification block.

[0047] The weight setting submodule is used to determine the setting method for the first client to upload and update the gradient in the current execution of the aggregation calculation, based on the federated learning round identifier, the timestamp of the recorded verification, and the verification data.

[0048] In one possible implementation, the system further includes:

[0049] The block reading module is used by the server to read blocks in the local ledger within a preset round according to the round identifier through the physical layer;

[0050] An isolation module is used to extract the client identifier from the verification block if a verification block is detected; the application layer does not write the update gradient uploaded by the same client corresponding to the detected client identifier.

[0051] In one implementation, the system further includes a verification module, which is used to perform a hash calculation on the update gradient and generate a second gradient hash value when a verification block is detected.

[0052] The second gradient hash value is compared with the first gradient hash value. If the first gradient hash value and the second gradient hash value are consistent, an update block is generated and the update block is broadcast to the first client and the second client.

[0053] During the next round of aggregation training, the block reading module is also used to write the detected specific local ledger and the update gradient of the same client corresponding to the specific local ledger if an updated block is detected.

[0054] Compared to existing technologies, this application provides a federated learning model update method and system, with the following advantages: After the client completes local training, it performs hash calculations on the update gradient to generate a first gradient hash value, packages this hash value into a transaction block, stores it in the local ledger, and broadcasts it to other clients. Upon receiving the update gradient, the server recalculates the second gradient hash value using the same hash algorithm. By comparing the first and second gradient hash values, it can accurately determine whether the update gradient uploaded by the client has been tampered with during transmission. Because hash functions are unidirectional and collision-resistant, any data modification will result in a completely different hash value. Therefore, this application can achieve highly reliable data integrity verification with extremely low computational overhead. Furthermore, the hash value stored in the ledger cannot be used to deduce the original gradient data, thus fully protecting the client's local data privacy while implementing the verification function. Attached Figure Description

[0055] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0056] Figure 1 This is a structural diagram of the federated learning model update system;

[0057] Figure 2 This is a flowchart illustrating the steps of the federated learning model update method proposed in this application.

[0058] Figure 3 This is a functional block diagram of the federated learning model update system proposed in the embodiments of this application. Detailed Implementation

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

[0060] In this application, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.

[0061] To better understand this application, the technical names involved in this application are explained below:

[0062] Federated learning is a distributed machine learning paradigm. Its basic process is as follows: The server initializes a global model and distributes it to multiple participating clients. Each client independently trains its model using local data and then uploads the model update (i.e., the gradient changes in the model weights) to the server, while the original data remains locally on the client. The server receives the model updates from each client and uses aggregation algorithms such as FedAvg, FedProx, SCAFFOLD, and FedNova to perform a weighted average to generate an updated global model, which is then distributed to each client for the next round of training. This process iterates until the model converges. This framework effectively utilizes distributed data resources to solve the "data silo" problem while ensuring data privacy and security, and it can adapt to real-world scenarios where client data is heterogeneously distributed.

[0063] Example 1

[0064] The federated learning model update method proposed in this application is applied to a federated learning model update system. Figure 1 This is a structure diagram of a federated learning model update system, such as... Figure 1As shown, the federated learning model update system includes a server 101 and multiple clients 102. The server includes a physical layer and a protocol layer. The multiple clients 102 communicate with each other, and each client 102 communicates with the server 101. Clients 102, acting as computing nodes, receive the global model, perform local training, and upload the model's update gradients. These computing node clients also package the hash values ​​of the update gradients into transaction blocks and broadcast them to other nodes in the federated learning model update system, including clients 102 and server 101. Clients and servers add these blocks to their local graph ledgers, forming immutable records that provide a foundation for client verification and access control. The graph ledger uses a directed acyclic graph (DAG) structure, allowing nodes to have multiple referencing edges simultaneously, and supporting multiple nodes concurrently adding blocks to the ledger.

[0065] The physical layer of the server is used to receive data packets uploaded by the client, the protocol layer is used to parse the data packets and perform model aggregation calculations, and to perform the process of maintaining the graphical ledger proposed in the embodiments of this application.

[0066] Figure 2 This is a flowchart illustrating the steps of the federated learning model update method proposed in this application. Figure 1 As shown, the steps include:

[0067] S110: After the first client completes model training using local data, it obtains the updated gradient of the global model.

[0068] In the first round of training, the global model is the original model distributed by the server. In the i-th round of training, where i is an integer greater than 1, the global model is distributed to the client by the server after completing the (i-1)-th round of aggregation.

[0069] The first client is any client 102, and the second client is any client other than the first client.

[0070] In one example, taking client a as an example, in the i-th round of training, client a receives the current global model sent by the server. Client A uses the locally stored training dataset. Local model training is performed using the stochastic gradient descent algorithm, with multiple iterations on a local dataset to obtain the local model parameters. Client A calculates the local model update gradient. .

[0071] S120: The first client performs a hash calculation on the update gradient to generate the first gradient hash value.

[0072] Continuing with the example above, client a updates the gradient of the local model. Perform hash calculations to generate gradient hash values. .

[0073] =Hash Hash calculations use SHA-256, SHA-3, SM3, or other cryptographically secure hash algorithms.

[0074] S130: The first client packages the first gradient hash value, generates a transaction block, stores it in the local ledger, and broadcasts the transaction block to at least one second client and server.

[0075] Continuing with the example above, client a will use the gradient hash value. Packaged into transaction data, generating transaction blocks .

[0076] Transaction Block The block consists of a block header and a block body. The block header contains the hash of the previous block in the transaction chain and a timestamp. The block body includes the identifier of client 'a' and the current training round. gradient hash value The digital signature of client 'a', and the block type. Block types include transaction blocks, verification blocks, and update blocks.

[0077] S140: After the second client reaches a consensus on the transaction block, it stores the transaction block in its local ledger.

[0078] After each second client and server receives a transaction block and reaches a consensus on the transaction block, it adds the transaction block to its local graph ledger. The first client, second client, and server all have the same graph ledger stored locally, and no node can tamper with the block content stored in the graph ledger. The content generated by the first client is immutable.

[0079] S150: The first client and the second client upload their respective update gradients to the server.

[0080] S160: The server reads the first gradient hash value from the local ledger, performs hash calculation on the update gradient, and generates the second gradient hash value.

[0081] Due to the one-way nature of hash functions, gradient data can be used to calculate hash values, but known hash values ​​cannot be used to deduce gradient data. The first gradient hash value stored in the local ledgers of each client and server is the hash value generated after the client's training. After training but before uploading, the client may be tampered with by attackers, for example, by injecting malicious noise or modifying specific parameters. The updated gradient uploaded to the server will be problematic. The server will recalculate the second gradient hash value based on the updated gradient using the same hash function. This second gradient hash value will be completely different from the first gradient hash value stored in the ledger. Thus, the server can accurately identify the difference by comparing the hash values.

[0082] S170: Perform aggregation calculation based on the comparison result of the first gradient hash value and the second gradient hash value.

[0083] Before storing and using the updated gradients uploaded by each client to perform aggregation operations, the server can verify the updated gradients uploaded by each client based on the information in the locally stored graph ledger. Only the updated gradients uploaded by clients that have passed the verification will be written, thus ensuring the security of the updated gradients used in the aggregation calculation.

[0084] One embodiment describes the server's verification process. Specifically, the physical layer reads blocks in the graph ledger according to round identifiers. If a verification block exists in the most recent N blocks, the client identifier in the verification block is extracted. It is determined that the client corresponding to the client identifier has failed verification, and the application layer does not write the update gradient uploaded by that client.

[0085] The verification block is generated by the server after executing S160 and S170 based on the execution results. The verification block can be used to identify whether the corresponding client has passed the verification.

[0086] In one example, assuming the current training round is i, the server performs the following steps before executing S160:

[0087] M1051: The server reads blocks in the local ledger within a preset round according to the round identifier through the physical layer.

[0088] The preset rounds can be calibrated through experimentation. Assuming a preset round Q, the server reads blocks with round identifiers i-1 to iQ-1, detects the block type, and if a verification block is detected, extracts the client identifier from that verification block. It is determined that the client corresponding to the client identifier is a client that failed verification in the previous round, therefore, the update gradient uploaded by that client is not used in this round of training.

[0089] M1052: If a verification block is detected, extract the client identifier from the verification block.

[0090] M1053: The server does not write the update gradient uploaded by the same client corresponding to the detected client identifier through the application layer.

[0091] Before writing the update gradients uploaded by each client locally on the server, this application embodiment reads the data from the local graph ledger to detect whether a verification block has been generated in the most recent round. The verification block can represent the server's historical verification results for a specific client. Therefore, in this round, based on the historical verification results for client data, it is determined whether to accept the update gradient uploaded by the client, thus ensuring the security of the written update gradients.

[0092] This application embodiment provides a specific process for executing S170, which includes the following sub-steps:

[0093] S1701: When the first gradient hash value and the second gradient hash value are consistent, input the updated gradient uploaded by the second client into the aggregation calculation model;

[0094] S1702: When the first gradient hash value and the second gradient hash value are inconsistent, the server generates a verification block, stores the verification block in the local ledger, and broadcasts the verification block to the at least one second client.

[0095] The verification block is generated by the server when it detects a problematic client and updates the gradient uploaded by that client. The verification block includes: client ID, timestamp, training round number, hash value, and other related data.

[0096] The process of the server generating and storing the verification block includes:

[0097] The first client's ID, federated learning round identifier, timestamp of the verification event, and verification data are packaged together to generate the verification block.

[0098] In another embodiment of this application, when client a is detected to have inconsistent first gradient hash value and second gradient hash value, the following steps can be taken to adjust the setting method of the corresponding client a and determine the weight coefficient of reducing the uploaded update gradient of client a in the current execution of aggregation calculation.

[0099] When the first gradient hash value and the second gradient hash value are inconsistent, the following steps can also be performed:

[0100] S1703: Read the historical data in the ledger uploaded by the second client, and query the historical verification block corresponding to the first client according to the identifier.

[0101] S1704: Read the federated learning round identifier, the timestamp of the verification occurrence, and the verification data from the historical verification block.

[0102] S1705: Based on the federated learning round identifier and the timestamp of the recorded verification, determine the setting method for the first client to upload and update the gradient in the current execution of the aggregation calculation.

[0103] This application provides an example of the specific process of executing S1705: if at least one historical verification block is found; if the time interval between the occurrence of the historical verification block and the current time is less than a time threshold, and the historical verification block has been queried a preset number of times, the weight of this round is set to 0; if the time interval between the occurrence of the historical verification block and the current time is less than a time threshold, or the historical verification block has been queried a preset number of times, the weight of this round is reduced.

[0104] In one example embodiment of this application, after executing M1051-M1053 to detect the verification block in the i-th round of training, the following steps can be performed: The target client that generated the verification block can be queried for the hash value updated in the current round of training. By comparing the target client's training data for the i-th round with the verification data, it can be determined whether the target client is at risk of being attacked or tampered with. If there is no risk of being attacked or tampered with in the i-th round, an update block can be generated. In the (i+1)-th round, the server detects the update block and allows the update gradient uploaded by the target client to be written. In this embodiment, for clients corresponding to update gradients written to the application layer, a verification block is generated when the first and second gradient hash values ​​are inconsistent. For clients corresponding to update gradients not written to the application layer, an update block is generated when the first and second gradient hash values ​​are consistent. The verification block and update block are used to adjust the dynamic admission flag for the client, dynamically adjusting the client's admission mechanism. This solves the problem of permanently judging malicious clients based on a single judgment result, which weakens the federated learning system's ability to model real heterogeneous data distributions and affects the generalization performance and practicality of the global model.

[0105] If execution M1052 detects the existence of a verification block, the following steps can also be performed:

[0106] K11: Reads the first gradient hash value from the target client's most recent transaction block in the local ledger through the application layer; the target client is the client that verifies the block.

[0107] K12: Perform hash calculation on the update gradient to generate the second gradient hash value;

[0108] K13: Compare the second gradient hash value with the first gradient hash value. If the first gradient hash value and the second gradient hash value are consistent, generate an update block and broadcast the update block to the first client and the second client.

[0109] K14: In the next round, when the execution server reads the most recent preset number of blocks from the local ledger uploaded by the first client and the local ledger uploaded by the second client according to the round identifier through the physical layer, it also performs the following process:

[0110] K15: If an update block is detected, the application layer writes the detected specific local ledger and the update gradient of the same client corresponding to the specific local ledger.

[0111] In this embodiment, when an inconsistency is detected between the update gradient uploaded by the client and the hash value, the server generates a verification block and broadcasts it to all nodes in the network, forming an immutable abnormal record. When the client's update gradient is consistent in subsequent rounds, an update block is generated and broadcast, restoring the client's normal access privileges. Through the synergistic effect of the verification block and the update block, this application achieves dynamic access control and hierarchical management of clients. Unlike existing technologies that permanently identify clients as malicious nodes based on single-round update deviations or fixed thresholds, this application allows clients marked as abnormal to regain their eligibility to participate in subsequent rounds after verification. This effectively solves the problem of permanently removing normal clients with strong data heterogeneity due to a single misjudgment, improving the federated learning system's ability to model real heterogeneous data distributions and the generalization performance of the global model.

[0112] Example 2

[0113] Based on the federated learning model update method provided in Embodiment 1 of this application, correspondingly, Embodiment 2 of this application also provides a federated learning model update system. Figure 3 This is a functional block diagram of the federated learning model update system proposed in the embodiments of this application, such as... Figure 3 As shown, the system includes:

[0114] Update module 31, set on the client, is used to obtain the update gradient of the global model after completing model training using local data; the first client performs hash calculation on the update gradient to generate the first gradient hash value;

[0115] The block generation module 32, set on the client, is used to package the first gradient hash value, generate transaction blocks, store them in the local ledger, and broadcast the transaction blocks to at least one second client and server;

[0116] Consensus module 33, located on the client, is used to store the transaction block to the local ledger after consensus is reached on the transaction block;

[0117] Upload module 34, set on the client, is used to upload the respective update gradients to the server;

[0118] The hash calculation module 35, located on the server, is used to read the first gradient hash value from the local ledger, perform hash calculation on the update gradient, and generate the second gradient hash value.

[0119] The aggregation training module 36, located on the server, is used to perform aggregation calculations based on the comparison results of the first gradient hash value and the second gradient hash value.

[0120] In one possible implementation, the aggregation training module includes:

[0121] The model training submodule is used to input the updated gradient uploaded by the second client into the aggregation calculation model when the first gradient hash value and the second gradient hash value are consistent.

[0122] The block generation submodule is used to generate a verification block when the first gradient hash value and the second gradient hash value are inconsistent, store the verification block in the local ledger, and broadcast the verification block to the at least one second client.

[0123] In one possible implementation, the block generation submodule is specifically used to package the ID identifier of the first client, the federated learning round identifier, the timestamp of the verification occurrence, and the verification data to generate the verification block;

[0124] The aggregated training module also includes:

[0125] The reading submodule is used to read historical data from the ledger uploaded by the second client, query the historical verification block corresponding to the first client based on the identifier, and read the federated learning round identifier, the timestamp of the verification occurrence, and the verification data in the historical verification block.

[0126] The weight setting submodule is used to determine the setting method for the first client to upload and update the gradient in the current execution of the aggregation calculation, based on the federated learning round identifier, the timestamp of the recorded verification, and the verification data.

[0127] In one possible implementation, the system further includes:

[0128] The block reading module is used by the server to read blocks in the local ledger within a preset round according to the round identifier through the physical layer;

[0129] An isolation module is used to extract the client identifier from the verification block if a verification block is detected; the application layer does not write the update gradient uploaded by the same client corresponding to the detected client identifier.

[0130] In one implementation, the system further includes a verification module, which is used to perform a hash calculation on the update gradient and generate a second gradient hash value when a verification block is detected.

[0131] The second gradient hash value is compared with the first gradient hash value. If the first gradient hash value and the second gradient hash value are consistent, an update block is generated and the update block is broadcast to the first client and the second client.

[0132] During the next round of aggregation training, the block reading module is also used to write the detected specific local ledger and the update gradient of the same client corresponding to the specific local ledger if an updated block is detected.

[0133] The specific principles and execution processes of each unit in the federated learning model update system disclosed in Embodiment 2 of this application can be found in the corresponding parts of the federated learning model update method disclosed in Embodiment 1 of this application, and will not be repeated here.

[0134] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computing software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0135] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.

[0136] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A federated learning model updating method, characterized in that, The method includes: After the first client completes model training using local data, it obtains the update gradient of the global model. The first client performs a hash calculation on the update gradient to generate the first gradient hash value; The first client packages the first gradient hash value, generates a transaction block, stores it in the local ledger, and broadcasts the transaction block to at least one second client and server; After the second client reaches a consensus on the transaction block, it stores the transaction block in its local ledger. The first and second clients upload their respective update gradients to the server. The server reads the first gradient hash value from the local ledger, performs hash calculation on the update gradient, and generates the second gradient hash value. Based on the comparison results of the first gradient hash value and the second gradient hash value, an aggregation calculation is performed.

2. The method of claim 1, wherein, Based on the comparison results of the first gradient hash value and the second gradient hash value, aggregation calculation is performed using the updated gradient, including: When the first gradient hash value and the second gradient hash value are the same, the updated gradient uploaded by the second client is input into the aggregation calculation model; When the first gradient hash value and the second gradient hash value are inconsistent, the server generates a verification block, stores the verification block in the local ledger, and broadcasts the verification block to the at least one second client.

3. The method of claim 2, wherein, The server generates a verification block and stores the verification block in the local ledger, including: The first client's ID, federated learning round identifier, timestamp of the verification event, and verification data are packaged together to generate the verification block; When the first gradient hash value and the second gradient hash value are inconsistent, the method further includes: Read historical data from the ledger uploaded by the second client, and query the historical verification block corresponding to the first client based on the identifier; Read the federated learning round identifier, the timestamp of the verification occurrence, and the verification data from the historical verification block; Based on the federated learning round identifier, the timestamp of the recorded verification, and the verification data, determine the setting method for the first client to upload and update the gradient in the current execution of the aggregation calculation.

4. The method according to claim 3, characterized in that, Before the server reads the first gradient hash value from the local ledger, performs hash calculations on the update gradient, and generates the second gradient hash value, the method further includes: The server reads blocks within a preset round from the local ledger according to the round identifier through the physical layer; If a verification block is detected, extract the client identifier from the verification block; The application layer does not write the update gradient uploaded by the same client corresponding to the detected client identifier.

5. The method according to claim 4, characterized in that, If a verification block is detected, the method further includes: The first gradient hash value is read from the target client's most recent transaction block in the local ledger at the application layer; the target client is the client that verifies the block. Perform a hash calculation on the updated gradient to generate a second gradient hash value; The second gradient hash value is compared with the first gradient hash value. If the first gradient hash value and the second gradient hash value are consistent, an update block is generated and the update block is broadcast to the first client and the second client. When the execution server reads blocks within a preset round from the local ledger according to the round identifier at the physical layer in the next round, it also performs the following process: If an update block is detected, the application layer writes the detected specific local ledger and the update gradient of the same client corresponding to the specific local ledger.

6. A federated learning model update system, characterized in that, The system includes: The update module, set on the client, is used to obtain the update gradient of the global model after completing model training with local data; the first client performs a hash calculation on the update gradient to generate the first gradient hash value; A block generation module, located on the client, is used to package the first gradient hash value, generate transaction blocks, store them in the local ledger, and broadcast the transaction blocks to at least one second client and server; The consensus module, located on the client side, is used to store the transaction block to the local ledger after consensus is reached on the transaction block. The upload module, set up on the client side, is used to upload the respective update gradients to the server; The hash calculation module, located on the server, is used to read the first gradient hash value from the local ledger, perform hash calculation on the updated gradient, and generate the second gradient hash value. An aggregation training module, located on the server, is used to perform aggregation calculations based on the comparison results of the first gradient hash value and the second gradient hash value.

7. The system according to claim 6, characterized in that, The aggregated training module includes: The model training submodule is used to input the updated gradient uploaded by the second client into the aggregation calculation model when the first gradient hash value and the second gradient hash value are consistent. The block generation submodule is used to generate a verification block when the first gradient hash value and the second gradient hash value are inconsistent, store the verification block in the local ledger, and broadcast the verification block to the at least one second client.

8. The system according to claim 7, characterized in that, The block generation submodule is specifically used to package the ID identifier of the first client, the federated learning round identifier, the timestamp of the verification occurrence, and the verification data to generate the verification block; The aggregated training module also includes: The reading submodule is used to read historical data from the ledger uploaded by the second client, query the historical verification block corresponding to the first client based on the identifier, and read the federated learning round identifier, the timestamp of the verification occurrence, and the verification data in the historical verification block. The weight setting submodule is used to determine the setting method for the first client to upload and update the gradient in the current execution of the aggregation calculation, based on the federated learning round identifier, the timestamp of the recorded verification, and the verification data.

9. The system according to claim 8, characterized in that, The system also includes: The block reading module is used by the server to read blocks in a preset round from the local ledger according to the round identifier through the physical layer; An isolation module is used to extract the client identifier from the verification block if a verification block is detected; the application layer does not write the update gradient uploaded by the same client corresponding to the detected client identifier.

10. The system according to claim 9, characterized in that, The system also includes a verification module, which is used to perform a hash calculation on the update gradient and generate a second gradient hash value when a verification block is detected. The second gradient hash value is compared with the first gradient hash value. If the first gradient hash value and the second gradient hash value are consistent, an update block is generated and the update block is broadcast to the first client and the second client. During the next round of aggregation training, the block reading module is also used to write the detected specific local ledger and the update gradient of the same client corresponding to the specific local ledger if an updated block is detected.