Privacy computing methods, devices, equipment, media and products based on blockchain

Through the method of machine learning model training on blockchain, the problem of data leakage risk in multiple data source scenarios is solved, and the combination of privacy computing and data security is achieved.

CN119046979BActive Publication Date: 2025-03-04GOLDEN NETWORK (BEIJING) E-COMMERCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411084039.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-08
Publication Date
2025-03-04
Estimated Expiration
2044-08-08

AI Technical Summary

Technical Problem

Existing machine learning model training schemes based on multi-data sources are prone to risk of data leakage, resulting in data security being threatened.

Method used

Using a blockchain-based privacy computing method, the computing tasks used to train machine learning models are on the chain and propagated between blockchain nodes. By constructing equation systems and solving training and adjustment values ​​of model parameters, model training and verification are realized to avoid the transmission of training data.

Benefits of technology

It realizes model training with the characteristics of privacy computing in the data source side in multi-data source scenarios, and integrates the training results on each side to avoid the transmission of training data, thereby protecting data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119046979B_ABST
    Figure CN119046979B_ABST
Patent Text Reader

Abstract

The present invention discloses a privacy computing method, device, equipment, medium and product based on blockchain, and relates to the field of privacy computing technology. The method is to first upload the computing task for training the machine learning model to the chain to transmit it to the data source side node device as other blockchain nodes, so that the node device can build a machine learning model when it determines that multiple training sample data can be obtained, and apply the training sample data to obtain the model training results and complete the chain, then build a set of equations based on the model training results on multiple chains and solve them to obtain the training adjustment values ​​of the model parameters, and finally build and verify the trained model that has achieved the model training target based on the training adjustment values, so that the data source side can be driven to perform model training with privacy computing characteristics, and the training results of each side are integrated to obtain a qualified trained model, so as to avoid the transmission of training data to protect data security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of privacy computing technology, and specifically relates to a privacy computing method, device, equipment, medium and product based on blockchain. Background Art

[0002] Blockchain technology, with its characteristics of decentralization, multi-party consensus, difficulty in tampering, openness, transparency and traceability, can, to a certain extent, provide a relatively reliable data anti-tampering solution. At the same time, with the development of big data technology, it is becoming more and more common to perform comprehensive operations on data from multiple participants. In order to avoid data privacy leakage in the scenario of data sharing between multiple parties, it is necessary to achieve "data available but invisible" through privacy computing (also known as privacy-preserving computing, which is a computing mode that protects data privacy). There are two main mainstream technical routes for privacy computing: one is to use cryptography and distributed systems, represented by secure multiparty computing (MPC); the other is to use a hardware-based trusted execution environment (TEE). In addition, there are technologies such as zero-knowledge proof, homomorphic encryption and differential privacy.

[0003] At present, in machine learning computing tasks, training data is usually aggregated from multiple data sources, and all training data is transmitted to a central server to train the machine learning model. However, this process is prone to data leakage risks. Therefore, in the process of machine learning model training based on multiple data sources, how to drive the data source side to perform model training with privacy computing characteristics and integrate the training results of each side to obtain a qualified trained model, so as to avoid the transmission of training data to protect data security, is a topic that technicians in this field need to study urgently. Summary of the invention

[0004] The purpose of the present invention is to provide a privacy computing method, apparatus, computer device, computer-readable storage medium and computer program product based on blockchain, so as to solve the problem of data leakage risk existing in the existing machine learning model training scheme based on multiple data sources.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions:

[0006] In the first aspect, a privacy computing method based on blockchain is provided, comprising:

[0007] Generate a computing task for training a machine learning model, wherein the computing task includes a unique identifier of the machine learning model to be trained, hyperparameters, initial values ​​of N model parameters, multiple model input item variables, and model output item variables, where N represents a positive integer greater than or equal to 2;

[0008] Generate a first block in the blockchain, and store the computing task in the first block;

[0009] The first block is broadcasted and transmitted to other blockchain nodes so that the data source side node devices of the other blockchain nodes can read the computing task from the first block and execute the computing task, specifically including the following steps: judging whether a plurality of training sample data can be obtained according to the model input item variables and the model output item variables, and if so, firstly building a first machine learning model according to the unique identifier of the machine learning model to be trained, the hyperparameters and the initial values ​​of the N model parameters, and then applying the plurality of training sample data to perform model training and verification on the first machine learning model to obtain the current adjustment values ​​of the N model parameters and the first model accuracy index value, and then generating a second block in the blockchain, and storing the current adjustment values ​​of the N model parameters and the first model accuracy index value in the second block, and finally broadcasting the second block, wherein the training sample data contains at least one first model input value corresponding to at least one model input item variable among the plurality of model input item variables and a first model output value corresponding to the model output item variable one by one;

[0010] When receiving the second block, reading the current adjustment values ​​of the N model parameters and the first model accuracy index value from the second block;

[0011] According to the current adjustment values ​​of the N model parameters read from the most recently received M second blocks and the first model accuracy index value, the following set of equations to be solved is constructed:

[0012]

[0013] In the formula, m1 and m2 represent positive integers, M represents a positive integer greater than or equal to 3, and D m1 Represents the array to be solved X = {x 1 ,x 2 ,…,x n ,…,x N} and the Euler distance between the current adjustment values ​​of the N model parameters read from the most recently received m1-th second block, D m2represents the Euler distance between the array to be solved X and the current adjustment values ​​of the N model parameters read from the m2-th second block most recently received, P m1 represents the first model accuracy index value read from the m1th second block received most recently, P m2 represents the first model accuracy index value read from the m2th second block received most recently, n represents a positive integer less than or equal to N, x n represents a value to be solved corresponding to the nth model parameter among the N model parameters;

[0014] Solve the set of equations to be solved to obtain a solved array in, represents a solved value corresponding to the nth model parameter among the N model parameters;

