Method and system combining blockchain data collection and model training

Through distributed data acquisition and model training methods under blockchain technology, the problems of data monopoly and privacy protection in large language model training are solved, efficient and extensive training data sources and optimization are achieved, and model performance and application potential are improved.

CN119623653BActive Publication Date: 2025-07-22SHENZHEN TENGMENG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510169706.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-17
Publication Date
2025-07-22
Estimated Expiration
2045-02-17

AI Technical Summary

Technical Problem

The training methods of existing large language models have data resource monopoly, data scope limitations and privacy protection challenges, resulting in reduced model accuracy and risk of privacy leakage.

Method used

Using blockchain-based data acquisition and model training methods, the blockchain node units under the hyper ledger architecture are used to collect training data using unlimited peer nodes, filter and integrate input model training units, and the expected and actual results are compared through the feedback unit, and the resource package is encapsulated for verification and optimization.

Benefits of technology

It enriches the training data of large language models, improves training efficiency, breaks the monopoly of centralized training mode, improves model performance and ensures data privacy, and expands the scope of application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119623653B_ABST
    Figure CN119623653B_ABST
Patent Text Reader

Abstract

An embodiment of the present disclosure provides a method combining blockchain data collection and model training. Upon receiving a training start instruction, send the start instruction to a terminal node and send an expected result to a feedback unit; the terminal node forwards the instruction to relevant peer nodes according to preset global parameters; the peer nodes generate training data using pre-stored resources and weights and transmit it to a data processing unit; after the data processing unit screens and integrates the training data, it inputs the data into a model training unit; the model training unit calculates the actual result and feeds it back to the feedback unit, and the feedback unit calculates the difference based on the expected and actual results, encapsulates the difference, weights, and peer node identifiers into a resource package and sends it to the terminal node; the terminal node forwards the resource package to the smart contract of the blockchain; the peer nodes run contract verification, and if it passes, it is sent to an ordering node; the ordering node generates a block for each peer node, and after the peer nodes verify it, if it is valid, it is added to the local blockchain, and if it is invalid, the weights are updated to optimize subsequent training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the fields of artificial intelligence and blockchain technology and related technology fields. Specifically, it relates to a method and system applicable to a combination of blockchain data collection and model training. Background Art

[0002] With the booming development of artificial intelligence technology, large language models have demonstrated extraordinary capabilities and are widely applied in multiple scenarios such as intelligent customer service, text creation, and knowledge Q&A. However, there are many drawbacks in the training methods of existing large language models.

[0003] Currently, a centralized data collection and training mode is adopted for large language models. Usually, in the data collection link, a large amount of data is collected in a centralized manner, and then these data are input into the large language model training model and parameters. This mode brings a series of serious problems: on the one hand, the data resources for training large language models are monopolized; on the other hand, due to the limitations of data sources and data scopes, the data used for training is extremely limited, thus greatly reducing the accuracy of large language models. Moreover, data privacy protection also faces challenges in the centralized mode. User data is stored centrally, and once a security vulnerability occurs, it will trigger a large-scale privacy leakage risk.

[0004] Therefore, there is an urgent need for a method and system that combines blockchain data collection and model training to break the existing dilemma and promote the sustainable development of large language model technology. Summary of the Invention

[0005] Embodiments described herein provide a method and system for combining blockchain data collection and model training to solve the problems existing in the prior art.

[0006] According to the first aspect of the present disclosure, there is provided a method for combining blockchain data collection and model training, which is applied to a system for combining blockchain data collection and model training. The system includes: a control unit, a blockchain node unit, a data processing unit, a model training unit, and a feedback unit. The blockchain node unit includes terminal nodes, peer nodes, and sorting nodes. The method includes the following steps:

[0007] Receive a training start instruction, send the training start instruction to the terminal nodes of the blockchain node unit, and send the expected result of this training to the feedback unit;

[0008] The terminal node transmits the training start instruction to the peer nodes of the blockchain node unit related thereto according to preset global parameters. The peer nodes obtain pre-stored training resources and preset weights, generate training data adapted to the training requirements, and transmit the training data to the data processing unit;

[0009] The data processing unit screens and integrates the training data, and conveys the screened training data to the model training unit for calculation. The model training unit outputs the actual result and feeds it back to the feedback unit;

[0010] The feedback unit calculates the deviation value based on the received expected result and actual result, encapsulates the deviation value, the preset weight, and the peer node identifier into a resource packet, and transmits it to the terminal node;

[0011] The terminal node forwards the resource packet to the smart contract deployed on the blockchain node unit. Each peer node runs the smart contract to verify the authenticity of the resource packet. If the verification result is true, the global parameters are updated, and the updated global parameters are sent to the sorting node of the blockchain node unit;

[0012] The sorting node generates a block based on the updated global parameters and the resource packet, and sends the block to each peer node. Each peer node verifies the validity of the block according to the information in the block. If the block is verified to be valid, the block is added to the local blockchain. If the block is verified to be invalid, the weight of its own node is updated to optimize the subsequent training process.

