Model generation method, reasoning method, related device, equipment, medium and product

By dividing the initial model into sub-models with constant network layer parameters and deploying them on different clients, data security compliance and performance issues in large-scale model generation and inference are solved, and efficient data circulation and privacy protection are achieved.

CN119740609APending Publication Date: 2025-04-01BEIJING ELECTRONIC DIGITAL INTELLIGENCE TECHNOLOGY CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411787009.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

In the process of generating and inference of large models, the existing technology faces data security compliance and performance issues, especially in data circulation and privacy computing, resulting in an increase in time and computing power costs.

Method used

By dividing the initial model into the first sub-model and the second sub-model with constant network layer parameters, and deploying them on different clients respectively, the intermediate data output from the first sub-model is used to adjust the parameters, generate the target model, reduce the number of data circulation, and avoid delay, computing power consumption and privacy leakage risks.

Benefits of technology

The efficiency of target model training is improved, ensuring that the target model performance generated by data without leaving the domain is close to that generated on the data owner side, and at the same time, the time and computing power cost are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119740609A_ABST
    Figure CN119740609A_ABST
Patent Text Reader

Abstract

The invention relates to a model generation method, a reasoning method, a related device, equipment, a medium and a product. The model generation method comprises the steps that an initial model is at least divided into a first sub-model and a second sub-model according to a preset first model division condition, and network layer parameters included in the first sub-model are kept unchanged; deploying the first sub-model at a first client, and deploying the second sub-model at a second client different from the first client; inputting sample input data in a first client into the first sub-model to obtain first intermediate data output by the first sub-model; performing parameter adjustment on the second sub-model according to the first intermediate data and sample annotation data in the first client; and when the second sub-model meets a parameter adjustment termination condition, generating a target model according to the first sub-model and the second sub-model. The number of times of data circulation is effectively reduced, so that the risks of excessive time delay, computing power consumption and privacy disclosure are avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data security and large model technology, and in particular, to a model generation method, a reasoning method, related devices, equipment, media and products. Background Art

[0002] At present, the demand for data in large models is becoming more and more obvious, especially the demand for fine-tuning the basic large models through high-quality data in vertical fields is relatively common. However, these high-quality data are often sensitive and involve the interests of the holders. For example, these data are important assets of the enterprise, or involve the constraints of the Personal Information Protection Law, etc., which leads to concerns about the security and compliance of data circulation. In order to ensure data security and compliance, the current industry practice is usually to desensitize the data or adopt the method of "original data does not leave the domain" (such as privacy computing technology).

[0003] Among them, the data holder's data is desensitized and then handed over to the data user. After the data user gets the data, it conducts local training. This can ensure that the model development (including pre-training, enhanced training, tuning, etc.) will not change significantly, thereby ensuring the time cost and computing power cost. Desensitization methods include but are not limited to: truncating sensitive personal information, or adding noise to key fields. This method is actually still delivering the data, and the data holder's future use value of this data is still uncontrollable; in addition, the desensitization method reduces the use value of the data (for example, noise causes inaccurate calculation results), which in turn leads to a high error rate in the model in the reasoning link.

[0004] In addition, privacy computing technology realizes the circulation of data usage value on the basis of ensuring the interests of data holders, that is, data is available but invisible. Privacy computing covers a variety of technology types, such as Trusted Execution Environment (TEE), Federated Learning (FL), Secure Multi-Party Computation (MPC), Homomorphic Encryption (HE), etc. Different technologies have different security strengths, performance, and applicable scenarios. At present, the industry generally believes that, in general, cryptographic technologies (such as MPC, HE) have the highest security strength but the lowest performance; security based on hardware environment (such as TEE) has the highest performance, but security depends on the security capabilities of hardware manufacturers. Of course, the pros and cons of each technology and its selection and use need to depend on the specific application scenarios and needs.

[0005] The application of privacy computing technology in the field of large models mainly faces performance issues. Large model-related development work often requires large computing power and long computing time. Because privacy computing technology involves underlying technologies such as cryptography and multi-party joint computing, it will generate a large amount (even orders of magnitude) of computing and communication volume, which will further extend the development time of large models and increase computing power costs. At present, the industry generally believes that privacy computing technology is not suitable for large model training, and can only be used in the model reasoning stage, that is, the model call and use stage. Therefore, finding a safe and efficient data circulation method to support large model generation and reasoning and other large model tasks is currently a concern of the industry. Summary of the invention

[0006] The purpose of the present disclosure is to provide a model generation method, reasoning method, related devices, equipment, media and products.

[0007] In order to achieve the above-mentioned purpose, the first aspect of the embodiment of the present disclosure provides a model generation method, the method comprising: According to a preset first model division condition, the initial model is divided into at least a first sub-model and a second sub-model, and the network layer parameters included in the first sub-model remain unchanged; Deploy the first sub-model on a first client, and deploy the second sub-model on a second client different from the first client; Inputting the sample input data in the first client into the first sub-model to obtain first intermediate data output by the first sub-model; Adjusting parameters of the second sub-model according to the first intermediate data and the sample annotation data in the first client; When the second sub-model satisfies the parameter adjustment termination condition, a target model is generated according to the first sub-model and the second sub-model.

[0008] A second aspect of the present disclosure provides a model reasoning method, the method comprising: According to the preset second model division condition, the target model is divided into at least a fourth sub-model and a fifth sub-model; In the third client, the input data in the third client is calculated in the fourth sub-model to obtain a first intermediate result output by the fourth sub-model; In the fourth client, a calculation result of the target model is obtained according to the first intermediate result and the fifth sub-model; Wherein, the target model is generated according to the model generation method described in any one of the first aspects of the embodiments of the present disclosure, the fourth sub-model is deployed on a third client, and the fifth sub-model is deployed on a fourth client different from the third client, and the second model division condition includes: a second condition for indicating that the development cost corresponding to the network layer in the target model meets a preset cost threshold, and a third condition for indicating that the algorithm complexity of the network layer in the target model meets a preset complexity threshold.

[0009] A third aspect of the present disclosure provides a model generation device, the model generation device comprising: A first division module, used to divide the initial model into at least a first sub-model and a second sub-model according to a preset first model division condition, wherein the network layer parameters included in the first sub-model remain unchanged; A deployment module, configured to deploy the first sub-model on a first client, and to deploy the second sub-model on a second client different from the first client; A first input module, used for inputting sample input data in the first client into the first sub-model to obtain first intermediate data output by the first sub-model; A first adjustment module, configured to adjust parameters of the second sub-model according to the first intermediate data and the sample annotation data in the first client; A generating module is used to generate a target model according to the first sub-model and the second sub-model when the second sub-model meets the parameter adjustment termination condition.

[0010] A fourth aspect of the present disclosure provides a model reasoning device, the model reasoning device comprising: A second division module, used for dividing the target model into at least a fourth sub-model and a fifth sub-model according to a preset second model division condition; A second input module is used to calculate the input data in the third client in the fourth sub-model in the third client to obtain a first intermediate result output by the fourth sub-model; An acquisition module, configured to obtain, in the fourth client, a calculation result of the target model according to the first intermediate result and the fifth sub-model; Wherein, the target model is generated according to the model generation method described in any one of the first aspects of the embodiments of the present disclosure, the fourth sub-model is deployed on a third client, and the fifth sub-model is deployed on a fourth client different from the third client, and the second model division condition includes: a second condition for indicating that the development cost corresponding to the network layer in the target model meets a preset cost threshold, and a third condition for indicating that the algorithm complexity of the network layer in the target model meets a preset complexity threshold.

[0011] A fifth aspect of the embodiments of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the model generation method described in any one of the first aspects of the embodiments of the present disclosure.

[0012] A sixth aspect of an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the model reasoning method described in any one of the second aspects of the embodiment of the present disclosure.

[0013] A seventh aspect of the present disclosure provides an electronic device, including: a memory having a computer program stored thereon; A processor is used to execute the computer program in the memory to implement the steps of the model generation method described in any one of the first aspects of the embodiments of the present disclosure.

[0014] An eighth aspect of the present disclosure provides an electronic device, including: a memory having a computer program stored thereon; A processor is used to execute the computer program in the memory to implement the steps of the model reasoning method described in any one of the second aspects of the embodiments of the present disclosure.

[0015] A ninth aspect of the embodiments of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the model generation method described in any one of the first aspects of the embodiments of the present disclosure.

[0016] A tenth aspect of an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the model reasoning method described in any one of the second aspects of the embodiment of the present disclosure.