[0015] The solved array as training adjustment values ​​of the N model parameters, and constructing a second machine learning model according to the unique identifier of the machine learning model to be trained, the hyperparameter and the training adjustment values ​​of the N model parameters;

[0016] Applying a validation set to perform model validation on the second machine learning model to obtain a second model accuracy index value, wherein the validation set includes a plurality of validation sample data, and the validation sample data includes a plurality of second model input values ​​corresponding one-to-one to the plurality of model input item variables and a second model output value corresponding one-to-one to the model output item variables;

[0017] If it is determined that the accuracy index value of the second model reaches the preset index threshold, the second machine learning model will be regarded as a trained completed model that has achieved the model training goal.

[0018] Based on the above invention content, a new scheme is provided for using blockchain technology privacy to complete machine learning model training tasks based on multiple data sources, that is, firstly, the computing task for training the machine learning model is uploaded to the chain to be transmitted to the data source side node device as other blockchain nodes, so that the node device can build a machine learning model when it determines that multiple training sample data can be obtained, and apply the training sample data to obtain the model training results and complete the chain, and then build a set of equations based on the model training results on multiple chains and solve them to obtain the training adjustment values ​​of the model parameters, and finally, build and verify the trained model that has achieved the model training goals based on the training adjustment values, so as to drive the data source side to perform model training with privacy computing characteristics, and integrate the training results of each side to obtain a qualified trained model, so as to achieve the purpose of avoiding the transmission of training data to protect data security, and facilitate practical application and promotion.

[0019] In a possible design, the computing task includes a plurality of ciphertexts, the plurality of model input item variables and the model output item variables are encrypted in the ciphertexts, wherein each ciphertext in the plurality of ciphertexts is encrypted using a different private key;

[0020] Reading the computing task from the first block and executing the computing task includes: first reading the computing task from the first block, and then decrypting the ciphertexts using the local public key; if any ciphertext among the multiple ciphertexts is successfully decrypted, executing the computing task; otherwise, not executing the computing task.

[0021] In one possible design, some of the multiple model input item variables and the model output item variables are encrypted in the ciphertext, and all the model input item variables in the multiple ciphertexts constitute the multiple model input item variables.

[0022] In a possible design, the computing task further includes the verification set;

[0023] Applying the plurality of training sample data to perform model training and verification on the first machine learning model to obtain current adjustment values ​​of the N model parameters and a first model accuracy index value, including:

[0024] Using the plurality of training sample data to perform model training on the first machine learning model to obtain a new model;

[0025] The new model is validated using the validation set to obtain a first model accuracy index value, and current adjustment values ​​of the N model parameters are extracted from the new model.

[0026] In one possible design, the solved array After the training adjustment values ​​of the N model parameters are obtained, the method further comprises:

[0027] Generating a third block in the blockchain, and storing the training adjustment values ​​of the N model parameters in the third block;

[0028] The third block is broadcasted to other blockchain nodes so that the data source side node devices of the other blockchain nodes read the training adjustment values ​​of the N model parameters from the third block, and also perform the computing task according to the following steps: the training adjustment values ​​of the N model parameters are updated to the first machine learning model to obtain a third machine learning model, and then the third machine learning model is trained and verified using the multiple training sample data to obtain a new model training result, and then a new second block is generated in the blockchain, and the new model training result is stored in the new second block, and finally the new second block is broadcast, wherein the model training result includes the current adjustment values ​​of the N model parameters and the first model accuracy index value.

[0029] In one possible design, after taking the second machine learning model as a trained model that has achieved the model training target, the method further includes:

[0030] Generate a fourth block in the blockchain, and store an end identifier of the computing task in the fourth block;

[0031] The fourth block is broadcasted to other blockchain nodes so that the data source side node devices of the other blockchain nodes read the end identifier of the computing task from the fourth block and then end the execution of the computing task.

[0032] In a second aspect, a privacy computing device based on blockchain is provided, comprising a computing task generation unit, a computing task chain unit, a block receiving and sending processing unit, an equation group construction unit, an equation group solving unit, a training model construction unit, a training model verification unit and a training model confirmation unit which are sequentially connected in communication;

[0033] The computing task generating unit is used to generate a computing task for training a machine learning model, wherein the computing task includes a unique identifier of the machine learning model to be trained, a hyperparameter, initial values ​​of N model parameters, a plurality of model input item variables and a model output item variable, where N represents a positive integer greater than or equal to 2;

[0034] The computing task chain unit is used to generate a first block in the blockchain and store the computing task in the first block;

[0035] The block transceiver processing unit is used to broadcast the first block to other blockchain nodes so that the data source side node device of the other blockchain nodes can read the computing task from the first block and execute the computing task, specifically including the following steps: judging whether multiple training sample data can be obtained according to the model input item variables and the model output item variables, and if so, first constructing a first machine learning model according to the unique identifier of the machine learning model to be trained, the hyperparameters and the initial values ​​of the N model parameters, and then applying the multiple training sample data to perform model training and verification on the first machine learning model to obtain the current adjustment values ​​of the N model parameters and the first model accuracy index value, and then generating a second block in the blockchain, and storing the current adjustment values ​​of the N model parameters and the first model accuracy index value in the second block, and finally broadcasting the second block, wherein the training sample data contains at least one first model input value corresponding to at least one model input item variable among the multiple model input item variables and a first model output value corresponding to the model output item variable one by one;

[0036] The block transceiver processing unit is further configured to read the current adjustment values ​​of the N model parameters and the first model accuracy index value from the second block when receiving the second block;

[0037] The equation group construction unit is used to construct the following equation group to be solved according to the current adjustment values ​​of the N model parameters read from the most recently received M second blocks and the first model accuracy index value:

[0038]