[0013] In some embodiments of the present disclosure, before the step of receiving the training start instruction, it further includes:

[0014] Build the blockchain node unit based on the Hyperledger architecture. The blockchain node unit includes the terminal node, the peer node, and the sorting node;

[0015] Preset global parameters, where the global parameters include but are not limited to the total number of peer nodes participating in training, the current node sending training data, the minimum result deviation, the maximum result deviation, and the peer node generating the minimum deviation result;

[0016] Build the data processing unit, receive and screen the training data, and send the screened training data to the model training unit;

[0017] Build the feedback unit, calculate the expected result and the actual result output by the model training unit, pack the obtained deviation value, the preset weight, and the peer node identifier into the resource packet, and feedback it to the terminal node.

[0018] In some embodiments of the present disclosure, after the step of receiving the training start instruction, it includes:

[0019] Whenever a new peer node that can provide training data joins the blockchain network, the initial value of the weight of the peer node is set to 1.

[0020] In some embodiments of the present disclosure, the peer nodes for providing training data are sorted according to their weights, and the peer nodes with higher weights are given priority to provide the training data.

[0021] In some embodiments of the present disclosure, the step of updating the global parameters includes:

[0022] Perform a subtraction operation on the total number of peer nodes participating in the training by 1;

[0023] Perform an addition operation on the index of the current node sending the training data by 1;

[0024] If the maximum result deviation is less than the deviation value, then set the deviation value to the maximum result deviation;

[0025] If the minimum result deviation is greater than the deviation value, then set the deviation value to the minimum result deviation, and set the peer node identifier to the peer node identifier that generates the minimum deviation result.

[0026] In some embodiments of the present disclosure, the block includes:

[0027] The total number of peer nodes participating in the training, the current node sending the training data, the minimum result deviation, the maximum result deviation, the peer node that generates the minimum deviation result, the deviation value, the preset weight, and the peer node identifier.

[0028] In some embodiments of the present disclosure, each of the peer nodes validates the block according to the information in the block. If the block is verified to be valid, the block is added to the local blockchain. If the block is verified to be invalid, the step of updating the weight of its own node includes:

[0029] After the current peer node receives the block packet, it judges the total number of peer nodes participating in the training. If it is greater than zero, it judges the current peer node identifier and the peer node identifier in the block packet. If the two are equal, it extracts the deviation in the block packet and saves it as the target actual difference of the peer node, and adds the block to the local blockchain;

[0030] If the total number of peer nodes participating in the training is equal to zero, update the weight of the peer node: the weight of the peer node = the original weight of the peer node + (the target actual difference of the peer node / the maximum result deviation) * the weight in the block packet;

[0031] Determine whether the current node index matches the peer node identifier with the minimum deviation. If they match, set the current peer node index in the number of points index to the current peer node index, and set the global parameter update switch to on to trigger the parameter update process of the model training unit.

[0032] According to a second aspect of the present disclosure, there is provided a system combining blockchain data collection and model training, including:

[0033] A control unit, a blockchain node unit, a data processing unit, a model training unit and a feedback unit, wherein the blockchain node unit includes a terminal node, a peer node and an ordering node;

[0034] The control unit is configured to receive a training start instruction, send the training start instruction to the terminal node, and send the expected result of this training to the feedback unit;

[0035] The terminal node is configured to transmit the training start instruction to the relevant peer node according to the preset global parameters, and forward the resource package to the smart contract deployed in the blockchain node unit. Each peer node runs the smart contract to verify the authenticity of the resource package. If the verification result is true, update the global parameters and send the updated global parameters to the ordering node of the blockchain node unit;

[0036] The peer node is configured to obtain the pre-stored training resources and the preset weights, generate training data adapted to the training requirements, and transmit the training data to the data processing unit, and verify the validity of the block according to the information in the block. If the block is verified to be valid, add the block to the local blockchain. If the block is verified to be invalid, update the weight of its own node to optimize the subsequent training process;

[0037] The data processing unit is configured to screen and integrate the training data, and convey the screened training data to the model training unit;

[0038] The model training unit is configured to perform calculations based on the screened training data, output the actual result and feedback it to the feedback unit;

[0039] The feedback unit is configured to calculate the deviation value according to the received expected result and the actual result, encapsulate the deviation value, the preset weight and the peer node identifier into a resource package and transmit it to the terminal node;

[0040] The ordering node is configured to generate a block according to the updated global parameters and the resource package, and send the block to each peer node.

[0041] According to a third aspect of the present disclosure, there is provided a computer device, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps of the method in any of the above embodiments are implemented.

[0042] According to a fourth aspect of the present disclosure, there is provided a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method in any of the above embodiments are implemented.