[0017] By adopting the above technical solution, the first sub-model with unchanged network layer parameters is deployed on the first client. The sample input data in the first client can be calculated by the first sub-model to obtain the first intermediate data without leaving the domain. After that, it is only necessary to send the first intermediate data to the second client, so that the second sub-model can be trained or adjusted for multiple rounds in the second client according to the first intermediate data and the sample annotation data in the first client. There is no need to obtain the first intermediate data from the first client in each round of training, which effectively reduces the number of data circulations and avoids excessive delays, computing power consumption and privacy leakage risks.

[0018] In addition, when training the target model, the first sub-model runs in the first client and the second sub-model runs in the second client. This improves the efficiency of target model training and ensures that the performance of the target model generated by the sample input data of the first client without going out of domain is close to the performance of the target model generated in the second client using the data of the first client.

[0019] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings: Figure 1 The figure is a flow chart of a model generating method according to an exemplary embodiment.

[0021] Figure 2 The figure is a schematic diagram showing a method of dividing an initial model according to an exemplary embodiment.

[0022] Figure 3 According to an exemplary embodiment, a method based on Figure 2 Schematic diagram of the generation of the initial model shown.

[0023] Figures 4A-4D is a schematic diagram showing another way of dividing an initial model according to an exemplary embodiment.

[0024] Figure 5 According to an exemplary embodiment, a method based on Figure 4A Schematic diagram of the generation of the initial model shown.

[0025] Figure 6 According to an exemplary embodiment, a method based on Figure 4B-4D Schematic diagram of the generation of the initial model shown.

[0026] Figure 7Another example embodiment based on Figure 2 Schematic diagram of the generation of the initial model shown.

[0027] Figure 8 Another example embodiment based on Figure 2 Schematic diagram of the generation of the initial model shown.

[0028] Fig. 9 The figure is a flowchart of a model reasoning method according to an exemplary embodiment.

[0029] Fig.10 It is a schematic diagram showing a partitioning target model according to an exemplary embodiment.

[0030] Fig.11 According to an exemplary embodiment, a method based on Fig.10 Schematic diagram of the inference of the target model shown.

[0031] Fig.12 is a schematic diagram showing another method of dividing a target model according to an exemplary embodiment.

[0032] Fig.13 According to an exemplary embodiment, a method based on Fig.12 Schematic diagram of the inference of the target model shown.

[0033] Fig.14 It is a block diagram of a model generating device according to an exemplary embodiment.

[0034] Fig.15 It is a block diagram of a model reasoning device according to an exemplary embodiment.

[0035] Fig.16 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0036] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.

[0037] The large model development scenario includes data holder A and computing power holder B, where data holder A can be called a data provider and computing power holder B can be a party that uses data for model training or parameter tuning. For example, data holder A and computing power holder B can both be defaulted as clients.

[0038] The requirements for large model development are as follows: Data holder A has the data required for large model training, parameter tuning, and reasoning, but due to hardware conditions such as computing power, it is not enough to cope with the training, parameter tuning, and reasoning of the complete large model. Computing power holder B has the computing power required for large model training, but does not have the data required for large model training, parameter tuning, and reasoning, and considering that the computing power of large models requires special building construction conditions and power consumption conditions, it is impossible to transfer the computing power to data holder A. Computing power holder B uses the data of data holder A to enhance and / or optimize the large model, but is unwilling to consume too much additional computing power. Data holder A allows computing power holder B to use its own data for training, parameter tuning, and reasoning, but requires data security, that is, it is necessary to ensure that the data cannot leave the domain.

[0039] Based on the above-mentioned large model development requirements, model splitting technology is proposed in related technologies. Model splitting technology is a technology often used in federated learning. Specifically, the large model is usually split into two parts: a small front end and a large back end. The small front end is the first few layers of the large model. In the model reasoning task, its irreversibility ensures the privacy security of the original data of data holder A. The intermediate parameters calculated by the small front end are sent to the computing power holder B. The computing power holder B can continue to run the large back end according to the intermediate parameters. The computing power holder B cannot reverse the original data of the data holder A based on these intermediate parameters. At the same time, in order to ensure the privacy security of the entire model (including the privacy security of the small front end model parameters), the computing power holder B will perform privacy calculations with the data holder A during the small front end calculation process.

[0040] However, in the related technology, in the scenario of model inference, the large model is split into a small front-end and a large back-end, and the data of data holder A is used once, without considering the data flow between data holder A and computing power holder B. If data needs to be circulated between data holder A and computing power holder B for each round of training during the model generation phase, it will cause excessive delays and computing power consumption, and may also introduce privacy leakage risks.

[0041] In view of this, the present disclosure provides a model generation method, an inference method, a related device, an equipment, a medium and a product. First, the initial model is divided into at least a first sub-model and a second sub-model according to a preset first model division condition, and the network layer parameters included in the first sub-model remain unchanged. The first sub-model is deployed on a first client, and the second sub-model is deployed on a second client different from the first client. Then, in the first client, the sample input data is input into the first sub-model to obtain the first intermediate data. After that, the parameters of the second sub-model are adjusted according to the first intermediate data and the sample annotation data in the first client. Finally, when the parameter adjustment is completed, the target model is obtained according to the first sub-model and the second sub-model. In this way, since the network layer parameters included in the first sub-model remain unchanged, it is only necessary to perform multiple rounds of training or multiple rounds of parameter tuning on the second sub-model in the second client according to the first intermediate data output by the first sub-model and the sample annotation data in the first client. It is not necessary to obtain the first intermediate data from the first client in each round of training, which effectively reduces the number of data circulations, thereby avoiding excessive delays, computing power consumption and privacy leakage risks.

[0042] In addition, when training the target model, the first sub-model runs in the first client and the second sub-model runs in the second client. This improves the efficiency of target model training and ensures that the performance of the generated target model using the sample input data of the first client is close to that of the target model generated in the second client using the data of the first client without going out of domain.

[0043] Figure 1 FIG. 1 is a flow chart of a model generation method according to an exemplary embodiment. Figure 1 As shown, the model generation method may include the following steps.

[0044] In step S11, the initial model is divided into at least a first sub-model and a second sub-model according to a preset first model division condition, and the parameters of the network layer included in the first sub-model remain unchanged.

[0045] In the present disclosure, the first model division condition may include at least one of the following conditions: a first condition for indicating that the network layer parameters in the initial model remain unchanged; a second condition for indicating that the development cost corresponding to the network layer in the initial model meets a preset cost threshold; a third condition for indicating that the algorithm complexity of the network layer in the initial model meets a preset complexity threshold.

[0046] For example, the development cost may include but is not limited to at least one of the hardware computing power cost, the model structure modification cost and the engineering cost. In addition, the algorithm complexity meets the preset complexity threshold means that the intermediate parameters of the network layer output meet the irreversibility. For example, mathematically irreversible operations are used to ensure that the input of the network layer cannot be inferred from its output. Here, the operation can be, for example, random number operation, many-to-one mapping, generalization operation, nonlinear function, etc. Among them, the combination of multiple types of operations can achieve irreversibility.

[0047] It should be understood that the combination of multiple operations usually involves multiple network layers, that is, the more network layers involved, the better the irreversibility. Therefore, the third condition indicates that the first sub-model divided is "large enough" to include more network layers so that the first sub-model meets the irreversibility. In addition, the network layers with unchanged parameters are usually located in the first few network layers of the initial model. The fewer network layers, the lower the development cost on the first client. Therefore, the first condition and the second condition indicate that the first sub-model divided is "small enough" to include fewer network layers so that the first sub-model meets the requirements of unchanged parameters without training and low development cost.

[0048] For example, the algorithm operators in the sub-model that ensures that data is not reversible may include, but are not limited to: pooling layers, ReLU (Rectified Linear Unit) activation functions, regularization techniques (such as Dropout), random initialization, data shuffling, batch normalization, random zeroing during training, early exit, attention mechanisms, etc.

[0049] In step S12, the first sub-model is deployed on the first client, and the second sub-model is deployed on the second client.

[0050] The first client may be a client of data holder A, and the second client may be a client of computing power holder B. In addition, since the computing power of the first client is limited, the number of network layers included in the first sub-model is usually not large.

[0051] In step S13, the sample input data in the first client is input into the first sub-model to obtain the first intermediate data output by the first sub-model.

[0052] In step S14, parameters of the second sub-model are adjusted according to the first intermediate data and the sample annotation data in the first client.