[0039] In the formula, m1 and m2 represent positive integers, M represents a positive integer greater than or equal to 3, and D m1 Represents the array to be solved X = {x 1 ,x 2 ,…,x n ,…,x N} and the Euler distance between the current adjustment values ​​of the N model parameters read from the most recently received m1-th second block, D m2 represents the Euler distance between the array to be solved X and the current adjustment values ​​of the N model parameters read from the m2-th second block most recently received, P m1 represents the first model accuracy index value read from the m1th second block received most recently, P m2 represents the first model accuracy index value read from the m2th second block received most recently, n represents a positive integer less than or equal to N, x nrepresents a value to be solved corresponding to the nth model parameter among the N model parameters;

[0040] The equation solving unit is used to solve the equation to be solved to obtain a solved array. in, represents a solved value corresponding to the nth model parameter among the N model parameters;

[0041] The training model building unit is used to convert the solved array as training adjustment values ​​of the N model parameters, and constructing a second machine learning model according to the unique identifier of the machine learning model to be trained, the hyperparameter and the training adjustment values ​​of the N model parameters;

[0042] The training model verification unit is used to apply the verification set to perform model verification on the second machine learning model to obtain a second model accuracy index value, wherein the verification set includes a plurality of verification sample data, and the verification sample data includes a plurality of second model input values ​​corresponding one-to-one to the plurality of model input item variables and a second model output value corresponding one-to-one to the model output item variables;

[0043] The training model confirmation unit is used to regard the second machine learning model as a trained completed model that has achieved the model training goal if it is determined that the second model accuracy index value reaches a preset index threshold.

[0044] In a third aspect, the present invention provides a computer device comprising a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program to execute the privacy computing method as described in the first aspect or any possible design of the first aspect.

[0045] In a fourth aspect, the present invention provides a computer-readable storage medium having instructions stored thereon. When the instructions are run on a computer, the privacy computing method as described in the first aspect or any possible design of the first aspect is executed.

[0046] In a fifth aspect, the present invention provides a computer program product, comprising a computer program or instructions, which, when executed by a computer, implement the privacy computing method as described in the first aspect or any possible design of the first aspect.

[0047] Beneficial effects of the above scheme:

[0048] (1) The present invention creatively provides a new solution for completing machine learning model training tasks based on multiple data sources using blockchain technology privacy, namely, firstly uploading the computing task for training the machine learning model to the chain to transmit it to the data source side node device as other blockchain nodes, so that when the node device determines that multiple training sample data can be obtained, it constructs the machine learning model, and applies the training sample data to obtain the model training results and completes the chain, then constructs a set of equations based on the model training results on multiple chains and solves them to obtain the training adjustment values ​​of the model parameters, and finally builds and verifies the trained model that has achieved the model training objectives based on the training adjustment values. In this way, the data source side can be driven to perform model training with privacy computing characteristics, and the training results of each side can be integrated to obtain a qualified trained model, thereby achieving the purpose of avoiding the transmission of training data to protect data security, and facilitating practical application and promotion. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 A flowchart of a privacy computing method based on blockchain provided in an embodiment of the present application.

[0051] Figure 2 A schematic diagram of the structure of a blockchain-based privacy computing device provided in an embodiment of the present application.

[0052] Figure 3 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in combination with the drawings and the description of the embodiments or the prior art. Obviously, the following description of the structures of the drawings is only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can be obtained based on these embodiments without creative work. It should be noted that the description of these embodiments is used to help understand the present invention, but does not constitute a limitation of the present invention.

[0054] It should be understood that although the terms first and second, etc. may be used herein to describe various objects, these objects should not be limited by these terms. These terms are only used to distinguish one object from another object. For example, a first object can be referred to as a second object, and similarly, a second object can be referred to as a first object without departing from the scope of the exemplary embodiments of the present invention.

[0055] It should be understood that the term "and / or" that may appear in this document is merely a description of the association relationship between associated objects, indicating that there may be three relationships. For example, A and / or B can indicate three situations: A exists alone, B exists alone, or A and B exist at the same time. For another example, A, B and / or C can indicate the existence of any one of A, B and C or any combination of them. The term " / and" that may appear in this document describes another type of association object relationship, indicating that there may be two relationships. For example, A / and B can indicate two situations: A exists alone or A and B exist at the same time. In addition, the character " / " that may appear in this document generally indicates that the previous and next associated objects are in an "or" relationship.

[0056] Example

[0057] like Figure 1 As shown, the privacy computing method based on blockchain provided in the first aspect of this embodiment can be executed by, but not limited to, a computer device with certain computing resources and connected to multiple data source side node devices based on blockchain technology, for example, a central server that needs to train a machine learning model. Figure 1 As shown, the privacy computing method may include but is not limited to the following steps S1 to S9.

[0058] S1. Generate a computing task for training a machine learning model, wherein the computing task includes but is not limited to a unique identifier of the machine learning model to be trained, hyperparameters, initial values ​​of N model parameters, multiple model input variables and model output variables, etc., and N represents a positive integer greater than or equal to 2.

[0059] In the step S1, the computing task may be specifically, but not limited to, conventionally generated in response to human-computer interaction operations, such as selecting and determining the machine learning model to be trained, filling in the hyperparameters, and setting the model input item variables and / or the model output item variables under the user human-computer interaction operation. The unique identifier is used to mark the machine learning model to be trained, such as marking a machine learning model to be trained based on a support vector machine, stochastic gradient descent, multivariate linear regression, multilayer perceptron, decision tree, back propagation neural network, or radial basis function network. The hyperparameter refers to a parameter that needs to be set to a specific value before model training (note that the specific value is not obtained through training), such as batch size, learning rate, regularization term coefficient (weight decay) and / or gamma in the kernel function, etc. The model parameter refers to a parameter in the machine learning model to be trained that can be automatically adjusted through learning, such as the node value of a hidden node or the weight and bias of deep learning, etc. The model input variable refers to a related variable used as input data in the model training process and having a direct impact on the model output variable. For example, when the model output variable is temperature, the model input variable may be resistance, power and / or cooling water flow, etc. The model output variable refers to a prediction target variable used as output data in the model training process, such as temperature that needs to be predicted through model training.

