Method and system based on combination of block chain data acquisition and model training

By using blockchain technology to train large language models for data acquisition and model training, the problems of data resource monopoly and privacy protection are solved, and efficient training and accuracy of large language models are achieved.

CN119623653AActive Publication Date: 2025-03-14SHENZHEN TENGMENG TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The training methods of existing large language models have problems such as monopoly of data resources, limited data accuracy, and data privacy protection challenges.

Method used

Using blockchain-based data acquisition and model training methods, the decentralized data acquisition and diversified source of training data is realized through terminal nodes, peer nodes and sorting nodes in the blockchain node unit.

Benefits of technology

It breaks the monopoly of data resources, enriches the training data of large language models, improves training efficiency, and improves the accuracy and privacy protection capabilities of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119623653A_ABST
    Figure CN119623653A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a method based on combination of block chain data acquisition and model training, and the method comprises the steps: receiving a training starting instruction, sending the starting instruction to a terminal node, and sending an expected result to a feedback unit; the terminal node forwards the instruction to a related peer node according to a preset global parameter; the peer-to-peer node generates training data by using pre-stored resources and weights and transmits the training data to a data processing unit; the data processing unit screens and integrates training data and then inputs the training data into the model training unit; the model training unit calculates an actual result and feeds back the actual result to the feedback unit, and the feedback unit calculates a difference value according to an expected result and the actual result, encapsulates the difference value, a weight and a peer node identifier into a resource packet and sends the resource packet to a terminal node; the terminal node forwards the resource packet to the smart contract of the block chain; the peer-to-peer node runs contract verification, and if the contract verification passes, the contract verification is sent to the sorting node; and the sorting node generates a block to each peer node, and after the peer nodes verify, the blocks are added to the local block chain if the blocks are valid, and the weights are updated if the blocks are invalid, so that subsequent training is optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the fields of artificial intelligence and blockchain technology and related technologies, and specifically, to a method and system for combining blockchain data collection with model training. Background Art

[0002] With the vigorous development of artificial intelligence technology, large language models have demonstrated extraordinary capabilities and are widely used in multiple scenarios such as intelligent customer service, text creation, and knowledge question answering. However, the existing training methods of large language models have many drawbacks.

[0003] At present, a centralized data collection and training model is adopted for large language models. Usually, the data collection process collects massive data in a centralized manner, and then inputs this data into the large language model training model and parameters. This model 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 scope, the data used for training is greatly limited, which greatly reduces the accuracy of large language models. In addition, data privacy protection in a centralized model also faces challenges. User data is stored in a centralized manner. Once a security vulnerability occurs, it will lead to the risk of large-scale privacy leakage.

[0004] Therefore, there is an urgent need for a method and system based on the combination of blockchain data collection and model training to break the existing difficulties and promote the sustainable development of large language model technology. Summary of the invention

[0005] The embodiments described in this article provide a method and system based on the combination of blockchain data collection and model training to solve the problems existing in the prior art.

[0006] According to a first aspect of the present disclosure, a method based on combining blockchain data collection and model training is provided, which is applied to a system based on combining blockchain data collection and model training, the system comprising: a control unit, a blockchain node unit, a data processing unit, a model training unit and a feedback unit, the blockchain node unit comprising a terminal node, a peer node and a sorting node, the method comprising the following steps: 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; The terminal node transmits the training start instruction to a peer node of a blockchain node unit related thereto according to preset global parameters, and the peer node obtains pre-stored training resources and preset weights, generates training data adapted to the training requirements, and transmits the training data to a data processing unit; The data processing unit screens and integrates the training data, and transmits the screened training data to the model training unit for calculation, and the model training unit outputs the actual result and feeds it back to the feedback unit; The feedback unit calculates a deviation value according to the received expected result and the actual result, encapsulates the deviation value, the preset weight and the peer node identifier into a resource package and transmits it to the terminal node; The terminal node forwards the resource package to the smart contract deployed on the blockchain node unit, and each of the peer nodes runs the smart contract to verify the authenticity of the resource package. If the verification result is true, the global parameters are updated and sent to the sorting node of the blockchain node unit; The sorting node generates a block according to the updated global parameters and the resource package, and sends the block to each of the peer nodes. Each of the peer nodes 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.