[0043] The method provided by the embodiments of the present disclosure, which combines blockchain data collection and model training, after receiving a training start instruction, sends a start instruction to a terminal node, and at the same time transmits an expected result to a feedback unit. The terminal node forwards the instruction to relevant peer nodes according to preset global parameters. Under the Hyperledger blockchain architecture, each peer node has the ability to collect data, and the optimal data is selected from them for large language model training. By virtue of the characteristic that the blockchain can access an infinite number of nodes, a large amount of training data from various sources is provided for large language model training. After the data is screened and integrated, it is input into a model training unit, and the calculation result of the model is fed back to the feedback unit. The expected result is compared with the actual result, a resource package is encapsulated and sent to the terminal node, and then forwarded to the smart contract of the blockchain node unit. After verification by the peer node, it is decided whether to send it to the sorting node, and finally block processing and verification are completed. It realizes that by using an infinite number of peer nodes accessed in the Hyperledger blockchain, each peer node collects data, provides an infinite number of sources of training data for the training of large language models, and selects the optimal data from them to train large models. It greatly enriches the training data of large language models, effectively improves the training efficiency, breaks the monopoly of a few centralized companies on large language model training, and provides a broader space for the development of large language models. It makes full use of the characteristics of the blockchain such as decentralization, distribution, and immutability, realizes the diversification of data collection, the fairness and efficiency of the training process, breaks the data monopoly and limitations of the traditional centralized training mode, improves the training effect and performance of large language models, and expands the breadth and depth of their applications.

[0044] The above description is only an overview of the technical solutions of the embodiments of the present application. In order to be able to understand the technical means of the embodiments of the present application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the embodiments of the present application more obvious and understandable, the following specific embodiments of the present application are specifically given. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly described below. It should be understood that the following described drawings only relate to some embodiments of the present disclosure and do not limit the present disclosure, where:

[0046] Figure 1It is a schematic structural diagram of a system combining blockchain data collection and model training provided by an embodiment of the present disclosure;

[0047] Figure 2 It is a schematic flowchart of a method combining blockchain data collection and model training provided by an embodiment of the present disclosure;

[0048] Figure 3 It is a schematic structural diagram of a computer device provided by an embodiment of the present disclosure.

[0049] In the drawings, marks with the same last two digits correspond to the same elements. It should be noted that the elements in the drawings are schematic and not drawn to scale. Detailed implementation manners

[0050] In order to make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings. Apparently, the described embodiments are some but not all of the embodiments of the present disclosure. All other embodiments obtained by those skilled in the art based on the described embodiments of the present disclosure without creative efforts also belong to the scope of protection of the present disclosure.

[0051] Referring to "embodiment" herein means that a specific feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present application. The phrase "embodiment" appearing in various positions in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art explicitly and implicitly understand that the embodiments described herein may be combined with other embodiments.

[0052] The term "and / or" herein is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B may represent: the existence of A, the simultaneous existence of A and B, and the existence of B. In addition, the character " / " herein generally represents an "or" relationship between the associated objects before and after.

[0053] In addition, in all embodiments of the present disclosure, terms such as "first" and "second" are only used to distinguish one component (or a part of the component) from another component (or another part of the component).

[0054] In the description of the present application, unless otherwise specified, the meaning of "a plurality" refers to two or more (including two). Similarly, "a plurality of groups" refers to two or more groups (including two groups).

[0055] To enable those skilled in the art to better understand the solution of this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the accompanying drawings.

[0056] Currently, a centralized data collection and training mode is generally adopted for large language models. Usually, a large amount of data is collected in a centralized manner, and then these data are input into the large language model training model and parameters. This mode brings a series of serious problems: on the one hand, the data is monopolized, and on the other hand, the data scope has limitations, which will greatly reduce the accuracy of the large language model. Moreover, data privacy protection also faces challenges under the centralized mode. User data is stored centrally. Once a security vulnerability appears, it will trigger a large-scale privacy leakage risk.

[0057] Based on the problems existing in the prior art, the embodiments of the present disclosure provide a method and system combining blockchain data collection and model training.

[0058] Figure 1 It is a schematic structural diagram of a system combining blockchain data collection and model training provided by the embodiments of the present disclosure. As Figure 1 shown, the system combining blockchain data collection and model training includes: a control unit 110, a blockchain node unit 120, a data processing unit 130, a model training unit 140, and a feedback unit 150. The blockchain node unit 120 includes a terminal node 1201, a peer node 1202, and an ordering node 1203;

[0059] In a possible implementation manner, the control unit 110 is connected to the terminal node 1201 and the feedback unit 150, and is used to receive a training start instruction, synchronously send the training start instruction to the terminal node 1201, and at the same time send the expected result of this training to the feedback unit 150.

[0060] In a possible implementation manner, the terminal node 1201 is connected to the peer node 1202, and the peer node 1202 is connected to the ordering node 1203;

[0061] The terminal node 1201 is used to transmit the training start instruction to the relevant peer node 1202 according to the preset global parameters, and forward the resource package to the smart contract deployed in the blockchain node unit. Each peer node 1202 runs the smart contract to verify the authenticity of the resource package. If the verification result is true, the global parameters are updated, and the updated global parameters are sent to the ordering node 1203.