[0060] S2. Generate a first block in the blockchain, and store the computing task in the first block.

[0061] In the step S2, the blockchain is used to tamper-proof record the computing task and the model training results corresponding to the computing task (such as the current adjustment values ​​of the N model parameters and the first model accuracy index value, etc.). Since the blockchain is an existing term in blockchain technology (Blockchain technology, also known as distributed ledger technology, is an Internet database technology characterized by decentralization, openness and transparency, allowing everyone to participate in database records; in a narrow sense, blockchain is a chain data structure that combines data blocks in a sequential manner in chronological order, and a distributed ledger that is tamper-proof and non-forgeable by cryptography; in a broad sense, blockchain technology is a new distributed infrastructure and computing method that uses a block chain data structure to verify and store data, uses a distributed node consensus algorithm to generate and update data, uses cryptography to ensure the security of data transmission and access, and uses smart contracts composed of automated script codes to program and operate data), the computing task can be chained using existing blockchain technology, so as to ensure the high credibility of the chained data by using the decentralized and tamper-proof characteristics of blockchain technology.

[0062] S3. Broadcast the first block to other blockchain nodes so that the data source side node devices of the other blockchain nodes read the computing task from the first block and execute the computing task, specifically including but not limited to the following steps S31 to S34.

[0063] In the step S3, since the machine learning model training is based on multiple data sources, there will be multiple data source side node devices used as the other blockchain nodes (i.e., another computer device arranged in each data source in the multiple data sources and having certain computing resources). The data source side node device can use the existing blockchain technology to download the computing task to complete the reading. In order to achieve the purpose of specifying the data source side node device to participate in model training and improve the privacy of model training calculation, preferably, the computing task contains multiple ciphertexts, the multiple model input item variables and the model output item variables are encrypted in the ciphertext, wherein each ciphertext in the multiple ciphertexts is encrypted using a different private key; read the computing task from the first block, and execute the computing task, including but not limited to: first read the computing task from the first block, and then use the local public key to decrypt the ciphertexts, if any ciphertext in the multiple ciphertexts is successfully decrypted, then execute the computing task, otherwise do not execute the computing task. The aforementioned private key and public key need to be configured in advance through trusted binding between the computer device used to execute the privacy computing method and the node device on the data source side based on the existing asymmetric encryption technology, wherein the private key is configured in the computer device used to execute the privacy computing method, and the public key is configured in the node device on the data source side, and different private keys correspond to different node devices on the data source side. For example, if the multiple ciphertexts include ciphertext A, ciphertext B and ciphertext C, wherein ciphertext A can be obtained by encrypting the multiple model input item variables and the model output item variables using the private key corresponding to the node device A on the data source side (in this case, ciphertext A can only be successfully decrypted by the node device A on the data source side using the local public key), ciphertext B can be obtained by encrypting the multiple model input item variables and the model output item variables using the private key corresponding to the node device B on the data source side (in this case, ciphertext B can only be successfully decrypted by the node device B on the data source side using the local public key), and ciphertext C can be obtained by encrypting the multiple model input item variables and the model output item variables using the private key corresponding to the node device C on the data source side (in this case, ciphertext C can only be successfully decrypted by the node device C on the data source side using the local public key); and for the existing node device D on the data source side, since the ciphertext A, the ciphertext B and / or the ciphertext C cannot be successfully decrypted, the computing task will not be executed (in this case, the node device A on the data source side, the node device B on the data source side and the node device D on the data source side will execute the computing task). In addition, the unique identifier of the machine learning model to be trained, the hyperparameters and the initial values ​​of the N model parameters, etc. can also be encrypted in the ciphertext to further improve the privacy of the model training calculation.

[0064] In step S3, in order to achieve the purpose of informing only part of the model input item variables to a specified data source side node device to further improve the privacy of the model training calculation, it is further preferred that part of the multiple model input item variables and the model output item variables are encrypted in the ciphertext, and all the model input item variables in the multiple ciphertexts constitute the multiple model input item variables. For example, if the multiple model input item variables include variable A, variable B, variable C, variable D and variable E, wherein the variable A, the variable B and the model output item variable are encrypted in the ciphertext A, the variable B, the variable C and the model output item variable are encrypted in the ciphertext B, and the variable C, the variable D, the variable E and the model output item variable are encrypted in the ciphertext C. In this way, the node device A on the data source side can only decrypt and know that the variable A, the variable B and the model output item variable will participate in the model training, the node device B on the data source side can only decrypt and know that the variable B, the variable C and the model output item variable will participate in the model training, and the node device C on the data source side can only decrypt and know that the variable C, the variable D, the variable E and the model output item variable will participate in the model training, thereby avoiding the leakage of the model input item variables participating in the model training between the node devices on the data source side, and further improving the privacy of the model training calculation.

[0065] S31. Determine whether multiple sets of training sample data can be obtained based on the model input item variables and the model output item variables, wherein the training sample data contains at least one first model input value corresponding one-to-one to at least one model input item variable among the multiple model input item variables and a first model output value corresponding one-to-one to the model output item variable.

[0066] In step S31, since the data source side node device is arranged at the data source, it can be conventionally determined whether multiple copies of the training sample data can be obtained based on the matching results of the local data and the model input item variables. For example, when the model output item variable is temperature and the multiple model input item variables include resistance, power and cooling water flow, if the local data contains temperature values, resistance values ​​and power values ​​collected in time series, it can be determined that multiple copies of training sample data can be obtained (that is, the at least one first model input value is resistance data and power value, and the first model output value is temperature value); and if the local data only contains temperature values ​​collected in time series, it can be determined that multiple copies of training sample data cannot be obtained (due to the lack of the first model input value). In addition, the at least one model input item variable can also be specifically specified by the partial variables encrypted into the ciphertext.

