Method and apparatus for blockchain-based model training and risk prediction
By deploying smart contracts and joint models on the blockchain and using a shared coding layer and risk prediction model for joint learning, the problem of high human and material costs in enterprise on-chain risk control is solved, the performance of risk prediction models is improved and costs are reduced, while ensuring data privacy and security.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
- Filing Date
- 2022-11-24
- Publication Date
- 2026-06-05
AI Technical Summary
In enterprise blockchain risk control, existing technologies require separate modeling and risk assessment for each business party, leading to an exponential increase in human and material costs as the number of participating business parties increases. Furthermore, traditional centralized controllers for collaborative learning suffer from data node issues and the risk of restoring original data.
A blockchain-based model training method is adopted. By deploying smart contracts and joint models on the blockchain, a risk prediction model is learned by using a shared encoding layer to learn general information of the target industry and business-specific information. This model includes an encoding layer, a fully connected layer, and a classification layer, thereby achieving joint learning and risk prediction.
It improved the performance of risk prediction models for multiple business units, reduced manpower input, lowered costs, and avoided the risk of data privacy leakage through decentralized aggregation.
Smart Images

Figure CN115829102B_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification belong to the field of blockchain technology, and in particular relate to methods and apparatus for blockchain-based model training and risk prediction. Background Technology
[0002] Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and cryptographic algorithms. In a blockchain system, data blocks are sequentially linked together to form a chain-like data structure, and a distributed ledger is cryptographically guaranteed to be immutable and unforgeable. Due to its decentralized, immutable, and autonomous characteristics, blockchain is receiving increasing attention and application.
[0003] In enterprise on-chain risk control, blockchain technology (such as 3.0 blockchain technology based on swarm learning) can connect multiple different business parties through the interconnectivity of the Internet. Each business party has its own unique training sample set, and each training sample contains information unique to its business party. Summary of the Invention
[0004] The purpose of this invention is to provide a method and apparatus for blockchain-based model training and risk prediction, which can not only improve the performance of risk prediction models corresponding to multiple business parties, but also reduce manpower input and lower costs.
[0005] This specification provides a blockchain-based model training method. A first smart contract is deployed in the blockchain. The state of the first smart contract stores training sample sets for multiple business parties belonging to a target industry that are connected to the blockchain. Any training sample includes a user identifier, user characteristic information, and a training label indicating whether the user poses a risk to the corresponding business party. A computing node corresponding to the blockchain stores a joint model to be trained. The joint model includes a shared encoding layer and risk prediction models corresponding to each of the multiple business parties. The risk prediction model includes an encoding layer, a fully connected layer, and a classification layer. The method is applied to the computing node and includes: obtaining the training sample sets for each of the multiple business parties by calling the first smart contract; for a first sample in the training sample set of the first business party, the user characteristic information in the first sample is... The user feature information is input into the encoding layer corresponding to the first business party to obtain the first private feature of the first business party output by the encoding layer; when the training sample sets of other business parties among the plurality of business parties do not include samples with the same user identifier as the first sample, the user feature information in the first sample is input into the shared encoding layer to obtain the first shared feature of the target industry output by the shared encoding layer; the first private feature and the first shared feature are input into the fully connected layer corresponding to the first business party to obtain the first fusion feature output by the fully connected layer, and the first fusion feature is input into the classification layer corresponding to the first business party to obtain the first prediction result output by the classification layer, and a first prediction loss is determined based on the first prediction result and the training labels in the first sample; based on the first prediction loss, the parameters of the shared encoding layer and the risk prediction model corresponding to the first business party are adjusted.
[0006] This specification provides a second aspect of a blockchain-based risk prediction method. The blockchain deploys a second smart contract, the state of which stores a trained joint model. The joint model includes a shared encoding layer and risk prediction models corresponding to multiple business entities connected to the blockchain and belonging to a target industry. Each risk prediction model includes an encoding layer, a fully connected layer, and a classification layer. The method is applied to a node in the blockchain and includes: receiving a first transaction sent by a computing device of a target business entity, where the target business entity is one of the multiple business entities. The first transaction is used to invoke the second smart contract and includes user characteristic information of the user to be risk predicted; by executing the first transaction, inputting the user characteristic information into the encoding layer and the shared encoding layer corresponding to the target business entity to obtain the private characteristics of the target business entity output by the encoding layer corresponding to the target business entity, and the shared characteristics of the target industry output by the shared encoding layer; inputting the private characteristics and the shared characteristics into the fully connected layer corresponding to the target business entity to obtain a fused characteristic output by the fully connected layer; inputting the fused characteristic into the classification layer corresponding to the target business entity to obtain a prediction result output by the classification layer; and returning the prediction result to the computing device.
[0007] This specification provides a blockchain-based model training device. A first smart contract is deployed in the blockchain. The state of the first smart contract stores training sample sets for multiple business parties belonging to a target industry and connected to the blockchain. Any training sample includes a user identifier, user characteristic information, and a training label indicating whether the user poses a risk to the corresponding business party. A joint model to be trained is stored in the computing node corresponding to the blockchain. The joint model includes a shared encoding layer and risk prediction models corresponding to each of the multiple business parties. The risk prediction model includes an encoding layer, a fully connected layer, and a classification layer. The device is applied to the computing node and includes: an acquisition unit configured to acquire the training sample sets for each of the multiple business parties by calling the first smart contract; and a first input unit configured to input the user characteristic information from the first sample in the training sample set of the first business party among the multiple business parties into the first sample. The system comprises: a first private feature of the first business party, output by the encoding layer corresponding to the first business party; a second input unit, configured to input user feature information from the first sample into the shared encoding layer when none of the training sample sets of the other business parties among the plurality of business parties contain samples with the same user identifier as the first sample, to obtain the first shared feature of the target industry output by the shared encoding layer; a determination unit, configured to input the first private feature and the first shared feature into the fully connected layer corresponding to the first business party, to obtain the first fusion feature output by the fully connected layer, and input the first fusion feature into the classification layer corresponding to the first business party, to obtain the first prediction result output by the classification layer, and determine the first prediction loss based on the first prediction result and the training labels in the first sample; and an adjustment unit, configured to adjust the parameters of the shared encoding layer and the risk prediction model corresponding to the first business party based on the first prediction loss.
[0008] This specification provides a blockchain-based risk prediction device in its fourth aspect. The blockchain deploys a second smart contract, the state of which stores a trained joint model. The joint model includes a shared encoding layer and risk prediction models corresponding to multiple business entities connected to the blockchain and belonging to a target industry. Each risk prediction model includes an encoding layer, a fully connected layer, and a classification layer. The device is applied to a node of the blockchain and includes a receiving unit configured to receive a first transaction sent by a computing device of a target business entity, which is one of the multiple business entities. The first transaction is used to invoke the second smart contract and includes a risk prediction model to be performed. The system includes: user characteristic information of the user being predicted; a transaction execution unit configured to, by executing the first transaction, input the user characteristic information into the encoding layer corresponding to the target business party and the shared encoding layer to obtain the private characteristics of the target business party output by the encoding layer corresponding to the target business party, and the shared characteristics of the target industry output by the shared encoding layer; input the private characteristics and the shared characteristics into the fully connected layer corresponding to the target business party to obtain the fused characteristics output by the fully connected layer; input the fused characteristics into the classification layer corresponding to the target business party to obtain the prediction result output by the classification layer; and a sending unit configured to return the prediction result to the computing device.
[0009] The fifth aspect of this specification provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method described in either the first or second aspect.
[0010] A sixth aspect of this specification provides a computing device including a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method described in either the first or second aspect.
[0011] A seventh aspect of this specification provides a computer program, wherein when the computer program is executed in a computer, it causes the computer to perform the method described in either the first or second aspect.
[0012] The solution provided in the embodiments of this specification supports multiple business parties in the target industry to access the blockchain and upload their respective training sample sets to the blockchain. Furthermore, a joint model is designed for training on the corresponding computing nodes of the blockchain. This joint model includes a shared encoding layer and risk prediction models corresponding to each of the multiple business parties. Each risk prediction model includes an encoding layer, a fully connected layer, and a classification layer. The shared encoding layer is used to learn general information of the target industry, while the encoding layers in the risk prediction models are used to learn the specific information of their respective business parties. The outputs of the encoding layers corresponding to any business party and the shared encoding layer serve as the inputs to the fully connected layers corresponding to that business party. Based on this, more business parties can access the blockchain, allowing computing nodes to collect a large number of training samples from the target industry. By employing a joint learning approach to train the joint model, the system ensures sufficient learning of both the specific information of each business party and the general information of the target industry. This not only improves the performance of the risk prediction models corresponding to each business party but also reduces manpower and costs. Attached Figure Description
[0013] To more clearly illustrate the technical solutions of the embodiments in this specification, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 This is a diagram of a blockchain architecture in one embodiment;
[0015] Figure 2 This is a schematic diagram illustrating one application scenario in which the embodiments of this specification can be applied;
[0016] Figure 3 This is a flowchart of the blockchain-based model training method in the embodiments of this specification;
[0017] Figure 4 This is a schematic diagram of the model training process;
[0018] Figure 5 This is a flowchart of the blockchain-based model training method in the embodiments of this specification;
[0019] Figure 6 This is a schematic diagram of the model training process;
[0020] Figure 7 This is a flowchart of the blockchain-based risk prediction method in the embodiments of this specification;
[0021] Figure 8 This is a schematic diagram of the structure of the blockchain-based model training device in the embodiments of this specification;
[0022] Figure 9 This is a schematic diagram of the structure of the blockchain-based risk prediction device in the embodiments of this specification. Detailed Implementation
[0023] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this specification.
[0024] Figure 1 A blockchain architecture diagram from one embodiment is shown. Figure 1 In the blockchain architecture diagram shown, blockchain 100 includes N nodes. Figure 1 The diagram illustrates nodes 1 through 8. The lines connecting the nodes schematically represent P2P (Peer-to-Peer) connections, such as TCP connections, used for data transfer between nodes. These nodes can store the entire ledger, i.e., the state of all blocks and all accounts. Each node in the blockchain can produce the same state by executing the same transactions, and each node can store the same state database.
[0025] In the blockchain field, a transaction refers to a unit of task executed and recorded within the blockchain. A transaction typically includes a From field, a To field, and a Data field. Specifically, in the case of a transfer transaction, the From field represents the account address initiating the transaction (i.e., initiating a transfer task to another account), the To field represents the account address receiving the transaction (i.e., receiving the transfer), and the Data field includes the transfer amount.
[0026] Blockchain provides the functionality of smart contracts. A smart contract on the blockchain is a contract that can be triggered and executed through transactions within the blockchain system. Smart contracts can be defined in the form of code. Calling a smart contract on the blockchain involves initiating a transaction pointing to the smart contract's address, causing each node in the blockchain to run the smart contract code in a distributed manner.
[0027] In a contract deployment scenario, for example, Bob sends a transaction containing information about creating a smart contract (i.e., deploying the contract) to a server such as... Figure 1In the blockchain shown, the `data` field of the transaction includes the code (such as bytecode or machine code) of the contract to be created, and the `to` field of the transaction is empty, indicating that the transaction is used to deploy the contract. After the nodes reach an agreement through the consensus mechanism, they determine the contract address "0x6f8ae93…". Each node adds a contract account corresponding to the contract address of the smart contract to the state database, allocates state storage corresponding to the contract account, stores the contract code, and saves the hash value of the contract code in the contract's state storage, thus the contract is successfully created.
[0028] In scenarios where contracts are invoked, for example, Bob sends a transaction to invoke a smart contract, such as... Figure 1 In the blockchain shown, the `from` field of this transaction is the address of the account of the transaction initiator (i.e., Bob), the `to` field is the aforementioned "0x6f8ae93…", which is the address of the smart contract being invoked, and the `data` field of the transaction includes the method and parameters for invoking the smart contract. After consensus is reached on this transaction in the blockchain, each node in the blockchain can execute the transaction, thereby executing the contract separately, and updating the state database based on the execution of the contract.
[0029] One of the decentralized characteristics that distinguishes blockchain technology from traditional technologies is its distributed ledger system, where records are kept on multiple nodes, rather than a centralized system. For a blockchain system to become a robust, publicly accessible, and tamper-proof decentralized system of honest and trustworthy data records, it needs to ensure the security, clarity, and irreversibility of distributed data records in the shortest possible time. In different types of blockchain networks, consensus algorithms are typically used to maintain consistency across the nodes recording the ledger—the consensus mechanisms mentioned earlier. For example, blockchain nodes can implement block-level consensus mechanisms. After a node (e.g., a unique node) generates a block, if this block is recognized by other nodes, those nodes record the same block. As another example, blockchain nodes can implement transaction-level consensus mechanisms. After a node (e.g., a unique node) acquires a blockchain transaction, if this transaction is recognized by other nodes, each node that recognized the transaction can add it to its own latest maintained block, ultimately ensuring that all nodes produce the same latest block. A consensus mechanism is a mechanism by which blockchain nodes reach a network-wide consensus on block information (or block data), ensuring that the latest block is accurately added to the blockchain. Current mainstream consensus mechanisms include Proof of Work (POW), Proof of Stake (POS), Delegated Proof of Stake (DPoS), and Practical Byzantine Fault Tolerance (PBFT) algorithms. In various consensus algorithms, consensus on a consensus proposal is typically determined after a predetermined number of nodes reach agreement on the proposed data. Specifically, in the PBFT algorithm, for N ≥ 3f+1 consensus nodes, f malicious nodes can be tolerated. That is, when 2f+1 out of N consensus nodes reach agreement, consensus is considered successful.
[0030] As mentioned earlier, in enterprise on-chain risk control, blockchain technology (such as Swarm learning-based 3.0 blockchain technology) can connect multiple different business parties through the interconnectivity of the internet. Each business party has its own unique training sample set, and each training sample contains information specific to its business party. Specifically, 3.0 blockchain technology combines blockchain with federated learning. Based on the Ethereum version, it adopts a decentralized aggregation approach, optimizing the data node issues in the centralized controller of traditional federated learning and avoiding the risk that even if gradients are transmitted, the original data can still be reconstructed. Currently, it is often necessary to model and analyze risks separately for each business party. The human and material costs involved increase exponentially with the number of participating business parties.
[0031] In order to improve the performance of risk prediction models for multiple business units, reduce manpower input, and lower costs, this specification provides a blockchain-based model training and risk prediction method.
[0032] See Figure 2 This is a schematic diagram illustrating one application scenario to which the embodiments of this specification can be applied. Figure 2 The application scenario shown may include the computing devices of multiple business parties (e.g., computing device 201 of business party A, computing device 202 of business party B, and computing device 203 of business party C), blockchain 204, and computing node 205 corresponding to blockchain 204.
[0033] It should be noted that, for ease of description, only... Figure 2 The diagram shows three business parties: Business Party A, Business Party B, and Business Party C. It should be understood that more business parties can join Blockchain204; no specific limitation is made here. These multiple business parties can be institutions belonging to the target industry. The target industry can be a broad sector, such as healthcare, finance, education, law, or construction. It should be understood that the target industry can be any industry; no specific limitation is made here.
[0034] A blockchain 204 includes N nodes. Figure 2The diagram illustrates nodes 1 through 8. For a detailed explanation of these N nodes, please refer to the preceding descriptions; they will not be repeated here. In one example, blockchain 204 can be a consortium blockchain formed based on the aforementioned business parties. Any of these business parties can correspond to a node in blockchain 204, and can access the blockchain through that node. In another example, blockchain 204 can employ swarm learning-based 3.0 blockchain technology. Compared to traditional methods, it uses a decentralized aggregation approach, optimizing the data node problem in the centralized controller of traditional federated learning and avoiding the risk that even if gradients are passed, the original data can still be reconstructed.
[0035] Blockchain 204 can deploy smart contracts Cont1 and Cont2. Smart contract Cont1 can be used for training sample management and can be called by the aforementioned multiple business parties. As an example, any of the aforementioned business parties can send a transaction Tx2 to blockchain 204 via a computing device to upload a training sample set to the blockchain. Transaction Tx2 can call smart contract Cont1 and includes the business party's account in the blockchain and the training sample set. Blockchain 204 can execute transaction Tx2 to associate the training sample set with that account and store it in the state of smart contract Cont1. Based on this, the state of smart contract Cont1 can store the training sample sets of each of the aforementioned business parties, and smart contract Cont1 can manage the training sample sets. In one example, smart contract Cont1 can include an interface I1 for uploading training samples and an interface I2 for retrieving training samples. Interface I1 can be called by the aforementioned multiple business parties, and interface I2 can be called by computing node 205. This avoids business parties calling smart contract Cont1 to obtain their respective training datasets, thereby preventing privacy leaks.
[0036] The smart contract Cont2 can be used for joint model management. As an example, the state of the smart contract Cont2 can store a joint model to be trained, which includes a shared encoding layer and risk prediction models corresponding to each of the aforementioned business parties. These risk prediction models include encoding layers, fully connected layers, and classification layers. Figure 2 As shown, the risk prediction model for business party A includes an encoding layer E1, a fully connected layer FCL1, and a classification layer S1. The risk prediction model for business party B includes an encoding layer E2, a fully connected layer FCL2, and a classification layer S2. The risk prediction model for business party C includes an encoding layer E3, a fully connected layer FCL3, and a classification layer S3.
[0037] For any of the aforementioned business parties, such as business party A, the encoding layer E1 corresponding to business party A is a unique encoding layer for business party A. Encoding layer E1 can be used to learn the unique information of business party A (which can be called private features). The shared encoding layer is an encoding layer shared by the aforementioned business parties and can be used to learn the general information of the target industry (which can be called shared features). The outputs of encoding layer E1 and the shared encoding layer serve as the inputs to the fully connected layer FCL1 corresponding to business party A. The fully connected layer FCL1 can be used to fuse the outputs of encoding layer E1 and the shared encoding layer, such as by adding or concatenating the outputs, thereby outputting fused features. These fused features can be input into the classification layer S1 corresponding to business party A, causing the classification layer S1 to output a prediction result.
[0038] In practice, the encoding layers corresponding to the aforementioned multiple business parties may include the same encoder; or, the encoders included in the encoding layers corresponding to the aforementioned multiple business parties may be determined based on the business of the respective business party. As an example, the complexity of the business can be categorized as simple, normal, and complex. Taking business party A as an example again, if business party A's business is relatively simple, the encoder included in encoding layer E1 can be a tree model; if business party A's business is relatively normal, the encoder included in encoding layer E1 can be a regular neural network; if business party A's business is relatively complex, the encoder included in encoding layer E1 can be a Transformer model. Additionally, the encoder included in the shared encoding layer can, for example, be a Transformer model. It should be noted that the selection of encoders included in the shared encoding layer and the encoding layers corresponding to the aforementioned multiple business parties can be chosen according to actual needs, and no specific limitations are made here. The classification layers corresponding to the aforementioned multiple business parties may include activation functions (such as the sigmoid function), which can be used to calculate the probability that a user poses a risk (such as default).
[0039] It should be noted that smart contract Cont1 and smart contract Cont2 can be the same smart contract or different smart contracts; no specific limitation is made here.
[0040] Compute node 205 can be independent of blockchain 204, or it can be a node within blockchain 204. Compute node 205 has the capability to train the joint model. Compute node 205 can obtain the joint model to be trained by calling smart contract Cont2. In one example, smart contract Cont2 may include an interface I3 for obtaining the joint model, which can be called by compute node 205 to obtain the joint model to be trained. Additionally, compute node 205 can obtain the training sample sets of each of the aforementioned business parties by calling smart contract Cont1, for example, by calling interface I2 in smart contract Cont1. Then, compute node 205 can train the joint model based on the obtained training sample sets.
[0041] After the joint model training is complete, compute node 205 can send transaction Tx3 to blockchain 204 to update the joint model in the state of smart contract Cont2. Transaction Tx3 includes information about the trained joint model, such as its parameters. Blockchain 204 can then update the joint model in the state of smart contract Cont2 by executing transaction Tx3. Subsequently, when the aforementioned business parties have risk prediction needs, they can perform risk prediction by calling smart contract Cont2.
[0042] The solutions provided in the embodiments of this specification are described below with reference to specific examples.
[0043] See Figure 3 This is a flowchart of a blockchain-based model training method in the embodiments of this specification. A first smart contract (e.g., the smart contract Cont1 described above) is deployed in the blockchain. The state of the first smart contract stores training sample sets for multiple business parties connected to the blockchain and belonging to the target industry. Any training sample includes the user identifier, user characteristic information, and training labels indicating whether the user poses a risk to the corresponding business party. The computing node corresponding to the blockchain stores a joint model to be trained. This joint model includes a shared encoding layer and risk prediction models corresponding to each of the multiple business parties. The risk prediction model includes an encoding layer, a fully connected layer, and a classification layer. This method can be applied to this computing node.
[0044] like Figure 3 As shown, firstly, in step S301, the training sample sets of multiple business parties are obtained by calling the first smart contract.
[0045] Specifically, when the computing node corresponding to the blockchain is independent of the blockchain, the computing node can send a transaction Tx4 to the blockchain to invoke the smart contract Cont1 to obtain the training sample sets of the aforementioned multiple business parties. The blockchain can then obtain the training sample sets of the aforementioned multiple business parties from the state of the smart contract Cont1 by executing transaction Tx4 and return the training sample sets to the computing node. When the computing node is a node in the blockchain, the computing node can directly invoke the smart contract Cont1 to obtain the training sample sets of the aforementioned multiple business parties.
[0046] The training samples in the training sample sets of the aforementioned multiple business units generally employ the same data structure, including user identifiers, user feature information, and training labels. Furthermore, these multiple business units typically use the same user identifier allocation rules, allowing the same user to be assigned the same identifier to the same user. This facilitates the identification of the same user from different business units during model training. Additionally, the user feature information in the training samples across the individual training sample sets of these multiple business units is generally associated with the same fields. This helps the respective encoding layers of each business unit better learn the unique information of that business unit, and also helps the shared encoding layers better learn the general information of the target industry.
[0047] In practice, to ensure the security of training samples, the training sample sets of the aforementioned business parties can be in encrypted form. In one example, a Trusted Execution Environment (TEE) can be introduced into the blockchain to protect private data. A TEE is a secure extension of CPU hardware and a trusted execution environment completely isolated from the outside world. Currently, the industry is paying close attention to TEE solutions; almost all mainstream chip and software alliances have their own TEE solutions, such as the TPM (Trusted Platform Module) in software and Intel SGX (Software Guard Extensions), ARM Trustzone, and AMD PSP (Platform Security Processor) in hardware. A TEE acts as a black box; the code and data executed within a TEE cannot be viewed even at the operating system level, and can only be manipulated through predefined interfaces in the code. In terms of efficiency, due to the black-box nature of the TEE, the computations performed within it are plaintext data, rather than the complex cryptographic operations of homomorphic encryption, resulting in almost no loss of computational efficiency. Therefore, adopting TEE technology can largely meet the trusted computing requirements in blockchain scenarios with relatively small performance loss.
[0048] In TEE technology, Intel SGX (Intel Software Guard Extension, hereinafter referred to as SGX) technology will be used as an example for explanation. Blockchain nodes can create enclaves (enclaves or enclaves) based on SGX technology to serve as TEEs for executing blockchain transactions. Specifically, blockchain nodes utilize newly added processor instructions in the CPU to allocate a portion of memory as an EPC (Enclave Page Cache) to house the aforementioned enclaves. The memory region corresponding to the EPC is encrypted by the CPU's internal Memory Encryption Engine (MEE). The contents of this memory region (the code and data within the enclave) can only be decrypted within the CPU core, and the encryption and decryption keys are only generated and stored in the CPU when the EPC starts. Therefore, the security boundary of the enclave only includes itself and the CPU. Neither privileged nor non-privileged software can access the enclave, and even operating system administrators and VMMs (Virtual Machine Monitors; or Hypervisors) cannot affect the code and data within the enclave, thus providing extremely high security. With the aforementioned security safeguards in place, the CPU can process data within the Enclave with extremely high computational efficiency, thus balancing data security and computational efficiency. Furthermore, data entering and leaving the TEE can be encrypted, thereby protecting data privacy.
[0049] Based on this, the computing node may include a TEE unit, which can provide the training sample sets of the various business parties and the joint model to be trained to the TEE unit. The TEE unit can then decrypt the ciphertext corresponding to the training sample sets of the various business parties and train the joint model based on the decrypted plaintext. The TEE unit may store corresponding public and private keys. The ciphertext corresponding to the training sample set can be generated by encryption based on the public key, and the TEE unit can decrypt the ciphertext corresponding to the training sample set based on the private key.
[0050] In another example, the ciphertext corresponding to the training sample sets of the aforementioned multiple business parties can be generated using a homomorphic encryption algorithm. Specifically, any training sample in this training sample set, including user identifiers, user feature information, and training labels, can be generated using a homomorphic encryption algorithm. A homomorphic encryption algorithm is an encryption function with the following property: performing operations on plaintext and then encrypting it is equivalent to performing the corresponding operations on the encrypted ciphertext. Based on this property of the homomorphic encryption algorithm, the joint model to be trained can be trained using the ciphertext corresponding to the training sample sets of the aforementioned multiple business parties. It should be noted that the computing nodes can store the public and private keys corresponding to the homomorphic encryption algorithm, and the ciphertext corresponding to the training sample sets of the aforementioned multiple business parties can be generated by encrypting them using the public key.
[0051] In step S303, for the first sample in the training sample set of the first business party among multiple business parties, the user feature information in the first sample is input into the encoding layer corresponding to the first business party to obtain the first private feature of the first business party output by the encoding layer.
[0052] The first business party can be one of the aforementioned business parties, and the first sample can be one or more samples from the training sample set of the first business party that did not participate in the training of the model in this round.
[0053] In step S305, when none of the training sample sets of the other business parties among the above-mentioned multiple business parties include samples with the same user identifier as the first sample, the user feature information in the first sample is input into the shared coding layer to obtain the first shared feature of the target industry output by the shared coding layer.
[0054] In step S307, the first private feature and the first shared feature are input into the fully connected layer corresponding to the first business party to obtain the first fusion feature output by the fully connected layer, and the first fusion feature is input into the classification layer corresponding to the first business party to obtain the first prediction result output by the classification layer, and the first prediction loss is determined based on the first prediction result and the training labels in the first sample.
[0055] In step S309, based on the first prediction loss, the parameters of the risk prediction model corresponding to the shared coding layer and the first business party are adjusted.
[0056] The following example illustrates the concept of business party A as the first business party and sample A_Sample1 as the first sample related to enterprise 1. Enterprise 1 is a user of business party A, and sample A_Sample1 specifically includes enterprise 1's enterprise identifier, enterprise characteristic information F1, and a training label Label1 used to indicate whether enterprise 1 poses a risk.
[0057] See Figure 4This is a schematic diagram of the model training process. During model training, it can be done as follows: Figure 4 As shown, the enterprise feature information F1 of enterprise 1 is input into the encoding layer E1 corresponding to business party A to obtain the private feature A_PF1 of business party A output by encoding layer E1. When the training sample sets of other business parties among the above-mentioned multiple business parties do not include samples with the same enterprise identifier as sample A_Sample1, the enterprise feature information F1 of enterprise 1 can be input into the shared encoding layer to obtain the shared feature SF1 of the target industry output by the shared encoding layer. Then, the private feature A_PF1 and the shared feature SF1 can be input into the fully connected layer FCL1 corresponding to business party A to obtain the fusion feature A_MF1 output by the fully connected layer FCL1, and the fusion feature A_MF1 can be input into the classification layer S1 corresponding to business party A to obtain the prediction result A_R1 output by classification layer S1. The fusion feature A_MF1 can include the feature obtained by adding or concatenating the private feature A_PF1 and the shared feature SF1. Then, the prediction loss A_Loss1 can be determined based on the prediction result A_R1 and the training label Label1. For example, a loss function (such as cross-entropy) can be used to determine the prediction loss A_Loss1 based on the prediction result A_R1 and the training label Label1. Then, based on the prediction loss A_Loss1, only the parameters of the risk prediction model corresponding to the shared encoding layer and business party A can be adjusted, without adjusting the parameters of the risk prediction models corresponding to other business parties.
[0058] Figure 3 The corresponding implementation provides a model training scheme that supports multiple business parties in the target industry to access the blockchain and upload their respective training sample sets to the blockchain. Furthermore, a joint model for training on the corresponding computing nodes of the blockchain is designed. This joint model includes a shared encoding layer and risk prediction models for each of the multiple business parties. Each risk prediction model includes an encoding layer, a fully connected layer, and a classification layer. The shared encoding layer learns general information about the target industry, while the encoding layers in the risk prediction models learn the specific information of their respective business parties. The outputs of the encoding layers for any business party and the shared encoding layer serve as the inputs to the fully connected layers for that business party. Based on this, more business parties can access the blockchain, allowing computing nodes to collect a large number of training samples from the target industry. By employing a joint learning approach to train the joint model, the system ensures sufficient learning of both the specific information of each business party and the general information of the target industry. This not only improves the performance of the risk prediction models for each business party but also reduces manpower and costs.
[0059] Existing multi-task learning methods typically train models based solely on training data from users within a shared user base across all participating parties. This results in limited training data available for model training, hindering performance improvement. However,... Figure 3 In the model training scheme provided in the corresponding embodiment, when the first sample in the training sample set of the first business party involves only users of the first business party, the shared coding layer and the risk prediction model corresponding to the first business party can be activated in the joint model, while the risk prediction models corresponding to other business parties are frozen. This allows training of the shared coding layer and the risk prediction model corresponding to the first business party based on the first sample. Compared with existing multi-task learning methods, this scheme ensures a large number of training samples for training the joint model, improving the performance of the joint model and thus improving the performance of the individual risk prediction models corresponding to the multiple business parties.
[0060] In one implementation, when the training sample set of the second business party among the aforementioned other business parties includes a second sample with the same user identifier as the first sample, the following can be executed: Figure 5 The process is shown below.
[0061] See Figure 5 This is a flowchart of a blockchain-based model training method as described in the embodiments of this specification. This method can be applied to computing nodes corresponding to a blockchain.
[0062] First, such as Figure 5 As shown, in step S501, the training sample sets of multiple business parties are obtained by calling the first smart contract.
[0063] In step S503, for the first sample in the training sample set of the first business party among multiple business parties, the user feature information in the first sample is input into the encoding layer corresponding to the first business party to obtain the first private feature of the first business party output by the encoding layer.
[0064] In step S505, when the training sample set of the second business party among other business parties includes a second sample with the same user identifier as the first sample, the user feature information in the second sample is input into the encoding layer corresponding to the second business party to obtain the second private feature of the second business party output by the encoding layer.
[0065] In step S507, the user feature information of the first sample and the second sample are input into the shared coding layer to obtain the second shared feature of the target industry output by the shared coding layer.
[0066] In step S509, the first private feature and the second shared feature are input into the fully connected layer corresponding to the first business party to obtain the second fusion feature output by the fully connected layer, and the second fusion feature is input into the classification layer corresponding to the first business party to obtain the second prediction result output by the classification layer, and the second prediction loss is determined based on the second prediction result and the training labels in the first sample.
[0067] In step S511, the second private feature and the second shared feature are input into the fully connected layer corresponding to the second business party to obtain the third fusion feature output by the fully connected layer. The third fusion feature is then input into the classification layer corresponding to the second business party to obtain the third prediction result output by the classification layer. Based on the third prediction result and the training labels in the second sample, the third prediction loss is determined.
[0068] In step S513, based on the fusion result of the second prediction loss and the third prediction loss, the parameters of the risk prediction models corresponding to the shared coding layer, the first business party, and the second business party are adjusted.
[0069] Below, we will continue with the example of business party A as the first business party and sample A_Sample1 as the first sample related to enterprise 1. Additionally, we assume the second business parties include business party B and business party C. The second sample in business party B's training sample set is sample B_Sample2, and the second sample in business party C's training sample set is sample C_Sample2. Sample B_Sample2 specifically includes enterprise 1's enterprise identifier, enterprise characteristic information F2, and training label Label2 used to indicate whether enterprise 1 has any risk. Sample C_Sample2 specifically includes enterprise 1's enterprise identifier, enterprise characteristic information F3, and training label Label3 used to indicate whether enterprise 1 has any risk.
[0070] See Figure 6 This is a schematic diagram of the model training process. During model training, in addition to inputting the enterprise feature information F1 from sample A_Sample1 into the encoding layer E1 corresponding to business party A to obtain the private feature A_PF1 output by encoding layer E1, the enterprise feature information F2 from sample B_Sample2 can also be input into the encoding layer E2 corresponding to business party B to obtain the private feature B_PF2 output by encoding layer E2. The enterprise feature information F3 from sample C_Sample2 can be input into the encoding layer E3 corresponding to business party C to obtain the private feature C_PF2 output by encoding layer E3. Furthermore, the enterprise feature information F1, F2, and F3 can be input into the shared encoding layer to obtain the shared feature SF2 of the target industry output by the shared encoding layer.
[0071] Next, for business party A, its private feature A_PF1 and shared feature SF2 can be input into the fully connected layer FCL1 corresponding to business party A to obtain the fused feature A_MF2 output by the fully connected layer FCL1. This fused feature A_MF2 is then input into the classification layer S1 corresponding to business party A to obtain the prediction result A_R2 output by the classification layer S1. The fused feature A_MF2 can include features obtained by adding or concatenating the private feature A_PF1 and the shared feature SF2. Afterwards, the prediction loss A_Loss2 can be determined based on the prediction result A_R2 and the training label Label1. Specifically, a loss function (such as cross-entropy) can be used to determine the prediction loss A_Loss2 based on the prediction result A_R2 and the training label Label1.
[0072] For business party B, its private feature B_PF2 and shared feature SF2 can be input into the fully connected layer FCL2 corresponding to business party B to obtain the fused feature B_MF3 output by the fully connected layer FCL2. This fused feature B_MF3 is then input into the classification layer S2 corresponding to business party B to obtain the prediction result B_R3 output by the classification layer S2. The fused feature B_MF3 can include features obtained by adding or concatenating the private feature B_PF2 and the shared feature SF2. Then, the prediction loss B_Loss3 can be determined based on the prediction result B_R3 and the training label Label2. Specifically, a loss function (such as cross-entropy) can be used to determine the prediction loss B_Loss3 based on the prediction result B_R3 and the training label Label2.
[0073] For business entity C, its private feature C_PF2 and shared feature SF2 can be input into the fully connected layer FCL3 corresponding to business entity C to obtain the fused feature C_MF3 output by the fully connected layer FCL3. This fused feature C_MF3 is then input into the classification layer S3 corresponding to business entity C to obtain the prediction result C_R3 output by the classification layer S3. The fused feature C_MF3 can include features obtained by adding or concatenating the private feature C_PF2 and the shared feature SF2. Then, the prediction loss C_Loss3 can be determined based on the prediction result C_R3 and the training label Label3. Specifically, a loss function (such as cross-entropy) can be used to determine the prediction loss C_Loss3 based on the prediction result C_R3 and the training label Label3.
[0074] Then, based on the fusion results (e.g., the average value) of the predicted losses A_Loss2, B_Loss3, and C_Loss3, the parameters of the risk prediction models corresponding to the shared coding layer and business parties A, B, and C can be adjusted.
[0075] Figure 5The model training scheme provided in the corresponding embodiment enables more business parties to access the blockchain, thereby allowing the computing nodes corresponding to the blockchain to collect a large number of training samples from the target industry and train the joint model using a joint learning approach. This ensures that the unique information of each business party is fully learned, as well as the general information of the target industry, and that the results of multiple business parties are input simultaneously. This not only improves the performance of the risk prediction models corresponding to each of the multiple business parties, but also reduces manpower input and lowers costs.
[0076] use Figure 3 , Figure 5 The corresponding implementation provides a model training scheme that can continuously iterate and optimize parameters until the model converges.
[0077] In one implementation, a second smart contract (such as the smart contract Cont2 described above) is also deployed in the blockchain. The state of the second smart contract stores the aforementioned joint model to be trained. After the joint model is trained, a computing node can send a transaction to the blockchain to update the joint model in the state of the second smart contract. This transaction includes information about the trained joint model, such as its parameters. The blockchain can then update the joint model in the state of the second smart contract by executing this transaction. In one example, this information can be in encrypted form. The blockchain can decrypt the encrypted information and update the joint model in the state of the second smart contract based on the decrypted plaintext. Subsequently, when the aforementioned multiple business parties have risk prediction needs, they can call the second smart contract to perform risk prediction.
[0078] See Figure 7 This is a flowchart of the blockchain-based model training method in the embodiments of this specification. A second smart contract is deployed in the blockchain, and the state of the second smart contract stores the trained joint model. The joint model includes a shared encoding layer and risk prediction models corresponding to multiple business parties that are connected to the blockchain and belong to the target industry. The risk prediction model includes an encoding layer, a fully connected layer, and a classification layer.
[0079] First, such as Figure 7 As shown, in step S701, the computing device of the target business party sends a first transaction to the node of the blockchain. The target business party is one of the aforementioned multiple business parties. The first transaction is used to call the second smart contract and includes user characteristic information of the user to be risk-predicted.
[0080] In step S703, the blockchain node executes the first transaction, inputting user feature information into the encoding layer and shared encoding layer corresponding to the target business party, obtaining the private features of the target business party output by the encoding layer corresponding to the target business party, and the shared features of the target industry output by the shared encoding layer; inputting the private features and shared features into the fully connected layer corresponding to the target business party, obtaining the fused features output by the fully connected layer; inputting the fused features into the classification layer corresponding to the target business party, obtaining the prediction result output by the classification layer.
[0081] In one implementation, the user characteristic information in the first transaction is in encrypted form. The blockchain nodes include TEE units. During the execution of the first transaction, the blockchain nodes can invoke a second smart contract to obtain a federated model. The TEE unit can load the federated model and decrypt the encrypted information corresponding to the user characteristic information. Therefore, risk prediction can be performed within the TEE unit based on the decrypted plaintext. The TEE unit can store corresponding public and private keys. The encrypted information corresponding to the user characteristic information can be generated by encryption based on the public key, and the TEE unit can decrypt the encrypted information corresponding to the user characteristic information based on the private key.
[0082] In step S705, the blockchain nodes return the prediction results to the computing device.
[0083] Figure 7 The corresponding implementation provides a risk prediction scheme that can achieve on-chain risk prediction. Moreover, by applying a high-performance joint model, the target business party can obtain risk prediction results with high accuracy.
[0084] Figure 8 This is a schematic diagram of the blockchain-based model training device described in the embodiments of this specification. A first smart contract is deployed in the blockchain. The state of the first smart contract stores training sample sets for multiple business parties connected to the blockchain and belonging to the target industry. Any training sample includes the user identifier, user characteristic information, and training labels indicating whether the user poses a risk to the corresponding business party. The computing node corresponding to the blockchain stores a joint model to be trained. The joint model includes a shared encoding layer and risk prediction models corresponding to each of the multiple business parties. The risk prediction model includes an encoding layer, a fully connected layer, and a classification layer. This device can be applied to this computing node.
[0085] like Figure 8As shown, the blockchain-based model training device 800 in the embodiments of this specification may include: an acquisition unit 801, a first input unit 802, a second input unit 803, a determination unit 804, and an adjustment unit 805. Specifically, the acquisition unit 801 is configured to acquire the training sample sets of each of the multiple business parties by calling the first smart contract; the first input unit 802 is configured to input the user feature information in the first sample of the training sample set of the first business party among the multiple business parties into the encoding layer corresponding to the first business party to obtain the first private feature of the first business party output by the encoding layer; the second input unit 803 is configured to input the user feature information in the first sample into the shared encoding layer when the training sample sets of the other business parties among the multiple business parties do not include samples with the same user identifier as the first sample, to obtain the first shared feature of the target industry output by the shared encoding layer; the determination unit 804 is configured to input the first private feature and the first shared feature into the fully connected layer corresponding to the first business party to obtain the first fusion feature output by the fully connected layer, and input the first fusion feature into the classification layer corresponding to the first business party to obtain the first prediction result output by the classification layer, and determine the first prediction loss based on the first prediction result and the training label in the first sample; the adjustment unit 805 is configured to adjust the parameters of the shared encoding layer and the risk prediction model corresponding to the first business party based on the first prediction loss.
[0086] In some embodiments, the first input unit 802 may further be configured to: when the training sample set of the second business party among the other business parties includes a second sample with the same user identifier as the first sample, input the user feature information of the second sample into the encoding layer corresponding to the second business party to obtain the second private feature of the second business party output by the encoding layer; the second input unit 803 may further be configured to: input the user feature information of the first sample and the second sample into a shared encoding layer to obtain the second shared feature of the target industry output by the shared encoding layer; the determining unit 804 may further be configured to: input the first private feature and the second shared feature into the fully connected layer corresponding to the first business party to obtain the second fusion feature output by the fully connected layer, and input the second fusion feature into the first The classification layer corresponding to the business party obtains a second prediction result output by the classification layer, and determines a second prediction loss based on the second prediction result and the training labels in the first sample; the determination unit 804 can also be configured to: input the second private feature and the second shared feature into the fully connected layer corresponding to the second business party to obtain a third fusion feature output by the fully connected layer, and input the third fusion feature into the classification layer corresponding to the second business party to obtain a third prediction result output by the classification layer, and determine a third prediction loss based on the third prediction result and the training labels in the second sample; the adjustment unit 805 can also be configured to: adjust the parameters of the risk prediction model corresponding to the shared encoding layer, the first business party, and the second business party respectively based on the fusion result of the second prediction loss and the third prediction loss.
[0087] In some embodiments, the computing node includes a TEE unit, the joint model is stored in the TEE unit, and the training sample sets of each of the plurality of business parties are training sample sets in encrypted form; and the device 800 may further include: a decryption unit (not shown in the figure), configured to decrypt the encrypted training sample sets corresponding to each of the plurality of business parties in the TEE unit.
[0088] In some embodiments, the computing node is a node in a blockchain.
[0089] In some embodiments, the user feature information in each training sample in the training sample sets of the aforementioned multiple business parties is associated with the same field.
[0090] In some embodiments, the first fusion feature may include a feature obtained by adding or concatenating a first private feature and a first shared feature.
[0091] In some embodiments, a second smart contract is also deployed in the blockchain, and the state of the second smart contract stores the joint model; and the aforementioned apparatus 800 may further include: a sending unit (not shown in the figure), configured to send a transaction to the blockchain after the joint model training is completed, for updating the joint model in the state of the second smart contract, the transaction including information of the trained joint model. In one example, the information of the joint model is in encrypted form.
[0092] Figure 9 This is a schematic diagram of the blockchain-based risk prediction device described in the embodiments of this specification. A second smart contract is deployed in the blockchain, and the state of the second smart contract stores a trained joint model. The joint model includes a shared encoding layer and risk prediction models corresponding to multiple business parties connected to the blockchain and belonging to the target industry. Each risk prediction model includes an encoding layer, a fully connected layer, and a classification layer. This device can be applied to blockchain nodes.
[0093] like Figure 9 As shown in the embodiments of this specification, the blockchain-based risk prediction device 900 may include: a receiving unit 901, a transaction execution unit 902, and a sending unit 903. The receiving unit 901 is configured to receive a first transaction sent by the computing device of a target business party, which is one of the aforementioned multiple business parties. The first transaction is used to invoke a second smart contract and includes user characteristic information of the user to be risk-predicted. The transaction execution unit 902 is configured to, by executing the first transaction, input the user characteristic information into the encoding layer and shared encoding layer corresponding to the target business party to obtain the private characteristics of the target business party output by the encoding layer corresponding to the target business party, and the shared characteristics of the target industry output by the shared encoding layer. The private characteristics and shared characteristics are then input into the fully connected layer corresponding to the target business party to obtain the fused characteristics output by the fully connected layer. The fused characteristics are then input into the classification layer corresponding to the target business party to obtain the prediction result output by the classification layer. The sending unit 903 is configured to return the prediction result to the computing device of the target business party.
[0094] In some embodiments, the user characteristic information in the first transaction is in encrypted form, the blockchain node includes a TEE unit; and the transaction execution unit 902 can be further configured to: call a second smart contract to obtain a federated model; load the federated model in the TEE unit, and decrypt the encrypted information corresponding to the user characteristic information.
[0095] exist Figure 8 , Figure 9 For further explanation of each unit in the corresponding device embodiments, please refer to the relevant descriptions in the previous method embodiments, which will not be repeated here.
[0096] This specification also provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed in a computer, it causes the computer to perform actions such as... Figure 3 , Figure 5 or Figure 7 The method described in the corresponding embodiment.
[0097] This specification also provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements, as shown in the embodiment. Figure 3 , Figure 5 or Figure 7 The method described in the corresponding embodiment.
[0098] This specification also provides a computer program, wherein when the computer program is executed in a computer, it causes the computer to perform the following... Figure 3 , Figure 5 or Figure 7 The method described in the corresponding embodiment.
[0099] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the methodology). However, with technological advancements, many methodological improvements today can be considered direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved methodology into the hardware circuit. Therefore, it cannot be said that a methodological improvement cannot be implemented using hardware physical modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic function is determined by the user programming the device. Designers can program and "integrate" a digital system onto a PLD themselves, without needing chip manufacturers to design and manufacture dedicated integrated circuit chips. Furthermore, nowadays, instead of manually manufacturing integrated circuit chips, this programming is mostly implemented using "logic compiler" software. Similar to the software compiler used in program development, the original code before compilation must be written in a specific programming language, called a Hardware Description Language (HDL). There are many HDLs, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, and RHDL (Ruby Hardware Description Language). Currently, the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should understand that by simply performing some logic programming on the method flow using one of these hardware description languages and programming it into an integrated circuit, the hardware circuit implementing the logical method flow can be easily obtained.
[0100] The controller can be implemented in any suitable manner. For example, it can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicon Labs C8051F320. A memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also recognize that, in addition to implementing the controller in purely computer-readable program code form, the same functionality can be achieved by logically programming the method steps to make the controller take the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers. Therefore, such a controller can be considered a hardware component, and the means included therein for implementing various functions can also be considered as structures within the hardware component. Alternatively, the means for implementing various functions can be considered as both software modules implementing the method and structures within the hardware component.
[0101] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or physical entities, or by products with certain functions. A typical implementation device is a server system. Of course, this application does not exclude the possibility that, with the future development of computer technology, the computer implementing the functions of the above embodiments can be, for example, a personal computer, a laptop computer, an in-vehicle human-machine interaction device, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0102] While one or more embodiments of this specification provide the operational steps of the methods described in the embodiments or flowcharts, more or fewer operational steps may be included based on conventional or non-inventive means. The order of steps listed in the embodiments is merely one possible order of execution among many steps and does not represent the only possible order. In actual device or end product execution, the methods shown in the embodiments or drawings may be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment, or even a distributed data processing environment). The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, product, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, product, or apparatus. Without further limitations, the presence of other identical or equivalent elements in the process, method, product, or apparatus that includes the elements is not excluded. For example, the use of terms such as "first," "second," etc., is to denote names and does not indicate any particular order.
[0103] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, when implementing one or more of these specifications, the functions of each module can be implemented in one or more software and / or hardware components, or a module that performs the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between devices or units, and may be electrical, mechanical, or other forms.
[0104] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0105] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0106] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0107] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0108] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0109] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage, graphene storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0110] Those skilled in the art will understand that one or more embodiments of this specification can be provided as a method, system, or computer program product. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0111] One or more embodiments of this specification can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a particular task or implement a particular abstract data type. One or more embodiments of this specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0112] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, system embodiments are basically similar to method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. In the description of this specification, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this specification. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described can be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification and the features of different embodiments or examples.
[0113] The above description is merely an embodiment of one or more embodiments of this specification and is not intended to limit the scope of these embodiments. Various modifications and variations can be made to these embodiments by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims.
Claims
1. A blockchain-based model training method, wherein a first smart contract is deployed in the blockchain, and the state of the first smart contract stores training sample sets for multiple business parties belonging to a target industry that are connected to the blockchain. Any training sample includes a user identifier, user characteristic information, and a training label indicating whether the user poses a risk to the corresponding business party. A joint model to be trained is stored in the computing node corresponding to the blockchain. The joint model includes a shared encoding layer and risk prediction models corresponding to each of the multiple business parties. The risk prediction models include an encoding layer, a fully connected layer, and a classification layer. The method is applied to the computing node and includes: The training sample sets of the multiple business parties are obtained by calling the first smart contract; For the first sample in the training sample set of the first business party among the plurality of business parties, the user feature information in the first sample is input into the encoding layer corresponding to the first business party to obtain the first private feature of the first business party output by the encoding layer. When none of the training sample sets of the other business parties among the plurality of business parties include samples with the same user identifier as the first sample, the user feature information in the first sample is input into the shared coding layer to obtain the first shared feature of the target industry output by the shared coding layer. The first private feature and the first shared feature are input into the fully connected layer corresponding to the first business party to obtain the first fusion feature output by the fully connected layer. The first fusion feature is then input into the classification layer corresponding to the first business party to obtain the first prediction result output by the classification layer. The first prediction loss is determined based on the first prediction result and the training labels in the first sample. Based on the first prediction loss, adjust the parameters of the risk prediction model corresponding to the shared coding layer and the first business party.
2. The method according to claim 1, further comprising: When the training sample set of the second business party among the other business parties includes a second sample with the same user identifier as the first sample, the user feature information in the second sample is input into the encoding layer corresponding to the second business party to obtain the second private feature of the second business party output by the encoding layer. The user feature information of the first sample and the second sample are input into the shared coding layer to obtain the second shared feature of the target industry output by the shared coding layer; The first private feature and the second shared feature are input into the fully connected layer corresponding to the first business party to obtain the second fusion feature output by the fully connected layer. The second fusion feature is then input into the classification layer corresponding to the first business party to obtain the second prediction result output by the classification layer. A second prediction loss is determined based on the second prediction result and the training labels in the first sample. The second private feature and the second shared feature are input into the fully connected layer corresponding to the second business party to obtain the third fusion feature output by the fully connected layer. The third fusion feature is then input into the classification layer corresponding to the second business party to obtain the third prediction result output by the classification layer. The third prediction loss is determined based on the third prediction result and the training labels in the second sample. Based on the fusion result of the second prediction loss and the third prediction loss, the parameters of the risk prediction models corresponding to the shared coding layer, the first business party, and the second business party are adjusted.
3. The method according to claim 1, wherein, The computing node includes a Trusted Execution Environment (TEE) unit, the joint model is stored in the TEE unit, and the training sample sets of each of the multiple business parties are in encrypted form. as well as The method further includes: The TEE unit decrypts the ciphertext corresponding to the training sample sets of each of the multiple business parties.
4. The method according to claim 1, wherein, The computing node is a node in the blockchain.
5. The method according to claim 1, wherein, The user feature information in each training sample in the training sample sets of the multiple business parties is associated with the same field.
6. The method according to claim 1, wherein, The first fusion feature includes, The feature obtained by adding or concatenating the first private feature and the first shared feature.
7. The method according to any one of claims 1-6, wherein, The blockchain also deploys a second smart contract, the state of which stores the federated model; as well as The method further includes: After the joint model is trained, a transaction is sent to the blockchain to update the state of the joint model in the second smart contract. The transaction includes information about the trained joint model.
8. The method according to claim 7, wherein, The information in the joint model is in encrypted form.
9. A blockchain-based risk prediction method, wherein a second smart contract is deployed in the blockchain, and the state of the second smart contract stores a trained joint model, the joint model including a shared encoding layer and risk prediction models corresponding to multiple business parties connected to the blockchain and belonging to a target industry, each risk prediction model including an encoding layer, a fully connected layer, and a classification layer, the method being applied to nodes of the blockchain, including: The system receives a first transaction sent by the computing device of the target business party, which is one of the plurality of business parties. The first transaction is used to invoke the second smart contract and includes user characteristic information of the user to be subject to risk prediction. By executing the first transaction, the user feature information is input into the encoding layer corresponding to the target business party and the shared encoding layer to obtain the private features of the target business party output by the encoding layer corresponding to the target business party, and the shared features of the target industry output by the shared encoding layer; the private features and the shared features are input into the fully connected layer corresponding to the target business party to obtain the fusion features output by the fully connected layer; the fusion features are input into the classification layer corresponding to the target business party to obtain the prediction result output by the classification layer; The prediction result is returned to the computing device.
10. The method according to claim 9, wherein, The user characteristic information is in encrypted form, and the node includes a Trusted Execution Environment (TEE) unit; and The method further includes: The second smart contract is invoked to obtain the joint model; The TEE unit loads the joint model and decrypts the ciphertext corresponding to the user feature information.
11. A blockchain-based model training device, wherein a first smart contract is deployed in the blockchain, the state of the first smart contract stores training sample sets of multiple business parties connected to the blockchain and belonging to a target industry, each training sample including a user identifier, user feature information, and a training label indicating whether the user poses a risk to the corresponding business party, and a computing node corresponding to the blockchain stores a joint model to be trained, the joint model including a shared encoding layer and risk prediction models corresponding to the multiple business parties, the risk prediction models including an encoding layer, a fully connected layer, and a classification layer, the device being applied to the computing node, comprising: The acquisition unit is configured to acquire the training sample sets of the multiple business parties by invoking the first smart contract; The first input unit is configured to input the user feature information in the first sample of the training sample set of the first business party among the plurality of business parties into the encoding layer corresponding to the first business party, so as to obtain the first private feature of the first business party output by the encoding layer. The second input unit is configured to input the user feature information in the first sample into the shared coding layer when none of the training sample sets of the other business parties among the plurality of business parties contain samples with the same user identifier as the first sample, so as to obtain the first shared feature of the target industry output by the shared coding layer. The determining unit is configured to input the first private feature and the first shared feature into the fully connected layer corresponding to the first business party to obtain the first fusion feature output by the fully connected layer, and input the first fusion feature into the classification layer corresponding to the first business party to obtain the first prediction result output by the classification layer, and determine the first prediction loss based on the first prediction result and the training labels in the first sample. The adjustment unit is configured to adjust the parameters of the risk prediction model corresponding to the shared coding layer and the first business party based on the first prediction loss.
12. A blockchain-based risk prediction device, wherein a second smart contract is deployed in the blockchain, and the state of the second smart contract stores a trained joint model, the joint model including a shared encoding layer and risk prediction models corresponding to multiple business parties connected to the blockchain and belonging to a target industry, the risk prediction model including an encoding layer, a fully connected layer, and a classification layer, the device being applied to nodes of the blockchain, comprising: The receiving unit is configured to receive a first transaction sent by the computing device of the target business party, which is one of the plurality of business parties. The first transaction is used to invoke the second smart contract and includes user characteristic information of the user to be risk-predicted. The transaction execution unit is configured to execute the first transaction by inputting the user feature information into the encoding layer and the shared encoding layer corresponding to the target business party to obtain the private features of the target business party output by the encoding layer corresponding to the target business party, and the shared features of the target industry output by the shared encoding layer; inputting the private features and the shared features into the fully connected layer corresponding to the target business party to obtain the fusion features output by the fully connected layer; and inputting the fusion features into the classification layer corresponding to the target business party to obtain the prediction result output by the classification layer. The sending unit is configured to return the prediction result to the computing device.
13. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of any one of claims 1-10.
14. A computing device comprising a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method of any one of claims 1-10.