[0062] Peer node 1202 is used to obtain pre-stored training resources and preset weights, generate training data adapted to the training requirements, transmit the training data to the data processing unit 130, and perform validity verification on the block according to the information in the block. If the block is verified to be valid, the block is added to the local blockchain. If the block is verified to be invalid, the weight of its own node is updated to optimize the subsequent training process.

[0063] Sorting node 1203 is used to generate a block according to the updated global parameters and the resource package, and send the block to each peer node 1202.

[0064] The data processing unit 130 includes a plurality of scalable data input ports ( , ,...) and a data output port InterfaceOutput. The data input ports correspond to the peer nodes one by one. Each data input interface is respectively connected to the peer node 1202 that provides training data to the blockchain node unit 120, that is connected , connected , etc. The training data sent by the peer interface is received through the data input ports. The data output port InterfaceOutput is connected to the data input end of the model training unit 140 to be trained, and screened training data is delivered to the large language model. The data processing unit 130 is used to screen and integrate the training data provided by the blockchain node unit 120, and deliver the valuable training data after screening to the large language model.

[0065] The model training unit 140 can specifically be a large language model. The input end is connected to the data processing unit 130, and the output end is connected to the feedback unit 150. It is used to calculate the screened training data, output the actual result and feedback it to the feedback unit 150.

[0066] The feedback unit 150 includes two data input ports. One of the data input ports (set as ) is connected to the control unit 110, and the input data is the expected result (set as vector ); the other data input port (set as ) is connected to the output end of the model training unit 140, and the input data is the actual result (set as vector ) obtained by the large language model (LLM) for the training data each time. The feedback unit 150 is used to calculate the deviation value according to the received expected result and the actual result , this deviation value reflects the current prediction accuracy of the model. The feedback unit 150 is also used to encapsulate the deviation value , the preset weight, and the peer node identifier into a resource packet ( ), and feedback it to the terminal node to help adjust the data collection strategy; the terminal node 1201 then passes it to the peer node to affect the node weight calculation; the peer node 1202 then provides it to the sorting node to participate in the block parameter encapsulation, forming a closed-loop optimization loop.

[0067] Figure 2 is a schematic flowchart of a method for combining blockchain data collection and model training provided by an embodiment of the present disclosure, which is applied to Figure 1 the system for combining blockchain data collection and model training shown in. As Figure 2 shown, the specific process of the method for combining blockchain data collection and model training includes:

[0068] S210. After starting the blockchain, receive a training start instruction, send the training start instruction to the terminal node of the blockchain node unit, and send the expected result of this training to the feedback unit .

[0069] In a specific implementation, under the blockchain technology architecture, the process of starting the blockchain involves the initialization of multiple nodes and the setting of network configuration to ensure the stable and secure operation of the entire blockchain. After starting the blockchain, it is in a real-time listening state. Once a training start instruction is received from the upper-layer system or a specific user, the training start instruction will be immediately sent to the terminal node. The terminal node is a key unit for executing specific training tasks. To calculate the difference, the expected result of this training will also be synchronously sent to the of the feedback unit.

[0070] Optionally, after implementing step S210, it may further include: whenever a new peer node that can provide training data joins the blockchain network, set the initial weight value of the peer node to 1.

[0071] Optionally, perform weight sorting on the peer nodes for providing training data, and let the nodes with higher weights (i.e., those providing higher-quality data) provide training data first. This can encourage peer nodes to actively improve their own data quality because high-quality data can bring higher weights, thereby obtaining more participation opportunities and resource allocations.

[0072] In addition, before implementing step S2010, it may further include:

[0073] S2001. Build the blockchain node unit based on the Hyperledger architecture, including terminal nodes, peer nodes, and sorting nodes.

[0074] In a specific implementation, Hyperledger is an open-source distributed ledger platform that provides components and tools to help build a secure and efficient network. To build a terminal node, hardware with sufficient computing and storage capabilities needs to be prepared. Install a suitable operating system, download and install the Hyperledger client software from the official website, configure the port number for communication with the blockchain, identity authentication information, and connection information with peer and sorting nodes to ensure its access to the network. To build a peer node, prepare a stable server with sufficient network bandwidth and install the core components strictly according to the official documentation. After installation, initialize the configuration to generate a key pair, configure the consensus mechanism parameters to determine the node role, and set the connection addresses with other peer and sorting nodes through the configuration file to achieve data interaction and sharing. To build a sorting node, select a high-performance server, install the sorting service components, configure the sorting algorithm parameters, such as the PBFT algorithm. At the same time, configure the communication channel with the peer nodes to receive transaction requests in a timely manner, and set the data backup and recovery strategy.

[0075] S2002. Preset global parameters, including:

[0076] In a specific implementation, the preset global parameter N represents the total number of peer nodes participating in each round of large language model training, which is dynamically adjusted according to multiple factors such as the complexity of the training task, data scale requirements, network bandwidth, and model complexity to ensure that an appropriate number of node resources can be efficiently utilized in each round of training;