[0067] S32. If yes, construct a first machine learning model according to the unique identifier of the machine learning model to be trained, the hyperparameters and the initial values ​​of the N model parameters.

[0068] In step S32, since the unique identifier of the machine learning model to be trained, the hyperparameters and the N model parameters are basic elements of the model, the first machine learning model can be conventionally constructed based on them. In addition, if it is determined that the multiple training sample data cannot be obtained, the computing task will be terminated due to lack of training sample data.

[0069] S33. Use the multiple training sample data to perform model training and verification on the first machine learning model to obtain the current adjustment values ​​of the N model parameters and the first model accuracy index value.

[0070] In the step S33, the specific process of model training and verification can be conventionally derived by referring to the existing calibration verification modeling process (specifically including the calibration process and verification process of the model, that is, first comparing the model simulation results with the measured data, and then adjusting the model parameters according to the comparison results, so that the simulation results are consistent with the actual process). Preferably, in the model training process of the first machine learning model, a tree-structured Bayesian optimization algorithm is used to tune the model parameters. In addition, the accuracy index value of the first model is specifically but not limited to accuracy (Accuracy), precision (Precision) or recall (Recall) and the like (these indicators are all existing terms).

[0071] S34. Generate a second block in the blockchain, store the current adjustment values ​​of the N model parameters and the first model accuracy index value in the second block, and finally broadcast the second block.

[0072] In step S34, the current adjustment values ​​of the N model parameters and the first model accuracy index value can also be uploaded to the chain using existing blockchain technology. In addition, if new copies of the training sample data are obtained, the new copies of the training sample data can be continuously applied to perform model training and verification on the first machine learning model again to obtain new model training results (i.e., the current adjustment values ​​of the N model parameters and the first model accuracy index value) and complete the upload to the chain.

[0073] S4. When the second block is received, the current adjustment values ​​of the N model parameters and the first model accuracy index value are read from the second block.

[0074] In step S4, the existing blockchain technology can also be used to download the current adjustment values ​​of the N model parameters and the first model accuracy index value to complete the reading.

[0075] S5. Construct the following set of equations to be solved according to the current adjustment values ​​of the N model parameters read from the most recently received M second blocks and the first model accuracy index value:

[0076]

[0077] In the formula, m1 and m2 represent positive integers, M represents a positive integer greater than or equal to 3, and D m1 Represents the array to be solved X = {x 1 ,x 2 ,…,x n ,…,x N} and the Euler distance between the current adjustment values ​​of the N model parameters read from the most recently received m1-th second block, D m2 represents the Euler distance between the array to be solved X and the current adjustment values ​​of the N model parameters read from the m2-th second block most recently received, P m1 represents the first model accuracy index value read from the m1th second block received most recently, P m2 represents the first model accuracy index value read from the m2th second block received most recently, n represents a positive integer less than or equal to N, x n represents the value to be solved corresponding to the nth model parameter among the N model parameters, f - () indicates a negative correlation function.

[0078] In the step S5, the specific calculation formula of the Euler distance is an existing formula. Considering the Euler distance from the current adjustment value of the N model parameters (i.e., a point in the N-dimensional space, each dimension in the N-dimensional space corresponds one-to-one to each model parameter in the N model parameters) to the training adjustment value of the N model parameters of the machine learning model obtained based on multiple data sources training (i.e., another point in the N-dimensional space), it must be negatively correlated with the first model accuracy index value, that is, the smaller the first model accuracy index value, the larger the Euler distance, and vice versa. Therefore, the training adjustment value of the N model parameters of the machine learning model obtained based on multiple data sources training can be first set as the array X to be solved, and then the set of equations to be solved can be constructed to solve the training adjustment value of the N model parameters of the machine learning model obtained based on multiple data sources training. Specifically, based on the knowledge of permutations and combinations, the set of equations to be solved will contain N quadratic equations, where the value of M needs to ensure the above N quadratic equations can be successfully solved, for example, when N is equal to 2, M needs to be at least 3. In addition, the negative correlation function f - () can be exemplified by f - (p)=1-p, where p represents the function variable (ie, the accuracy index value of the first model).

[0079] S6. Solve the set of equations to be solved to obtain a solved array in, represents the solved value corresponding to the nth model parameter among the N model parameters.

[0080] In step S6, the specific solution process of the equation group to be solved is the existing technology, for example, it is specifically implemented by using the existing homogeneous combination solution method, Lagrange substitution method or deformation method and other multivariate quadratic equation group solution methods.

[0081] S7. The solved array As the training adjustment values ​​of the N model parameters, and constructing a second machine learning model according to the unique identifier of the machine learning model to be trained, the hyperparameters and the training adjustment values ​​of the N model parameters.

[0082] In step S7, if the solved array If there are multiple, the average results of these solved arrays can be used as the training adjustment values ​​of the N model parameters. In addition, in order to share the training adjustment values ​​of the N model parameters with the data source side so that the data source side can obtain model parameters closer to the actual situation, preferably, when the solved array is used After the training adjustment values ​​of the N model parameters are obtained, the method further includes but is not limited to the following steps S71 to S72.

[0083] S71. Generate a third block in the blockchain, and store the training adjustment values ​​of the N model parameters in the third block.

[0084] In step S71, the training adjustment values ​​of the N model parameters can also be uploaded to the chain using existing blockchain technology. In addition, the training adjustment values ​​of the N model parameters can also be encrypted and uploaded to the chain using a private key so that only a certain designated data source side node device is informed, further improving the privacy of the model training calculation.