[0053] The first client stores multiple sets of training samples, each set of training samples includes sample input data and corresponding sample annotation data. For example, the sample annotation data can also be called the true value in the model training process.

[0054] In step S15, when the second sub-model satisfies the parameter adjustment termination condition, a target model is generated according to the first sub-model and the second sub-model.

[0055] The parameter adjustment termination condition may be a condition that the model error reaches a preset error.

[0056] By adopting the above technical solution, the first sub-model with unchanged network layer parameters is deployed on the first client. The sample input data in the first client can be calculated by the first sub-model to obtain the first intermediate data without leaving the domain. After that, it is only necessary to send the first intermediate data to the second client, so that the second sub-model can be trained or adjusted for multiple rounds in the second client according to the first intermediate data and the sample annotation data in the first client. There is no need to obtain the first intermediate data from the first client in each round of training, which effectively reduces the number of data circulations and avoids excessive delays, computing power consumption and privacy leakage risks.

[0057] In addition, when training the target model, the first sub-model runs in the first client and the second sub-model runs in the second client. This improves the efficiency of target model training and ensures that the performance of the target model generated by the sample input data of the first client without going out of domain is close to the performance of the target model generated in the second client using the data of the first client.

[0058] In the present disclosure, according to the preset first model division condition, the initial model is divided into at least a first sub-model and a second sub-model, including: according to the preset first model division condition, determining the network layer range corresponding to each condition; according to the network layer range corresponding to each condition, the initial model is divided into at least a first sub-model and a second sub-model.

[0059] In some embodiments, the first model division condition may include a first condition for indicating that the network layer parameters in the initial model remain unchanged. In this embodiment, first, in the initial model, the network layer that meets the first condition is determined, and the network layer that meets the first condition is determined as the first network layer range corresponding to the first condition. Afterwards, the network layer included in the first network layer range is determined as the first sub-model, and the other network layers in the initial model are determined as the second sub-model.

[0060] In some other embodiments, the first model division condition may include a second condition for indicating that the development cost corresponding to the network layer in the initial model meets a preset cost threshold. The development cost may be a computing power cost, and the preset cost threshold may be a computing power threshold of the first client. In this embodiment, first, in the initial model, the network layer that meets the second condition is determined, and the network layer that meets the second condition is determined as the second network layer range corresponding to the second condition. Afterwards, the network layer included in the second network layer range is determined as the first sub-model, and the other network layers in the initial model are determined as the second sub-model.

[0061] In some other embodiments, the first model division condition may include a third condition for indicating that the algorithm complexity of the network layer in the initial model satisfies a preset complexity threshold. In this embodiment, first, in the initial model, the network layer that satisfies the third condition is determined, and the network layer that satisfies the third condition is determined as the third network layer range corresponding to the third condition. Afterwards, the network layer before the third network layer range and the first few network layers within the third network layer range close to the input layer of the initial model are determined as the first sub-model, and the other network layers within the third network layer range are determined as the second sub-model.

[0062] First of all, it should be understood that the first model division condition can also include any two conditions among the first condition, the second condition and the third condition. When the first model division condition includes any two of the above conditions, it can be divided according to actual needs, and the present disclosure does not make specific limitations on this.

[0063] Secondly, it should be understood that in the above embodiment, the parameters of the network layers included in the determined first sub-model remain unchanged.

[0064] In order to facilitate those skilled in the art to better understand the model generation method provided by the present disclosure, the following description is made by taking the first model division condition including the first condition, the second condition and the third condition as an example.

[0065] In some embodiments, if the first model division condition includes a first condition, a second condition, and a third condition, dividing the initial model into at least a first sub-model and a second sub-model according to the preset first model division condition may include: According to the preset first model division conditions, determine the network layer range corresponding to each condition; According to the network layer range corresponding to each condition, determining whether there is a first overlapping area between the first network layer range corresponding to the first condition, the second network layer range corresponding to the second condition, and the third network layer range corresponding to the third condition; If it is determined that the first network layer range, the second network layer range and the third network layer range have a first overlapping area, the initial model is divided into only the first sub-model and the second sub-model.

[0066] The first overlapping area refers to the overlapping area of ​​the first network layer range, the second network layer range and the third network layer range. If the first overlapping area exists, it can be determined in the initial model that at least one network layer can simultaneously meet the first condition, the second condition and the third condition, that is, the initial model can be divided into the first sub-model and the second sub-model.

[0067] In one embodiment, if it is determined that there is a first overlapping area among the first network layer range, the second network layer range, and the third network layer range, the specific implementation method of dividing the initial model into only the first sub-model and the second sub-model can be: if it is determined that there is a first overlapping area among the first network layer range, the second network layer range, and the third network layer range, then it is determined that the first boundary layer between the first sub-model and the second sub-model is located in the first overlapping area; the network layer between the first boundary layer and the input layer of the initial model is determined as the first sub-model; and the network layer between the first boundary layer and the output layer of the initial model is determined as the second sub-model.

[0068] In this implementation, any network layer in the first overlapping region can serve as the first boundary layer between the first sub-model and the second sub-model. Figure 2 The figure is a schematic diagram showing a method of dividing an initial model according to an exemplary embodiment. Figure 2 All network layers of the initial model are shown, and the input layer of the initial model is located at the front end of the initial model, and the output layer of the initial model is located at the back end of the initial model. Figure 2 As shown, rectangular box 10 represents the first network layer range corresponding to the first condition, rectangular box 20 represents the second network layer range corresponding to the second condition, and rectangular box 30 represents the third network layer range corresponding to the third condition. The network layer area between dotted line 1 and dotted line 2 is the first overlap area. The first boundary layer can be any network layer between dotted line 1 and dotted line 2.

[0069] In addition, considering that the computing power of the first client is relatively small, in order to further save the computing power of the first client, the first boundary layer is as close to the front end as possible. For example, the first boundary layer is the network layer closest to the initial model input layer in the first overlap area. For example, the first boundary layer is Figure 2 The network layer corresponding to the dotted line 1. In this way, it can ensure that the divided first sub-model satisfies the above three conditions at the same time, and can also save the computing power of the first client to the greatest extent.

[0070] Accordingly, in this embodiment, Figure 1The specific implementation method of step S14 for adjusting the parameters of the second sub-model according to the first intermediate data and the sample annotation data in the first client can be: inputting the first intermediate data into the second sub-model to obtain the output data of the second sub-model; and adjusting the parameters of the second sub-model according to the output data and the sample annotation data in the first client.

[0071] Figure 3 A method for generating a Figure 2 The schematic diagram of the initial model is shown in Figure 2. Figure 3 As shown, in the first client, first, the sample database (including sample input data and sample annotation data) in the first client is tokenized using Tokenizer and converted into a text Tokenid in a format that can be input into the model. Next, the text Tokenid is input into the first sub-model to obtain the first intermediate data output by the first sub-model. After that, the first intermediate data is input into the second sub-model to obtain the output data of the second sub-model. Finally, the parameters of the second sub-model are adjusted according to the output data and the sample annotation data in the first client using Loss-related security calculation. That is, the parameters in the second sub-model are adjusted using Loss-related security calculation back propagation. And when the parameter adjustment of the second sub-model is completed, that is, when the second sub-model meets the parameter adjustment termination condition, the target model is generated according to the second sub-model and the first sub-model at this time. In other words, the first sub-model and the second sub-model that meets the parameter adjustment termination condition are spliced ​​to generate the target model.

[0072] It should be understood that if Figure 2 As shown, since the second sub-model also includes a network layer that meets the first condition, and the network layer that meets the first condition is a network layer whose parameters remain unchanged, that is, a network layer that does not require parameter adjustment, therefore, when adjusting the parameters in the second sub-model, the back propagation algorithm does not need to cover all network layers in the second sub-model, but only needs to cover the last network layer in the range of the first network layer in the second sub-model.

[0073] In other embodiments, the initial model is divided into at least a first sub-model and a second sub-model according to a preset first model division condition, and may also include: determining the network layer range corresponding to each condition according to the preset first model division condition; if it is determined that there is no first overlapping area among the first network layer range, the second network layer range and the third network layer range, the initial model is divided into the first sub-model, the third sub-model and the second sub-model in sequence, wherein the third sub-model is deployed on the second client.

[0074] In this embodiment, considering that the above three conditions may conflict, the selection of the first sub-model needs to be comprehensively considered in engineering implementation. For example, the network layer range that meets the first and second conditions is not large enough to meet the third condition, which may lead to security risks, or, conversely, the first sub-model that meets the third condition is large enough to meet the first condition of parameter solidification and the second condition that the development cost is lower than the preset cost threshold. Therefore, in order to avoid the above problems, the initial model can also be divided into the first sub-model, the third sub-model and the second sub-model in the order from the input layer to the output layer.