[0007] In some embodiments of the present disclosure, before the step of receiving the training start instruction, the method further includes: Building the blockchain node unit based on the hyperledger architecture, the blockchain node unit includes the terminal node, the peer node and the sorting node; Preset global parameters, including but not limited to the total number of peer nodes participating in the training, the node currently sending training data, the minimum result deviation, the maximum result deviation, and the peer node that produces the minimum deviation result; Constructing the data processing unit, receiving and screening the training data, and sending the screened training data to the model training unit; Construct the feedback unit, calculate the expected result and the actual result output by the model training unit, obtain the deviation value, package the deviation value, the preset weight and the peer node identifier into the resource package and feed it back to the terminal node.

[0008] In some embodiments of the present disclosure, after the step of receiving the training start instruction, the following steps are included: Whenever a new peer node that can provide training data joins the block two network, the initial weight value of the peer node is set to 1.

[0009] In some embodiments of the present disclosure, peer nodes for providing training data are sorted according to weights, so that peer nodes with high weights are given priority in providing the training data.

[0010] In some embodiments of the present disclosure, the step of updating the global parameters includes: Subtract one from the total number of peer nodes participating in the training; Add one to the node index currently sending the training data; If the maximum result deviation is less than the deviation value, setting the deviation value to the maximum result deviation; If the minimum result deviation is greater than the deviation value, the deviation value is set to the minimum result deviation, and the peer node identifier is set to the peer node identifier that generates the minimum deviation result.

[0011] In some embodiments of the present disclosure, the block includes: The total number of peer nodes participating in the training, the node currently sending training data, the minimum result deviation, the maximum result deviation, the peer node that produces the minimum deviation result, the deviation value, the preset weight and the peer node identifier.

[0012] In some embodiments of the present disclosure, each of the peer nodes verifies the validity of the block according to the information in the block, and if the block is verified to be valid, adds the block to the local blockchain, and if the block is verified to be invalid, updates the weight of its own node, including: After receiving the block package, the current peer node determines the total number of peer nodes participating in the training. If it is greater than zero, the current peer node identifier and the peer node identifier in the block package are determined. If the two are equal, the deviation in the block package is extracted and saved as the actual difference of the peer node target, and the block is added to the local blockchain; If the total number of peer nodes participating in the training is equal to zero, the weight of the peer node is updated: the weight of the peer node = the original weight of the peer node + (the actual difference between the peer node target and the maximum result deviation) The weight in the block package; Determine whether the current node index matches the peer node identifier with the minimum deviation. If so, set the current peer node point index to the current peer node index, and set the global parameter update switch to on to trigger the model training unit parameter update process.

[0013] According to a second aspect of the present disclosure, a system based on combining blockchain data collection and model training is provided, including: 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 a sorting 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 peer node related thereto according to the preset global parameters, and forward the resource package to the smart contract deployed on the blockchain node unit. Each of the peer nodes 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 sorting node of the blockchain node unit. The peer node is used to obtain pre-stored training resources and preset weights, generate training data adapted to training requirements, 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, the block is added to the local blockchain. If the block is verified to be invalid, the weight of the node itself is updated to optimize the subsequent training process; The data processing unit is used to screen and integrate the training data, and transmit the screened training data to the model training unit; The model training unit is used to perform calculations based on the screened training data, output actual results and feed them back to the feedback unit; The feedback unit is used to calculate a 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; The sorting node is used to generate a block according to the updated global parameters and the resource package, and send the block to each of the peer nodes.

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

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

[0016] The method based on the combination of blockchain data collection and model training provided by the embodiment of the present disclosure sends a start instruction to the terminal node after receiving the training start instruction, and transmits the expected result to the feedback unit at the same time. The terminal node forwards the instruction to the relevant peer node according to the preset global parameters. Under the hyperledger blockchain architecture, each peer node has the ability to collect data and select the best data for large language model training. With the characteristic that the blockchain can access an unlimited number of nodes, a large number of training data from sources is provided for large language model training. After screening and integration, the data is input into the model training unit, and the model calculation results are fed back to the feedback unit. The expected and actual results are compared, and the resource package is encapsulated to the terminal node, and then forwarded to the smart contract of the blockchain node unit. After verification, the peer node decides whether to send it to the sorting node, and finally completes the block processing and verification. It is realized that by utilizing the unlimited peer nodes accessed in the hyperledger blockchain, each peer node collects data, provides unlimited sources of training data for the training of the large language model, and selects the best data to train the large model. It greatly enriches the training data of large language models, effectively improves 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 decentralized, distributed, and tamper-proof characteristics of blockchain to achieve diversified data collection, fairness and efficiency in the training process, break the data monopoly and limitations of traditional centralized training models, improve the training effect and performance of large language models, and expand the breadth and depth of their applications.