[0085] S72. Broadcast the third block to other blockchain nodes so that the data source side node devices of the other blockchain nodes read the training adjustment values ​​of the N model parameters from the third block, and also perform the computing task according to the following steps: update the training adjustment values ​​of the N model parameters to the first machine learning model to obtain a third machine learning model, and then apply the multiple training sample data to perform model training and verification on the third machine learning model to obtain a new model training result, and then generate a new second block in the blockchain, and store the new model training result in the new second block, and finally broadcast the new second block, wherein the model training result includes the current adjustment values ​​of the N model parameters and the first model accuracy index value.

[0086] In step S72, the specific technical details can be derived from the above steps S31 to S34, which will not be repeated here. In addition, if new training sample data is obtained, the new training sample data can be applied to train and verify the third machine learning model, obtain new model training results and complete the chain.

[0087] S8. Use the validation set to perform model validation on the second machine learning model to obtain a second model accuracy index value, wherein the validation set contains multiple validation sample data, and the validation sample data contains multiple second model input values ​​corresponding one-to-one to the multiple model input item variables and second model output values ​​corresponding one-to-one to the model output item variables.

[0088] In the step S8, the verification set can also be used as public test data so that a more accurate value of the first model accuracy index can be obtained on the data source side, that is, preferably, the computing task also includes the verification set; and the first machine learning model is trained and verified using the multiple training sample data to obtain the current adjustment values ​​of the N model parameters and the first model accuracy index value, specifically including but not limited to: firstly, the first machine learning model is trained using the multiple training sample data to obtain a new model; then, the new model is model verified using the verification set to obtain the first model accuracy index value, and the current adjustment values ​​of the N model parameters are extracted from the new model. In addition, the second model accuracy index value may also be specifically but not limited to accuracy, precision or recall, etc., and the verification set may also be encrypted in the ciphertext to further improve the privacy of the model training calculation.

[0089] S9. If it is determined that the accuracy index value of the second model reaches the preset index threshold, the second machine learning model is regarded as a trained completed model that has achieved the model training goal.

[0090] In step S9, if it is determined that the second model accuracy index value does not reach the index threshold, steps S5 to S8 will be returned to execution until it is determined that the second model accuracy index value reaches the index threshold. In order to promptly instruct the data source side node device to terminate the execution of the computing task, preferably, after the second machine learning model is used as a trained completed model that has achieved the model training target, the method also includes but is not limited to the following steps: generating a fourth block in the blockchain, and storing the end identifier of the computing task in the fourth block; broadcasting the fourth block to other blockchain nodes, so that the data source side node devices of the other blockchain nodes read the end identifier of the computing task from the fourth block, and then terminate the execution of the computing task.

[0091] Therefore, based on the privacy computing method described in the aforementioned steps S1 to S9, a new solution is provided for using blockchain technology privacy to complete machine learning model training tasks based on multiple data sources, that is, the computing task for training the machine learning model is first uploaded to the chain to be transmitted to the data source side node device as other blockchain nodes, so that when the node device determines that multiple training sample data can be obtained, it builds a machine learning model, and applies the training sample data to obtain the model training results and completes the chain, and then constructs a set of equations based on the model training results of multiple chains and solves them to obtain the training adjustment values ​​of the model parameters, and finally builds and verifies the trained model that has achieved the model training goals based on the training adjustment values. In this way, the data source side can be driven to perform model training with privacy computing characteristics, and the training results of each side can be integrated to obtain a qualified trained model, so as to achieve the purpose of avoiding the transmission of training data to protect data security, which is convenient for practical application and promotion.

[0092] like Figure 2 As shown, the second aspect of this embodiment provides a virtual device for implementing the privacy computing method based on blockchain described in the first aspect, including a computing task generation unit, a computing task chain unit, a block receiving and sending processing unit, an equation group construction unit, an equation group solving unit, a training model construction unit, a training model verification unit and a training model confirmation unit that are sequentially connected in communication;

[0093] The computing task generating unit is used to generate a computing task for training a machine learning model, wherein the computing task includes a unique identifier of the machine learning model to be trained, a hyperparameter, initial values ​​of N model parameters, a plurality of model input item variables and a model output item variable, where N represents a positive integer greater than or equal to 2;

[0094] The computing task chain unit is used to generate a first block in the blockchain and store the computing task in the first block;

[0095] The block transceiver processing unit is used to broadcast the first block to other blockchain nodes so that the data source side node device of the other blockchain nodes can read the computing task from the first block and execute the computing task, specifically including the following steps: judging whether multiple training sample data can be obtained according to the model input item variables and the model output item variables, and if so, first constructing a first machine learning model according to the unique identifier of the machine learning model to be trained, the hyperparameters and the initial values ​​of the N model parameters, and then applying the multiple training sample data to perform model training and verification on the first machine learning model to obtain the current adjustment values ​​of the N model parameters and the first model accuracy index value, and then generating a second block in the blockchain, and storing the current adjustment values ​​of the N model parameters and the first model accuracy index value in the second block, and finally broadcasting the second block, wherein the training sample data contains at least one first model input value corresponding to at least one model input item variable among the multiple model input item variables and a first model output value corresponding to the model output item variable one by one;

[0096] The block transceiver processing unit is further configured to read the current adjustment values ​​of the N model parameters and the first model accuracy index value from the second block when receiving the second block;

[0097] The equation group construction unit is used to construct the following equation group to be solved according to the current adjustment values ​​of the N model parameters read from the most recently received M second blocks and the first model accuracy index value:

[0098]

[0099] In the formula, m1 and m2 represent positive integers, M represents a positive integer greater than or equal to 3, and D m1 Represents the array to be solved X = {x 1 ,x 2 ,…,x n ,…,x N} and the Euler distance between the current adjustment values ​​of the N model parameters read from the most recently received m1-th second block, D m2 represents the Euler distance between the array to be solved X and the current adjustment values ​​of the N model parameters read from the m2-th second block most recently received, P m1represents the first model accuracy index value read from the m1th second block received most recently, P m2 represents the first model accuracy index value read from the m2th second block received most recently, n represents a positive integer less than or equal to N, x n represents a value to be solved corresponding to the nth model parameter among the N model parameters;

