Machine learning model verification and transaction method
By using fully homomorphic encryption and blockchain technology in machine learning model transactions, and using smart contracts to verify and trade models, the problems of data confidentiality and transaction security in model transactions are solved, and a safe and efficient model transaction process is achieved.
Patent Information
- Application Number
- CN202311532865.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-16
- Publication Date
- 2025-05-16
AI Technical Summary
In machine learning model transactions, how to ensure the confidentiality of model buyers' data and model providers' model, and prevent fraudulent behavior during the transaction, especially in verification and transaction processes.
Using all-homomorphic encryption technology and blockchain system, machine learning models are verified and traded through smart contracts. The specific steps include: generating private keys and public keys based on fully homomorphic encryption parameters, encrypting test data and models, generating smart contracts for verification and transaction control, and executing contracts using the blockchain system to ensure the confidentiality of data and models and the security of transactions.
It realizes the security verification and transaction of machine learning models, ensures the confidentiality of data and models, reduces the risk of fraud in the transaction process, and improves the security and transparency of transactions.
Smart Images

Figure CN120013531A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to a method for verifying and trading a machine learning model, and more particularly to a method for verifying and trading a machine learning model using fully homomorphic encryption. Background Art
[0002] There are two roles in machine learning model transactions: model buyers and model providers. The machine learning model provided by the model provider needs to be verified to prove that the machine learning model provided by the model provider can meet the needs of the model buyer. However, how to protect the confidentiality of both the model buyer's data and the model provider's model and complete the model verification in a secure computing manner is crucial. In addition, both the model buyer and the model provider may commit fraud during the transaction. For example, the model buyer does not pay after receiving the model, or the model provider does not deliver the model or gives an uncertified model after receiving the payment. Automating the above verification and transaction processes through digital technology will ensure the enforceability of the transaction contract and the security of the data while greatly saving manpower. Summary of the invention
[0003] In some embodiments of the present application, the method for machine learning model verification and transaction provided by the present application includes the following steps: generating a first private key and a public key according to a set of fully homomorphic encryption parameters; encrypting test data and a label of the test data respectively by the public key to generate test data ciphertext and label ciphertext; generating a smart contract executed by a blockchain system according to the test data ciphertext and the label ciphertext, and transferring control of an amount of cryptocurrency from a first cryptocurrency account to the blockchain system through the smart contract; receiving the result of the blockchain system performing verification on the model ciphertext according to the smart contract; when the result indicates that the model ciphertext has not passed the verification, reclaiming control of the amount of cryptocurrency; and when the result indicates that the model ciphertext has passed the verification, receiving the model ciphertext and a second private key from the blockchain system, and decrypting the model ciphertext according to the first private key and the second private key to generate a model for inferring the test data.
[0004] In some embodiments of the present application, the method for machine learning model verification and transaction provided by the present application also includes: publishing model requirements; receiving transaction requests generated from an electronic device based on the model requirements; and when the result indicates that the model ciphertext has passed the verification, providing control of the cryptocurrency of the amount to a second cryptocurrency account that is different from the first cryptocurrency account.
[0005] In some embodiments of the present application, the method for machine learning model verification and transaction provided by the present application includes the following steps: generating a first private key and a public key according to a set of fully homomorphic encryption parameters; encrypting the model by the public key to generate a model ciphertext, wherein the model is used to infer test data; providing the first private key and the model ciphertext to the blockchain system, and the blockchain system generates a smart contract according to the first private key, the model ciphertext, the test data ciphertext of the test data, and the label ciphertext of the label of the test data; receiving the result of the blockchain system performing verification on the model ciphertext according to the smart contract; and when the result indicates that the model ciphertext has passed the verification, receiving control of the cryptocurrency from the blockchain system, and the blockchain system provides the first private key and the model ciphertext to the first electronic device, and the first electronic device decrypts the model ciphertext according to the first private key to generate a model.
[0006] In some embodiments of the present application, the first private key is secretly shared by the blockchain system to multiple nodes of the blockchain system, and when the result indicates that the model ciphertext passes the verification, the first electronic device reconstructs the first private key based on multiple shares of multiple of the nodes.
[0007] In some embodiments of the present application, the method for machine learning model verification and transaction provided by the present application includes executing the following steps according to a first smart contract generated by a first private key, a second private key, a test data ciphertext, a label ciphertext, a model ciphertext and an accuracy threshold ciphertext generated by a set of fully homomorphic encryption parameters: secretly sharing the first private key and the second private key to multiple blockchain nodes; selecting multiple verification devices, wherein these verification devices are used to perform verification, and the verification includes: inferring the test data ciphertext according to the model ciphertext to generate multiple inference results; performing multiple first fully homomorphic encryption comparison operations on these inference results and the label ciphertext to generate multiple accuracies; and performing multiple second fully homomorphic encryption comparison operations on these accuracies and accuracy thresholds to generate multiple first comparison results; generating correct comparison results according to multiple third fully homomorphic encryption comparison operations between these first comparison results; decrypting the correct comparison results using the secretly shared first private key and the second private key to generate correct comparison result plaintext; and determining whether to provide the second private key to the first electronic device according to the correct comparison result plaintext, wherein the first electronic device decrypts the model ciphertext according to the first private key and the second private key.
[0008] In some embodiments of the present application, these verification devices also each provide a first amount of cryptocurrency according to the second smart contract, and generating a correct comparison result includes: grouping these first comparison results, wherein the third fully homomorphic encryption comparison results of the same group among these first comparison results are the same as each other; generating a correct comparison result based on the comparison result group including the maximum number generated by the grouping, and determining that one of these first comparison results other than the comparison result group including the maximum number is a fraudulent result; and confiscating the first amount of cryptocurrency belonging to the fraudulent verification device corresponding to the fraudulent result.
[0009] In some embodiments of the present application, the method of machine learning model verification and transaction provided by the present application also includes executing according to the first smart contract: dividing the second amount of cryptocurrency equally into the cryptocurrency account of each of the comparison result groups corresponding to the maximum number of such verification devices.
[0010] In some embodiments of the present application, the method of machine learning model verification and transaction provided by the present application also includes: according to the first smart contract, comparing the maximum number and the quantity threshold, wherein when the maximum number is less than the quantity threshold, selecting multiple re-selected verification devices to re-execute the verification.
[0011] In some embodiments of the present application, the method for machine learning model verification and transaction provided by the present application also includes: receiving a second amount of cryptocurrency from the model buyer's cryptocurrency account; and based on the correct comparison result plaintext including the first value, determining that the model ciphertext has passed the verification, and transmitting the second amount of cryptocurrency to the model provider's cryptocurrency account.
[0012] In some embodiments of the present application, the method for machine learning model verification and transaction provided by the present application also includes: based on the correct comparison result plaintext including a second value, determining that the model ciphertext has not passed the verification, and transferring the second amount of cryptocurrency to the model buyer's cryptocurrency account, and transferring the confiscated first amount of cryptocurrency to the model provider's cryptocurrency account. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 Shown is a schematic diagram of a system for machine learning model verification and trading according to an embodiment of the present application.
[0014] Figure 2 The display corresponds to an embodiment of the present application Figure 1 A flow chart of a method for systematic machine learning model validation and trading.
[0015] Figure 3 The display corresponds to an embodiment of the present application Figure 1 A flow chart of a method for systematic machine learning model validation and trading.
[0016] Figure 4 The display corresponds to an embodiment of the present application Figure 1 A flow chart of a method for systematic machine learning model validation and trading.
[0017] Figure 5 It is shown as an embodiment of the present application Figure 4 A flow chart of additional steps of the method.
[0018] Figure 6 It is shown as an embodiment of the present application Figure 4 and Figure 5 A flow chart of additional steps of the method.
[0019] Component number description
[0020] 100 Systems
[0021] 101 Electronic Devices
[0022] 102 Electronic devices
[0023] 103 Blockchain System
[0024] 104 Verification Device
[0025] 200 Methods
[0026] 300 Methods
[0027] 400 Methods
[0028] Accuracy
[0029] Steps B1~B11
[0030] C1 Smart Contract
[0031] Dec Decoding operation
[0032] Enc encryption operation
[0033] m Machine Learning Model
[0034] Machine Learning Model Encryption
[0035] Steps P1 to P9
[0036] pk public key
[0037] q Quantity
[0038] sk B Private Key
[0039] sk P Private Key
[0040] SMPC_DEC Decryption operation
[0041] Steps T1 to T20
[0042] Steps W1~W6
[0043] x Test data
[0044] Test data ciphertext
[0045] y label
[0046] Label ciphertext
[0047] Inference results
[0048] α threshold
[0049] β accuracy threshold
[0050] Accuracy Threshold Ciphertext
[0051] γ Correct comparison result plaintext
[0052] Correct comparison results
[0053] Comparison results
[0054] $ B Amount
[0055] $ P Amount
[0056] $ W Amount
[0057] $ Wj Amount DETAILED DESCRIPTION
[0058] In order to make the description of this application more detailed and complete, reference can be made to the accompanying drawings and various embodiments described below, in which the same numbers represent the same or similar components. On the other hand, well-known components and steps are not described in the embodiments to avoid unnecessary limitations on this application.
[0059] Please refer to Figure 1 . Figure 11 is a schematic diagram of a system 100 for machine learning model verification and transaction according to an embodiment of the present application. The system 100 is used to verify the machine learning model provided by the model provider, and to perform model transaction operations between the model buyer and the model provider. For illustration, the system 100 includes an electronic device 101 of the model buyer, an electronic device 102 of the model provider, a blockchain system 103, and at least one verification device 104.
[0060] like Figure 1 As shown, the electronic device 101 of the model purchaser is electrically connected to the electronic device 102 of the model provider and the blockchain system 103. The electronic device 102 of the model provider is electrically connected to the blockchain system 103. The blockchain system 103 is electrically connected to multiple verification devices 104. It should be understood that in the embodiments, the description involving "electrical connection" can generally refer to a component being indirectly electrically coupled to another component through other components, or a component being directly electrically connected to another component without passing through other components.
[0061] According to some embodiments, the model purchaser's electronic device 101, the model provider's electronic device 102, and the verification device 104 include a central processing unit (CPU), or other programmable general-purpose or special-purpose micro control unit (MCU), microprocessor (microprocessor), digital signal processor (digital signal processor, DSP), programmable controller, application specific integrated circuit (ASIC), graphics processing unit (graphics processing unit, GPU), arithmetic logic unit (arithmetic logic unit, ALU), complex programmable logic device (complex programmable logic device, CPLD), field programmable gate array (field programmable gate array, FPGA) or other similar components or combinations of the above components.
[0062] In some embodiments, the electronic device 101 of the model purchaser, the electronic device 102 of the model provider, and the verification device 104 further include a storage device and a transmission device. According to different embodiments, the storage device includes a hard disk, a random access memory, or other storage media. The transmission device includes a transmission interface, a transmission line, a network device, a communication device, or other transmission media.
[0063] The blockchain system 103 includes a plurality of blockchain nodes. The blockchain nodes are used to execute smart contracts deployed on a blockchain network, such as smart contracts on the Ethereum blockchain.
[0064] In some embodiments, the blockchain system 103 performs full homomorphic encryption (FHE) on the test data provided by the model buyer and the machine learning model provided by the model provider according to the smart contract jointly generated by the electronic device 101 of the model buyer and the electronic device 102 of the model provider, and infers the encrypted test data through the verification device 104 to verify the model. Then, the blockchain system 103 performs the transaction operation according to the verification result. The details of the operation method of the system 100 will be referred to below. Figures 2 to 6 Further description.
[0065] Figure 1 The configuration of is given for illustrative purposes. Figure 1 Various implementations of are within the contemplated scope of an embodiment of the present invention. For example, Figure 1 The electrical connection shown can be replaced by a wireless communication connection. For example, the electronic device 101 of the model purchaser and the electronic device 102 of the model provider are connected to each other via a wireless network.
[0066] Please refer to Figure 2 . Figure 2 According to an embodiment of the present application, Figure 1 A flow chart of a method 200 for machine learning model validation and trading of system 100. Method 200 includes steps B1 to B11.
[0067] In step B1, the electronic device 101 of the model purchaser publishes the requirements of the machine learning model to be purchased. For example, the model requirements include model specifications, model parameter quantities, input and output data types and formats, and inference accuracy. In some embodiments, the electronic device 101 publishes the model requirements on the blockchain network through the blockchain system 103. In some embodiments, the electronic device 101 also publishes the amount of cryptocurrency $_B that can be provided for purchasing the machine learning model.
[0068] In step B2, the electronic device 101 receives the model verification and transaction request of the electronic device 102 from the model provider. Operationally, the electronic device 101 and the electronic device 102 communicate peer-to-peer to confirm that a set of parameters used to encrypt the test data x stored in the electronic device 101, the label y of the test data, the accuracy threshold β, and the machine learning model m stored in the electronic device 102 are the same. That is, a fully homomorphic encryption function and its parameters (for example, the power or coefficient in this fully homomorphic encryption function) are determined. This fully homomorphic encryption function is used to encrypt the test data x stored in the electronic device 101, the label y of the test data, the accuracy threshold β, and the machine learning model m stored in the electronic device 102. In some embodiments, the fully homomorphic encryption of method 200 is threshold fully homomorphic encryption (threshold FHE).
[0069] In some embodiments, the machine learning model m is a model provided by a model provider. The test data x and the label y are data provided by the model buyer to verify the machine learning model m. The accuracy threshold β is the minimum value required by the model buyer to generate the accuracy after inference of the test data x and comparison with the label y.
[0070] In step B3, the electronic device 101 generates a fully homomorphic encrypted private key sk according to the fully homomorphic encryption function B , and jointly generate a fully homomorphic encrypted public key pk with the electronic device 102. For example, in some embodiments, the electronic device 101 and the electronic device 102 generate the same public key pk according to the fully homomorphic encryption parameter function. In different embodiments, the electronic device 101 generates a temporary public key, and the electronic device 102 generates a public key pk based on the temporary public key and shares the public key pk with the electronic device 101.
[0071] In step B4, the electronic device 101 performs a fully homomorphic encryption encryption operation Enc(x, y, β, pk). In this operation, the electronic device 101 encrypts the test data x, the label y, and the accuracy threshold β using the public key pk according to the fully homomorphic encryption function to generate the test data ciphertext Label ciphertext and accuracy threshold ciphertext
[0072] In step B5, the electronic device 101 provides the model buyer with the amount of money $ required to purchase the model. B Proof of cryptocurrency that the model purchaser's cryptocurrency account contains at least $ B The encrypted currency certificate is sent to the electronic device 102 and / or the blockchain system 103.
[0073] In step B6, the electronic device 101, the electronic device 102 and the blockchain system 103 jointly generate the smart contract C1. Specifically, in some embodiments, the electronic device 101 or the electronic device 102 publishes the smart contract C1 to the blockchain network, the blockchain system 103 executes the smart contract C1, and the electronic device 101 and / or the electronic device 102 then provide data (such as the test data ciphertext or its access link, the address of the cryptocurrency account of the model purchaser or model provider) to the smart contract C1 to complete the signing of the smart contract C1. In different embodiments, the electronic device 101 and / or the electronic device 102 provide the data required for the smart contract C1 to the blockchain system 103, and the blockchain system 103 publishes and executes the smart contract C1.
[0074] In some embodiments, the electronic device 101 provides the amount $ required to purchase the model. B The control of the cryptocurrency of the model purchaser is transferred to the smart contract C1. For example, the electronic device 101 initiates a transfer of the amount $ B The transaction of the cryptocurrency to the account of the smart contract C1 is transmitted to the blockchain network, and the blockchain system 103 controls the cryptocurrency of the account of the smart contract C1 according to the smart contract C1.
[0075] Smart contract C1 specifies the verification operation of machine learning model m. Blockchain system 103 performs the verification operation according to smart contract C1 and transmits the verification result to electronic device 101. In step B7, electronic device 101 receives the verification result from blockchain system 103. The verification result is whether machine learning model m passes the verification. In some embodiments, smart contract C1 specifies that blockchain system 103 generates a verification result indicating that machine learning model m passes the verification according to the inference accuracy of machine learning model m being greater than the accuracy threshold β.
[0076] In step B8, when the verification result is that the machine learning model m fails the verification, the electronic device 101 executes step B9 to retrieve the amount $ B For example, the smart contract C1 specifies that the blockchain system 103 transfers the amount $ B The cryptocurrency is transferred from the account of smart contract C1 to the cryptocurrency account of the model buyer.
[0077] On the contrary, when the verification result is that the machine learning model m passes the verification, the electronic device 101 executes step B10 to receive the public key pk generated by the electronic device 102 and the electronic device 101 together, and the private key sk generated by the electronic device 102 P Specifically, the smart contract C1 specifies the blockchain system 103 to convert the private key sk intoP Provided to the electronic device 101.
[0078] In step B11, the electronic device 101 performs a decryption operation Dec( sk B ,sk P ). In this operation, the electronic device 101 uses the private key sk B and sk P The machine learning model ciphertext m^ provided by the electronic device 102 is decrypted to obtain the machine learning model m used to infer the test data x.
[0079] Please refer to Figure 3 . Figure 3 According to an embodiment of the present application, Figure 1 A flowchart of a method 300 for machine learning model verification and transaction of system 100. Method 300 includes steps P1 to P9. In some embodiments, electronic device 101 according to method 200 and electronic device 102 according to method 300 cooperate with each other to perform machine learning model verification and transaction.
[0080] In step P1, according to the model requirements published by the electronic device 101 (e.g., the model requirements published in step B1 of method 200), the electronic device 102 generates a verification and transaction request. Specifically, the electronic device 102 transmits a message of voluntarily participating in the verification and transaction of the machine learning model to the electronic device 101 in step P1. In some embodiments, the electronic device 102 communicates point-to-point with the electronic device 101 in step P1 to determine the fully homomorphic encryption function and its parameters for encrypting the test data x stored by the electronic device 101, the label y of the test data, the accuracy threshold β, and the machine learning model m stored by the electronic device 102.
[0081] In step P2, the electronic device 102 generates a public key pk and a secret key sk according to the homomorphic encryption function and its parameters determined in step P1. B In some embodiments, the electronic device 102 in step P2 and the electronic device 101 in step B3 of the method 200 jointly generate the public key pk.
[0082] In step P3, the electronic device 102 encrypts the machine learning model m with the public key pk through the fully homomorphic encryption function to generate a machine learning model ciphertext
[0083] In step P4, the electronic device 102 provides the model provider with the amount of money $ required to verify the model. P Proof of cryptocurrency that the model provider's cryptocurrency account contains at least $ P The encrypted proof is sent to the electronic device 101 and / or the blockchain system 103.
[0084] In step P5, the electronic device 101, the electronic device 102, and the blockchain system 103 jointly generate the smart contract C1. For example, the electronic device 102 in step P5 and the electronic device 101 in step B6 of the method 200 jointly generate the smart contract C1. Specifically, in some embodiments, the electronic device 101 or the electronic device 102 publishes the smart contract C1 to the blockchain network, the blockchain system 103 executes the smart contract C1, and the electronic device 101 and / or the electronic device 102 then provide data (such as a test data ciphertext or its access link) to the smart contract C1 to complete the signing of the smart contract C1. In different embodiments, the electronic device 101 and / or the electronic device 102 provide the data required for the smart contract C1 to the blockchain system 103, and the blockchain system 103 publishes and executes the smart contract C1.
[0085] In some embodiments, the electronic device 101 provides the amount $ required to verify the model. P The control of the cryptocurrency of the model purchaser is transferred to the smart contract C1. For example, the electronic device 101 initiates a transfer of the amount $ P The transaction of the cryptocurrency to the account of the smart contract C1 is transmitted to the blockchain network, and the blockchain system 103 controls the cryptocurrency of the account of the smart contract C1 according to the smart contract C1.
[0086] The blockchain system 103 performs a verification operation according to the smart contract C1 and transmits the verification result of the machine learning model m to the electronic device 102. The verification result indicates whether the machine learning model m has passed the verification. In some embodiments, the smart contract C1 specifies that the blockchain system 103 generates a verification result indicating that the machine learning model m has passed the verification based on the judgment that the inference accuracy of the machine learning model m is greater than the accuracy threshold β. In step P6, the electronic device 102 receives the verification result from the blockchain system 103.
[0087] In step P7, when the verification result is that the machine learning model m fails the verification, the electronic device 102 executes step P8 to receive the amount $ W For example, transferring the amount of $ W The cryptocurrency of $ is transferred from the account of smart contract C1 to the cryptocurrency account of the model buyer. W The cryptocurrency is a deposit or participation fee from the verification device 104, and the relevant content will be referred to below Figure 5 and Figure 6 Further description.
[0088] On the contrary, when the verification result is that the machine learning model m passes the verification, the electronic device 102 executes step P9 to receive the amount $ W Cryptocurrency and amount in $B For example, the amount $ provided by the electronic device 101 in steps B5 and B6 of the method 200 B Cryptocurrency.
[0089] In step B11, the electronic device 101 performs a decryption operation Dec( sk B ,sk P ). In this operation, the electronic device 101 uses the private key sk B and sk P The machine learning model ciphertext provided to the electronic device 102 Decryption results in the machine learning model m used to infer the test data x.
[0090] Please refer to Figure 4 . Figure 4 According to an embodiment of the present application, Figure 1 Flowchart of method 400 for machine learning model verification and transaction of system 100. Method 400 includes steps T1 to T5. In some embodiments, electronic device 101 according to method 200, electronic device 102 according to method 300, and blockchain system 103 according to method 400 cooperate with each other to perform verification and transaction of machine learning models.
[0091] In step T1, the blockchain system 103 publishes the machine learning model demand. For example, the electronic device 101 transmits the demand for the machine learning model to be purchased to the blockchain system 103 in step B1 of the method 200, and publishes the machine learning model demand in the blockchain network through the blockchain system 103 in step T1 to seek a model provider.
[0092] In step T2, the blockchain system 103 receives a verification and transaction request from a model provider for the machine learning model requirements published in step 3. For example, the verification and transaction request generated by the electronic device 102 in step P1 of the method 300.
[0093] In step T3, the blockchain system 103 generates a smart contract C1. In some embodiments, the electronic device 101, the electronic device 102, and the blockchain system 103 jointly generate the smart contract C1. For example, the electronic device 101 in step B6 of method 200, the electronic device 102 in step P5 of method 300, and the blockchain system 103 in step T3 jointly generate the smart contract C1.
[0094] In terms of operation, smart contract C1 is based on public key pk and private key sk B , private key sk P , Test data ciphertext Label ciphertext Accuracy Threshold Ciphertext Machine Learning Model Encryption Amount$ B and amount $ P For example, the electronic device 101 and / or the electronic device 102 provides the public key pk to the blockchain system 103, and the electronic device 101 provides the private key sk B , test data ciphertext Label ciphertext Accuracy Threshold Ciphertext and amount $ B The encrypted currency is sent to the blockchain system 103, and the electronic device 102 provides the private key sk P , machine learning model ciphertext m^ and amount $ P The cryptocurrency is sent to the blockchain system 103 to sign the smart contract C1.
[0095] In step T4, the blockchain system 103 secretly shares the private key sk B and private key sk P For example, by using Shamir's secret sharing or Blakley's secret sharing, the private key sk is secretly shared. B and private key sk P In some embodiments, the blockchain system 103 performs secret sharing operations according to the instructions (program code) in the smart contract C1. In some embodiments, the blockchain system 103 secretly shares the private key sk B and private key sk P To multiple nodes in the blockchain system 103. For example, the blockchain system 103 uses secret sharing to send the private key sk B and private key sk P The data is divided into multiple shares, and multiple nodes in the blockchain system 103 respectively access the multiple shares.
[0096] In step T5, the blockchain system 103 publishes the public key pk and the test data ciphertext Label ciphertext Accuracy Threshold Ciphertext and machine learning model ciphertext For example, the blockchain system 103 executes the smart contract C1 and returns the state of the new smart contract C1 recorded in the blockchain network, which includes the public key pk, the test data ciphertext Label ciphertext Accuracy Threshold Ciphertext and machine learning model ciphertext And other public information.
[0097] Please refer to Figure 5 . Figure 5 According to an embodiment of the present application Figure 4 A flowchart of additional steps of method 400 is provided. Figure 5 As shown, the method 400 further includes steps T6 to T13 and steps W1 to W6. In operation, the verification device 104 executes steps W1 to W6 to encrypt the machine learning model. to verify.
[0098] In some embodiments, steps T6 to T13 and steps W1 to W6 are specified by smart contract C1 and executed according to the instructions in smart contract C1. In some embodiments, blockchain system 103 publishes the ciphertext of the standardized machine learning model The verified smart contract C2, and steps T6 to T13 and steps W1 to W6 are specified by the smart contract C2 and executed according to the instructions in the smart contract C1.
[0099] In step W1, the verification device 104 generates a verification request to the blockchain system 103 to indicate its willingness to assist in verifying the machine learning model ciphertext. In some embodiments, the operation of generating a request for participation in verification is to call a function for participation in verification in smart contract C1 or smart contract C2.
[0100] In step T6, the blockchain system 103 selects n verification devices (verification device 1 to verification device n) from all verification devices 104 that have generated verification requests. In some embodiments, the blockchain system 103 and verification devices 1 to n sign the canonical machine learning model ciphertext Verified smart contract C2.
[0101] In step W2, verification device 1 to verification device n respectively provide the amount $ Wj The control of the cryptocurrency is transferred to the blockchain system 103 as a deposit or participation fee for participating in the verification. In some embodiments, the amount of participating in the verification is $ Wj It is regulated in smart contract C1 or smart contract C2.
[0102] In step T7, the blockchain system 103 receives the amounts $ provided by verification devices 1 to n respectively. Wj Specifically, in some embodiments, verification device 1 to verification device n transfer the amount $ from their respective corresponding cryptocurrency accounts. WjThe cryptocurrency is transferred to the cryptocurrency account of smart contract C1 or smart contract C2, and the blockchain system 103 controls the cryptocurrency of the smart contract C1 account according to the smart contract C1 or controls the cryptocurrency of the smart contract C2 account according to the smart contract C2.
[0103] In step T8, the blockchain system 103 provides the test data ciphertext Label ciphertext Accuracy Threshold Ciphertext and machine learning model ciphertext To verification device 1 to verification device n. Verification device 1 to verification device n receives in step W3
[0104] Test data ciphertext Label ciphertext Accuracy Threshold Ciphertext and machine learning model ciphertext
[0105] In step W4, verification devices 1 to n perform the fully homomorphic encryption inference operation of the fully homomorphic encryption method. In the fully homomorphic encryption inference operation, verification devices 1 to n each use the machine learning model ciphertext Fully homomorphic encryption inference test data ciphertext Produce inference results respectively
[0106] In step W5, verification devices 1 to n perform the fully homomorphic encryption comparison operation of the fully homomorphic encryption method. In the fully homomorphic encryption comparison operation of step W5, the inference results are respectively homomorphically compared. With label ciphertext To produce accuracy According to some embodiments, in this fully homomorphic encryption comparison operation, the accuracy is generated by judging that the inference result is correct based on whether the inference result is the same as the tag ciphertext or differs within a preset range. One of them and the label ciphertext The corresponding one in the homomorphism comparison is the same, judge the inference result The inference is correct and the inference is produced in this way. accuracy.
[0107] In step W6, verification devices 1 to n perform a fully homomorphic encryption comparison operation. In the fully homomorphic encryption comparison operation of step W5, the accuracy obtained by the inference is homomorphically compared. With accuracy threshold ciphertext To produce comparison results
[0108] In step T9, the blockchain system 103 compares the comparison results based on whether they are the same or the difference is less than a default value. In some embodiments, the blockchain system 103 compares the results of Homomorphic comparisons are divided into the same group if the comparison results are the same.
[0109] In step T9, the blockchain system 103 further determines the one with the largest number of comparison result groups as the correct comparison result group, and determines the comparison results outside the correct comparison result group as the fraudulent results of the comparison fraud. The blockchain system 103 determines the one of the verification devices 1 to n corresponding to the correct comparison result as the correct verification device, and determines the one of the verification devices 1 to n corresponding to the fraudulent result as the fraudulent verification device. The blockchain system 103 determines the number q of the correct comparison results.
[0110] In step T10, the blockchain system 103 determines whether the number q of correct comparison results is greater than the threshold α. The blockchain system 103 determines that the verification operation of the machine learning model ciphertext m^ through the verification device 1 to the verification device n is incorrect (failed) based on the number q of correct comparison results being less than or equal to the threshold α. Based on the judgment that the number q of correct comparison results is not greater than the threshold α, the blockchain system 103 re-executes step T6 in step T11 to select n re-selected verification devices 104 and re-executes the verification of the machine learning model ciphertext m^ through the re-selected verification device 104 (for example, re-execute steps W1 to W6 and steps T7 to T10 with the re-selected verification device 104).
[0111] When the amount provided by verification device 1 to verification device n is $ Wj When the cryptocurrency is used as a deposit according to smart contract C1 or smart contract C2, the blockchain system 103 confiscates the amount $ provided by the fraud verification device in step T11. Wj Cryptocurrency. That is, the judgment does not transfer the amount of $ Wj The control of the encrypted currency is returned to the counterfeit verification device from verification device 1 to verification device n.
[0112] In step T12, the blockchain system 103 determines whether the machine learning model ciphertext is correct based on the number of correct comparison results q being greater than the threshold α. Verify that the operation is correct.
[0113] In step T13, when the amount $ provided by verification device 1 to verification device n WjWhen the cryptocurrency is used as a deposit according to smart contract C1 or smart contract C2, the blockchain system 103 confiscates the amount provided by the fraudulent verification device. Wj Cryptocurrency.
[0114] Please refer to Figure 6 . Figure 6 According to an embodiment of the present application Figure 4 and Figure 5 A flowchart of additional steps of method 400 is provided. Figure 6 As shown, the method 400 further includes steps T14 to T20.
[0115] In step T14, in some embodiments, the blockchain system 103 transfers the amount $ P The cryptocurrency is evenly distributed to the verification devices 104 in the correct verification group. Specifically, the blockchain system 103 divides the amount $ P The cryptocurrency of / q is transferred to the cryptocurrency account corresponding to each verification device 104 in the correct verification group.
[0116] In different embodiments, the blockchain system 103 transfers the amount $ P The cryptocurrency divided by the number n is transmitted to the verification device 104 in the correct verification group. Specifically, the blockchain system 103 transmits the amount $ P / n cryptocurrency is transferred to the cryptocurrency account corresponding to each verification device 104 in the correct verification group.
[0117] In some embodiments, when verification device 1 to verification device n provide an amount of $ Wj When the cryptocurrency is used as a deposit according to smart contract C1 or smart contract C2, the blockchain system 103 will transfer the amount $ Wj The cryptocurrency is transferred to the cryptocurrency account corresponding to each verification device 104 in the correct verification group.
[0118] In some embodiments, the blockchain system 103 executes step T15, step T16, and steps T18 to T20 according to the smart contract C1. In some embodiments, step T15, step T16, and steps T18 to T20 are executed according to the instructions in the smart contract C1.
[0119] In step T15, the blockchain system 103 The correct comparison results in the group produce the correct comparison results For example, correctly compare the results To correctly compare the homomorphic means of the result groups, or to correctly compare the results is one of the correct comparison results. Then, the blockchain system 103 compares the correct comparison results. Execute the decryption operation SMPC_DEC of the secure multi-party computation (SMPC) under secret sharing. Specifically, a node in the blockchain system 103 uses multiple private keys sk according to the secret sharing method adopted in step T5. B and private key sk p Share to decrypt the comparison results To generate the comparison result plaintext γ.
[0120] In step T16, the blockchain system 103 determines the machine learning model ciphertext according to the comparison result plaintext γ Whether it passes the verification, including the machine learning model ciphertext Representing machine learning model ciphertext through verification Encrypt the test data The inference accuracy is greater than the accuracy threshold ciphertext In some embodiments, the blockchain system 103 determines the machine learning model ciphertext Through verification, it is further determined that the machine learning model m has passed the verification, that is, it is determined that the accuracy of the inference of the test data ciphertext x by the machine learning model m is greater than the accuracy threshold β.
[0121] In some embodiments, the blockchain system 103 determines the machine learning model ciphertext according to the value of the comparison result plaintext γ being true (true). By verification, on the contrary, the blockchain system 103 judges the machine learning based on the value of the comparison result plaintext γ being false.
[0122] Model ciphertext Failed verification.
[0123] Then, the blockchain system 103 generates a verification result of the machine learning model ciphertext m^ or whether the machine learning model m passes the verification. In some embodiments, the electronic device 101 receives the verification result in step B7 of method 200 and the electronic device 102 receives the verification result in step P6 of method 300.
[0124] According to the verification result that the verification is not passed, the blockchain system 103 executes step T17. In step T17, when the amount $ provided by the verification device 1 to the verification device n is Wj When the cryptocurrency is used as a deposit according to smart contract C1 or smart contract C2, the blockchain system 103 will confiscate the amount of the cryptocurrency $ W of cryptocurrency is transferred to the model provider's account, where $ W Provide the amount of $ for the counterfeit verification device Wj The total amount of cryptocurrency.
[0125] In different embodiments, when the amount $ provided by verification device 1 to verification device n Wj When the blockchain system 103 uses the cryptocurrency of the smart contract C1 or the smart contract C2 as the participation fee, the amount $ W The cryptocurrency is transferred to the cryptocurrency account of the model provider, where the amount $W is provided by all verification devices separately. Wj Total amount of cryptocurrency, amount $ W Equal to n$ Wj .
[0126] In step T18, according to the verification result that the verification fails, the blockchain system 103 transfers the amount $ B The cryptocurrency is transferred to the cryptocurrency account of the model buyer.
[0127] In step T19, according to the verification result, the blockchain system 103 transfers the amount $ B The cryptocurrency is transferred to the model provider's cryptocurrency account.
[0128] In step T20, according to the verification result, the blockchain system 103 secretly transmits the private key sk P For example, the blockchain system 103 uses a secret sharing method to send the private key sk P The multiple shares are provided to the electronic device 101, and the electronic device 101 uses the multiple shares to reconstruct the private key sk according to the secret sharing method. P The electronic device 101 uses the private key sk P and private key sk B Decrypting Machine Learning Model Ciphertext Produce a machine learning model m for inference on test data x.
[0129] It should be understood that the steps of method 200 to method 400, except for those whose order is specifically described, can be adjusted in order according to actual needs, and can even be executed simultaneously or partially simultaneously. Figures 2 to 6 Additional operations are provided before, during, and after the steps shown, and some of the operations described below may be replaced or eliminated to obtain additional embodiments of methods 200 to 400 for machine learning model validation and trading.
[0130] In summary, the present application provides a system and method for machine learning model verification and transaction. The system includes a blockchain system, an electronic device that performs transaction verification functions with model buyers, an electronic device that performs transaction verification functions with model providers, and one or more verification devices that assist in secure computing. The blockchain system serves as a trusted device for model buyers and model providers. The blockchain system can execute the smart contract signed by the model buyer and the model provider to perform model verification and transaction work, ensuring that the model obtained by the model buyer is a verified model, and also ensuring that the model provider can obtain the payment when the verified model provided by the model provider passes the verification conditions of the model buyer.
[0131] The features of several embodiments are summarized above so that those skilled in the art can better understand the various aspects of an embodiment of the present invention. Those skilled in the art should understand that they can easily use an embodiment of the present invention as a basis for designing or modifying other processes and structures to achieve the same purposes and / or achieve the same advantages of the embodiments introduced herein. Those skilled in the art should also recognize that these equivalent structures do not deviate from the spirit and scope of an embodiment of the present invention, and these equivalent structures can be variously modified, replaced and changed herein without departing from the spirit and scope of an embodiment of the present invention.
Claims
1. A method for machine learning model verification and trading, characterized in that: The following steps are involved: Generate a first private key and a public key according to a set of fully homomorphic encryption parameters; Encrypt a test data and a label of the test data respectively by using the public key to generate a test data ciphertext and a label ciphertext; generating a smart contract executed by a blockchain system according to the test data ciphertext and the tag ciphertext, and transferring control of a cryptocurrency of a certain amount from a first cryptocurrency account to the blockchain system through the smart contract; Receiving a result of the blockchain system performing a verification on a model ciphertext according to the smart contract; When the result indicates that the model ciphertext fails the verification, reclaiming control of the cryptocurrency of the amount; as well as When the result indicates that the model ciphertext passes the verification, the model ciphertext and a second private key are received from the blockchain system, and the model ciphertext is decrypted according to the first private key and the second private key to generate a model for inferring the test data.
2. The method for machine learning model verification and transaction according to claim 1, characterized in that: Also includes: Publish a model requirement; receiving a transaction request generated from an electronic device according to the model requirement; and When the result indicates that the model ciphertext passes the verification, control of the amount of cryptocurrency is provided to a second cryptocurrency account different from the first cryptocurrency account.
3. A method for machine learning model verification and trading, characterized in that: The following steps are involved: Generate a first private key and a public key according to a set of fully homomorphic encryption parameters; Encrypting a model by the public key to generate a model ciphertext, wherein the model is used to make inferences on a test data; Providing the first private key and the model ciphertext to a blockchain system, wherein the blockchain system generates a smart contract according to the first private key, the model ciphertext, a test data ciphertext of the test data, and a label ciphertext of a label of the test data; Receiving a result of the blockchain system performing a verification on the model ciphertext according to the smart contract; as well as When the result indicates that the model ciphertext passes the verification, control of a cryptocurrency is received from the blockchain system, and the blockchain system provides the first private key and the model ciphertext to a first electronic device, and the first electronic device decrypts the model ciphertext according to the first private key to generate the model.
4. The method for machine learning model verification and transaction according to claim 3, characterized in that: The first private key is secretly shared by the blockchain system to multiple nodes of the blockchain system, and when the result indicates that the model ciphertext passes the verification, the first electronic device reconstructs the first private key based on multiple shares of multiple nodes.
5. A method for machine learning model verification and trading, characterized in that: A first smart contract generated according to a first private key, a second private key, a test data ciphertext, a label ciphertext, a model ciphertext, and an accuracy threshold ciphertext is executed according to a set of fully homomorphic encryption parameters: Secretly sharing the first private key and the second private key with a plurality of blockchain nodes; Selecting a plurality of verification devices, wherein the plurality of verification devices are used to perform a verification, the verification comprising: Inferring the test data ciphertext according to the model ciphertext to generate a plurality of inference results; Performing a plurality of first fully homomorphic encryption comparison operations on the plurality of inference results and the tag ciphertext to generate a plurality of accuracies; as well as performing a plurality of second fully homomorphic encryption comparison operations on a plurality of the accuracies and the accuracy thresholds to generate a plurality of first comparison results; Produce a correct comparison result according to a plurality of third fully homomorphic encryption comparison operations between a plurality of the first comparison results; Decrypting the correct comparison result using the first private key and the second private key that are secretly shared to generate a correct comparison result plaintext; as well as It is determined whether to provide the second private key to the first electronic device according to the correct comparison result, wherein the first electronic device decrypts the model ciphertext according to the first private key and the second private key.
6. The method for machine learning model verification and transaction according to claim 5, characterized in that: The plurality of verification devices are further configured to provide a first amount of cryptocurrency respectively according to a second smart contract, and to generate the correct comparison result, including: Grouping the plurality of first comparison results, wherein third fully homomorphic encryption comparison results of the same group among the plurality of first comparison results are identical to each other; generating the correct comparison result according to a comparison result group including a maximum number generated by the grouping, and determining that one of the plurality of first comparison results other than the comparison result group including the maximum number is a fraudulent result; as well as The first amount of cryptocurrency belonging to a fraud verification device corresponding to the fraud result is confiscated.
7. The method for machine learning model verification and transaction according to claim 6, characterized in that: The method further includes distributing a second amount of cryptocurrency equally to a cryptocurrency account of each of the plurality of verification devices corresponding to the maximum number of comparison result groups according to the first smart contract.
8. The method for machine learning model verification and transaction according to claim 6, characterized in that: Also includes: According to the first smart contract, the maximum number is compared with a quantity threshold, wherein when the maximum number is less than the quantity threshold, a plurality of re-selected verification devices are selected to re-execute the verification.
9. The method for machine learning model verification and transaction according to claim 6, characterized in that: Also includes: receiving a second amount of cryptocurrency from a model purchaser cryptocurrency account; and According to the correct comparison result plaintext including a first value, it is determined that the model ciphertext passes the verification, and the second amount of cryptocurrency is transferred to a model provider cryptocurrency account.
10. The method for machine learning model verification and transaction according to claim 6, characterized in that: Also includes: According to the correct comparison result plaintext including a second value, it is determined that the model ciphertext has not passed the verification, and the second amount of cryptocurrency is transferred to the model buyer's cryptocurrency account, and the confiscated first amount of cryptocurrency is transferred to the model provider's cryptocurrency account.