[0075] In one embodiment, if it is determined that there is no first overlapping area among the first network layer range, the second network layer range and the third network layer range, the specific implementation method of dividing the initial model into the first sub-model, the third sub-model and the second sub-model in sequence is as follows: if it is determined that there is no first overlapping area among the first network layer range, the second network layer range and the third network layer range, the network layer range with the smallest range among the first network layer range and the second network layer range is determined as the first target network layer range, and the network layer range with the largest range is determined as the second target network layer range; the second boundary layer between the first sub-model and the third sub-model is determined according to the first target network layer range; the third boundary layer between the third sub-model and the second sub-model is determined according to the second target network layer range and the third network layer range; the network layer between the second boundary layer and the input layer of the initial model is determined as the first sub-model; the network layer between the second boundary layer and the third boundary layer is determined as the third sub-model; and the network layer between the third boundary layer and the output layer of the initial model is determined as the second sub-model.

[0076] Optionally, determining the second boundary layer between the first submodel and the third submodel according to the first target network layer range may be: determining the last network layer within the first target network layer range as the second boundary layer between the first submodel and the third submodel.

[0077] The third boundary layer between the third sub-model and the second sub-model is determined according to the second target network layer range and the third network layer range. The method can be as follows: if there is a second overlapping area between the second target network layer range and the third network layer range, then the third boundary layer between the third sub-model and the second sub-model is determined to be located in the second overlapping area; or, if there is no second overlapping area between the second target network layer range and the third network layer range, then the network layer closest to the input layer in the third network layer range is determined as the third boundary layer between the third sub-model and the second sub-model.

[0078] Figures 4A-4D is a schematic diagram showing another way of dividing an initial model according to an exemplary embodiment. Figures 4A-4DAll network layers of the initial model are shown, and the input layer of the initial model is located at the front end of the initial model, and the output layer of the initial model is located at the back end of the initial model. Figures 4A-4D As shown, rectangular frame 10 represents the first network layer range corresponding to the first condition, rectangular frame 20 represents the second network layer range corresponding to the second condition, and rectangular frame 30 represents the third network layer range corresponding to the third condition. Figures 4A-4D As shown, there is no first overlapping area among the first network layer range, the second network layer range and the third network layer range.

[0079] exist Figure 4A and 4B In the example, if the second network layer range is smaller than the first network layer range, the first sub-model is determined by the second condition, and the second network layer range is determined as the first target network layer range, and the first network layer range is determined as the second target network layer range. That is, the rectangular frame 20 represents the first target network layer range, and the rectangular frame 10 represents the second target network layer range. The last network layer in the first target network layer range is determined as the second boundary layer between the first sub-model and the third sub-model, that is, Figure 4A and 4B The network layer corresponding to the dotted line 3 in FIG. 3 is recorded as the second boundary layer.

[0080] exist Figure 4A In the example, rectangular frame 10 and rectangular frame 30 have a second overlapping area, that is, the area between dotted line 4 and dotted line 5 is the second overlapping area, and the third boundary layer is any network layer in the area between dotted line 4 and dotted line 5. For example, since the third sub-model uses privacy computing technology when running, in order to make the number of network layers using privacy computing technology as small as possible, the third sub-model can include as few network layers as possible, that is, the third boundary layer is preferably the network layer closest to the output layer of the initial model in the second overlapping area. In 4A, the network layer corresponding to dotted line 4 is recorded as the third boundary layer.

[0081] exist Figure 4B In the figure, there is no second overlapping area between the rectangular box 10 and the rectangular box 30. At this time, in order to make the number of network layers using privacy computing technology as small as possible, that is, to make the third sub-model include as few network layers as possible, the network layer closest to the input layer in the third network layer range can be determined as the third boundary layer between the third sub-model and the second sub-model, that is, the network layer corresponding to the dotted line 6 is recorded as the third boundary layer.

[0082] exist Figure 4C and 4DIn the example, if the first network layer range is smaller than the second network layer range, the first sub-model is determined by the first condition, and the first network layer range is determined as the first target network layer range, and the second network layer range is determined as the second target network layer range. That is, the rectangular frame 10 represents the first target network layer range, and the rectangular frame 20 represents the second target network layer range. The network layer corresponding to the dotted line 7 is recorded as the second boundary layer.

[0083] exist Figure 4C In the example, rectangular frame 20 and rectangular frame 30 have a second overlapping area, that is, the area between dotted line 8 and dotted line 9 is the second overlapping area, and the third boundary layer is any network layer in the area between dotted line 8 and dotted line 9. For example, since the third sub-model uses privacy computing technology when running, in order to make the number of network layers using privacy computing technology as small as possible, the third sub-model can include as few network layers as possible, that is, the third boundary layer is preferably the network layer closest to the output layer of the initial model in the second overlapping area. In 4C, the network layer corresponding to dotted line 8 is recorded as the third boundary layer.

[0084] exist Figure 4D In the figure, there is no second overlapping area between the rectangular box 20 and the rectangular box 30. At this time, in order to make the number of network layers using privacy computing technology as small as possible, that is, to make the third sub-model include as few network layers as possible, the network layer closest to the input layer in the third network layer range can be determined as the third boundary layer between the third sub-model and the second sub-model, that is, the network layer corresponding to the dotted line 10 is recorded as the third boundary layer.

[0085] In this embodiment, since the first sub-model does not meet the third condition, at this time, in order to prevent the second client from inferring the input data of the first sub-model (i.e., the sample input data of the first client) based on the first intermediate data output by the first sub-model, a privacy computing method can be used as a means to enhance data privacy security. Therefore, in this embodiment, according to the first intermediate data and the sample annotation data in the first client, the parameters of the second sub-model are adjusted, including: in the first client, the first intermediate data is encrypted to obtain the encrypted first intermediate data, and the encrypted first intermediate data is sent to the second client; in the second client, the encrypted first intermediate data is input into the third sub-model to obtain the second intermediate data output by the third sub-model; according to the second intermediate data and the sample annotation data in the first client, the parameters of the second sub-model are adjusted.

[0086] Figure 5 A method for generating a Figure 4A The schematic diagram of the initial model is shown in Figure . Figure 5As shown, in the first client, first, the sample data (including sample input data and sample annotation data) in the first client is tokenized using Tokenizer and converted into a text Tokenid in a format that can be input into the model. Then, the text Tokenid is input into the first sub-model to obtain the first intermediate data output by the first sub-model. Since the first sub-model does not meet the third condition, in order to avoid inverting the input data of the first sub-model based on the first intermediate data output by the first sub-model, a privacy computing method can be used as a means to enhance data privacy security, that is, the first intermediate data is encrypted using a data encryption module to obtain the encrypted first intermediate data, and the encrypted first intermediate data is sent to the second client. Afterwards, in the second client, the encrypted first intermediate data is input into the third sub-model to obtain the second intermediate data output by the third sub-model, wherein the third sub-model can be located in the trusted execution environment TEE. In addition, other secure computing technologies can be used instead of TEE, such as homomorphic encryption technology. Afterwards, the second intermediate data is input into the second sub-model to obtain the output data of the second sub-model.

[0087] exist Figure 5 In the example, since the third sub-model satisfies the first condition, that is, the parameters of the network layer included in the third sub-model remain unchanged and do not need to be trained or adjusted, only the parameters of the second sub-model are adjusted. For example, the parameters in the second sub-model are adjusted by the back propagation algorithm using the result of the Loss-related logic calculation. And when the parameter adjustment of the second sub-model is completed, that is, when the second sub-model meets the parameter adjustment termination condition, the target model is generated according to the second sub-model and the first sub-model at this time. In other words, the first sub-model and the second sub-model that meets the parameter adjustment termination condition are spliced ​​to generate the target model.

[0088] It should be understood that in the present disclosure, compared with the full use of privacy computing technology in the entire model, the present disclosure will localize the privacy computing model logic and only use privacy computing technology for the third sub-model, which greatly reduces the computing power loss and data bandwidth requirements introduced by privacy computing, while also ensuring the privacy security of the data and reducing computing power and time costs.

[0089] In addition, in the present disclosure, the method further comprises: If the network layer included in the third sub-model does not completely belong to the range of the first network layer, the parameters of the third sub-model are adjusted.