[0017] The above description is only an overview of the technical solution of the embodiment of the present application. In order to more clearly understand the technical means of the embodiment of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] 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 noted that the drawings described below only relate to some embodiments of the present disclosure, but are not intended to limit the present disclosure, wherein: Figure 1 It is a structural diagram of a system based on combining blockchain data collection and model training provided by an embodiment of the present disclosure; Figure 2 It is a flowchart of a method based on combining blockchain data collection and model training provided by an embodiment of the present disclosure; Figure 3 It is a structural diagram of a computer device provided in an embodiment of the present disclosure.

[0019] In the drawings, reference numerals 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 DESCRIPTION

[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work also fall within the scope of protection of the present disclosure.

[0021] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase "embodiments" in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0022] The term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists, A and B exist at the same time, and B exists. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0023] Furthermore, in all embodiments of the present disclosure, terms such as “first” and “second” are used only to distinguish one component (or a part of a component) from another component (or another part of a component).

[0024] In the description of the present application, unless otherwise specified, "plurality" means more than two (including two), and similarly, "multiple groups" means more than two groups (including two).

[0025] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0026] At present, a centralized data collection and training model is generally used for large language models. Massive data is usually collected in a centralized manner, and then the data is input into the large language model training model and parameters. This model brings a series of serious problems: on the one hand, the data is monopolized, and on the other hand, the data scope is limited, which will greatly reduce the accuracy of the large language model. Moreover, data privacy protection in the centralized model also faces challenges. User data is stored in a centralized manner. Once a security vulnerability occurs, it will lead to the risk of large-scale privacy leakage.

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

[0028] Figure 1 is a schematic diagram of a system based on combining blockchain data collection and model training provided by an embodiment of the present disclosure, such as Figure 1 As shown, the system based on the combination of 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; In a possible implementation, the control unit 110 is connected to the terminal node 1201 and the feedback unit 150 to receive a training start instruction, synchronously send the training start instruction to the terminal node 1201, and send the expected result of this training to the feedback unit 150.

[0029] In a possible implementation, the terminal node 1201 is connected to the peer node 1202, and the peer node 1202 is connected to the ordering node 1203; The terminal node 1201 is used to transmit the training start instruction to the related peer node 1202 according to the preset global parameters, and forward the resource package to the smart contract deployed on the blockchain node unit. Each peer node 1202 runs the smart contract and verifies 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 sorting node 1203.

[0030] The peer node 1202 is used to 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 130, and verify 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.

[0031] The 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 of the peer nodes 1202.

[0032] The data processing unit 130 includes multiple expandable data input ports ( , ...) and a data output port InterfaceOutput, the data input port corresponds to the peer node one by one, and each data input interface is respectively connected to the peer node 1202 that provides training data to the blockchain node unit 120, that is, connect , connect The data processing unit 130 is used to filter and integrate the training data provided by the blockchain node unit 120, and transmit the filtered valuable training data to the large language model.

[0033] The model training unit 140 , which can specifically be a large language model, has an input end connected to the data processing unit 130 and an output end connected to the feedback unit 150 , and is used to calculate the filtered training data, output the actual result and feed it back to the feedback unit 150 .