[0077] The preset global parameter m represents the node currently sending training data, with an initial value set to m = 1;

[0078] The preset global parameter represents the minimum result deviation calculated during each round of large language model training;

[0079] The preset global parameter represents the maximum result deviation calculated during each round of large language model training;

[0080] These two variables are used to measure the dispersion degree of the training results;

[0081] The preset global parameter represents the peer node that provides the training data to produce the minimum deviation result.

[0082] S2003. Build a data processing unit;

[0083] In a specific embodiment, the data processing unit includes a plurality of scalable data input ports and one data output port. Among them, one of the data input interfaces is connected to one of the peer nodes, and the training data is received through the data input port. The data output port is connected to the data input end of the model training unit to deliver the screened training data to the large language model. An extensible data input port architecture is designed according to the expected number of peer nodes to be accessed and data types.

[0084] S2004, construct a feedback unit;

[0085] In a specific embodiment, connect the feedback unit to the output interface of the model training unit, and write a data comparison and difference calculation program to realize real-time analysis of the expected result and the actual result.

[0086] S2005, deploy a smart contract (chain code) in the blockchain;

[0087] In a specific embodiment, define the logical rules for key operations such as data verification, global parameter update, and block generation to ensure the compliance and consistency of node operations.

[0088] S220. After receiving the training start instruction, the terminal node transmits the training start instruction to the peer nodes of the blockchain node unit related thereto according to the preset global parameters. The peer nodes obtain the pre-stored training resources and preset weights, generate training data adapted to the training requirements, and transmit the training data to the data processing unit.

[0089] Among them, each peer node is connected to an input interface of the data processing unit to ensure the exclusivity and stability of data transmission.

[0090] Optionally, use a switch to control the large language model to change / optimize its own parameters. Preset a global parameter update switch Switch, and set the initial value to Switch = false. Decide whether to optimize and adjust the parameters of the large language model according to the feedback of model training, control the parameter update timing, and avoid model instability caused by over-optimization. At the initial stage of training or when the large language model performs relatively stably, turn off the parameter update switch to avoid model instability or even overfitting caused by frequent parameter adjustment; when the large language model shows a large deviation, such as when the feedback unit detects that the deviation between the prediction results of multiple consecutive rounds and the actual results exceeds the threshold, turn on the switch and optimize the parameters of the large language model according to the latest data.

[0091] In a specific embodiment, for the i-th round of training, it is preset that there are n peer nodes participating in providing training data, and the result of sorting these peer nodes from high to low according to their weights is ( ), the result of sorting these peer nodes in descending order according to their weights is . Among them, the training data provided by each peer node are respectively ( ). Let the basic weight that can be contributed to all nodes in this round of training be . The target value expected to be obtained from the large language model in this round of training is the vector . Let the global parameter N = n.

[0092] S230. After receiving the training data, the data processing unit screens and integrates the training data, and conveys the screened training data to the model training unit. The model training unit calculates according to the training data, outputs the actual result and feeds it back to the feedback unit;

[0093] In a specific implementation manner, the training start instruction sends the training data to the interface of the data processing unit , and at the same time the data processing unit closes the remaining interfaces ( ,...), ensuring the uniqueness and certainty of the input of each round of training data and avoiding data chaos. The data processing unit will output through its to the data input end of the model training unit.

[0094] The large language model of the model training unit calculates the training data to obtain the actual result . At this time, it is determined whether to update the parameters (Token) of the large language model according to the state of the parameter update switch Switch. If Switch = false, no update is performed and the current state of the model is maintained for further observation and analysis; if Switch = true, the parameter update process is started, and the internal parameters of the model are optimized according to the feedback of this training to improve the performance of the model. The output to the of the feedback unit provides the basic data for comparative analysis of the feedback unit.

[0095] S240. After receiving the expected result and the actual result , the feedback unit calculates the deviation value between the two, and encapsulates the deviation value , the preset weight and the peer node identifier into a resource package ( ), and immediately transmits it to the terminal node , so as to timely discover possible deviations and problems in the training process, thereby providing a basis for subsequent adjustment and optimization.

[0096] In a specific implementation manner, the feedback unit includes two data input ports, one of which (set as ), and the input data is the expected result (assumed to be a vector ); Another data input port (assumed to be ) has input data that is the actual result obtained by the large language model (LLM) for each training data (assumed to be a vector ). By comparing and analyzing these two result vectors, the deviation of the model prediction can be insighted, providing direct feedback for subsequent training optimization. Calculate the deviation value , and this deviation value reflects the current prediction accuracy of the model. Pack this deviation value, the preset weight, and the peer node identifier into the resource package ( ) and feedback it to the terminal node to help adjust the data collection strategy.

[0097] S250. The terminal node After receiving the resource package ( ), it forwards it to the chain code smart contract deployed in the blockchain to drive the distributed verification process within the blockchain. Each peer node runs the smart contract to verify the authenticity of the resource package. If the verification result is true, update the global parameters and send the updated global parameters to the sorting node of the blockchain node unit.