[0090] Accordingly, when the second sub-model satisfies the parameter adjustment termination condition, generating a target model according to the first sub-model and the second sub-model includes: When both the third sub-model and the second sub-model satisfy the parameter adjustment termination condition, a target model is generated according to the first sub-model, the second sub-model and the third sub-model.

[0091] The network layers included in the third sub-model do not completely belong to the first network layer, that is, the parameters of at least part of the network layers included in the third sub-model need to be adjusted, therefore, the parameters of the third sub-model also need to be adjusted.

[0092] Figure 6 A method for generating a Figure 4B-4D The schematic diagram of the initial model is shown in Figure . Figure 4B-4D As shown in , the third sub-model includes network layers whose parameters need to be adjusted or trained. Therefore, Figure 6 As shown, the parameters of the second sub-model and the third sub-model are adjusted. For example, the parameters in the second sub-model and the third sub-model are adjusted by the back propagation algorithm using the result of the Loss-related logic calculation. When the parameter adjustment of the second sub-model and the third sub-model is completed, that is, when the second sub-model and the third sub-model meet the parameter adjustment termination condition, the target model is generated according to the second sub-model and the third sub-model at this time, and the first sub-model. In other words, the first sub-model, the third sub-model when the parameter adjustment termination condition is met, and the second sub-model are spliced ​​to generate the target model.

[0093] In the present disclosure, the error between the output data and the sample annotated data may be calculated in the first client, or the error between the output data and the sample annotated data may be calculated in the second client.

[0094] In some embodiments, when the computing power of the first client is capable of performing Loss-related logic calculations, the error between the output data and the sample annotation data can be calculated in the first client. In this embodiment, the specific implementation method of adjusting the parameters of the second sub-model according to the first intermediate data and the sample annotation data in the first client can be: in the second client, according to the first intermediate data and the second sub-model, the output data of the second sub-model is obtained, and the output data is sent to the first client; in the first client, according to the preset error-related algorithm, the output data and the sample annotation data in the first client, the error between the output data and the sample annotation data is determined, and the error is sent to the second client; in the second client, the parameters of the second sub-model are adjusted according to the error.

[0095] However, in order to avoid the problem of data leakage of the first client caused by the second client inferring the sample annotation data based on the error sent by the first client and the output data of the second sub-model, in the present disclosure, the error correlation algorithm may include an error algorithm and other algorithms to increase the complexity of the error correlation algorithm, improve the irreversibility of the error correlation algorithm, and further improve the privacy security of the data.

[0096] It should be understood that when the error correlation algorithm may include the error algorithm and other algorithms, the calculation result of the error correlation algorithm obtained by the second client refers to the result of performing the other algorithm on the error.

[0097] Figure 7 Another example embodiment of the invention is shown in FIG. Figure 2 The schematic diagram of the initial model is shown in Figure . Figure 7 As shown, Loss-related logic calculation is performed in the first client to obtain Loss-related logic calculation results, wherein the Loss-related logic calculation results refer to the results obtained after running other algorithms included in the Loss-related logic calculation on the basis of the error obtained by the error algorithm. The first client sends the Loss-related logic calculation results to the second client, which, on the one hand, enables the second client to adjust the parameters of the second sub-model according to the Loss-related logic calculation results, and on the other hand, because the second client obtains the result after other algorithms are applied to the error, it can avoid the second client from inverting the sample annotation data of the first client.

[0098] In this embodiment, the second client sends the output data of the second sub-model to the first client, so that the first client determines the error between the output data and the sample annotation data according to the preset error correlation algorithm, the output data and the sample annotation data in the first client. In this way, the error between the output data and the sample annotation data can be calculated on the basis that the sample annotation data does not go out of the domain, further improving the privacy security of the data.

[0099] In some other embodiments, the error between the output data and the sample annotated data may be calculated in the second client. In this embodiment, the specific implementation method of adjusting the parameters of the second sub-model according to the first intermediate data and the sample annotated data in the first client may be: obtaining the output data of the second sub-model according to the first intermediate data and the second sub-model; in the second client, according to the preset error correlation algorithm, the output data and the sample annotated data in the first client, using the preset privacy calculation method, determining the error between the output data and the sample annotated data, and adjusting the parameters of the second sub-model according to the error.

[0100] In this embodiment, in order to prevent the second client from knowing the sample annotation data of the first client, in the second section, a preset privacy calculation method is adopted to determine the error between the output data and the sample annotation data according to the preset error correlation algorithm, the output data and the sample annotation data in the first client, so as to ensure the security of the sample annotation data of the first client.

[0101] Figure 8 Another example embodiment based on Figure 2 The schematic diagram of the generation of the initial model is shown in Figure . Figure 8 As shown, Loss related logic calculation is performed in the second client to obtain Loss related logic calculation results. In order to prevent the second client from obtaining the sample annotation data of the first client, as shown in FIG. Figure 8 As shown, the first client uses a data encryption module to encrypt the sample annotation data, and the Loss-related logic calculation is located in the TEE. In this way, it can ensure that the second client cannot obtain the sample annotation data of the first client, thereby improving the privacy and security of the data.

[0102] Based on the same inventive concept, the present disclosure also provides a model reasoning method. Fig. 9 FIG. 1 is a flow chart of a model reasoning method according to an exemplary embodiment. Fig. 9 As shown, the model inference method may include the following steps.

[0103] In step S91, the target model is divided into at least a fourth sub-model and a fifth sub-model according to the preset second model division condition.

[0104] Among them, the target model is generated according to the model generation method provided by the present disclosure, and the fourth sub-model is deployed on a third client, and the fifth sub-model is deployed on a fourth client different from the third client, and the second model division condition includes: a second condition for indicating that the development cost corresponding to the network layer in the target model meets a preset cost threshold, and a third condition for indicating that the algorithm complexity of the network layer in the target model meets a preset complexity threshold.

[0105] It should be understood that the model reasoning stage refers to the stage where the model has been trained and applied. In this stage, the parameters of the model are fixed and remain unchanged. When the trained target model is divided, since the parameters of all network layers of the model remain unchanged, the second model division condition includes a second condition for indicating that the development cost corresponding to the network layer in the target model meets the preset cost threshold, and a third condition for indicating that the algorithm complexity of the network layer in the target model meets the preset complexity threshold. The specific division method of the target model will be described below.

[0106] In addition, in the present disclosure, the third client may be the same as or different from the first client, and the fourth client may be the same as or different from the second client, and the present disclosure does not make any specific limitation on this.

[0107] In step S92, in the third client, the input data in the third client is calculated in the fourth sub-model to obtain a first intermediate result output by the fourth sub-model.

[0108] In step S93, in the fourth client, a calculation result of the target model is obtained according to the first intermediate result and the fifth sub-model.

[0109] By adopting the above technical solution, the target model is divided according to the second condition and the third condition, so that the fourth sub-model obtained by the division satisfies both the second condition and the third condition. In this way, the third client can obtain the first intermediate result through the fourth sub-model without the data leaving the domain. After that, it only needs to send the first intermediate result to the fifth sub-model in the fourth client to obtain the calculation result of the target model. In this way, the third client can realize model reasoning without the data leaving the domain, ensuring the privacy security of the third client data.

[0110] In some embodiments, step S91 divides the target model into at least a fourth sub-model and a fifth sub-model according to a preset second model division condition, and may include: if there is a third overlapping area between the second network layer range corresponding to the second condition and the third network layer range corresponding to the third condition, the target model is divided only into the fourth sub-model and the fifth sub-model.

[0111] The fourth boundary layer between the fourth sub-model and the fifth sub-model may be any network layer in the third overlapping region.

[0112] For example, if there is a third overlapping area between the second network layer range corresponding to the second condition and the third network layer range corresponding to the third condition, the specific implementation method of dividing the target model into only the fourth sub-model and the fifth sub-model can be: determining the network layer between the fourth boundary layer and the input layer of the target model as the fourth sub-model; determining the network layer between the fourth boundary layer and the output layer of the target model as the fifth sub-model.

[0113] Fig.10 FIG. 1 is a schematic diagram showing a partition target model according to an exemplary embodiment. Fig.10 As shown, there is a third overlapping area between the rectangular frame 20 and the rectangular frame 30, wherein the area between the dotted line 11 and the dotted line 12 is the third overlapping area. The fourth boundary layer between the fourth sub-model and the fifth sub-model can be any network layer between the dotted line 11 and the dotted line 12. The network layer between the input layer of the target model and the fourth boundary layer is the fourth sub-model, and the other network layers are the fifth sub-model.

