Model encryption training and reasoning method and device based on large model and storage medium
By using large-model-based model encryption training and inference methods to encrypt the input data and labeled data during the inference process, and encrypted inference is performed during the inference process, the problem of the model leaking user sensitive information during the training or inference process is solved, and the dual guarantees of data security and model performance are achieved.
Patent Information
- Application Number
- CN202411765173.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-04-18
AI Technical Summary
In the prior art, neural network models are prone to leaking user sensitive information during training or inference, resulting in privacy violation problems. It is necessary to maintain model performance while ensuring data security and user privacy are not violated.
The model encryption training and inference method based on large models are adopted. By obtaining the public key and random numbers of the task model application, the input data and labeled data are encrypted using a preset encryption algorithm, and encrypted inference is performed during the inference process. Finally, the task model is encrypted and adjusted based on the encrypted inference results and encrypted annotation data.
It effectively reduces the risk of data breaches, improves data security, ensures that users' privacy is not violated, and maintains the performance of the model.
Smart Images

Figure CN119848885A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, specifically to the field of artificial intelligence technology such as data security, large models, and machine learning and task reasoning, and more particularly to a model encryption training and reasoning method, device and storage medium based on a large model. Background Art
[0002] With the rapid development of artificial intelligence and big data technologies, the use of neural network models has shown excellent capabilities in processing large-scale data.
[0003] In the prior art, during the training or inference process of the model, the model input information usually contains sensitive information of the user. If not handled properly, sensitive information may be leaked, leading to privacy violations. Therefore, model privacy protection becomes particularly important. It needs to ensure data security and user privacy while maintaining model performance. Summary of the invention
[0004] The present invention provides a large-model-based model encryption training and reasoning method, device and storage medium.
[0005] According to one aspect of the present disclosure, a model encryption training method based on a large model is provided, wherein the method comprises:
[0006] Obtain the public key and random number of the task model application party;
[0007] Based on the public key and the random number, a preset encryption algorithm is used to encrypt the input data and the labeled data in the training sample to obtain encrypted input data and encrypted labeled data;
[0008] Using the task model, based on the public key, the random number, the encrypted input data and the preset encryption algorithm, encryption reasoning is performed to obtain an encryption reasoning result;
[0009] Based on the encrypted reasoning result and the encrypted annotation data, the task model is encrypted and adjusted.
[0010] According to another aspect of the present disclosure, a large model-based encrypted reasoning method is provided, wherein the method includes:
[0011] Receiving an encrypted question sent by a client of the task model application party, wherein the encrypted question is obtained by encrypting the question by the client using a preset encryption algorithm based on a public key and a random number of the task model application party;
[0012] Using a pre-trained task model, performing encryption reasoning based on the encryption problem, the public key, and the random number to obtain an encryption reasoning result;
[0013] The encrypted reasoning result is returned to the client, so that the client can decrypt the encrypted reasoning result based on the private key of the task model application party to obtain an answer.
[0014] According to another aspect of the present disclosure, a model encryption training device based on a large model is provided, wherein the device comprises:
[0015] The key acquisition module is used to obtain the public key and random number of the task model application party;
[0016] A data encryption module, used to encrypt the input data and the labeled data in the training sample based on the public key and the random number using a preset encryption algorithm to obtain encrypted input data and encrypted labeled data;
[0017] An inference encryption module, used to adopt the task model, perform encryption inference based on the public key, the random number, the encrypted input data and the preset encryption algorithm, and obtain an encryption inference result;
[0018] The encryption adjustment module is used to perform encryption adjustment on the task model based on the encrypted reasoning result and the encrypted annotation data.
[0019] According to another aspect of the present disclosure, there is provided an encrypted reasoning device based on a large model, wherein the device comprises:
[0020] A receiving module, used to receive an encrypted question sent by a client of the task model application party, wherein the encrypted question is obtained by encrypting the question by the client using a preset encryption algorithm based on the public key and random number of the task model application party;
[0021] An inference encryption module, used to use a pre-trained task model to perform encryption inference based on the encryption problem, the public key and the random number to obtain an encryption inference result;
[0022] The sending module is used to return the encrypted reasoning result to the client, so that the client can decrypt the encrypted reasoning result based on the private key of the task model application party to obtain an answer.
[0023] According to yet another aspect of the present disclosure, there is provided an electronic device, including:
[0024] at least one processor; and
[0025] a memory communicatively connected to the at least one processor; wherein,
[0026] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any possible implementation manner and the aspects described above.
[0027] According to yet another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method of the above-mentioned aspect and any possible implementation manner.
[0028] According to yet another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the computer program implements the above-mentioned aspects and the method of any possible implementation manner.
[0029] According to the technology disclosed in the present invention, the risk of data leakage can be reduced and the security of data can be effectively improved.
[0030] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0032] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;
[0033] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure;
[0034] Figure 3 is a schematic diagram according to a third embodiment of the present disclosure;
[0035] Figure 4 is a schematic diagram according to a fourth embodiment of the present disclosure;
[0036] Figure 5 is a schematic diagram according to a fifth embodiment of the present disclosure;
[0037] Figure 6 is a schematic diagram according to a sixth embodiment of the present disclosure;
[0038] Figure 7 is a schematic diagram according to a seventh embodiment of the present disclosure;
[0039] Figure 8 The block diagram is a block diagram of an electronic device for implementing the method of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0040] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0041] Obviously, the described embodiments are only part of the embodiments of the present disclosure, but not all of them. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present disclosure.
[0042] It should be noted that the terminal devices involved in the embodiments of the present disclosure may include but are not limited to mobile phones, personal digital assistants (PDAs), wireless handheld devices, tablet computers and other smart devices; display devices may include but are not limited to personal computers, televisions and other devices with display functions.
[0043] In addition, the term "and / or" in this article is only a description of the association relationship between the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0044] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure; Figure 1 As shown, this embodiment provides a model encryption training method based on a large model, which may specifically include the following steps:
[0045] S101, obtaining the public key and random number of the task model application party;
[0046] S102, based on the public key and the random number, using a preset encryption algorithm, encrypting the input data and the labeled data in the training sample respectively to obtain encrypted input data and encrypted labeled data;
[0047] S103, using the task model, based on the public key, random number, encrypted input data and a preset encryption algorithm, performing encryption reasoning to obtain an encryption reasoning result;
[0048] S104: Based on the encrypted reasoning results and the encrypted annotation data, encrypt and adjust the task model.
[0049] The executor of the model encryption training method based on a large model in this embodiment is a model encryption training device based on a large model, which can be an electronic entity or a software integrated application. When used, it runs on a computing device to implement encryption training of a task model based on a large model. In this embodiment, the task model application party can be any enterprise, company, group or organization that wants to use the task model for task reasoning. On the side of the task model application party, the public key and private key used by the task model during encryption can be generated, and a random number can be configured. For example, a secret key generation algorithm can be used in the server of the task model application party to generate a public key and a private key, and a random number can be configured. Among them, the random number configured by the task model application party can increase the security of encryption and prevent attackers from obtaining information through some statistical analysis methods.
[0050] Normally, the party applying the task model and the party building the task model may not be the same party. It can be considered that the party applying the task model purchased the task model from the party building the task model and then used it itself. In order to improve the reasoning effect of the task model, the party applying the task model needs to use its own data to fine-tune the task model (FineTuning; FT) to optimize the performance of the task model in the application scenario of the task model. The encrypted training of the task model of this embodiment may refer to the fine-tuning of the task model.
[0051] In order to improve the security of training data during training, the input data and labeled data in the training samples can be encrypted respectively based on the public key and random number using a preset encryption algorithm to obtain encrypted input data and encrypted labeled data. This ensures that the task model does not directly process the input data and labeled data in the training samples when used. Even if an attacker intercepts the processed data of the task model, he or she will not be able to obtain the content of the input data and labeled data in the training data, which can effectively enhance data security.
[0052] In actual application scenarios, the task model is based on the input data, and multiple steps of reasoning are required to obtain the reasoning result. In order to further enhance the security of the data, in this embodiment, the task model is also used to perform encrypted reasoning based on the public key, random number, encrypted input data and a preset encryption algorithm to obtain an encrypted reasoning result. In other words, not only the input data is encrypted, but also the reasoning process of the task model is encrypted, which further prevents attackers from analyzing the input data by attacking and intercepting part of the processing information of the task model, and can further improve the security of the data.
[0053] Since the input data and the reasoning process of the task model are encrypted, finally, in the encrypted scenario, the task model can be encrypted and adjusted based on the encrypted reasoning results and encrypted labeled data to enhance the security of task model training.
[0054] That is to say, in the scenario of this embodiment, each step of the task model is encrypted when it is trained, which can effectively ensure the security of the training process, reduce the risk of data leakage, and effectively improve data security.
[0055] The above method in this embodiment takes one round of training as an example. In actual applications, in each round of training in the FT stage, the above method is used to adjust the task model until the training cutoff condition is reached and the training ends.
[0056] The large-model-based model encryption training method of this embodiment adopts the above-mentioned technical solution to not only encrypt the input data, but also perform encrypted reasoning during the reasoning process of the task model. Finally, based on the encrypted reasoning result and the encrypted annotation data, the task model is encrypted and adjusted to achieve encrypted training of the task model. During the entire training process, encryption processing is performed at every link, which can reduce the risk of data leakage, effectively ensure the security of the training process, and thus effectively improve the security of the data of the task model application party.
[0057] Figure 2 is a schematic diagram according to the second embodiment of the present disclosure; the model encryption training method based on a large model in this embodiment, in the above Figure 1 Based on the technical solutions of the embodiments shown in the figure, the technical solutions of the present disclosure are further described in more detail. Figure 2 As shown, the model encryption training method based on the large model of this embodiment may specifically include the following steps:
[0058] S201, obtaining the public key and random number of the task model application party;
[0059] For example, in this embodiment, the technical solution of this embodiment can be described by taking the preset encryption algorithm as a homomorphic encryption algorithm as an example.
[0060] Specifically, the server of the task model application party can use the Paillier encryption algorithm to generate public keys and private keys. For details, please refer to the implementation process of the relevant Paillier encryption algorithm, which will not be repeated here. At the same time, random numbers can also be configured to enhance the security of training data. Among them, public keys and random numbers are used to implement encryption, and private keys can be used to implement decryption. During the encryption training process, private keys are usually not used. However, if the task model application party needs to parse the data during the training process, it can obtain the data from the task model application party and use the private key to decrypt it. Then, the server of the task model application party can send the public key and random number to the encryption training device of the task model.
[0061] Optionally, the large model-based model encryption training device of this embodiment can be set in the server of the task model application party, or can be independent of the server of the task model application party. However, after training, the obtained task model is usually deployed in the server of the task model application party.
[0062] S202, based on the public key and the random number, using a preset encryption algorithm, encrypt the input data and the labeled data in the training sample respectively to obtain encrypted input data and encrypted labeled data;
[0063] Specifically, a homomorphic encryption algorithm can be used to encrypt input data using a public key and a random number to obtain encrypted input data; similarly, a homomorphic encryption algorithm can be used to encrypt labeled data using a public key and a random number to obtain encrypted labeled data.
[0064] S203, based on the public key and the random number, using a preset encryption algorithm, encrypting the structural parameters of the task model to obtain an encrypted task model;
[0065] S204, using the encryption task model, performing encryption reasoning based on the public key, random number, encrypted input data and a preset encryption algorithm to obtain an encryption reasoning result;
[0066] The structure of the task model can include a large number of parameters. In this embodiment, when the task model is used for encrypted reasoning, first, the structural parameters of the task model are encrypted based on the public key and random number using the homomorphic encryption algorithm to obtain the encrypted task model. At the same time, in order to improve security, the encrypted task model is also used to perform encrypted reasoning based on the public key, random number, encrypted input data and homomorphic encryption algorithm to obtain the encrypted reasoning result.
[0067] For example, in a specific implementation, step S204 may include the following steps:
[0068] (1) Based on the public key and random number, the inference process of the encryption task model is encrypted using a preset encryption algorithm;
[0069] (2) Using the encrypted task model, based on the encrypted input data, reasoning is performed according to the encrypted reasoning process to obtain the encrypted reasoning result.
[0070] Specifically, based on the public key and random numbers, a homomorphic encryption algorithm can be used to encrypt the reasoning process of the encrypted task model, and the encrypted task model can be used to perform reasoning based on the encrypted input data according to the encrypted reasoning process to obtain an encrypted reasoning result.
[0071] Step S203 and step S204 are as above. Figure 1A specific implementation of step S103 of the illustrated embodiment. In this way, encrypted reasoning can be implemented, thereby effectively improving the security of the task model reasoning process.
[0072] S205. Construct an encrypted loss function based on the encrypted reasoning result and the encrypted labeled data;
[0073] S206: Based on the encrypted loss function, encrypt and adjust the task model so that the encrypted loss function converges.
[0074] Step S205 and step S206 are as above. Figure 1 A specific implementation of step S104 of the illustrated embodiment. In this way, encryption adjustment can be performed during the training of the task model, which can effectively prevent attackers from intercepting and analyzing any useful information, reduce the risk of data leakage, and effectively improve the security of the data of the task model application party.
[0075] In this embodiment, taking one round of training as an example, the task model is fine-tuned. In practical applications, the fine-tuning stage may include multiple rounds of the above operation steps of this embodiment until the training termination condition is reached, the training is terminated, and the encrypted training task model is obtained. Optionally, the training termination condition may include the convergence of the encryption loss function, or the number of training times reaches a preset number threshold, or other conditions, which are not limited here.
[0076] It should be noted that in this embodiment, the preset encryption algorithm used takes the homomorphic encryption algorithm as an example. In actual applications, other encryption algorithms can also be used, which is not limited here.
[0077] The application of homomorphic encryption algorithms is not limited to protecting data content, but also includes protecting the way data is used, because in some scenarios, data access patterns may also leak sensitive information. The homomorphic encryption algorithm of this embodiment can not only protect data, but also protect the reasoning process, achieving all-round protection and effectively improving data security.
[0078] The large-model-based model encryption training method of this embodiment adopts the above-mentioned technical scheme to not only encrypt the input data, but also encrypt the task model and the reasoning process during the reasoning process of the task model, and encrypt and adjust the task model, so as to realize encryption processing in every link of the entire training process, which can effectively ensure the security of the training process, and further effectively improve the security of the data of the task model application party.
[0079] Figure 3 is a schematic diagram according to the third embodiment of the present disclosure; Figure 3As shown, this embodiment provides an encryption reasoning method based on a large model, which may specifically include the following steps:
[0080] S301, receiving an encrypted question sent by a client of the task model application party, where the encrypted question is obtained by encrypting the question by the client using a preset encryption algorithm based on the public key and random number of the task model application party;
[0081] S302, using a pre-trained task model, performing encryption reasoning based on the encryption problem, the public key and the random number, and obtaining an encryption reasoning result;
[0082] S303. Return the encrypted reasoning result to the client, so that the client can decrypt the encrypted reasoning result based on the private key of the task model application party to obtain the answer.
[0083] The executor of the large-model-based encryption reasoning method of this embodiment may be a large-model-based encryption reasoning device, which may be arranged in a server of the task model application party to provide services for the task model application party.
[0084] The task model of this embodiment can be the above Figure 1 or Figure 2 The task model obtained by encryption training in the embodiment shown in the figure is similar to the task model in the embodiment described above. Figure 1 and Figure 2 The task model application in the embodiment shown is the same. Therefore, the public key, private key and random number in this embodiment are respectively the same as those in the above embodiment. Figure 2 The embodiments shown are identical.
[0085] The encrypted reasoning method based on the large model of this embodiment adopts the above technical solution, uses the public key and random number on the encrypted reasoning device side of the task model to perform encrypted reasoning on the reasoning process of the task model, and returns the encrypted reasoning result to the client, so that the client can decrypt the encrypted reasoning result based on the private key of the task model application party. During the entire reasoning process, all data is encrypted on the encrypted reasoning device side of the task model, which can reduce the risk of data leakage and effectively improve data security.
[0086] Figure 4 is a schematic diagram according to the fourth embodiment of the present disclosure; the encryption reasoning method based on the large model of this embodiment, in the above Figure 3 Based on the technical solutions of the embodiments shown in the figure, the technical solutions of the present disclosure are further described in more detail. Figure 4 As shown, the encryption reasoning method based on the large model of this embodiment may specifically include the following steps:
[0087] S401, the server of the task model application party generates a public key and a private key, and configures a random number;
[0088] For example, this embodiment takes the homomorphic encryption algorithm as an example. Specifically, the task model application party can use the Paillier encryption algorithm to generate public keys and private keys. For details, please refer to the implementation process of the relevant Paillier encryption algorithm, which will not be repeated here. In actual applications, the preset encryption algorithm can also use other encryption algorithms, and correspondingly use other encryption algorithms to generate corresponding public keys and private keys, which will not be repeated here one by one.
[0089] It should be noted that for the same task model application and the same task model, you can only generate the public key and private key once and configure the random number once. The subsequent training process and inference process will use this set of public key, private key and random number.
[0090] S402, the server of the task model application party sends the public key, private key and random number to the client, and sends the public key and random number to the encryption reasoning device of the task model;
[0091] It should be noted that the encryption reasoning device of the task model of this embodiment can be set in the server of the task model application party.
[0092] S403, the client of the task model application party receives the public key, private key and random number sent by the server of the task model application party;
[0093] S404, the client of the task model application receives the user's question;
[0094] S405, the client of the task model application party encrypts the question based on the public key and the random number using a preset encryption algorithm to obtain an encrypted question; and sends the encrypted question to the encryption reasoning device of the task model;
[0095] For example, taking the homomorphic encryption algorithm as an example, the following formula can be used for homomorphic encryption to obtain the encryption problem:
[0096] c=g m ·r n ·modn 2
[0097] Among them, c is the encryption problem obtained, (n, g) is the public key, and m is the plaintext data of the problem.
[0098] S406, the encryption inference device of the task model obtains the public key and random number of the task model application party;
[0099] Specifically, the encryption reasoning device of the task model receives the public key and random number sent by the server of the task model application party.
[0100] S407, the encryption inference device of the task model encrypts the structural parameters of the task model based on the public key and the random number using a preset encryption algorithm to obtain an encrypted task model;
[0101] S407, the encryption reasoning device of the task model adopts the encryption task model, performs encryption reasoning based on the public key, random number, encryption problem and preset encryption algorithm, and obtains the encryption reasoning result;
[0102] For example, when this step is implemented specifically, it may include the following steps:
[0103] (a) The encrypted reasoning device of the task model encrypts the reasoning process of the encrypted task model based on the public key and the random number using a preset encryption algorithm;
[0104] (b) The encrypted reasoning device of the task model adopts the encrypted task model, based on the encryption problem, and performs reasoning according to the encrypted reasoning process to obtain the encrypted reasoning result.
[0105] For example, in this embodiment, the encryption reasoning device of the task model can specifically use a homomorphic encryption algorithm based on a public key and a random number to encrypt the reasoning process of the encrypted task model; then the encrypted task model can be used to perform reasoning based on the encryption problem according to the encrypted reasoning process to obtain an encrypted reasoning result.
[0106] In this way, encrypted reasoning can be achieved, reducing the risk of data leakage, thereby effectively improving the security of the task model reasoning process.
[0107] S408, the encrypted reasoning device of the task model returns the encrypted reasoning result to the client of the task model application party;
[0108] S409: The client of the task model application party decrypts the received encrypted reasoning result based on the private key of the task model application party to obtain the answer.
[0109] The task model of this embodiment can be implemented based on a large model. Correspondingly, the encryption reasoning device of the task model can be an encryption reasoning device based on the large model.
[0110] The encrypted reasoning method based on a large model of this embodiment adopts the above-mentioned technical solution. The client of the task model application party can encrypt the question based on the public key and random number and send it to the encrypted reasoning device side of the task model. On the encrypted reasoning device side of the task model, all data are encrypted during the entire reasoning process, which can reduce the risk of data leakage and effectively improve data security. On the client side of the task model application party, the encrypted reasoning result can also be inferred based on the private key to obtain the answer, which can effectively ensure that in the security scenario of encrypted reasoning, the client can still obtain an accurate answer, effectively ensuring the practicality of the entire encrypted reasoning scheme.
[0111] The technical solution disclosed in the present invention can solve the problem of privacy protection when using task models for reasoning and training in cloud computing and distributed computing environments. Through the technical solution disclosed in the present invention, encrypted calculations and reasoning can be performed on the data without decrypting it, thereby ensuring the confidentiality and integrity of the data. This is particularly important for industries that need to process sensitive data, such as in scenarios where transaction data is analyzed and trained in financial services, in scenarios where patient records and medication are processed in the medical field, or in scenarios where personal data needs to be processed in other companies, organizations or groups, the above-mentioned technical solution disclosed in the present invention is very suitable for use, which can effectively reduce the risk of data leakage during training and reasoning, and thus effectively improve data security.
[0112] Figure 5 is a schematic diagram according to the fifth embodiment of the present disclosure; Figure 5 As shown, this embodiment provides a model encryption training device 500 based on a large model, including:
[0113] The key acquisition module 501 is used to obtain the public key and random number of the task model application party;
[0114] A data encryption module 502 is used to encrypt the input data and the labeled data in the training sample based on the public key and the random number using a preset encryption algorithm to obtain encrypted input data and encrypted labeled data;
[0115] The reasoning encryption module 503 is used to adopt the task model, perform encryption reasoning based on the public key, the random number, the encrypted input data and the preset encryption algorithm, and obtain an encryption reasoning result;
[0116] The encryption adjustment module 504 is used to perform encryption adjustment on the task model based on the encrypted reasoning result and the encrypted annotation data.
[0117] The large-model-based model encryption training device 500 of this embodiment implements the implementation principle and technical effect of large-model-based model encryption training by adopting the above-mentioned modules, which is the same as the implementation of the above-mentioned related method embodiments. For details, please refer to the records of the above-mentioned related method embodiments, which will not be repeated here.
[0118] Further optionally, in one embodiment of the present disclosure, in the above-mentioned large model-based model encryption training device 500, the inference encryption module 503 is used to:
[0119] Based on the public key and the random number, the preset encryption algorithm is used to encrypt the structural parameters of the task model to obtain an encrypted task model;
[0120] The encryption task model is adopted to perform encryption reasoning based on the public key, the random number, the encrypted input data and the preset encryption algorithm to obtain the encryption reasoning result.
[0121] Further optionally, in one embodiment of the present disclosure, the inference encryption module 503 is used to:
[0122] Based on the public key and the random number, the inference process of the encryption task model is encrypted using the preset encryption algorithm;
[0123] The encrypted task model is adopted, based on the encrypted input data, reasoning is performed according to the encrypted reasoning process to obtain the encrypted reasoning result.
[0124] Further optionally, in one embodiment of the present disclosure, the encryption module 504 is adjusted to:
[0125] Constructing an encrypted loss function based on the encrypted reasoning result and the encrypted labeled data;
[0126] Based on the encrypted loss function, the task model is encrypted and adjusted so that the encrypted loss function converges.
[0127] Further optionally, in one embodiment of the present disclosure, the preset encryption algorithm includes a homomorphic encryption algorithm.
[0128] The large-model-based model encryption training device 500 of the above-mentioned embodiment realizes the implementation principle and technical effect of large-model-based model encryption training by adopting the above-mentioned module, which is the same as the implementation of the above-mentioned related method embodiments. For details, please refer to the records of the above-mentioned related method embodiments, which will not be repeated here.
[0129] Figure 6 is a schematic diagram according to the sixth embodiment of the present disclosure; Figure 6As shown, this embodiment provides an encryption reasoning device 600 based on a large model, including:
[0130] The receiving module 601 is used to receive an encrypted question sent by a client of the task model application party, where the encrypted question is obtained by encrypting the question by the client using a preset encryption algorithm based on the public key and random number of the task model application party;
[0131] The reasoning encryption module 602 is used to use a pre-trained task model to perform encryption reasoning based on the encryption problem, the public key and the random number to obtain an encryption reasoning result;
[0132] The sending module 603 is used to return the encrypted reasoning result to the client, so that the client can decrypt the encrypted reasoning result based on the private key of the task model application party to obtain the answer.
[0133] The large-model-based encryption inference device 600 of this embodiment implements the implementation principle and technical effect of large-model-based encryption inference by adopting the above-mentioned modules, which is the same as the implementation of the above-mentioned related method embodiments. For details, please refer to the records of the above-mentioned related method embodiments, which will not be repeated here.
[0134] Figure 7 is a schematic diagram according to the seventh embodiment of the present disclosure; the encryption reasoning device 700 based on the large model of this embodiment, in the above Figure 6 Based on the technical solutions of the embodiments shown in the figure, the technical solutions of the present disclosure are further described in more detail. Figure 7 As shown, the encryption reasoning device 700 based on the large model of this embodiment includes the above Figure 6 The modules with the same name and function are shown as: receiving module 701 , inference encryption module 702 and sending module 703 .
[0135] In this embodiment, the inference encryption module 702 is used to:
[0136] Based on the public key and the random number, the preset encryption algorithm is used to encrypt the structural parameters of the task model to obtain an encrypted task model;
[0137] The encryption task model is adopted to perform encryption reasoning based on the public key, the random number, the encryption problem and the preset encryption algorithm to obtain the encryption reasoning result.
[0138] Further optionally, the inference encryption module 702 in this embodiment is used to:
[0139] Based on the public key and the random number, the inference process of the encryption task model is encrypted using the preset encryption algorithm;
[0140] The encryption task model is adopted, based on the encryption problem, reasoning is performed according to the encryption reasoning process to obtain the encryption reasoning result.
[0141] Further optionally, if Figure 7 As shown, the encryption reasoning device 700 based on the large model of this embodiment also includes:
[0142] A key acquisition module 704 is used to acquire the public key and the random number of the task model application party; the public key and the private key of the task model application party are generated by the task model application party using a key generation algorithm; the random number is configured by the task model application party;
[0143] And / or the preset encryption algorithm includes a homomorphic encryption algorithm.
[0144] The large-model-based encryption inference device 700 of this embodiment implements the implementation principle and technical effect of large-model-based encryption inference by adopting the above-mentioned modules, which is the same as the implementation of the above-mentioned related method embodiments. For details, please refer to the records of the above-mentioned related method embodiments, which will not be repeated here.
[0145] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0146] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0147] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0148] like Figure 8As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0149] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0150] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as the above-mentioned methods of the present disclosure. For example, in some embodiments, the above-mentioned methods of the present disclosure may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the above-mentioned methods of the present disclosure described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the above-mentioned methods of the present disclosure in any other appropriate manner (e.g., by means of firmware).
[0151] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0152] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0153] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0154] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0155] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0156] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0157] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0158] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A model encryption training method based on a large model, wherein: The method comprises: Obtain the public key and random number of the task model application party; Based on the public key and the random number, a preset encryption algorithm is used to encrypt the input data and the labeled data in the training sample to obtain encrypted input data and encrypted labeled data; Using the task model, based on the public key, the random number, the encrypted input data and the preset encryption algorithm, encryption reasoning is performed to obtain an encryption reasoning result; Based on the encrypted reasoning result and the encrypted annotation data, the task model is encrypted and adjusted.
2. The method according to claim 1, wherein: The task model is used to perform encryption reasoning based on the public key, the random number, the encrypted input data and the preset encryption algorithm to obtain an encryption reasoning result, including: Based on the public key and the random number, the preset encryption algorithm is used to encrypt the structural parameters of the task model to obtain an encrypted task model; The encryption task model is adopted to perform encryption reasoning based on the public key, the random number, the encrypted input data and the preset encryption algorithm to obtain the encryption reasoning result.
3. The method according to claim 2, wherein: The encryption task model is adopted to perform encryption reasoning based on the public key, the random number, the encrypted input data and the preset encryption algorithm to obtain the encryption reasoning result, including: Based on the public key and the random number, the inference process of the encryption task model is encrypted using the preset encryption algorithm; The encrypted task model is adopted, based on the encrypted input data, reasoning is performed according to the encrypted reasoning process to obtain the encrypted reasoning result.
4. The method according to claim 1, wherein: Based on the encrypted reasoning result and the encrypted annotation data, encryption adjustment is performed on the task model, including: Constructing an encrypted loss function based on the encrypted reasoning result and the encrypted labeled data; Based on the encrypted loss function, the task model is encrypted and adjusted so that the encrypted loss function converges.
5. The method according to any one of claims 1 to 4, wherein: The preset encryption algorithm includes a homomorphic encryption algorithm; and / or the task model is implemented based on a large model.
6. A large model-based encrypted reasoning method, wherein: The method comprises: Receiving an encrypted question sent by a client of the task model application party, wherein the encrypted question is obtained by encrypting the question by the client using a preset encryption algorithm based on a public key and a random number of the task model application party; Using a pre-trained task model, performing encryption reasoning based on the encryption problem, the public key, and the random number to obtain an encryption reasoning result; The encrypted reasoning result is returned to the client, so that the client can decrypt the encrypted reasoning result based on the private key of the task model application party to obtain an answer.
7. The method according to claim 6, wherein: Using a pre-trained task model, cryptographic reasoning is performed based on the encryption problem, the public key, and the random number to obtain an encryption reasoning result, including: Based on the public key and the random number, the preset encryption algorithm is used to encrypt the structural parameters of the task model to obtain an encrypted task model; The encryption task model is adopted to perform encryption reasoning based on the public key, the random number, the encryption problem and the preset encryption algorithm to obtain the encryption reasoning result.
8. The method according to claim 7, wherein: The encryption task model is adopted to perform encryption reasoning based on the public key, the random number, the encryption problem and the preset encryption algorithm to obtain the encryption reasoning result, including: Based on the public key and the random number, the inference process of the encryption task model is encrypted using the preset encryption algorithm; The encryption task model is adopted, based on the encryption problem, reasoning is performed according to the encryption reasoning process to obtain the encryption reasoning result.
9. The method according to any one of claims 6 to 8, wherein: Before receiving the encrypted question sent by the client of the task model application party, the method further includes: Acquire the public key and the random number of the task model application party; the public key and the private key of the task model application party are generated by the task model application party using a key generation algorithm; the random number is configured by the task model application party; And / or the preset encryption algorithm includes a homomorphic encryption algorithm; And / or the task model is implemented based on a large model.
10. A model encryption training device based on a large model, wherein: The device comprises: The key acquisition module is used to obtain the public key and random number of the task model application party; A data encryption module, used to encrypt the input data and the labeled data in the training sample based on the public key and the random number using a preset encryption algorithm to obtain encrypted input data and encrypted labeled data; An inference encryption module, used to adopt the task model, perform encryption inference based on the public key, the random number, the encrypted input data and the preset encryption algorithm, and obtain an encryption inference result; The encryption adjustment module is used to perform encryption adjustment on the task model based on the encrypted reasoning result and the encrypted annotation data.
11. The device according to claim 10, wherein: The inference encryption module is used to: Based on the public key and the random number, the preset encryption algorithm is used to encrypt the structural parameters of the task model to obtain an encrypted task model; The encryption task model is adopted to perform encryption reasoning based on the public key, the random number, the encrypted input data and the preset encryption algorithm to obtain the encryption reasoning result.
12. The device according to claim 11, wherein: The inference encryption module is used to: Based on the public key and the random number, the inference process of the encryption task model is encrypted using the preset encryption algorithm; The encrypted task model is adopted, based on the encrypted input data, reasoning is performed according to the encrypted reasoning process to obtain the encrypted reasoning result.
13. The device according to claim 10, wherein: The encryption module is adjusted to: Constructing an encrypted loss function based on the encrypted reasoning result and the encrypted labeled data; Based on the encrypted loss function, the task model is encrypted and adjusted so that the encrypted loss function converges.
14. The device according to any one of claims 10 to 13, wherein: The preset encryption algorithm includes a homomorphic encryption algorithm; and / or the task model is implemented based on a large model.
15. An encrypted reasoning device based on a large model, wherein: The device comprises: A receiving module, used to receive an encrypted question sent by a client of the task model application party, wherein the encrypted question is obtained by encrypting the question by the client using a preset encryption algorithm based on the public key and random number of the task model application party; An inference encryption module, used to use a pre-trained task model to perform encryption inference based on the encryption problem, the public key and the random number to obtain an encryption inference result; The sending module is used to return the encrypted reasoning result to the client, so that the client can decrypt the encrypted reasoning result based on the private key of the task model application party to obtain an answer.
16. The device according to claim 15, wherein: The inference encryption module is used to: Based on the public key and the random number, the preset encryption algorithm is used to encrypt the structural parameters of the task model to obtain an encrypted task model; The encryption task model is adopted to perform encryption reasoning based on the public key, the random number, the encryption problem and the preset encryption algorithm to obtain the encryption reasoning result.
17. The device according to claim 16, wherein: The inference encryption module is used to: Based on the public key and the random number, the inference process of the encryption task model is encrypted using the preset encryption algorithm; The encryption task model is adopted, based on the encryption problem, reasoning is performed according to the encryption reasoning process to obtain the encryption reasoning result.
18. The device according to any one of claims 15 to 17, wherein: The device also includes: A key acquisition module, used to acquire the public key and the random number of the task model application party; the public key and the private key of the task model application party are generated by the task model application party using a key generation algorithm; the random number is configured by the task model application party; And / or the preset encryption algorithm includes a homomorphic encryption algorithm; And / or the task model is implemented based on a large model.
19. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9.
20. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-9.
21. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 9.