[0098] In a specific implementation manner, when the terminal node receives the resource package ( ), it first performs an integrity check on the resource package ( ). After the check is correct, the terminal node will forward the resource package to the chain code smart contract deployed in the blockchain according to the established network routing rules. The chain code smart contract is the core component in the blockchain responsible for executing specific business logic. It runs based on established programming rules and algorithms. When it receives the resource package forwarded by the terminal node, it will parse and process the data therein. The smart contract will decide whether to start subsequent operations according to the preset conditions. After the smart contract finishes processing the resource package, it begins to drive the distributed verification process within the blockchain.

[0099] In a specific implementation manner, multiple peer nodes in the network will participate in the verification simultaneously. Each peer node will verify the transactions or operations involved in the resource package based on the ledger data and consensus algorithm stored by itself. Only when most nodes in the network pass the verification, the transaction or operation will be considered valid and thus recorded in the blockchain ledger. The entire distributed verification process not only ensures the accuracy and security of the data but also enhances the decentralized characteristics of the blockchain.

[0100] Optionally, the step of updating the global parameters specifically includes:

[0101] Perform a subtraction operation on the total number of peer nodes participating in the training, orderly advance the training process, and mark the nodes that have completed the tasks;

[0102] Perform an increment operation on the node index of the currently sending training data, and seamlessly switch to the next data providing node;

[0103] If the maximum result deviation is less than the deviation value, set the deviation value to the maximum result deviation to capture the maximum deviation change in model training;

[0104] If the minimum result deviation is greater than the deviation value, set the deviation value to the minimum result deviation, and set the peer node identifier to the peer node identifier that generates the minimum deviation result to ensure the association between the key node and the deviation index.

[0105] S260. After the sorting node receives the updated global parameters, generate a block according to the updated global parameters and the resource package, and send the block to each peer node. After each peer node receives the block, verify the validity of the block according to the information in the block. If the block is verified to be valid, add the block to the local blockchain. If the block is verified to be invalid, update the weight of its own node to optimize the subsequent training process;

[0106] In a specific implementation manner, pack the total number of peer nodes participating in the training, the currently sending training data node, the minimum result deviation, the maximum result deviation, the peer node that generates the minimum deviation result, the deviation value, the preset weight, and the peer node identifier into a block.

[0107] Optionally, the block package at least includes the number of peer nodes to be trained, the peer node identifier of the minimum result deviation, the peer node identifier of the maximum result deviation, the peer node identifier of the minimum deviation, the deviation value, the preset weight, and the peer node identifier, where

[0108] The number of peer nodes to be trained reflects the participation scale of the current training round in real time and provides a basis for resource allocation;

[0109] The minimum result deviation and the maximum result deviation quantify the fluctuation range of the model training effect and provide a key reference for subsequent training strategy adjustment;

[0110] The peer node identifier of the minimum deviation locks the node that is crucial for model optimization and facilitates targeted attention and adjustment.

[0111] All peer nodes in the blockchain node unit run chain code verification ( ), and send their verification results to the sorting node. Relying on the distributed computing power and consensus mechanism of the blockchain, the authenticity of data feedback is ensured, and interference from false data in the training process is eliminated.

[0112] According to the blockchain consensus mechanism, when more than 50% of the peer nodes verify and recognize the authenticity of the resource package ( ), update the global parameters:

[0113] Num = Num - 1;

[0114] m = m + 1;

[0115] If , it means that the deviation of the model training result is within a reasonable range, and relevant parameters can be adjusted moderately; if , it indicates that the model has a large deviation and a more aggressive parameter adjustment strategy is needed;

[0116] Sorting node Pack the parameters (Num, ) into a block and send the block to all peer nodes for block verification to ensure the authority and immutability of data records.

[0117] In a specific implementation, when a peer node receives a block, it checks the parameters:

[0118] If Num > 0, check the parameter , and decide subsequent operations according to the deviation situation, such as whether to adjust the data sending strategy, etc.;

[0119] If , m = m + 1, then verify whether the block is valid. If it is valid, add this block to the local blockchain to complete data storage and update.

[0120] If Num > 0 is not satisfied, update the weight of its own node using the following formula: ;

[0121] If and m = j, Switch = true, it indicates that the data provided by the current node has high quality and makes a significant contribution to model optimization. Increase its weight to encourage it to continue providing high-quality data;

[0122] Verify whether the block is valid. If it is valid, add this block to the local blockchain.

[0123] Finally, start the next round of training loop and continuously iterate to optimize the large language model.