[0034] The feedback unit 150 includes two data input ports, one of which is set to ) is connected to the control unit 110, and its input data is the expected result (set as vector Another data input port (set to ) is connected to the output end of the model training unit 140, and its input data is the actual result (set as vector) obtained by the large language model (LLM) for each training data The feedback unit 150 is used to calculate the deviation value according to the received expected result and the actual result. , the calculation formula is , the deviation value reflects the current prediction accuracy of the model. The feedback unit 150 is also used to , the preset weight and peer node identifier are packaged into a resource package , and feeds it back 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.

[0035] Figure 2 This is a flow chart of a method based on combining blockchain data collection and model training provided by an embodiment of the present disclosure, which is applied to Figure 1 The system shown is based on the combination of blockchain data collection and model training. Figure 2 As shown in the figure, the specific process of the method based on combining blockchain data collection and model training includes: S210: After starting the blockchain, a training start instruction is received, the training start instruction is sent to the terminal node of the blockchain node unit, and the expected result of this training is sent to the feedback unit. .

[0036] In a specific implementation, under the blockchain technology architecture, the process of starting the blockchain involves initializing multiple nodes and setting network configurations to ensure that the entire blockchain can run stably and securely. After the blockchain is started, it is in a real-time monitoring state. Once a training start instruction is received from the upper system or a specific user, the training start instruction will be immediately sent to the terminal node. The terminal node is the key unit for executing specific training tasks. In order to calculate the difference, the expected results of this training will also be sent to the terminal node. Synchronously sent to the feedback unit .

[0037] Optionally, after implementing step S210, the method may further include: whenever a new peer node that can provide training data joins the block two network, setting the initial weight value of the peer node to 1.

[0038] Optionally, the peer nodes used to provide training data are ranked by weight, so that nodes with higher weights (i.e., nodes that provide higher quality data) are given priority in providing training data. 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 allocation.

[0039] In addition, before implementing step S2010, the following steps may also be included: S2001, building the blockchain node unit based on the hyperledger architecture, including terminal nodes, peer nodes and sorting nodes.

[0040] In a specific implementation method, 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, you need to prepare hardware with sufficient computing and storage capabilities. Install an adapted operating system, download and install the Hyperledger client software from the official website, configure the port number and identity authentication information for communicating with the blockchain, and the connection information with peer and sorting nodes to ensure that they can access 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 address 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 component, and configure the sorting algorithm parameters, such as the PBFT algorithm. At the same time, configure the communication channel with the peer node, receive transaction requests in a timely manner, and set data backup and recovery strategies.

[0041] S2002, preset global parameters, including: In a specific implementation, a preset global parameter N represents the total number of peer nodes participating in each round of large language model training, and 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 each round of training can efficiently utilize an appropriate number of node resources; The preset global parameter m represents the node currently sending training data, and the initial value is set to m=1; Preset global parameters Indicates the minimum result deviation calculated during each round of large language model training; Preset global parameters Indicates the maximum result deviation calculated during each round of large language model training; These two variables are used to measure the dispersion of training results; Preset global parameters Indicates the peer that provided the training data that produced the least biased results.

[0042] S2003, constructing a data processing unit; In a specific implementation, the data processing unit includes multiple expandable data input ports and one data output port, wherein 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, and the screened training data is delivered to the large language model; and an expandable data input port architecture is designed according to the expected number of peer nodes to be connected and the type of data.

[0043] S2004, construct feedback unit; In a specific implementation, the feedback unit is connected to the output interface of the model training unit, and a data comparison and difference calculation program is written to achieve real-time analysis of expected results and actual results.

[0044] S2005, deploying smart contracts (chaincode) in blockchain; In a specific implementation method, logical rules for key operations such as data verification, global parameter update, and block generation are defined to ensure the compliance and consistency of operations of each node.

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

[0046] Each of the peer nodes is connected to an input interface of the data processing unit to ensure the specificity and stability of data transmission.

[0047] Optionally, use a switch to control the large language model to change / optimize its own parameters through training. Preset the global parameter 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 based on the feedback from model training, control the timing of parameter updates, and avoid model instability caused by over-optimization. In the early stages of training or when the large language model performs relatively stably, turn off the parameter update switch to avoid model instability or even overfitting due to frequent parameter adjustments; and when the large language model has a large deviation, such as when the feedback unit detects that the deviation between the prediction results and the actual results for multiple consecutive rounds exceeds the threshold, turn on the switch to optimize the parameters of the large language model based on the latest data.

[0048] In a specific implementation, for the i-th round of training, it is assumed that there are n peer nodes participating in providing training data, and these peer nodes are sorted from high to low according to their weights to obtain the following result: ), these peer nodes are sorted from high to low according to their weights, and the result is The training data provided by each peer node are ( ). Let the basic weight that this round of training can contribute to all nodes be The target value expected from the large language model in this round of training is the vector . Let the global parameter N=n.