[0100] The equation solving unit is used to solve the equation to be solved to obtain a solved array. in, represents a solved value corresponding to the nth model parameter among the N model parameters;

[0101] The training model building unit is used to convert the solved array as training adjustment values ​​of the N model parameters, and constructing a second machine learning model according to the unique identifier of the machine learning model to be trained, the hyperparameter and the training adjustment values ​​of the N model parameters;

[0102] The training model verification unit is used to apply the verification set to perform model verification on the second machine learning model to obtain a second model accuracy index value, wherein the verification set includes a plurality of verification sample data, and the verification sample data includes a plurality of second model input values ​​corresponding one-to-one to the plurality of model input item variables and a second model output value corresponding one-to-one to the model output item variables;

[0103] The training model confirmation unit is used to regard the second machine learning model as a trained completed model that has achieved the model training goal if it is determined that the second model accuracy index value reaches a preset index threshold.

[0104] The working process, working details and technical effects of the aforementioned device provided in the second aspect of this embodiment can be found in the privacy computing method described in the first aspect and will not be repeated here.

[0105] like Figure 3As shown, the third aspect of this embodiment provides a computer device for executing the privacy computing method as described in the first aspect, including a memory, a processor and a transceiver that are sequentially connected in communication, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program to execute the privacy computing method as described in the first aspect. For example, the memory may include, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a flash memory, a first-in-first-out memory (FIFO) and / or a first-in-last-out memory (FILO), etc.; the processor may include, but is not limited to, a microprocessor of the STM32F105 series. In addition, the computer device may also include, but is not limited to, a power module, a display screen and other necessary components.

[0106] The working process, working details and technical effects of the aforementioned computer device provided in the third aspect of this embodiment can be found in the privacy computing method described in the first aspect and will not be repeated here.

[0107] In a fourth aspect, this embodiment provides a computer-readable storage medium storing instructions including the privacy computing method described in the first aspect, that is, the computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the privacy computing method described in the first aspect is executed. The computer-readable storage medium refers to a carrier for storing data, which may include but is not limited to computer-readable storage media such as floppy disks, optical disks, hard disks, flash memories, USB flash drives, and / or memory sticks, and the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.

[0108] The working process, working details and technical effects of the aforementioned computer-readable storage medium provided in the fourth aspect of this embodiment can be referred to the privacy computing method described in the first aspect, and will not be repeated here.

[0109] In a fifth aspect, this embodiment provides a computer program product, including a computer program or instructions, which, when executed by a computer, implements the privacy computing method as described in the first aspect. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.

[0110] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A privacy computing method based on blockchain, characterized in that: include: Generate a computing task for training a machine learning model, wherein the computing task includes a unique identifier of the machine learning model to be trained, hyperparameters, initial values ​​of N model parameters, multiple model input item variables, and model output item variables, where N represents a positive integer greater than or equal to 2; Generate a first block in the blockchain, and store the computing task in the first block; The first block is broadcasted and transmitted to other blockchain nodes so that the data source side node devices of the other blockchain nodes can read the computing task from the first block and execute the computing task, specifically including the following steps: judging whether a plurality of training sample data can be obtained according to the model input item variables and the model output item variables, and if so, firstly building a first machine learning model according to the unique identifier of the machine learning model to be trained, the hyperparameters and the initial values ​​of the N model parameters, and then applying the plurality of training sample data to perform model training and verification on the first machine learning model to obtain the current adjustment values ​​of the N model parameters and the first model accuracy index value, and then generating a second block in the blockchain, and storing the current adjustment values ​​of the N model parameters and the first model accuracy index value in the second block, and finally broadcasting the second block, wherein the training sample data contains at least one first model input value corresponding to at least one model input item variable among the plurality of model input item variables and a first model output value corresponding to the model output item variable one by one; When receiving the second block, reading the current adjustment values ​​of the N model parameters and the first model accuracy index value from the second block; According to the current adjustment values ​​of the N model parameters read from the most recently received M second blocks and the first model accuracy index value, the following set of equations to be solved is constructed: In the formula, m1 and m2 represent positive integers, M represents a positive integer greater than or equal to 3, and D m1 Represents the solution array X = {x1, x2, ..., x n ,…,x N } and the Euler distance between the current adjusted values ​​of the N model parameters read from the most recently received m1-th second block, D m2 represents the Euler distance between the array to be solved X and the current adjustment values ​​of the N model parameters read from the m2th second block most recently received, P m1 represents the first model accuracy index value read from the m1th second block received most recently, P m2 represents the first model accuracy index value read from the m2th second block received most recently, n represents a positive integer less than or equal to N, x n represents a value to be solved corresponding to the nth model parameter among the N model parameters; Solve the set of equations to be solved to obtain a solved array in, represents a solved value corresponding to the nth model parameter among the N model parameters; The solved array as training adjustment values ​​of the N model parameters, and constructing a second machine learning model according to the unique identifier of the machine learning model to be trained, the hyperparameter and the training adjustment values ​​of the N model parameters; Applying a validation set to perform model validation on the second machine learning model to obtain a second model accuracy index value, wherein the validation set includes a plurality of validation sample data, and the validation sample data includes a plurality of second model input values ​​corresponding one-to-one to the plurality of model input item variables and a second model output value corresponding one-to-one to the model output item variables; If it is determined that the accuracy index value of the second model reaches the preset index threshold, the second machine learning model will be regarded as a trained completed model that has achieved the model training goal.

2. The privacy computing method according to claim 1, characterized in that: The computing task includes a plurality of ciphertexts, the plurality of model input item variables and the model output item variables are encrypted in the ciphertexts, wherein each ciphertext in the plurality of ciphertexts is encrypted using a different private key; Reading the computing task from the first block and executing the computing task includes: first reading the computing task from the first block, and then decrypting the ciphertexts using the local public key; if any ciphertext among the multiple ciphertexts is successfully decrypted, executing the computing task; otherwise, not executing the computing task.