[0114] In addition, the closer the fourth boundary layer is to the dotted line 11, the more computing power of the third client can be saved, but the algorithm complexity of the fourth sub-model is lower, that is, the irreversibility of the fourth sub-model is weaker. The closer the fourth boundary layer is to the dotted line 12, the higher the algorithm complexity of the fourth sub-model is, that is, the stronger the irreversibility is, but the greater the consumption of computing power of the third client. Therefore, the fourth boundary layer can be determined in the third overlap area according to actual needs.

[0115] Correspondingly, in this embodiment, obtaining the calculation result of the target model based on the first intermediate result and the fifth sub-model can include: inputting the first intermediate result into the fifth sub-model to obtain the output result of the fifth sub-model, and determining the output result as the calculation result of the target model.

[0116] Fig.11 According to an exemplary embodiment, Fig.10 Schematic diagram of the reasoning of the target model shown. Fig.11 As shown, the fourth sub-model is deployed in the third client. First, in the third client, the input data is input into the fourth sub-model to obtain the first intermediate result output by the fourth sub-model. Afterwards, the third client sends the first intermediate result to the fourth client. Since the fourth sub-model is irreversible, the fourth client cannot reverse the input data based on the first intermediate result, which can ensure the data privacy security of the third client. In the fourth client, the first intermediate result is input into the fifth sub-model to obtain the output result of the fifth sub-model, and the output result is determined as the calculation result of the target model.

[0117] In other embodiments, step S91 divides the target model into at least a fourth sub-model and a fifth sub-model according to a preset second model division condition, and may also include: if there is no third overlapping area between the second network layer range corresponding to the second condition and the third network layer range corresponding to the third condition, the initial model is divided into a fourth sub-model, a sixth sub-model and a fifth sub-model in sequence, and the sixth sub-model is deployed on the fourth client.

[0118] In this embodiment, if the second network layer range corresponding to the second condition and the third network layer range corresponding to the third condition do not have a third overlapping area, in order to avoid security risks, the target model can be divided into a fourth sub-model, a sixth sub-model and a fifth sub-model in the order from the input layer to the output layer.

[0119] For example, if there is no third overlapping area between the second network layer range corresponding to the second condition and the third network layer range corresponding to the third condition, the specific implementation method of dividing the initial model into the fourth sub-model, the sixth sub-model and the fifth sub-model in sequence can be: if there is no third overlapping area between the second network layer range corresponding to the second condition and the third network layer range corresponding to the third condition, the last network layer within the second network layer range is determined as the fifth boundary layer between the fourth sub-model and the sixth sub-model, and any network layer within the third network layer range is determined as the sixth boundary layer between the sixth sub-model and the fifth sub-model; the network layer between the fifth boundary layer and the input layer of the target model is determined as the fourth sub-model, the network layer between the fifth boundary layer and the sixth boundary layer is determined as the sixth sub-model, and the network layer between the sixth boundary layer and the output layer of the target model is determined as the fifth sub-model.

[0120] Fig.12 FIG. 1 is a schematic diagram showing another method of dividing a target model according to an exemplary embodiment. Fig.12 As shown, there is no third overlapping area between the rectangular frame 20 and the rectangular frame 30. At this time, the last network layer in the second network layer range can be determined as the fifth boundary layer between the fourth sub-model and the sixth sub-model, as shown in FIG. Fig.12 As shown, the network layer corresponding to the dotted line 13 is determined as the fifth boundary layer. The sixth boundary layer between the sixth sub-model and the fifth sub-model is located within the third network layer range. For example, in order to minimize the number of network layers included in the sixth sub-model using the privacy computing method, the network layer closest to the input layer of the target model within the third network layer range can be determined as the sixth boundary layer, that is, Fig.12 As shown, the network layer corresponding to the dotted line 14 is determined as the sixth boundary layer.

[0121] exist Fig.12 In the figure, the network layer between the input layer and the fifth boundary layer of the target model is the fourth sub-model, the network layer between the fifth boundary layer and the sixth boundary layer is the sixth sub-model, and the network layer between the sixth boundary layer and the output layer of the target model is the fifth sub-model.

[0122] Accordingly, in this embodiment, obtaining the calculation result of the target model based on the first intermediate result and the fifth sub-model may include: in the third client, encrypting the first intermediate result to obtain the encrypted first intermediate result, and sending the encrypted first intermediate result to the fourth client; in the fourth client, inputting the encrypted first intermediate result into the sixth sub-model to obtain the second intermediate result output by the sixth sub-model, and, inputting the second intermediate result into the fifth sub-model to obtain the calculation result output by the fifth sub-model, and determining the output result as the calculation result of the target model.

[0123] Fig.13According to an exemplary embodiment, Fig.12 Schematic diagram of the reasoning of the target model shown. Fig.13 As shown, the fourth sub-model is deployed in the third client, and the sixth sub-model and the fifth sub-model are deployed in the fourth client. First, in the third client, the input data is input into the fourth sub-model to obtain the first intermediate result output by the fourth sub-model. Since the fourth sub-model is not irreversible, in order to prevent the fourth client from reversing the input data of the third client based on the first intermediate result, before sending the first intermediate result to the fourth client, the first intermediate result can be encrypted by using a data encryption module to obtain an encrypted first intermediate result. Afterwards, the encrypted first intermediate result is sent to the fourth client. In the fourth client, in TEE, the encrypted first intermediate result is input into the sixth sub-model to obtain the second intermediate result output by the sixth sub-model. Finally, the second intermediate result is input into the fifth sub-model to obtain the output result of the fifth sub-model, and the output result is determined as the calculation result of the target model.

[0124] Based on the same inventive concept, the present disclosure also provides a model generating device. Fig.14 FIG. 1 is a block diagram of a model generation device according to an exemplary embodiment. Fig.14 As shown, the model generating device 1400 may include: A first division module 1401 is used to divide the initial model into at least a first sub-model and a second sub-model according to a preset first model division condition, wherein the parameters of the network layer included in the first sub-model remain unchanged; A deployment module 1402, configured to deploy the first sub-model on a first client, and to deploy the second sub-model on a second client different from the first client; A first input module 1403, configured to input sample input data in the first client into the first sub-model to obtain first intermediate data output by the first sub-model; A first adjustment module 1404, configured to adjust parameters of the second sub-model according to the first intermediate data and the sample annotation data in the first client; The generating module 1405 is used to generate a target model according to the first sub-model and the second sub-model when the second sub-model meets the parameter adjustment termination condition.

[0125] Optionally, the first model division condition includes at least one of the following conditions: a first condition for indicating that the network layer parameters in the initial model remain unchanged; a second condition for indicating that the development cost corresponding to the network layer in the initial model meets a preset cost threshold; a third condition for indicating that the algorithm complexity of the network layer in the initial model meets a preset complexity threshold.

[0126] Optionally, the first model division condition includes the first condition, the second condition and the third condition; the first division module 1401 may include: a first determination submodule, used to determine the network layer range corresponding to each condition according to the preset first model division condition; a first division submodule, used to determine that the first boundary layer between the first sub-model and the second sub-model is located in the first overlapping area if it is determined that the first network layer range corresponding to the first condition, the second network layer range corresponding to the second condition and the third network layer range corresponding to the third condition have a first overlapping area; determine the network layer between the first boundary layer and the input layer of the initial model as the first sub-model; and determine the network layer between the first boundary layer and the output layer of the initial model as the second sub-model.

[0127] Optionally, the first adjustment module 1404 is used to: input the first intermediate data into the second sub-model to obtain output data of the second sub-model; and adjust parameters of the second sub-model according to the output data and sample annotation data in the first client.

[0128] Optionally, the first division module 1401 may include: a second determination submodule, used to determine the network layer range corresponding to each condition according to the preset first model division condition; a second division submodule, used to: if it is determined that the first network layer range corresponding to the first condition, the second network layer range corresponding to the second condition and the third network layer range corresponding to the third condition do not have a first overlapping area, then determine the network layer range with the smallest range between the first network layer range and the second network layer range as the first target network layer range, and determine the network layer range with the largest range as the second target network layer range; determine the second boundary layer between the first submodel and the third submodel according to the first target network layer range; determine the third boundary layer between the third submodel and the second submodel according to the second target network layer range and the third network layer range; determine the network layer between the second boundary layer and the input layer of the initial model as the first submodel, determine the network layer between the second boundary layer and the third boundary layer as the third submodel, and determine the network layer between the third boundary layer and the output layer of the initial model as the second submodel.