[0049] S230, after receiving the training data, the data processing unit screens and integrates the training data, and transmits the screened training data to the model training unit, and the model training unit performs calculations based on the training data, outputs actual results and feeds them back to the feedback unit; In a specific implementation, the training start instruction sends the training data to the interface of the data processing unit. , while the data processing unit closes the remaining interfaces ( , ..., , , ...), to ensure the uniqueness and certainty of each round of training data input and avoid data confusion. The data processing unit will Output to the data input terminal of the model training unit.

[0050] The large language model of the model training unit calculates the training data to obtain the actual results At this time, the state of the parameter update switch Switch determines whether to update the large language model parameters (Token). 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 to optimize the internal parameters of the model based on the feedback from this training to improve the model performance. Output to the feedback unit , providing basic data for comparative analysis for the feedback unit.

[0051] S240: the feedback unit receives the expected result and the actual results Then, the deviation between the two is obtained by calculation. , and the deviation value , the preset weight and peer node identifier are packaged into a resource package , and transmit it to the terminal node immediately , so as to promptly discover possible deviations and problems in the training process, thereby providing a basis for subsequent adjustments and optimizations.

[0052] In a specific implementation, the feedback unit includes two data input ports, one of which is set to ), whose input data is the expected result (set as vector Another data input port (set to ) is the actual result (set as vector) obtained by the large language model (LLM) for each training data ). By comparing and analyzing these two result vectors, we can gain insight into the deviation of model prediction and provide direct feedback for subsequent training optimization. Calculate the deviation value The deviation value reflects the current prediction accuracy of the model. The deviation value, the preset weight and the peer node identifier are packaged into the resource package And feed it back to the terminal node to help adjust the data collection strategy.

[0053] S250, the terminal node Receive the resource package Afterwards, it is forwarded to the chain code smart contract deployed in the blockchain to drive the distributed verification process in the blockchain. Each peer node runs the smart contract to verify the authenticity of the resource package. If the verification result is true, the global parameters are updated and sent to the sorting node of the blockchain node unit.

[0054] In a specific implementation, when the terminal node Receive the resource package When it first checks the resource bundle After the integrity check is completed, 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 in it. The smart contract will decide whether to start subsequent operations based on the preset conditions. After the smart contract completes the processing of the resource package, it starts to drive the distributed verification process in the blockchain.

[0055] In a specific implementation, multiple peer nodes in the network will participate in the verification at the same time. Each peer node will verify the transaction or operation involved in the resource package based on its own stored ledger data and consensus algorithm. Only when most nodes in the network pass the verification will the transaction or operation be considered valid and 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 nature of the blockchain.

[0056] Optionally, the step of updating the global parameters specifically includes: Subtract one from the total number of peer nodes participating in the training, advance the training process in an orderly manner, and mark the nodes that have completed the task; Increment the index of the node currently sending the training data by one, and seamlessly switch to the next data providing node; If the maximum result deviation is less than the deviation value, the deviation value is set to the maximum result deviation to capture the maximum deviation change of the model training; If the minimum result deviation is greater than the deviation value, the deviation value is set to the minimum result deviation, and the peer node identifier is set to the peer node identifier that produces the minimum deviation result, ensuring the association between the key node and the deviation indicator.

[0057] S260, after receiving the updated global parameters, the sorting node generates a block according to the updated global parameters and the resource package, and sends the block to each of the peer nodes. After receiving the block, each of the peer nodes 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. In a specific implementation, the total number of peer nodes participating in the training, the node currently sending training data, the minimum result deviation, the maximum result deviation, the peer node that produces the minimum deviation result, the deviation value, the preset weight and the peer node identifier are packaged into a block.

[0058] Optionally, the block packet includes at least 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, wherein, The number of peer nodes to be trained reflects the scale of participation in the current training round in real time, providing a basis for resource allocation; Minimum result deviation and maximum result deviation quantify the fluctuation range of model training effect and provide key reference for subsequent training strategy adjustment; The peer node identification with the smallest deviation locks the nodes that are critical to model optimization, facilitating targeted attention and adjustment.

[0059] All peer nodes in the blockchain node unit run chaincode verification The authenticity of the data is verified and the verification results are sent to the sorting node. With the distributed computing power and consensus mechanism of the blockchain, the authenticity of the data feedback is ensured, and the interference of false data on the training process is eliminated.