3. The privacy computing method according to claim 2, characterized in that: Some of the multiple model input item variables and the model output item variables are encrypted in the ciphertext, and all the model input item variables in the multiple ciphertexts constitute the multiple model input item variables.

4. The privacy computing method according to claim 1, characterized in that: The computing task also includes the verification set; Applying the plurality of training sample data to perform model training and verification on the first machine learning model to obtain current adjustment values ​​of the N model parameters and a first model accuracy index value, including: Using the plurality of training sample data to perform model training on the first machine learning model to obtain a new model; The new model is validated using the validation set to obtain a first model accuracy index value, and current adjustment values ​​of the N model parameters are extracted from the new model.

5. The privacy computing method according to claim 1, characterized in that: In the solved array After the training adjustment values ​​of the N model parameters are obtained, the method further comprises: Generating a third block in the blockchain, and storing the training adjustment values ​​of the N model parameters in the third block; The third block is broadcasted to other blockchain nodes so that the data source side node devices of the other blockchain nodes read the training adjustment values ​​of the N model parameters from the third block, and also perform the computing task according to the following steps: the training adjustment values ​​of the N model parameters are updated to the first machine learning model to obtain a third machine learning model, and then the third machine learning model is trained and verified using the multiple training sample data to obtain a new model training result, and then a new second block is generated in the blockchain, and the new model training result is stored in the new second block, and finally the new second block is broadcast, wherein the model training result includes the current adjustment values ​​of the N model parameters and the first model accuracy index value.

6. The privacy computing method according to claim 1, characterized in that: After taking the second machine learning model as a trained model that has achieved the model training target, the method further includes: Generate a fourth block in the blockchain, and store an end identifier of the computing task in the fourth block; The fourth block is broadcasted to other blockchain nodes so that the data source side node devices of the other blockchain nodes read the end identifier of the computing task from the fourth block and then end the execution of the computing task.

7. A privacy computing device based on blockchain, characterized in that: It includes a computing task generating unit, a computing task uplinking unit, a block transceiver processing unit, an equation group building unit, an equation group solving unit, a training model building unit, a training model verification unit and a training model confirmation unit which are sequentially connected in communication; The computing task generating unit is used to generate a computing task for training a machine learning model, wherein the computing task includes a unique identifier of the machine learning model to be trained, a hyperparameter, initial values ​​of N model parameters, a plurality of model input item variables and a model output item variable, where N represents a positive integer greater than or equal to 2; The computing task chain unit is used to generate a first block in the blockchain and store the computing task in the first block; The block transceiver processing unit is used to broadcast the first block to other blockchain nodes so that the data source side node device of the other blockchain nodes can read the computing task from the first block and execute the computing task, specifically including the following steps: judging whether multiple training sample data can be obtained according to the model input item variables and the model output item variables, and if so, first constructing a first machine learning model according to the unique identifier of the machine learning model to be trained, the hyperparameters and the initial values ​​of the N model parameters, and then applying the multiple training sample data to perform model training and verification on the first machine learning model to obtain the current adjustment values ​​of the N model parameters and the first model accuracy index value, and then generating a second block in the blockchain, and storing the current adjustment values ​​of the N model parameters and the first model accuracy index value in the second block, and finally broadcasting the second block, wherein the training sample data contains at least one first model input value corresponding to at least one model input item variable among the multiple model input item variables and a first model output value corresponding to the model output item variable one by one; The block transceiver processing unit is further configured to read the current adjustment values ​​of the N model parameters and the first model accuracy index value from the second block when receiving the second block; The equation group construction unit is used to construct the following equation group to be solved according to the current adjustment values ​​of the N model parameters read from the most recently received M second blocks and the first model accuracy index value: In the formula, m1 and m2 represent positive integers, M represents a positive integer greater than or equal to 3, and D m1 Represents the solution array X = {x1, x2, ..., x n ,…,x N } and the Euler distance between the current adjusted values ​​of the N model parameters read from the most recently received m1-th second block, D m2 represents the Euler distance between the array to be solved X and the current adjustment values ​​of the N model parameters read from the m2th second block most recently received, P m1 represents the first model accuracy index value read from the m1th second block received most recently, P m2 represents the first model accuracy index value read from the m2th second block received most recently, n represents a positive integer less than or equal to N, x n represents a value to be solved corresponding to the nth model parameter among the N model parameters; The equation solving unit is used to solve the equation to be solved to obtain a solved array. in, represents a solved value corresponding to the nth model parameter among the N model parameters; The training model building unit is used to convert the solved array as training adjustment values ​​of the N model parameters, and constructing a second machine learning model according to the unique identifier of the machine learning model to be trained, the hyperparameter and the training adjustment values ​​of the N model parameters; The training model verification unit is used to apply the verification set to perform model verification on the second machine learning model to obtain a second model accuracy index value, wherein the verification set includes a plurality of verification sample data, and the verification sample data includes a plurality of second model input values ​​corresponding one-to-one to the plurality of model input item variables and a second model output value corresponding one-to-one to the model output item variables; The training model confirmation unit is used to regard the second machine learning model as a trained completed model that has achieved the model training goal if it is determined that the second model accuracy index value reaches a preset index threshold.

8. A computer device, characterized in that: It includes a memory, a processor and a transceiver which are communicatively connected in sequence, wherein the memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program to execute the privacy computing method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are run on a computer, the privacy computing method as described in any one of claims 1 to 6 is executed.

10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or the instruction is executed by a computer, the privacy computing method as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Privacy protection method for collaborative deep learning model training

    CN111460478A

  • Privacy security calculation verification method and system based on block chain and federal learning

    CN115203751A