[0129] Optionally, the first adjustment module 1404 is used to: encrypt the first intermediate data in the first client to obtain encrypted first intermediate data, and send the encrypted first intermediate data to the second client; input the encrypted first intermediate data into the third sub-model in the second client to obtain second intermediate data output by the third sub-model; and adjust parameters of the second sub-model according to the second intermediate data and the sample annotation data in the first client.

[0130] Optionally, the second division submodule is further used to: determine the last network layer within the first target network layer range as the second boundary layer between the first sub-model and the third sub-model.

[0131] Optionally, the second division submodule is further used to: if there is a second overlapping area between the second target network layer range and the third network layer range, determine that a third boundary layer between the third submodel and the second submodel is located in the second overlapping area.

[0132] Optionally, the second division submodule is also used to: if there is no second overlapping area between the second target network layer range and the third network layer range, determine the network layer closest to the input layer in the third network layer range as the third boundary layer between the third sub-model and the second sub-model.

[0133] Optionally, the model generating device 1400 may also include: a second adjustment module, used to adjust the parameters of the third sub-model if the network layer included in the third sub-model does not completely belong to the first network layer; the generating module 1405 is used to: when the third sub-model and the second sub-model both meet the parameter adjustment termination condition, generate the target model according to the first sub-model, the second sub-model and the third sub-model.

[0134] Optionally, the first adjustment module 1404 is used to: in the second client, obtain output data of the second sub-model based on the first intermediate data and the second sub-model, and send the output data to the first client; in the first client, determine the error between the output data and the sample annotation data based on a preset error correlation algorithm, the output data and the sample annotation data in the first client, and send the error to the second client; in the second client, adjust parameters of the second sub-model based on the error.

[0135] Optionally, the first adjustment module 1404 is used to: obtain the output data of the second sub-model based on the first intermediate data and the second sub-model; in the second client, based on a preset error correlation algorithm, the output data and the sample annotation data in the first client, use a preset privacy calculation method to determine the error between the output data and the sample annotation data, and adjust the parameters of the second sub-model based on the error.

[0136] Optionally, the error-related algorithm includes an error algorithm and other algorithms.

[0137] Based on the same inventive concept, the present disclosure also provides a model reasoning device. Fig.15 FIG. 1 is a block diagram of a model inference device according to an exemplary embodiment. Fig.15 As shown, the model reasoning device 1500 may include: A second division module 1501 is used to divide the target model into at least a fourth sub-model and a fifth sub-model according to a preset second model division condition; A second input module 1502 is used to calculate the input data in the third client in the fourth sub-model in the third client to obtain a first intermediate result output by the fourth sub-model; An acquisition module 1503 is used to obtain, in the fourth client, a calculation result of the target model according to the first intermediate result and the fifth sub-model; Wherein, the target model is generated according to the model generation method described in the present disclosure, the fourth sub-model is deployed on a third client, the fifth sub-model is deployed on a fourth client different from the third client, and the second model division condition includes: a second condition for indicating that the development cost corresponding to the network layer in the target model meets a preset cost threshold, and a third condition for indicating that the algorithm complexity of the network layer in the target model meets a preset complexity threshold.

[0138] Optionally, the second division module 1501 is used for: if there is a third overlapping area between the second network layer range corresponding to the second condition and the third network layer range corresponding to the third condition, then determining that the fourth boundary layer between the fourth sub-model and the fifth sub-model is located in the third overlapping area; determining the network layer between the fourth boundary layer and the input layer of the target model as the fourth sub-model; determining the network layer between the fourth boundary layer and the output layer of the target model as the fifth sub-model; the acquisition module 1503 is used for: inputting the first intermediate result into the fifth sub-model, obtaining the output result of the fifth sub-model, and determining the output result as the calculation result of the target model.

[0139] Optionally, the second division module 1501 is used to: if the second network layer range corresponding to the second condition and the third network layer range corresponding to the third condition do not have a third overlapping area, then determine the last network layer within the second network layer range as the fifth boundary layer between the fourth sub-model and the sixth sub-model, and determine any network layer within the third network layer range as the sixth boundary layer between the sixth sub-model and the fifth sub-model; determine the network layer between the fifth boundary layer and the input layer of the target model as the fourth sub-model, and determine the network layer between the fifth boundary layer and the sixth boundary layer as the sixth sub-model. model, determining the network layer between the sixth boundary layer and the output layer of the target model as the fifth sub-model; the acquisition module 1503 is used for: in the third client, encrypting the first intermediate result to obtain the encrypted first intermediate result, and sending the encrypted first intermediate result to the fourth client; in the fourth client, inputting the encrypted first intermediate result into the sixth sub-model to obtain the second intermediate result output by the sixth sub-model, and, inputting the second intermediate result into the fifth sub-model to obtain the calculation result output by the fifth sub-model, and determining the output result as the calculation result of the target model.

[0140] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0141] Fig.16 1 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 1900 may be provided as a server. Fig.16 The electronic device 1900 includes a processor 1922, which may be one or more, and a memory 1932 for storing a computer program executable by the processor 1922. The computer program stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processor 1922 may be configured to execute the computer program to perform the above-mentioned model generation method and / or the model reasoning method.

[0142] In addition, the electronic device 1900 may further include a power supply component 1926 and a communication component 1950. The power supply component 1926 may be configured to perform power management of the electronic device 1900, and the communication component 1950 may be configured to implement communication of the electronic device 1900, for example, wired or wireless communication. In addition, the electronic device 1900 may further include an input / output (I / O) interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2000. TM, Mac OS X TM , Unix TM , Linux TM etc.

[0143] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned model generation method and / or the model reasoning method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 1932 including program instructions, and the above-mentioned program instructions can be executed by the processor 1922 of the electronic device 1900 to complete the above-mentioned model generation method and / or the model reasoning method.

[0144] In another exemplary embodiment, a computer program product is also provided. The computer program product includes a computer program that can be executed by a processor. When the computer program is executed by the processor, the steps of the above-mentioned model generation method and / or model reasoning method are implemented.

[0145] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.

[0146] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.

[0147] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.

Claims

1. A model generation method, characterized in that: The method comprises: According to a preset first model division condition, the initial model is divided into at least a first sub-model and a second sub-model, and the parameters of the network layer included in the first sub-model remain unchanged; Deploy the first sub-model on a first client, and deploy the second sub-model on a second client different from the first client; Inputting the sample input data in the first client into the first sub-model to obtain first intermediate data output by the first sub-model; Adjusting parameters of the second sub-model according to the first intermediate data and the sample annotation data in the first client; When the second sub-model satisfies the parameter adjustment termination condition, a target model is generated according to the first sub-model and the second sub-model.

2. The model generation method according to claim 1, characterized in that: The first model division condition includes at least one of the following conditions: A first condition for indicating that network layer parameters in the initial model remain unchanged; A second condition for indicating that the development cost corresponding to the network layer in the initial model meets a preset cost threshold; A third condition is used to indicate that the algorithm complexity of the network layer in the initial model satisfies a preset complexity threshold.

3. The model generation method according to claim 2, characterized in that: The first model division condition includes the first condition, the second condition and the third condition; and the initial model is divided into at least a first sub-model and a second sub-model according to the preset first model division condition, including: According to the preset first model division conditions, determine the network layer range corresponding to each condition; If it is determined that the first network layer range corresponding to the first condition, the second network layer range corresponding to the second condition, and the third network layer range corresponding to the third condition have a first overlapping area, then determining that the first boundary layer between the first sub-model and the second sub-model is located in the first overlapping area; determining a network layer between the first boundary layer and the input layer of the initial model as the first sub-model; and A network layer between the first boundary layer and the output layer of the initial model is determined as the second sub-model.

4. The model generation method according to claim 3, characterized in that: The step of adjusting parameters of the second sub-model according to the first intermediate data and the sample annotation data in the first client includes: Inputting the first intermediate data into the second sub-model to obtain output data of the second sub-model; The parameters of the second sub-model are adjusted according to the output data and the sample annotation data in the first client.

5. The model generation method according to claim 2, characterized in that: The step of dividing the initial model into at least a first sub-model and a second sub-model according to a preset first model division condition further includes: According to the preset first model division conditions, determine the network layer range corresponding to each condition; If it is determined that the first network layer range corresponding to the first condition, the second network layer range corresponding to the second condition, and the third network layer range corresponding to the third condition do not have a first overlapping area, then the network layer range with the smallest range between the first network layer range and the second network layer range is determined as the first target network layer range, and the network layer range with the largest range is determined as the second target network layer range; Determine a second boundary layer between the first sub-model and the third sub-model according to the first target network layer range; Determine a third boundary layer between the third sub-model and the second sub-model according to the second target network layer range and the third network layer range; The network layer between the second boundary layer and the input layer of the initial model is determined as the first sub-model, the network layer between the second boundary layer and the third boundary layer is determined as the third sub-model, and the network layer between the third boundary layer and the output layer of the initial model is determined as the second sub-model.