[0124] The method provided by the embodiments of the present disclosure combines blockchain data collection and model training. After receiving the training start instruction, the control unit sends the start instruction to the terminal node and transmits the expected result to the feedback unit at the same time. The terminal node forwards the instruction to the relevant peer nodes according to the preset global parameters. In the Hyperledger blockchain architecture, each peer node has the ability to collect data and selects the optimal data for large model training. By virtue of the characteristic that the blockchain can access an infinite number of nodes, a large amount of training data sources are provided for large language model training. After the data is screened and integrated, it is input into the model training unit, and the model calculation result is fed back to the feedback unit. The expected result is compared with the actual result, and a resource package is encapsulated and sent to the terminal node, and then forwarded to the smart contract of the blockchain. After verification by the peer node, it decides whether to send it to the sorting node, and finally completes the block processing and verification. It realizes the use of an infinite number of peer nodes accessed in the Hyperledger blockchain, and each peer node collects data to provide an infinite number of training data sources for the training of large language models, and selects the optimal data from them to train the large model. It greatly enriches the training data of large language models, effectively improves the training efficiency, breaks the monopoly of a few centralized companies on the training of large language models, and provides a broader space for the development of large language models.

[0125] The embodiments of the present application also provide a computer device. For details, please refer to Figure 3 , Figure 3 which is the basic structural block diagram of the computer device in this embodiment.

[0126] The computer device includes a memory 310 and a processor 320 that communicate with each other through a system bus. It should be noted that only the computer device with components 310-320 is shown in the figure, but it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Among them, those skilled in the art of the present technology can understand that a computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0127] The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer device can interact with the user through a keyboard, a mouse, a remote control, a touchpad or a voice control device.

[0128] The memory 310 includes at least one type of readable storage medium, and the readable storage medium includes non-volatile memory or volatile memory, such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disc, etc. The RAM may include static RAM or dynamic RAM. In some embodiments, the memory 310 may be an internal storage unit of a computer device, such as the hard disk or memory of the computer device. In other embodiments, the memory 310 may also be an external storage device of the computer device, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device. Of course, the memory 310 may also include both the internal storage unit and the external storage device of the computer device. In this embodiment, the memory 310 is generally used to store the operating system and various application software installed on the computer device, such as the program code of the above method. In addition, the memory 310 may also be used to temporarily store various data that have been output or will be output.

[0129] The processor 320 is generally used to execute the overall operations of the computer device. In this embodiment, the memory 310 is used to store program code or instructions, and the program code includes computer operation instructions. The processor 320 is used to execute the program code or instructions stored in the memory 310 or process data, such as running the program code of the above method.

[0130] In this text, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. This bus system can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0131] Another embodiment of the present application also provides a computer-readable medium, which can be a computer-readable signal medium or a computer-readable storage medium. A processor in the computer reads the computer-readable program code stored in the computer-readable medium, so that the processor can perform the functional actions specified in each step or the combination of steps in the above method; and generate a device that implements the functional actions specified in each block or the combination of blocks in the block diagram.

[0132] The computer-readable medium includes but is not limited to electronic, magnetic, optical, electromagnetic, infrared memories or semiconductor systems, devices or apparatuses, or any suitable combination of the foregoing. The memory is used to store program code or instructions, and the program code includes computer operation instructions. The processor is used to execute the program code or instructions of the above method stored in the memory.

[0133] For the definitions of the memory and the processor, reference can be made to the description of the foregoing computer device embodiments, and details are not described herein again.

[0134] In several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.

[0135] In each embodiment of the present application, each functional unit or module can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0136] When an integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods in various embodiments of this application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.

[0137] Unless the context clearly indicates otherwise, the singular forms of the words used in this specification and the appended claims include the plural, and vice versa. Thus, when referring to the singular, the corresponding plural of the term is usually included. Similarly, the terms "comprising" and "including" will be interpreted as inclusive rather than exclusive. Likewise, the term "including" and "or" should be interpreted as inclusive, unless such an interpretation is explicitly prohibited in this specification. Where the term "example" is used in this specification, particularly when it is located after a group of terms, the "example" is merely illustrative and explanatory and should not be considered exclusive or extensive.

[0138] Further aspects and scopes of adaptability become apparent from the description provided herein. It should be understood that the various aspects of this application can be implemented alone or in combination with one or more other aspects. It should also be understood that the description herein and the specific embodiments are for illustrative purposes only and are not intended to limit the scope of this application.

[0139] The above has described several embodiments of the present disclosure in detail. However, obviously, those skilled in the art can make various modifications and variations to the embodiments of the present disclosure without departing from the spirit and scope of the present disclosure. The protection scope of the present disclosure is defined by the appended claims.

Claims

1. A method combining blockchain data collection and model training, characterized in that Including: Receiving a training start instruction, sending the training start instruction to the terminal node of the blockchain node unit, and sending the expected result of this training to the feedback unit; According to the preset global parameters, the terminal node transmits the training start instruction to the peer nodes of the blockchain node unit associated therewith. The peer nodes obtain the pre-stored training resources and the preset weights, generate training data adapted to the training requirements, and transmit the training data to the data processing unit; The data processing unit screens and integrates the training data, and conveys the screened training data to the model training unit. The model training unit performs calculations based on the training data, outputs the actual result and feeds it back to the feedback unit; The feedback unit calculates the deviation value based on the received expected result and the actual result, encapsulates the deviation value, the preset weight, and the peer node identifier into a resource packet and transmits it to the terminal node; The terminal node forwards the resource packet to the smart contract deployed in the blockchain node unit. Each peer node runs the smart contract to verify the authenticity of the resource packet. If the verification result is true, the global parameters are updated, and the updated global parameters are sent to the sorting node of the blockchain node unit; The sorting node generates a block based on the updated global parameters and the resource packet, and sends the block to each peer node. Each peer node verifies the validity of the block according to the information in the block. If the block is verified to be valid, the block is added to the local blockchain. If the block is verified to be invalid, the weight of its own node is updated to optimize the subsequent training process.