[0060] According to the blockchain consensus mechanism, when more than 50% of the peer nodes verify and approve the resource package After the authenticity is verified, update the global parameters: Num=Num-1; m = m + 1; like , , indicating that the deviation of the model training results is within a reasonable range, and the relevant parameters can be adjusted appropriately; if , , , it indicates that the model has a large deviation and requires a more aggressive parameter adjustment strategy; Ordering Node Will The parameters are packaged into a block, and the block is sent to all peer nodes for block verification to ensure the authority and immutability of data records.

[0061] In a specific implementation, when a peer node receives a block, it checks the parameters: If Num>0 check parameters ,determine subsequent operations based on the deviation, such as whether to adjust the data sending strategy, etc.; like , m = m + 1, then verify whether the block is valid. If it is valid, add the block to the local blockchain to complete data storage and update.

[0062] If Num>0 is not satisfied, the following formula is used to update the node weight: ; like And m = j , Switch = true, indicating that the data quality provided by the current node is high and has made significant contributions to model optimization. Its weight is increased to encourage it to continue to provide high-quality data; Verify whether the block is valid. If valid, add the block to the local blockchain.

[0063] Finally, start the next round of training cycle and continuously iterate and optimize the large language model.

[0064] The method based on the combination of blockchain data collection and model training provided by the embodiment of the present disclosure, 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 node according to the preset global parameters. Under the hyperledger blockchain architecture, each peer node has the ability to collect data and select the best data for large model training. With the characteristic that the blockchain can access unlimited nodes, a large amount of training data from sources is provided for large language model training. After screening and integration, the data is input into the model training unit, and the model calculation results are fed back to the feedback unit, and the expected and actual results are compared. The resource package is encapsulated to the terminal node and then forwarded to the smart contract of the blockchain. After verification, the peer node decides whether to send it to the sorting node, and finally completes the block processing and verification. It is realized that the unlimited peer nodes in the hyperledger blockchain are accessed, and each peer node collects data, providing unlimited sources of training data for the training of the large language model, and selecting the best data to train the large model. It greatly enriches the training data of large language models, effectively improves 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.

[0065] The present application also provides a computer device. Figure 3 , Figure 3 This is a basic structural block diagram of the computer device in this embodiment.

[0066] The computer device includes a memory 310 and a processor 320 that are connected to each other through a system bus. It should be noted that the figure only shows a computer device with components 310-320, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the 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 (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0067] Computer devices can be computing devices such as desktop computers, notebooks, PDAs, and cloud servers. Computer devices can interact with users through keyboards, mice, remote controls, touch pads, or voice control devices.

[0068] The memory 310 includes at least one type of readable storage medium, and the readable storage medium includes a non-volatile memory or a volatile memory, for example, a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc., and the RAM may include a static RAM or a dynamic RAM. In some embodiments, the memory 310 may be an internal storage unit of a computer device, for example, a hard disk or a 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, a smart media card (SMC), a secure digital (SD) card, or a flash card (FlashCard) equipped on the computer device. Of course, the memory 310 may also include both the internal storage unit of the computer device and its external storage 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 are to be output.

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

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

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

[0072] Computer-readable media include but are not limited to electronic, magnetic, optical, electromagnetic, infrared memory or semiconductor systems, devices or apparatuses, or any appropriate combination of the foregoing, the memory is used to store program codes or instructions, the program codes include computer operating instructions, and the processor is used to execute the program codes or instructions of the above methods stored in the memory.

[0073] For the definitions of memory and processor, please refer to the description of the aforementioned computer device embodiment and will not be repeated here.

[0074] In the several embodiments provided in 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 schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0075] Each functional unit or module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0076] If the 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 the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.

[0077] Unless the context clearly indicates otherwise, the singular form of the words used herein and in the appended claims includes the plural and vice versa. Thus, when referring to the singular, the plural form of the corresponding term is generally included. Similarly, the words "comprise" and "include" are to be interpreted as inclusive rather than exclusive. Likewise, the terms "include" and "or" should be interpreted as inclusive unless such interpretation is expressly prohibited herein. Where the term "example" is used herein, particularly when it is located after a group of terms, the "example" is merely exemplary and illustrative and should not be considered exclusive or comprehensive.

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

[0079] Several embodiments of the present disclosure are described in detail above, but it is obvious that 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 attached claims.

Claims