6. The model generation method according to claim 5, characterized in that: The step of adjusting parameters of the second sub-model according to the first intermediate data and the sample annotation data in the first client includes: In the first client, encrypting the first intermediate data to obtain encrypted first intermediate data, and sending the encrypted first intermediate data to the second client; In the second client, the encrypted first intermediate data is input into the third sub-model to obtain the second intermediate data output by the third sub-model; The parameters of the second sub-model are adjusted according to the second intermediate data and the sample annotation data in the first client.

7. The model generation method according to claim 5, characterized in that: The step of determining a second boundary layer between the first sub-model and the third sub-model according to the first target network layer range includes: The last network layer within the first target network layer range is determined as the second boundary layer between the first sub-model and the third sub-model.

8. The model generation method according to claim 5, characterized in that: The determining, according to the second target network layer range and the third network layer range, a third boundary layer between the third sub-model and the second sub-model comprises: If there is a second overlapping area between the second target network layer range and the third network layer range, it is determined that the third boundary layer between the third sub-model and the second sub-model is located in the second overlapping area.

9. The model generation method according to claim 5, characterized in that: The determining of the third boundary layer between the third sub-model and the second sub-model according to the second target network layer range and the third network layer range also includes: If there is no second overlapping area between the second target network layer range and the third network layer range, the network layer closest to the input layer in the third network layer range is determined as the third boundary layer between the third sub-model and the second sub-model.

10. The model generation method according to any one of claims 5 to 9, characterized in that: The method further comprises: If the network layer included in the third sub-model does not completely belong to the first network layer range, adjusting the parameters of the third sub-model; When the second sub-model satisfies the parameter adjustment termination condition, generating a target model according to the first sub-model and the second sub-model includes: When the third sub-model and the second sub-model both satisfy the parameter adjustment termination condition, a target model is generated according to the first sub-model, the second sub-model and the third sub-model.

11. The model generation method according to claim 1, characterized in that: The step of adjusting parameters of the second sub-model according to the first intermediate data and the sample annotation data in the first client includes: In the second client, according to the first intermediate data and the second sub-model, output data of the second sub-model is obtained, and the output data is sent to the first client; In the first client, according to a preset error correlation algorithm, the output data and the sample annotation data in the first client, an error between the output data and the sample annotation data is determined, and the error is sent to the second client; In the second client, parameters of the second sub-model are adjusted according to the error.

12. The model generation method according to claim 1, characterized in that: The step of adjusting parameters of the second sub-model according to the first intermediate data and the sample annotation data in the first client includes: Obtaining output data of the second sub-model according to the first intermediate data and the second sub-model; In the second client, based on the preset error correlation algorithm, the output data and the sample annotation data in the first client, a preset privacy calculation method is adopted to determine the error between the output data and the sample annotation data, and the parameters of the second sub-model are adjusted according to the error.

13. The model generation method according to claim 11 or 12, characterized in that: The error correlation algorithm includes error algorithm and other algorithms.

14. A model reasoning method, characterized in that: The method comprises: According to the preset second model division condition, the target model is divided into at least a fourth sub-model and a fifth sub-model; In the third client, the input data in the third client is calculated in the fourth sub-model to obtain a first intermediate result output by the fourth sub-model; In the fourth client, a calculation result of the target model is obtained according to the first intermediate result and the fifth sub-model; Wherein, the target model is generated according to the model generation method described in any one of claims 1 to 13, the fourth sub-model is deployed on a third client, the fifth sub-model is deployed on a fourth client different from the third client, and the second model division condition includes: a second condition for indicating that the development cost corresponding to the network layer in the target model meets a preset cost threshold, and a third condition for indicating that the algorithm complexity of the network layer in the target model meets a preset complexity threshold.

15. The model reasoning method according to claim 14, characterized in that: The step of dividing the target model into at least a fourth sub-model and a fifth sub-model according to the preset second model division condition includes: If the second network layer range corresponding to the second condition and the third network layer range corresponding to the third condition have a third overlapping area, determining that the fourth boundary layer between the fourth sub-model and the fifth sub-model is located in the third overlapping area; Determine a network layer between the fourth boundary layer and the input layer of the target model as the fourth sub-model; Determine the network layer between the fourth boundary layer and the output layer of the target model as the fifth sub-model; The step of obtaining the calculation result of the target model according to the first intermediate result and the fifth sub-model includes: The first intermediate result is input into the fifth sub-model to obtain an output result of the fifth sub-model, and the output result is determined as a calculation result of the target model.

16. The model reasoning method according to claim 14, characterized in that: The step of dividing the target model into at least a fourth sub-model and a fifth sub-model according to the preset second model division condition further includes: If the second network layer range corresponding to the second condition and the third network layer range corresponding to the third condition do not have a third overlapping area, the last network layer within the second network layer range is determined as the fifth boundary layer between the fourth sub-model and the sixth sub-model, and any network layer within the third network layer range is determined as the sixth boundary layer between the sixth sub-model and the fifth sub-model; Determine the network layer between the fifth boundary layer and the input layer of the target model as the fourth sub-model, determine the network layer between the fifth boundary layer and the sixth boundary layer as the sixth sub-model, and determine the network layer between the sixth boundary layer and the output layer of the target model as the fifth sub-model; The step of obtaining the calculation result of the target model according to the first intermediate result and the fifth sub-model includes: In the third client, encrypting the first intermediate result to obtain an encrypted first intermediate result, and sending the encrypted first intermediate result to the fourth client; In the fourth client, the encrypted first intermediate result is input into the sixth sub-model to obtain the second intermediate result output by the sixth sub-model, and the second intermediate result is input into the fifth sub-model to obtain the output result of the fifth sub-model, and the output result is determined as the calculation result of the target model.

17. A model generation device, characterized in that: The model generating device comprises: A first division module, used to divide the initial model into at least a first sub-model and a second sub-model according to a preset first model division condition, wherein the parameters of the network layer included in the first sub-model remain unchanged; A deployment module, configured to deploy the first sub-model on a first client, and to deploy the second sub-model on a second client different from the first client; A first input module, used for inputting sample input data in the first client into the first sub-model to obtain first intermediate data output by the first sub-model; A first adjustment module, configured to adjust parameters of the second sub-model according to the first intermediate data and the sample annotation data in the first client; A generating module is used to generate a target model according to the first sub-model and the second sub-model when the second sub-model meets the parameter adjustment termination condition.

18. A model reasoning device, characterized in that: The model reasoning device comprises: A second division module, used for dividing the target model into at least a fourth sub-model and a fifth sub-model according to a preset second model division condition; A second input module is used to calculate the input data in the third client in the fourth sub-model in the third client to obtain a first intermediate result output by the fourth sub-model; An acquisition module, configured to obtain, in the fourth client, a calculation result of the target model according to the first intermediate result and the fifth sub-model; Wherein, the target model is generated according to the model generation method described in any one of claims 1 to 13, the fourth sub-model is deployed on a third client, the fifth sub-model is deployed on a fourth client different from the third client, and the second model division condition includes: a second condition for indicating that the development cost corresponding to the network layer in the target model meets a preset cost threshold, and a third condition for indicating that the algorithm complexity of the network layer in the target model meets a preset complexity threshold.

19. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the program implements the steps of the model generation method described in any one of claims 1-13, and / or implements the steps of the model reasoning method described in any one of claims 14-16.

20. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the model generation method described in any one of claims 1 to 13, and / or to implement the steps of the model reasoning method described in any one of claims 14 to 16.

21. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the steps of the model generation method described in any one of claims 1 to 13, and / or implements the steps of the model reasoning method described in any one of claims 14 to 16.

Citation Information

Patent Citations

  • Power distribution area load prediction method and system based on multi-model hierarchical learning

    CN114091325A

  • Model training method and face recognition method based on adaptive segmentation federated learning

    CN114912605A

  • Model reasoning method, cloud platform, equipment and storage medium

    CN116010067A

  • Model training, reasoning and construction method and device, equipment and storage medium

    CN116432770A

  • Model training or reasoning method and device and communication equipment

    CN117093859A