2. The method according to claim 1, wherein Before the step of receiving the training start instruction, it further includes: Building the blockchain node unit based on the Hyperledger architecture. The blockchain node unit includes the terminal node, the peer nodes, and the sorting node; Presetting global parameters, where the global parameters include the total number of peer nodes participating in the training, the current node sending the training data, the minimum result deviation, the maximum result deviation, and the peer node that generates the minimum result deviation; Building the data processing unit to receive and screen the training data, and sending the screened training data to the model training unit; Building the feedback unit to calculate the deviation value between the expected result and the actual result output by the model training unit, and packing the deviation value, the preset weight, and the peer node identifier into the resource packet and feeding it back to the terminal node.

3. The method according to claim 1, wherein After the step of receiving the training start instruction, it includes: Whenever a new peer node that can provide training data joins the blockchain node unit, setting the initial value of the weight of this peer node to 1.

4. The method according to claim 1, wherein Sorting the peer nodes for providing training data according to their weights, and letting the peer nodes with higher weights provide the training data first.

5. The method according to claim 2, wherein The step of updating the global parameters includes: Performing a subtraction operation on the total number of peer nodes participating in the training; Performing an addition operation on the current node sending the training data; If the maximum result deviation is less than the deviation value, then set the deviation value to the maximum result deviation; If the minimum result deviation is greater than the deviation value, then set the deviation value to the minimum result deviation, and set the peer node identifier to the peer node identifier that generates the minimum result deviation.

6. The method according to claim 2, characterized in that, The block includes: The total number of peer nodes participating in the training, the current node sending the training data, the minimum result deviation, the maximum result deviation, the peer node that generates the minimum result deviation, the deviation value, the preset weight, and the peer node identifier.

7. The method according to claim 1, wherein The step in which each of the peer nodes validates the effectiveness of the block according to the information in the block. If the block is verified to be effective, then add the block to the local blockchain. If the block is verified to be ineffective, then update the weight of its own node, includes: After the current peer node receives the block, judge the total number of peer nodes participating in the training. If it is greater than zero, then judge the current peer node identifier and the peer node identifier in the block. If the two are equal, then extract the deviation value in the block and save it as the actual difference of the peer node target, and add the block to the local blockchain; If the total number of peer nodes participating in the training is equal to zero, then update the weight of the peer node: the weight of the peer node = the original weight of the peer node + (the actual difference of the peer node target / the maximum result deviation) * the weight in the block; Judge whether the current peer node identifier matches the peer node identifier that generates the minimum result deviation. If they match, then set the current peer node as the peer node that generates the minimum result deviation, and set the global parameter update switch to on, triggering the parameter update process of the model training unit.

8. A system combining blockchain data collection and model training, characterized in that, It is used to implement the method of combining blockchain data collection and model training according to any one of claims 1-7. The system includes: A control unit, a blockchain node unit, a data processing unit, a model training unit, and a feedback unit. The blockchain node unit includes a terminal node, a peer node, and an ordering node; The control unit is used to receive a training start instruction, send the training start instruction to the terminal node, and send the expected result of this training to the feedback unit; The terminal node is used to transmit the training start instruction to the relevant peer nodes according to the preset global parameters, and forward the resource package to the smart contract deployed in the blockchain node unit. Each peer node runs the smart contract to verify the authenticity of the resource package. If the verification result is true, then update the global parameters and send the updated global parameters to the ordering node of the blockchain node unit; The peer node is used to obtain the pre-stored training resources and the preset weight, generate training data adapted to the training requirements, and transmit the training data to the data processing unit, and verify the effectiveness of the block according to the information in the block. If the block is verified to be effective, then add the block to the local blockchain. If the block is verified to be ineffective, then update the weight of its own node to optimize the subsequent training process; The data processing unit is configured to screen and integrate the training data, and convey the screened training data to the model training unit; The model training unit is configured to perform calculations based on the screened training data, output the actual result and feed it back to the feedback unit; The feedback unit is configured to calculate the deviation value according to the received expected result and the actual result, encapsulate the deviation value, the preset weight and the peer node identifier into a resource packet and transmit it to the terminal node; The sorting node is configured to generate a block according to the updated global parameter and the resource packet, and send the block to each peer node.

9. A computer device, characterized in that, Comprising: One or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Block chain-based data training method and apparatus, storage medium and block chain node

    CN108323200A

  • Federal learning method of lightweight grouping consensus based on block chain

    CN115796261A