1. A method based on combining blockchain data collection and model training, characterized in that: include: 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; The terminal node transmits the training start instruction to a peer node of a blockchain node unit related thereto according to preset global parameters, and the peer node obtains pre-stored training resources and preset weights, generates training data adapted to the training requirements, and transmits the training data to a data processing unit; The data processing unit screens and integrates the training data, and transmits the screened training data to the model training unit, and the model training unit performs calculations based on the training data, outputs actual results and feeds them back to the feedback unit; The feedback unit calculates a deviation value according to the received expected result and the actual result, encapsulates the deviation value, the preset weight and the peer node identifier into a resource package and transmits it to the terminal node; The terminal node forwards the resource package to the smart contract deployed on the blockchain node unit, and each of the peer nodes runs the smart contract to verify the authenticity of the resource package. If the verification result is true, the global parameters are updated and sent to the sorting node of the blockchain node unit; The sorting node generates a block according to the updated global parameters and the resource package, and sends the block to each of the peer nodes. Each of the peer nodes 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, characterized in that Before the step of receiving the training start instruction, the method further includes: Building the blockchain node unit based on the hyperledger architecture, the blockchain node unit includes the terminal node, the peer node and the sorting node; Preset global parameters, including but not limited to the total number of peer nodes participating in the training, the node currently sending training data, the minimum result deviation, the maximum result deviation, and the peer node that produces the minimum deviation result; Constructing the data processing unit, receiving and screening the training data, and sending the screened training data to the model training unit; Construct the feedback unit, calculate the expected result and the actual result output by the model training unit, obtain the deviation value, package the deviation value, the preset weight and the peer node identifier into the resource package and feed it back to the terminal node.

3. The method according to claim 1, characterized in that After the step of receiving the training start instruction, the method further comprises: Whenever a new peer node that can provide training data joins the block two network, the initial weight value of the peer node is set to 1.

4. The method according to claim 1, characterized in that: The peer nodes for providing training data are sorted according to weights, so that peer nodes with high weights are given priority in providing the training data.

5. The method according to claim 1, characterized in that The step of updating the global parameters comprises: Subtract one from the total number of peer nodes participating in the training; Add one to the node index currently sending the training data; If the maximum result deviation is less than the deviation value, setting the deviation value to the maximum result deviation; If the minimum result deviation is greater than the deviation value, the deviation value is set to the minimum result deviation, and the peer node identifier is set to the peer node identifier that generates the minimum deviation result.

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

7. The method according to claim 1, characterized in that The step of each of the peer nodes verifying the validity of the block according to the information in the block, and if the block is verified to be valid, adding the block to the local blockchain, and if the block is verified to be invalid, updating the weight of its own node, includes: After receiving the block package, the current peer node determines the total number of peer nodes participating in the training. If it is greater than zero, the current peer node identifier and the peer node identifier in the block package are determined. If the two are equal, the deviation in the block package is extracted and saved as the actual difference of the peer node target, and the block is added to the local blockchain; If the total number of peer nodes participating in the training is equal to zero, the weight of the peer node is updated: the weight of the peer node = the original peer node weight + (the actual difference between the peer node target and the maximum result deviation) The weight in the block package; Determine whether the current node index matches the peer node identifier with the minimum deviation. If so, set the current peer node point index to the current peer node index, and set the global parameter update switch to on to trigger the model training unit parameter update process.

8. A system based on combining blockchain data collection and model training, characterized in that: It is used to implement the method based on combining blockchain data collection and model training as described in any one of claims 1 to 7, and the system includes: 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 a sorting 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 peer node related thereto according to the preset global parameters, and forward the resource package to the smart contract deployed on the blockchain node unit. Each of the peer nodes 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 sorting node of the blockchain node unit. The peer node is used to obtain pre-stored training resources and preset weights, generate training data adapted to training requirements, 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, the block is added to the local blockchain. If the block is verified to be invalid, the weight of the node itself is updated to optimize the subsequent training process; The data processing unit is used to screen and integrate the training data, and transmit the screened training data to the model training unit; The model training unit is used to perform calculations based on the screened training data, output actual results and feed them back to the feedback unit; The feedback unit is used to calculate a 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; The sorting node is used to generate a block according to the updated global parameters and the resource package, and send the block to each of the peer nodes.

9. A computer device, characterized in that: include: 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 a 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

  • Model training method for federated learning network, and related device

    WO2021120676A1

  • Blockchain-based federated learning method and apparatus

    WO2022217914A1