Artificial intelligence model fine tuning method, system and device, medium and program product

By splitting the model into the head, tail and middle part during the fine-tuning of the artificial intelligence model, and fine-tuning it in the TEE joint computing system, the problems of data security and GPU resource utilization are solved, and the problem of data security and GPU resource utilization is realized More efficient model fine-tuning and data protection.

CN119311325APending Publication Date: 2025-01-14CHINA MOBILE COMM LTD RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411320617.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

In the process of fine-tuning of artificial intelligence models, it is difficult for the existing technology to effectively protect data security. At the same time, due to the high requirements of TEE technology for GPU resources, it is limited in actual implementation.

Method used

By splitting the artificial intelligence model into the model head, model middle and model tail, and fine-tuning it in the TEE joint computing system with the ordinary system, the model head and tail are encrypted using the TEE system to reduce the Performance requirements, and fine-tuning the middle of the model through ordinary systems to improve data security and GPU resource utilization.

Benefits of technology

On the basis of ensuring data security, the performance requirements for TEE systems are reduced, the demand for specific GPU resources is reduced, and the actual deployment and application of TEE solutions is promoted.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311325A_ABST
    Figure CN119311325A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an artificial intelligence model fine tuning method, system and device, a medium and a program product, which are applied to a TEE joint computing system, and the method comprises the following steps: receiving a training data set and a split artificial intelligence model; the split artificial intelligence model comprises a model head part, a model middle part and a model tail part; loading the model head and the model tail to a TEE system of a TEE joint computing system, and loading the model middle to a common system of the TEE joint computing system; wherein the TEE system comprises a first computing resource and a first volatile storage resource which can support a TEE environment; the common system comprises a second computing resource and a second volatile storage resource; and performing fine tuning on the artificial intelligence model based on the training data set, the TEE system and the common system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of artificial intelligence technology, and in particular, relates to an artificial intelligence model fine-tuning method, system, device, medium and program product. Background Art

[0002] Artificial intelligence models, especially large artificial intelligence models, are usually general models. For specific industry fields, it is also necessary to use industry-specific data to fine-tune the pre-trained artificial intelligence models so that they can achieve better prediction results in this field. The fine-tuning process of artificial intelligence models will involve data security issues: on the one hand, the pre-trained model party does not want its pre-trained model to be leaked to the industry data party; on the other hand, the industry data party does not want the industry data it provides to be leaked to the pre-trained model party. In order to protect the data security of the industry data party and the pre-trained model party, the Trusted Execution Environment (TEE) technology can be used to protect the data security of both parties. However, when fine-tuning artificial intelligence models based on TEE technology, especially fine-tuning large artificial intelligence models, a large amount of graphics processing unit (GPU) resources are usually required, and GPU resources are required to provide support for TEE technology before the TEE environment can be deployed in the corresponding GPU. Summary of the invention

[0003] Embodiments of the present application provide an artificial intelligence model fine-tuning method, system, device, medium, and program product.

[0004] The present application embodiment provides an artificial intelligence model fine-tuning method, which is applied to a trusted execution environment TEE joint computing system, and the method includes:

[0005] Receiving a training data set and a split artificial intelligence model; the split artificial intelligence model includes a model head, a model middle, and a model tail;

[0006] Loading the model header and the model tail into the TEE system of the TEE joint computing system, and loading the model middle into the common system of the TEE joint computing system; wherein the TEE system includes a first computing resource and a first volatile storage resource capable of supporting the TEE environment; and the common system includes a second computing resource and a second volatile storage resource;

[0007] The artificial intelligence model is fine-tuned based on the training data set, the TEE system, and the ordinary system.

[0008] In some embodiments, the split artificial intelligence model is sent by the pre-trained model party; the training data set is sent by the industry data party; before receiving the training data set and the split artificial intelligence model, the method also includes: issuing a first key to the pre-trained model party and issuing a second key to the industry data party; receiving the training data set and the split artificial intelligence model includes: receiving the training data set encrypted based on the second key uploaded by the industry data party, and receiving the split artificial intelligence model sent by the pre-trained model party; wherein the split artificial intelligence model includes a model middle part, a model head encrypted based on the first key, and a model tail encrypted based on the first key; after loading the model head and the model tail into the TEE system of the TEE joint computing system, the method also includes: decrypting the model head encrypted by the first key, the model tail encrypted by the first key, and the training data set encrypted by the second key through the TEE system.

[0009] It can be seen that this embodiment provides a method for encrypting part of the model based on the TEE system. Processing the partially encrypted model based on the TEE system is beneficial to reducing the performance requirements of the TEE system during the model fine-tuning process while ensuring data security.

[0010] In some embodiments, the model head includes at least the input layer and the first hidden layer of the artificial intelligence model; the middle part of the model includes at least the second hidden layer of the artificial intelligence model; the model tail includes at least the output layer and the third hidden layer of the artificial intelligence model; the first hidden layer includes at least the first layer of the hidden layer of the artificial intelligence model; the third hidden layer includes at least the last layer of the hidden layer of the artificial intelligence model; the second hidden layer includes other hidden layers excluding the first hidden layer and the third hidden layer.

[0011] It can be seen that in this embodiment, the model head and the model tail include at least one hidden layer. Since the hidden layer outputs the processing and calculation results of the training data, it is difficult to reversely infer the original data through the data output by the hidden layer. Therefore, the split model given in this embodiment can better ensure the security of the training data.

[0012] In some embodiments, the fine-tuning of the artificial intelligence model based on the training data set, the TEE system, and the ordinary system includes: inputting the sample data in the training data set into the model head for calculation through the TEE system to obtain the first hidden state value output by the first hidden layer; sending the first hidden state value to the ordinary system; inputting the first hidden state value into the middle part of the model for calculation through the ordinary system to obtain the second hidden state value output by the second hidden layer; sending the second hidden state value to the TEE system; inputting the second hidden state value into the tail of the model for calculation through the TEE system to obtain a prediction result; comparing the annotation result in the training data set with the prediction result to obtain a comparison result; the comparison result indicates the difference between the annotation result and the prediction result; and fine-tuning the artificial intelligence model based on the comparison result.

[0013] It can be seen that this embodiment further provides a method for fine-tuning the artificial intelligence model by jointly using the TEE system and the ordinary system, which is beneficial to reducing the performance requirements of the TEE system during the model fine-tuning process on the basis of protecting data and model security.

[0014] In some embodiments, the fine-tuning of the artificial intelligence model based on the comparison result includes: sending the comparison result to the output layer at the tail of the model, and calculating the error gradient of each layer in the tail of the model in sequence from the output layer to the third hidden layer; updating the model parameters of the tail of the model based on the error gradient of each layer in the tail of the model; sending the error gradient of the first layer in the third hidden layer to the last layer of the second hidden layer of the ordinary system; calculating the error gradient of each layer in the middle of the model in sequence from the last layer of the second hidden layer to the first layer of the second hidden layer through the ordinary system; updating the model parameters of the middle of the model based on the error gradient of each layer in the middle of the model; sending the error gradient of the first layer in the second hidden layer to the last layer of the first hidden layer in the TEE system; calculating the error gradient of each layer in the head of the model in sequence from the last layer of the first hidden layer to the input layer through the TEE system; and updating the model parameters of the model head based on the error gradient of each layer in the model head.

[0015] It can be seen that by reversely calculating the error gradient of each layer in the model and fine-tuning the model accordingly, it is beneficial to obtain more accurate model prediction results.

[0016] In some embodiments, the first computing resource includes a first GPU that can support a TEE environment; before receiving the split artificial intelligence model, the method also includes: sending the memory size of the first GPU to the pre-trained model party; the memory size of the first GPU is used to enable the pre-trained model party to determine the number of layers of the first hidden layer, the second hidden layer, and the third hidden layer.

[0017] It can be seen that based on the method given in this embodiment, the hierarchical structure of the model head, model middle and model tail in the split artificial intelligence model can be adjusted based on the memory size of the first GPU, which is conducive to improving the utilization of GPU resources in the TEE system.

[0018] In some embodiments, the fine-tuning of the artificial intelligence model based on the training data set, the TEE system, and the ordinary system includes: when the sum of the memory sizes of the GPU required for the model head and the model tail is greater than the memory size of the first GPU, fine-tuning the model head and the model tail based on the first volatile storage resource and the third computing resource; the third computing resource is the computing resource in the first computing resource excluding the first GPU; when the sum of the memory sizes of the GPU required for the model head and the model tail is less than or equal to the memory size of the first GPU, fine-tuning the model head and the model tail based on the first GPU.

[0019] It can be seen that when the memory of the first GPU does not meet the memory size required for fine-tuning the split artificial intelligence model, the security of the data can be guaranteed by applying the first volatile storage resources and other computing resources; when the memory of the first GPU meets the memory size required for fine-tuning the split artificial intelligence model, the model head and model tail can be fine-tuned through the first GPU, which is conducive to speeding up the model fine-tuning speed.

[0020] In some embodiments, the TEE joint computing system is deployed together with the artificial intelligence model before the split, or the TEE joint computing system is deployed separately from the artificial intelligence model before the split.

[0021] It can be seen that this embodiment provides two deployment methods of TEE joint computing systems; when the TEE joint computing system and the artificial intelligence model before splitting are deployed on the pre-trained model side at the same time, it is beneficial to speed up the deployment of the artificial intelligence model after splitting on the TEE joint computing system; when the TEE joint computing system and the artificial intelligence model before splitting are deployed on different platforms respectively, it is beneficial to further improve the security of the data provided by the business data side.

[0022] An embodiment of the present application also provides an artificial intelligence model fine-tuning method, which is applied to a pre-trained model. The method includes: splitting the artificial intelligence model to obtain a model head, a model middle and a model tail; sending the split artificial intelligence model to a TEE joint computing system, so that the TEE joint computing system fine-tunes the artificial intelligence model according to the artificial intelligence model fine-tuning method executed by the above-mentioned TEE joint computing system.

[0023] In some embodiments, the model head includes at least the input layer and the first hidden layer of the artificial intelligence model; the middle part of the model includes at least the second hidden layer of the artificial intelligence model; the model tail includes at least the output layer and the third hidden layer of the artificial intelligence model; the first hidden layer includes at least the first layer of the hidden layer of the artificial intelligence model; the third hidden layer includes at least the last layer of the hidden layer of the artificial intelligence model; the second hidden layer is the other hidden layers excluding the first hidden layer and the third hidden layer.

[0024] It can be seen that in this embodiment, the model head and the model tail include at least one hidden layer. Since the hidden layer outputs the processing and calculation results of the training data, it is difficult to reversely infer the original data through the data output by the hidden layer. Therefore, the split model given in this embodiment can better ensure the security of the training data.

[0025] In some embodiments, the artificial intelligence model is split, including: receiving the memory size of a first GPU sent by the TEE joint computing system; the first GPU is a GPU in a TEE system in the TEE joint computing system; obtaining the memory size required for the input layer, output layer, and hidden layer of the artificial intelligence model; based on the memory size required for the input layer, output layer, and hidden layer of the artificial intelligence model, and the memory size of the first GPU, the artificial intelligence model is split.

[0026] It can be seen that splitting the artificial intelligence model based on the memory size of the first GPU is conducive to fine-tuning more hidden layers through the first GPU, which is conducive to improving the fine-tuning rate of the split artificial intelligence model.

[0027] In some embodiments, the artificial intelligence model is split based on the memory size required for each layer of the input layer, output layer, and hidden layer of the artificial intelligence model, as well as the memory size of the first GPU, including: taking the input layer and the first hidden layer as the head of the model; taking the second hidden layer as the middle of the model; taking the third hidden layer and the output layer as the tail of the model; calculating a first memory size; the first memory size represents the sum of the memory sizes required for the head of the model and the tail of the model; when the difference between the memory size of the first GPU and the first memory size is greater than a preset difference, increasing the number of layers of the first hidden layer and / or the third hidden layer, and updating the first memory size until the difference between the memory size of the first GPU and the first memory size is less than the preset difference; wherein the preset difference is greater than 0.

[0028] It can be seen that this embodiment further provides a method for splitting the artificial intelligence model based on the memory size of the GPU. When the split model head and the split model tail contain multiple hidden layers, fine-tuning the split model head and the split model tail through the TEE system is beneficial to improving the security of the sample data and the split model head and the split model tail.

[0029] The embodiment of the present application also provides a TEE joint computing system, the system is used to fine-tune the split artificial intelligence model; the split artificial intelligence model includes a model head, a model middle and a model tail; the system includes a TEE system and a common system; wherein,

[0030] The TEE system is used to train the model head and the model tail; the TEE system includes a first computing resource and a first volatile storage resource capable of supporting a TEE environment;

[0031] The common system is used to train the middle part of the model; the common system includes a second computing resource and a second volatile storage resource.

[0032] The present application also provides an artificial intelligence model fine-tuning device, which is applied to a TEE joint computing system, and the device includes:

[0033] A receiving module, used to receive a training data set and a split artificial intelligence model; the split artificial intelligence model includes a model head, a model middle and a model tail;

[0034] A loading module, used to load the model header and the model tail into the TEE system of the TEE joint computing system, and load the model middle into the common system of the TEE joint computing system; wherein the TEE system includes a first computing resource and a first volatile storage resource capable of supporting the TEE environment; and the common system includes a second computing resource and a second volatile storage resource;

[0035] A fine-tuning module is used to fine-tune the artificial intelligence model based on the training data set, the TEE system, and the ordinary system.

[0036] The present application also provides an artificial intelligence model fine-tuning device, which is applied to a pre-training model, and the device includes:

[0037] A splitting module is used to split the artificial intelligence model into a model head, a model middle, and a model tail;

[0038] The sending module is used to send the split artificial intelligence model to the TEE joint computing system, so that the TEE joint computing system fine-tunes the artificial intelligence model according to the artificial intelligence model fine-tuning method executed by the above-mentioned TEE joint computing system.

[0039] An embodiment of the present application provides a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements any of the above-mentioned artificial intelligence model fine-tuning methods performed by the TEE joint computing system, or the artificial intelligence model fine-tuning method performed by the pre-trained model party.

[0040] An embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned artificial intelligence model fine-tuning methods performed by a TEE joint computing system, or the artificial intelligence model fine-tuning method performed by a pre-trained model party.

[0041] The embodiments of the present application provide an artificial intelligence model fine-tuning method, system, device, medium and program product. Through the method provided in this embodiment, it is possible to combine the TEE system and the ordinary system to reduce the performance requirements of the TEE system while ensuring the security of the data provided by the business data party and the artificial intelligence model provided by the pre-trained model party, which is conducive to reducing the demand for the use of the specific GPU required for the TEE environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 A flow chart of an artificial intelligence model fine-tuning method provided in an embodiment of the present application;

[0043] Figure 2 A schematic diagram of the structure of an artificial intelligence model provided in an embodiment of the present application;

[0044] Figure 3 A schematic diagram of the structure of a large language model provided in an embodiment of the present application;

[0045] Figure 4 A schematic diagram of the structure of the TEE joint computing system provided in the embodiment of the present application;

[0046] Figure 5 A schematic diagram of a model deployment method provided in an embodiment of the present application;

[0047] Figure 6 A flowchart of a method for obtaining prediction results based on a TEE system and a common system provided in an embodiment of the present application;

[0048] Figure 7 A flow chart of a method for reverse fine-tuning a model provided in an embodiment of the present application;

[0049] Figure 8 A schematic diagram of a TEE joint computing system deployment provided in an embodiment of the present application;

[0050] Fig. 9 A schematic diagram of another TEE joint computing system deployment provided in an embodiment of the present application;

[0051] Fig.10 A flow chart of another artificial intelligence model fine-tuning method provided in an embodiment of the present application;

[0052] Fig.11 A flow chart of a configuration method provided in an embodiment of the present application;

[0053] Fig.12 A model fine-tuning startup flow chart provided in an embodiment of the present application;

[0054] Fig.13 A schematic diagram of the structure of an artificial intelligence model fine-tuning device provided in an embodiment of the present application;

[0055] Fig.14 A schematic diagram of the structure of another artificial intelligence model fine-tuning device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0056] With the continuous development of big data and artificial intelligence technology, artificial intelligence models, especially large artificial intelligence models, have achieved remarkable achievements in the field of artificial intelligence. Most of these pre-trained artificial intelligence models are general models. For different industry fields, it is necessary to use the industry-specific data to fine-tune the pre-trained artificial intelligence models so that they can achieve better prediction results in the field. In the fine-tuning process, data protection issues will be involved: on the one hand, the pre-trained model party does not want the data of its pre-trained model to be leaked to the industry data party; on the other hand, the industry data party does not want the training data it provides to be leaked to the pre-trained model party.

[0057] A method based on model segmentation and compression is proposed in the related art. By compressing part of the model or related components and deploying them on the industry data side, and deploying the main part of the model on the pre-trained model side itself, the purpose of protecting the data of both parties during fine-tuning training is achieved. The method of using model segmentation and model compression in the related art can achieve data privacy protection, but it will lead to a decrease in training accuracy or a significant increase in training time. Because during fine-tuning training, the compressed model is trained together with the encoder (Encoder) and decoder (Decoder) instead of the original pre-trained model, the actual training effect of the encoder and decoder will be lower than when they are trained with the original model.

[0058] In another related technology, a method is provided for achieving data privacy protection for both parties through data interaction between the pre-trained model party and the industry data party. However, since multiple remote data transmissions are required between the pre-trained model party and the industry data party in each round of training, the training time will be significantly increased.

[0059] For the TEE technology solution, since both the model data and the training data are concentrated in the TEE environment, the above shortcomings can be avoided. However, in the current environment, the use of TEE technology for fine-tuning training of artificial intelligence models often faces the problem of insufficient computing resources. The main reason is that model training requires a large amount of GPU resources, but the TEE environment corresponding to TEE technology requires GPU resources to provide support for TEE technology before access to the corresponding GPU for TEE environment deployment. However, since GPUs that support TEE environments are difficult to obtain, solutions based on TEE technology are usually limited by GPU resource issues and cannot be actually implemented.

[0060] In response to the above-mentioned problems, the embodiments of the present application provide an artificial intelligence model fine-tuning method, system, device, medium and program product. The present application proposes a TEE resource-saving artificial intelligence model fine-tuning method, which is a fine-tuning environment jointly created by a TEE system supporting a TEE environment and a common system, in which artificial intelligence model fine-tuning training is performed, and data protection for both the pre-trained model party and the industry data party is achieved during the fine-tuning process. It overcomes the problem of limited access to specific GPUs supporting TEE and facilitates the actual implementation of the TEE solution.

[0061] The following is a further detailed description of the embodiments of the present application in conjunction with the accompanying drawings and examples. It should be understood that the embodiments provided herein are only used to explain the embodiments of the present application and are not intended to limit the embodiments of the present application. In addition, the embodiments provided below are partial embodiments for implementing the present application, rather than providing all embodiments for implementing the present application. In the absence of conflict, the technical solutions recorded in the embodiments of the present application can be implemented in any combination.

[0062] It should be noted that, in the embodiments of the present application, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a method or device including a series of elements includes not only the elements explicitly recorded, but also includes other elements not explicitly listed, or also includes elements inherent to the implementation of the method or device. In the absence of further restrictions, an element defined by the sentence "includes..." does not exclude the presence of other related elements (such as steps in the method or units in the device, such as a unit in the device may be a part of a circuit, a part of a processor, a part of a program or software, etc.) in the method or device including the element.

[0063] The artificial intelligence model fine-tuning method provided in the embodiment of the present application includes a series of steps, but the artificial intelligence model fine-tuning method provided in the embodiment of the present application is not limited to the recorded steps. Similarly, the artificial intelligence model fine-tuning device provided in the embodiment of the present application includes a series of modules, but the device provided in the embodiment of the present application is not limited to including the modules explicitly recorded, and may also include modules required to obtain relevant information or perform processing based on information.

[0064] The present application embodiment provides a method for fine-tuning an artificial intelligence model, such as Figure 1 As shown, Figure 1 A flow chart of an artificial intelligence model fine-tuning method is shown, which is applied to the TEE joint computing system. Figure 1 The AI ​​model fine-tuning methods shown include:

[0065] Step 101: Receive a training data set and a split artificial intelligence model; the split artificial intelligence model includes a model head, a model middle, and a model tail.

[0066] The artificial intelligence model in this embodiment (hereinafter referred to as the model) refers to a model that performs complex tasks in the field of artificial intelligence, and may include neural networks, natural language processing, computer vision models, etc.; the artificial intelligence model in this embodiment may also be a large artificial intelligence model, such as a large language model or other natural language processing or image recognition model.

[0067] Figure 2 A schematic diagram of the structure of an artificial intelligence model is shown, including an input layer, multiple hidden layers, and an output layer. Figure 2 As shown, the multiple hidden layers include hidden layer 1 to hidden layer N, hidden layer 1 represents the first hidden layer, hidden layer 2 represents the second hidden layer, and hidden layer N represents the Nth hidden layer.

[0068] Figure 3 Figure 1 shows a schematic diagram of the structure of a large language model, which consists of a word segmenter, an embedding layer, a multi-transformer layer, and a prediction layer. Figure 3 As shown in the figure, the multiple Transformer layers include Transformer 1 to Transformer N, Transformer 1 represents the first Transformer layer, Transformer 2 represents the second Transformer layer, and Transformer N represents the Nth Transformer layer. For example, the deep learning model (Generative Pre-Trained2, GPT2) SMALL model has a total of 12 Transformer layers, and the GPT2 EXTRA LARGE model has a total of 48 Transformer layers. Figure 3 The Transformer layer shown is equivalent to a hidden layer. This embodiment is based on a general hidden layer as an implementation method of the embodiment of the present application, but when the application is fine-tuned for different artificial intelligence models, the input layer, hidden layer and output layer involved in this embodiment can be replaced accordingly.

[0069] The training data set received in this step includes sample data used for model fine-tuning and the annotation results corresponding to the sample data. The training data set can be data collected by the pre-trained model party or data provided by the business data party. The business data party can be the model demander. For example, when the business data party needs the pre-trained model party to provide a model, the business data party provides the pre-trained model party with the data of the corresponding business. The pre-trained model party fine-tunes its pre-trained model based on the data provided by the business data party, so that the fine-tuned model can be used in the usage scenario of the business data party. The business data party can meet its own usage needs through the fine-tuned model.

[0070] The artificial intelligence model after splitting in this step is a pre-trained model that is split before fine-tuning the model in order to meet the model fine-tuning requirements. The split model includes at least a model head, a model middle, and a model tail. The split model here is split into a model head, a model middle, and a model tail in sequence according to the different layers in the model structure. In this embodiment, the model can be split according to the actual training requirements and in combination with the corresponding computing resources, so that the split model includes at least a model head, a model middle, and a model tail.

[0071] Step 102: Load the model header and the model tail into the TEE system of the TEE joint computing system, and load the middle part of the model into the common system of the TEE joint computing system; wherein the TEE system includes a first computing resource and a first volatile storage resource capable of supporting the TEE environment; and the common system includes a second computing resource and a second volatile storage resource.

[0072] Figure 4A schematic diagram of the composition structure of the TEE joint computing system is shown. In this embodiment, the TEE joint computing system includes a TEE system 401 and a common system 402, wherein the TEE system 401 includes a first computing resource 4011 and a first volatile storage resource 4012 that can support the TEE environment; here, the first computing resource 4011 may include a specific first central processing unit (CPU) that can support the normal operation of the TEE environment, and the first volatile storage resource 4012 may include a first memory that can ensure the normal operation of the TEE environment. When a specific first GPU that meets the operation of the TEE environment can be obtained, the first computing resource 4011 may also include the first GPU; when the first GPU cannot be obtained, the first computing resource 4011 may also implement the deployment of the TEE environment based on the first CPU and the first memory. The common system 402 includes a second computing resource 4021 and a second volatile storage resource 4022, the second computing resource 4021 may include any CPU and any GPU that meet the use requirements, and the second volatile storage resource 4022 may include any memory that meets the use requirements. The specific number of the first GPU in the TEE system 401 is not limited, and the number of GPUs in the ordinary system 402 needs to be able to support the fine-tuning tasks of the corresponding model.

[0073] like Figure 5 As shown, Figure 5 A schematic diagram of a model deployment method is shown. Combined with the split model given in the above steps, the model head and the model tail are input into the TEE system 401, and the middle of the model is sent to the ordinary system 402. The split model is jointly calculated by the TEE system 401 and the ordinary system 402 of the TEE joint computing system.

[0074] Step 103: Fine-tune the AI ​​model based on the training data set, TEE system, and ordinary system.

[0075] After the middle part and the tail part of the model are input into the TEE system 401 based on the above steps, the TEE joint computing system will also input the sample data in the received training data set into the TEE system 401, and the TEE system 401 will first pre-process and preliminarily calculate the sample data based on the model head to obtain the calculation result of the model head, and then the middle part of the model will calculate the calculation result obtained by the model head to obtain the calculation result of the middle part of the model, and finally the tail part of the model will further calculate the calculation result output by the middle part of the model to obtain the prediction result. After the prediction result is output, the annotation result corresponding to the sample data can be compared with the prediction result, and the model can be fine-tuned according to the comparison result. This embodiment provides a method for fine-tuning an artificial intelligence model, which can split the artificial intelligence model and jointly fine-tune the split model through the TEE system 401 and the ordinary system 402 in the TEE joint computing system. Compared with using the ordinary system 402 to fine-tune the model, the security of the fine-tuning data and the model data can be guaranteed; compared with using the TEE environment to fine-tune the model, the performance requirements for the GPU in the TEE system 401 can be reduced, and at the same time the security of the fine-tuning data and the model data can be guaranteed.

[0076] In practical applications, steps 101 to 103 can be implemented based on a processor, and the processor can be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a CPU, a controller, a microcontroller, and a microprocessor.

[0077] In some embodiments, the split artificial intelligence model is sent by the pre-trained model party; the training data set is sent by the industry data party; before the above-mentioned receiving the training data set and the split artificial intelligence model, the above-mentioned method also includes: issuing a first key to the pre-trained model party, and issuing a second key to the industry data party; the above-mentioned receiving of the training data set and the split artificial intelligence model includes: receiving the training data set encrypted based on the second key uploaded by the industry data party, and receiving the split artificial intelligence model sent by the pre-trained model party; wherein, the split artificial intelligence model includes a model middle part, a model head encrypted based on the first key, and a model tail encrypted based on the first key; after the above-mentioned loading of the model head and the model tail into the TEE system of the TEE joint computing system, the above-mentioned method also includes: decrypting the model head encrypted by the first key, the model tail encrypted by the first key, and the training data set encrypted by the second key through the TEE system.

[0078] According to the above embodiment, the model fine-tuned in the TEE system 401 in this embodiment is not the whole model, but the split model. When it is necessary to fine-tune the model in the TEE environment, the TEE system 401 first generates a first key and a second key in the TEE environment, and then sends the first key to the pre-trained model party, and sends the second key to the industry data party. The pre-trained model party and the industry data party encrypt their own model data or training data based on the first key and the second key, and then send the encrypted model data or training data to the TEE system 401 of the TEE joint computing system to ensure the security of the data during transmission.

[0079] For the pre-trained model party, before encrypting the model data, the model needs to be split first. Based on the above steps, since the middle part of the split model is fine-tuned in the common system 402, in order to speed up the fine-tuning efficiency of the model, the pre-trained model party can only encrypt the model head and model tail that are fine-tuned in the TEE system 401, and send the encrypted model head, encrypted model tail, and unencrypted model middle part to the TEE joint computing system.

[0080] After receiving the encrypted model header, encrypted model tail, unencrypted model tail sent by the pre-trained model party, and the encrypted training data set sent by the industry data party, the TEE joint computing system sends the encrypted model header, encrypted model tail, and encrypted training data set to the TEE system 401, and sends the unencrypted model middle part to the general system 402. The TEE system 401 decrypts the encrypted model header and encrypted model tail by the first key, and decrypts the encrypted training data set by the second key, and then starts model fine-tuning based on the decrypted data and model; or, the TEE system 401 decrypts the encrypted model header and encrypted model tail by the key corresponding to the first key, and decrypts the encrypted training data set by the key corresponding to the second key, and then starts model fine-tuning based on the decrypted data and model.

[0081] This embodiment provides an encryption method based on a TEE joint computing system, which can only encrypt the split model and data fine-tuned in the TEE system 401, ensure the security of the model, and speed up the transmission rate of the model. In practical applications, in order to further improve the security of model transmission, the middle part of the model fine-tuned in the common system 402 can also be encrypted, and this application does not make specific restrictions on this.

[0082] In some embodiments, the model head includes at least the input layer and the first hidden layer of the artificial intelligence model; the middle part of the model includes at least the second hidden layer of the artificial intelligence model; the model tail includes at least the output layer and the third hidden layer of the artificial intelligence model; the first hidden layer includes at least the first layer of the hidden layer of the artificial intelligence model; the third hidden layer includes at least the last layer of the hidden layer of the artificial intelligence model; the second hidden layer includes other hidden layers excluding the first hidden layer and the third hidden layer.

[0083] In this embodiment, the model head and the model tail include at least one hidden layer. Figure 2As shown, the division starts from the input layer of the model, and the input layer and a part of the hidden layer, for example, hidden layer 1, are divided into the head of the model in sequence, and the first hidden layer includes the first hidden layer; hidden layer 2 to hidden layer N-1 are divided into the middle of the model, and the second hidden layer includes the second hidden layer to the N-1th hidden layer; hidden layer N and the output layer are divided into the tail of the model, and the third hidden layer includes the Nth hidden layer. Alternatively, the input layer and the 1st to the i-th hidden layers can also be divided into the head of the model, and the first hidden layer includes the 1st hidden layer to the i-th hidden layer; the i+1th to the jth hidden layers are divided into the middle of the model, and the second hidden layer includes the i+1th hidden layer to the jth hidden layer; the j+1th to the Nth hidden layers and the output layer are divided into the tail of the model, and the third hidden layer includes the j+1th hidden layer to the Nth hidden layer; here 1≤i<j<N.

[0084] by Figure 3 For example, when the model that needs fine-tuning is a large language model, the tokenizer, embedding layer, and Transformer 1 layer can be divided into the model head. In this case, the first hidden layer includes the 1st Transformer layer; Transformer 2 to Transformer N-1 layers are divided into the middle of the model. In this case, the second hidden layer includes the 2nd Transformer layer to the N-1th Transformer layer; Transformer N and the prediction layer are divided into the model tail. In this case, the third hidden layer includes the Nth Transformer layer. Alternatively, the word segmenter, embedding layer, and the 1st to kth Transformer layers can be divided into the model head, in which case the first hidden layer includes the 1st to kth Transformer layers; the k+1th to qth Transformer layers can be divided into the middle of the model, in which case the second hidden layer includes the k+1th to qth Transformer layers; the q+1th to Nth Transformer layers and the prediction layer can be divided into the model tail, in which case the third hidden layer includes the q+1th to Nth Transformer layers, where 1≤k<q<N.

[0085] According to the split model given in this embodiment, Figure 2Taking the model shown as an example, after the model head and model tail are input into the TEE system 401 based on the above steps, the TEE joint computing system will also input the sample data in the received training data set into the TEE system 401, and the TEE system 401 will first pre-process the sample data based on the input layer of the model head, and then the hidden layer included in the model head will calculate the processed sample data to obtain the calculation result of the model head, and then the first hidden layer included in the middle of the model in the ordinary system 402, that is, the i+1th hidden layer, will further calculate the calculation result output by the model head, and the last hidden layer in the middle of the model, that is, the jth hidden layer, will output the calculation result of the middle of the model. The first layer of the model tail in the TEE system 401, that is, the j+1th hidden layer, will calculate based on the calculation result output by the middle of the model, and finally the output layer of the model tail will output the prediction result.

[0086] According to the above steps, the divided model head and model tail in this embodiment include at least one hidden layer, and the divided model head and model tail are sent to the TEE system 401. Since the TEE system 401 can ensure the security of the data, the data output by the model head in the TEE system 401 is the data output by the hidden layer. When the data is input to the ordinary system 402, since the data has been calculated through at least one hidden layer, even in the ordinary system 402, the data is difficult to be reversed, thereby ensuring the security of the data in fine-tuning. Since the model tail also includes at least one hidden layer, the data output by the ordinary system 402 is also the data output by the hidden layer, rather than the result data, so this data also has a high security in the ordinary system 402. In summary, by dividing the model head and model tail into at least one hidden layer, and inputting the model head and model tail into the TEE system 401 for fine-tuning, the security of the data can be guaranteed and the data can be prevented from being read by reverse.

[0087] In some embodiments, the above-mentioned fine-tuning of the artificial intelligence model based on the training data set, the TEE system, and the ordinary system includes: inputting the sample data in the training data set into the model head for calculation through the TEE system to obtain the first hidden state value output by the first hidden layer; sending the first hidden state value to the ordinary system; inputting the first hidden state value into the middle part of the model for calculation through the ordinary system to obtain the second hidden state value output by the second hidden layer; sending the second hidden state value to the TEE system; inputting the second hidden state value into the tail of the model for calculation through the TEE system to obtain the prediction result; comparing the labeled result in the training data set with the prediction result to obtain the comparison result; the comparison result indicates the difference between the labeled result and the prediction result; and fine-tuning the artificial intelligence model based on the comparison result.

[0088] This embodiment further provides a method for fine-tuning the model based on the training data set, the TEE system 401 and the common system 402. Figure 6 As shown, Figure 6 A flow chart of a method for obtaining prediction results based on a TEE system 401 and a common system 402 is shown, including:

[0089] Step 601: The TEE system selects sample data.

[0090] In this step, the sample data required for fine-tuning the model can be selected from the training data set through the TEE system 401 in the TEE joint computing system.

[0091] Step 602: The TEE system inputs the sample data into the model header.

[0092] Based on the model splitting method given in the above embodiment, after selecting the sample data, the TEE system 401 inputs the sample data into the model head, and calculates the sample data based on the input layer in the model head and the first hidden layer.

[0093] Step 603: The TEE system obtains the first hidden state value output by the i-th hidden layer.

[0094] Based on the model splitting method given in the above embodiment, the i-th hidden layer serves as the last layer of the model head, and the first hidden state value output by the i-th hidden layer is the value output by the model head.

[0095] After obtaining the first hidden state value output by the i-th hidden layer, the first hidden state value needs to be sent to the next layer of the i-th hidden layer in the artificial intelligence model, that is, the i+1-th hidden layer, which is the first layer in the middle of the model. Since the middle of the model is located in the ordinary system 402, the first hidden state value needs to be sent from the TEE system 401 to the ordinary system 402 at this time, and step 604 is executed in the ordinary system 402.

[0096] Step 604: The common system inputs the first hidden state value into the middle of the model.

[0097] After the ordinary system 402 receives the first hidden state value sent by the TEE system 401, the first hidden state value is input into the first layer in the middle of the model in the ordinary system 402, that is, the i+1th hidden layer of the artificial intelligence model, and the first hidden state value is calculated through each hidden layer contained in the middle of the model.

[0098] Step 605: The common system obtains the second hidden state value output by the j-th hidden layer.

[0099] Based on the splitting method of the model given in the above embodiment, when the jth hidden layer completes the calculation, the middle part of the model completes the calculation of the first hidden state value. The jth hidden layer is the last layer in the middle part of the model, and the second hidden state value output by it is the output value of the middle part of the model.

[0100] After obtaining the second hidden state value output by the j-th hidden layer, the second hidden state value needs to be sent to the next layer of the j-th hidden layer in the artificial intelligence model, that is, the j+1-th hidden layer, which is the first layer at the end of the model. Since the end of the model is located in the TEE system 401, the second hidden state value needs to be sent from the ordinary system 402 to the TEE system 401, and step 606 is executed in the TEE system 401.

[0101] Step 606: The TEE system inputs the second hidden state value into the model tail.

[0102] After the TEE system 401 receives the second hidden state value sent by the ordinary system 402, the second hidden state value is input into the first layer at the end of the model in the TEE system 401, that is, the j+1th hidden layer of the artificial intelligence model, and the second hidden state value is calculated through each hidden layer contained in the end of the model.

[0103] Step 607: The TEE system obtains the prediction result y'.

[0104] The calculation results of the hidden layer are finally processed through the output layer at the end of the model in the TEE system 401 to obtain the prediction result y'.

[0105] After the sample data is calculated through the TEE system 401 and the ordinary system 402 based on the above steps to obtain the prediction result y', the prediction result y' can be compared with the labeled results in the training data set to obtain the difference between the prediction result y' and the labeled results, and the model can be further fine-tuned based on the difference.

[0106] In some embodiments, the above-mentioned fine-tuning of the artificial intelligence model based on the comparison results includes: sending the comparison results to the output layer at the tail of the model, and calculating the error gradient of each layer in the tail of the model in sequence from the output layer to the third hidden layer; updating the model parameters of the tail of the model based on the error gradient of each layer in the tail of the model; sending the error gradient of the first layer in the third hidden layer to the last layer of the second hidden layer of the ordinary system; calculating the error gradient of each layer in the middle of the model in sequence from the last layer of the second hidden layer to the first layer of the second hidden layer through the ordinary system; updating the model parameters of the middle of the model based on the error gradient of each layer in the middle of the model; sending the error gradient of the first layer in the second hidden layer to the last layer of the first hidden layer in the TEE system; calculating the error gradient of each layer in the head of the model in sequence from the last layer of the first hidden layer to the input layer through the TEE system; updating the model parameters of the model head based on the error gradient of each layer in the model head.

[0107] The above embodiment provides a method for calculating the prediction result by sequentially calculating the model head, the middle part of the model and the tail part of the model. After obtaining the prediction result, based on the method of this embodiment, the error gradient of each layer is calculated from the back to the front in the order of the model tail to the model middle part and then to the model head, and the model parameters of each layer are fine-tuned based on the error gradient of each layer.

[0108] by Figure 2 Taking the structure diagram of the artificial intelligence model shown in the figure as an example, when fine-tuning each layer in the artificial intelligence model after obtaining the prediction results, Figure 2 The structure shown calculates the error gradient layer by layer in the order from the output layer to the input layer. Corresponding to the splitting method of the model given in the above embodiment, the error gradient is first calculated for the last layer of the model tail, that is, the output layer, and then the error gradient is calculated for the Nth hidden layer, and finally the error gradient is calculated for the first layer of the model tail, that is, the j+1th layer; after the error gradient of each layer is calculated from the back to the front of the model tail, the error gradient of each layer is calculated from the back to the front of the model middle part, for example, from the last layer of the model middle part, that is, the last layer of the second hidden layer, that is, the jth hidden layer, and finally to the first layer of the model middle part, that is, the first layer of the second hidden layer, that is, the i+1th layer, the error gradient is calculated layer by layer; after the error gradient of each layer is calculated from the back to the front of the model middle part, the error gradient of each layer is calculated from the back to the front of the model head, for example, from the last layer of the model head, that is, the last layer of the first hidden layer, that is, the ith hidden layer, and finally to the input layer of the model head, the error gradient is calculated layer by layer.

[0109] exist Figure 6 On the basis of Figure 7A flow chart of a method for reverse fine-tuning a model is shown, such as Figure 7 As shown, back-tuning the model involves:

[0110] Step 701: The TEE system calculates the error between the labeled result and the predicted result y'.

[0111] The TEE system 401 calculates the error value of the prediction result of this model based on the annotation result and the prediction result y' corresponding to the input sample data to obtain a comparison result.

[0112] Step 702: The TEE system sends it to the last layer at the end of the model and reversely calculates the error gradient in sequence until the j+1th hidden layer.

[0113] The comparison result obtained in step 701 is sent to the last layer at the end of the model, i.e., the output layer. The error gradient of each layer from the output layer to the first layer of the third hidden layer, i.e., the j+1th layer, is calculated in sequence from back to front, and the model parameters of each layer are updated.

[0114] After calculating the first layer of the third hidden layer, the error gradient δ output by the j+1th hidden layer j+1 Afterwards, it is sent to the common system 402.

[0115] Step 703: The common system sends the error gradient output by the j+1th hidden layer to the jth hidden layer, and reversely calculates the error gradient in sequence until the i+1th hidden layer.

[0116] When the first layer of the model tail in the TEE system 401, i.e., the j+1th hidden layer outputs the error gradient δ j+1 After that, the common system 402 receives the received δ j+1 The error gradient is sent to the last layer in the middle of the model, that is, the last layer of the second hidden layer, that is, the jth hidden layer of the artificial intelligence model, and the error gradient of each layer is calculated from back to front until the error gradient of the first layer in the middle of the model, that is, the first layer of the second hidden layer, that is, the i+1th hidden layer of the artificial intelligence model is calculated. The model parameters of each layer in the middle of the model are fine-tuned by calculating the error gradient of each layer in the middle of the model.

[0117] After calculating the first layer of the second hidden layer, the error gradient δ output by the i+1th hidden layer i+1 Afterwards, it is sent to the TEE system 401.

[0118] Step 704: The TEE system sends the error gradient output by the i+1th hidden layer to the ith hidden layer, and reversely calculates the error gradient in sequence until the first layer of the model head.

[0119] Corresponding to step 703, when the first layer in the middle of the model in the common system 402, i.e., the i+1th hidden layer outputs the error gradient δ i+1 After that, the TEE system 401 receives the received δ i+1 The last layer sent to the model head, that is, the last layer of the first hidden layer, that is, the i-th hidden layer of the artificial intelligence model, calculates the error gradient of each layer from back to front until the error gradient of the first layer of the model head, that is, the input layer, is calculated. The model parameters of each layer in the model head are fine-tuned by calculating the error gradient of each layer of the model head.

[0120] Based on the fine-tuning method in the above steps, fine-tuning of each layer in the model is completed. You can repeat Figure 6 as well as Figure 7 The process shown is continued until the comparison result meets the preset conditions, for example, the difference between the annotation result and the prediction result is less than the threshold value, the fine-tuning is stopped, and the fine-tuning training of the artificial intelligence model is completed.

[0121] In some embodiments, the first computing resource includes a first GPU that can support a TEE environment; before receiving the split artificial intelligence model, the above method also includes: sending the memory size of the first GPU to the pre-trained model party; the memory size of the first GPU is used to enable the pre-trained model party to determine the number of first hidden layers, second hidden layers, and third hidden layers.

[0122] In order to speed up the fine-tuning of the model, the first computing resource 4011 may also include the first GPU if the first GPU device that supports the operation of the TEE environment can be obtained. When the first computing resource 4011 includes the first GPU, before the TEE joint computing system performs model fine-tuning, the TEE joint computing system will also send the memory size of the first GPU to the pre-trained model party. The pre-trained model party can determine the size of the model head and model tail that need to be fine-tuned by the TEE system 401 based on the size of the first GPU. Further, the pre-trained model party can determine the number of hidden layers divided into the model head, model middle, and model tail through the size of the first GPU. The specific method of dividing the hidden layer in this embodiment can refer to the method given in the following embodiment.

[0123] In some embodiments, the above-mentioned fine-tuning of the artificial intelligence model based on the training data set, the TEE system, and the ordinary system includes: when the sum of the memory sizes of the GPU required for the model head and the model tail is greater than the memory size of the first GPU, fine-tuning the model head and the model tail based on the first volatile storage resource and the third computing resource; the third computing resource is the computing resource in the first computing resource excluding the first GPU; when the sum of the memory sizes of the GPU required for the model head and the model tail is less than or equal to the memory size of the first GPU, fine-tuning the model head and the model tail based on the first GPU.

[0124] When the memory required for the artificial intelligence model is large, or when fine-tuning certain complex artificial intelligence models, the fine-tuning process may require a large memory support. In order to ensure the security of the model data and the data of the industry data party, it is necessary to divide at least one hidden layer at the head and tail of the model. When the first hidden layer includes only one hidden layer, and the third hidden layer includes only one hidden layer, when the memory size required for the model head and the model tail is still greater than the memory size of the first GPU, the model will be fine-tuned based on the first volatile storage resource 4012 and the third computing resource in the first computing resource 4011. Here, the third computing resource is a computing resource other than the first GPU. For example, the third computing resource can be the first CPU.

[0125] When the first hidden layer includes only one hidden layer, and the third hidden layer includes only one hidden layer, when the memory size required for the model head and the model tail is less than the memory size of the first GPU, the split part of the model is fine-tuned based on the first GPU. In practical applications, since the memory size required for each layer in the model before splitting is determined based on the pre-trained model, the memory size required for each layer of the model calculated by the pre-trained model may have errors. Therefore, when the sum of the GPU memory size required for the model head and the model tail calculated by the pre-trained model is less than the memory size of the first GPU, the model head and the model tail are sent to the TEE system 401. However, when there is a calculation error, the sum of the GPU memory size actually required for the model head and the model tail received by the TEE system 401 may be greater than the memory size of the first GPU. In this state, the TEE system 401 can be set to issue a prompt, or the model head and the model tail can be fine-tuned directly through the first volatile storage resource 4012 and the third computing resource in the first computing resource 4011.

[0126] In some embodiments, the TEE joint computing system is deployed together with the artificial intelligence model before the split, or the TEE joint computing system is deployed separately from the artificial intelligence model before the split.

[0127] The TEE joint computing system and the artificial intelligence model before the split can be deployed together, that is, the TEE joint computing system and the artificial intelligence model before the split are deployed on one side. Figure 8 As shown, the artificial intelligence model and the TEE joint computing system before the split can be deployed together on the pre-trained model party, and the pre-trained model party is the party that provides the artificial intelligence model. Specifically, the artificial intelligence model and the TEE joint computing system before the split can be respectively deployed on different hardware devices of the pre-trained model party, and the artificial intelligence model and the TEE joint computing system before the split can also be deployed in different storage units of the pre-trained model party.

[0128] When the TEE joint computing system and the artificial intelligence model before the split are deployed together on the pre-trained model side, the TEE joint computing system obtains the split artificial intelligence model on other devices of the pre-trained model side, or the TEE joint computing system receives the split artificial intelligence model sent from different storage units of the pre-trained model side. When the TEE joint computing system and the artificial intelligence model before the split are deployed together on the pre-trained model side, the industry data side sends the training data set to the TEE joint computing system in the pre-trained model side, and the TEE joint computing system fine-tunes the model based on the received training data set and the split artificial intelligence model.

[0129] The TEE joint computing system and the artificial intelligence model before the split can also be deployed separately, that is, the TEE joint computing system and the artificial intelligence model before the split are deployed on different platforms. Fig. 9 As shown, the artificial intelligence model before the split can be deployed on the pre-trained model party, and the TEE joint computing system can be deployed on other platform parties. Here, the other platform party is a third party different from the pre-trained model party and the industry data party. Specifically, the other platform party can be a trusted third-party platform, such as a data exchange. When the TEE joint computing system is deployed separately on other platform parties, the pre-trained model party sends the split artificial intelligence model to other platform parties, and the industry data party sends the training data set to other platform parties. The TEE joint computing system in the other platform party fine-tunes the model based on the received split artificial intelligence model and the training data set.

[0130] Based on the artificial intelligence model fine-tuning method applied to the TEE joint computing system proposed in the above embodiment, the embodiment of the present application also proposes an artificial intelligence model fine-tuning method applied to the pre-training model, such as Fig.10 As shown, the AI ​​model fine-tuning method includes:

[0131] Step 1001: Split the artificial intelligence model to obtain a model head, a model middle, and a model tail.

[0132] Step 1002: Send the split artificial intelligence model to the TEE joint computing system, so that the TEE joint computing system fine-tunes the artificial intelligence model according to the artificial intelligence model fine-tuning method executed by the TEE joint computing system given in the above embodiment.

[0133] The artificial intelligence model fine-tuning method given in this embodiment corresponds to the above-mentioned embodiment, and the specific implementation method can refer to the specific implementation method given in the above-mentioned embodiment.

[0134] In some embodiments, the model head includes at least the input layer and the first hidden layer of the artificial intelligence model; the middle part of the model includes at least the second hidden layer of the artificial intelligence model; the model tail includes at least the output layer and the third hidden layer of the artificial intelligence model; the first hidden layer includes at least the first layer of the hidden layer of the artificial intelligence model; the third hidden layer includes at least the last layer of the hidden layer of the artificial intelligence model; the second hidden layer is the other hidden layers excluding the first hidden layer and the third hidden layer.

[0135] In this embodiment, the model head and the model tail include at least one hidden layer, which corresponds to the split model calculated by the TEE joint computing system given in the above embodiment. The specific splitting method can refer to the method given in the above embodiment.

[0136] In some embodiments, the above-mentioned splitting of the artificial intelligence model includes: receiving the memory size of the first GPU sent by the TEE joint computing system; the first GPU is a GPU in the TEE system in the TEE joint computing system; obtaining the memory size required for the input layer, output layer, and hidden layer of the artificial intelligence model; based on the memory size required for the input layer, output layer, and hidden layer of the artificial intelligence model, and the memory size of the first GPU, splitting the artificial intelligence model.

[0137] This embodiment corresponds to the method of splitting the hidden layer and determining the number of the first hidden layer, the second hidden layer, and the third hidden layer given in the above embodiment. Before splitting the model, the pre-trained model party can first load each layer of the pre-trained model into the memory of the training environment of the pre-trained model party, and then read the memory size occupied by each layer such as the input layer, the hidden layer, and the output layer in the memory. For example, the memory size occupied by different layers can be measured through pympler.asizeof in Python. Assume that the memory size occupied by the input layer is M in , the memory size occupied by the output layer is M out , each hidden layer occupies M memory hi , then calculate the sum of the memory size required for the model head and the model tail M total for:

[0138] M total =Min +M out +ε 1 +n 1 ×(M hi +ΔM hi ) (1)

[0139] Among them, ε 1 ΔM represents the size of the additional memory required for operations such as calculating hidden state values ​​from input sample data for the input layer and output layer during fine-tuning; hi represents the additional memory size required for each hidden layer during fine-tuning; n 1 Represents the sum of the number of hidden layers in the model head and model tail. For example, when n 1 When it is 2, it means that the model head and the model tail each contain a hidden layer, that is, when n in formula 1 1 When M is 2, total Indicates the memory size required when the model head and model tail each contain one hidden layer. Here ε 1 , ΔM hi You can make estimates based on experience.

[0140] When it is necessary Figure 3 When splitting the large language model shown in the figure, you can read the memory size occupied by the tokenizer, embedding layer, each Transformer layer, and prediction layer. Assume that the memory size occupied by the tokenizer is M to , the memory size occupied by the embedding layer is M em , the memory size occupied by the prediction layer is M pr , each Transformer layer occupies M memory tr , then calculate the sum of the memory size required for the model head and the model tail M total for:

[0141] M total =M to +M em +M pr +ε 2 +n 2 ×(M tr +ΔM tr ) (2)

[0142] Among them, ε 2 ΔM represents the size of the additional memory required for operations such as calculating hidden state values ​​from input sample data during fine-tuning for the tokenizer, embedding layer, and prediction layer; tr Indicates the additional memory size required for each layer of the Transformer layer during fine-tuning; n 2Represents the sum of the number of Transformer layers contained in the model head and the model tail. For example, when n 2 When it is 2, it means that the model head and the model tail each contain a Transformer layer, that is, when n in formula 2 2 When M is 2, total Indicates the memory size required when the model head and model tail each contain a Transformer layer. Here ε 2 , ΔM tr You can make estimates based on experience.

[0143] After determining the memory size required for each layer in the current model according to different model types, the total memory size M required for the model head and model tail when including different numbers of hidden layers or Transformer layers can be calculated based on Formula 1 or Formula 2: total , and based on M total , as well as the memory size of the first GPU, select the appropriate splitting method for the artificial intelligence model.

[0144] In some embodiments, the above-mentioned artificial intelligence model is split based on the memory size required for each layer of the input layer, output layer, and hidden layer of the artificial intelligence model, as well as the memory size of the first GPU, including: taking the input layer and the first hidden layer as the model head; taking the second hidden layer as the middle part of the model; taking the third hidden layer and the output layer as the model tail; calculating the first memory size; the first memory size represents the sum of the memory sizes required for the model head and the model tail; when the difference between the memory size of the first GPU minus the first memory size is greater than a preset difference, increasing the number of first hidden layers and / or third hidden layers, and updating the first memory size until the difference between the memory size of the first GPU minus the first memory size is less than a preset difference; wherein the preset difference is greater than 0.

[0145] This embodiment provides a specific method for splitting the model. Figure 2 As an example, when the model structure diagram shown in Figure 2 When splitting the model shown, first calculate n based on formula 1 1 When M is 2 total , M total Compare with the memory size of the first GPU, for example, calculate the memory size of the first GPU minus M total When the difference is greater than the preset difference, it is considered that the first GPU still has remaining computing power.

[0146] If the first GPU has some remaining computing power, add the second hidden layer to the head of the model and / or the N-1th hidden layer to the tail of the model, and calculate n1 When M is 3 or 4 total Continue to calculate the first GPU memory size minus M total If the difference is greater than the preset difference, add a new hidden layer to the model head and / or model tail according to the above steps until the first GPU memory size minus M is calculated. total When the difference is less than the preset difference, the model is split according to the latest number of hidden layers in the model head and the model tail, or the model is split according to the last splitting method of the current splitting mode.

[0147] In this embodiment, the first GPU memory size is calculated by subtracting M total The difference ensures that the memory size required by the model head and the model tail is infinitely close to the first GPU memory size and does not exceed the first GPU memory size. Therefore, the above preset difference is at least greater than 0.

[0148] When it is necessary Figure 3 When the large language model shown in the figure is split, based on the above splitting method, if the M calculated by formula 2 total If the size of the first GPU memory is smaller than that of the first GPU, you can increase the number of Transformer layers in the model head and / or model tail to make M total Close to but not exceeding the first GPU memory size.

[0149] After completing the above calculations, the pre-trained model party can confirm the number of hidden layers or Transformer layers contained in the model head and model tail, respectively, and then upload the model head and model tail to the TEE system 401 of the TEE joint computing system according to the method given in the previous embodiment. The pre-trained model party can also upload an identifier of whether the minimum memory required for the model head and model tail exceeds the memory size of the first GPU. If it does not exceed the memory size of the first GPU, the TEE system 401 loads the model head and model tail into the first GPU for fine-tuning; if it exceeds, the TEE system 401 will fine-tune the model head and model tail through the first volatile storage resource 4012 and the third computing resource.

[0150] Based on the method given in this embodiment, Figure 3 Take the large language model structure shown as an example. Fig.11 A flow chart of a configuration method for confirming the model head and model tail is given, such as Fig.11 As shown, the configuration method of confirming the model header and the model tail includes:

[0151] Step 1101: Start.

[0152] Step 1102: Load the word segmenter, embedding layer, Transformer layer and prediction layer of the pre-trained model into the memory of the pre-trained model.

[0153] Step 1103: Read the memory size occupied by each layer.

[0154] In this step, you can use pympler.asizeof in Python to measure the memory size occupied by different layers.

[0155] Step 1104: Calculate the minimum memory size required for the model head and the model tail.

[0156] In this step, Formula 2 can be used to calculate the minimum memory size required for the model head and model tail. Here, the minimum memory size means that when n 2 When it is 2, that is, when the model head and the model tail each contain a Transformer layer, the size of the memory required for the model head and the model tail.

[0157] Step 1105: Determine whether the minimum memory is greater than or equal to the first GPU memory size.

[0158] When the minimum memory size is greater than or equal to the first GPU memory size, execute step 1107; otherwise, execute step 1106.

[0159] Step 1106: appropriately increase the size of the model head and the model tail.

[0160] When the minimum memory size is smaller than the first GPU memory size, based on the method provided in the above embodiment, the number of Transformer layers in the model head and / or the model tail is appropriately increased or decreased.

[0161] Step 1107: End.

[0162] The method provided in this embodiment can improve the resource utilization of the first GPU, which is conducive to improving the speed of fine-tuning the model. Figure 2 The structure shown can be based on Fig.11 The given method configures the corresponding model head and model tail.

[0163] Based on the model fine-tuning method given in the above embodiment, Fig.12 A model fine-tuning startup flow chart is given, in which the startup process before model fine-tuning includes:

[0164] Step 1201: Start.

[0165] Step 1202: The TEE joint computing system generates key 1 and key 2 in the TEE system.

[0166] The TEE joint computing system can be deployed in Figure 8 The pre-trained model shown can also be deployed in Fig. 9 The other platform parties shown. The key 1 in this step may be the first key in the above embodiment, and the key 2 may be the second key in the above embodiment.

[0167] Step 1203: The pre-trained model party receives key 1 and TEE resource configuration information issued by the TEE joint computing system.

[0168] The TEE joint computing system sends key 1 to the pre-trained model party, and sends TEE resource configuration information to the pre-trained model party, where the TEE resource configuration information can be the first GPU memory size.

[0169] Step 1204: The pre-trained model party encrypts the model header and the model tail.

[0170] Before encryption, the pre-trained model party can also split the model based on the TEE resource configuration information, that is, the first GPU memory size. The pre-trained model party encrypts the model header and model tail obtained after the splitting with key 1.

[0171] Step 1205: The pre-trained model party uploads the model header and model tail separately.

[0172] The pre-trained model party uploads the encrypted model header and model tail to the TEE joint computing system respectively.

[0173] Step 1206: The TEE joint computing system sends key 2 to the industry data party.

[0174] In practical applications, step 1206 and step 1203 may be executed synchronously.

[0175] Step 1207: The industry data provider encrypts the training data set.

[0176] The industry data provider encrypts the training data set it provides based on key 2.

[0177] Step 1208: The industry data provider uploads data.

[0178] The industry data provider uploads the encrypted training data set to the TEE joint computing system.

[0179] Step 1209: The TEE joint computing system decrypts the three parts of data separately in the TEE system.

[0180] The TEE joint computing system decrypts the received encrypted model header, encrypted model tail and encrypted training data set in its TEE system 401 respectively.

[0181] Step 1210: The pre-trained model party uploads the model center.

[0182] In actual applications, step 1210 can also be executed synchronously with step 1205, that is, the pre-trained model party can upload the encrypted model header, the encrypted model tail, and the unencrypted model middle part to the TEE joint computing system at the same time.

[0183] Step 1211: The TEE joint computing system loads the middle part of the model into the common system.

[0184] Step 1212: TEE and the computing system start fine-tuning.

[0185] Step 1213: End.

[0186] The embodiment of the present application provides a method for fine-tuning an artificial intelligence model. Through the fine-tuning method provided in the embodiment of the present application, the data of the industry training party has always been in the TEE system 401, so its content cannot be known to the outside world. Although the data in the middle of the model is in the ordinary system 402, since the model head and tail data are in the TEE system 401, all the model data cannot be inferred from the data in the middle of the model alone. Moreover, after the fine-tuning training is started, since the model head and model tail cannot be known in the TEE system 401, even if the hidden state data or error gradient data flowing through the middle of the model is leaked, it is impossible to reversely infer the original input sample data or the labeling result of the sample data. The embodiment of the present application supports the maximum protection of the data security of both the pre-trained model party and the industry data party when the GPU of the TEE system 401 is insufficient. For the scenario where the pre-trained model party and the industry data party jointly perform model fine-tuning, since the data in the middle of the model originally belongs to the pre-trained model party, even if the middle of the model is deployed in the ordinary system 402, it will not cause leakage. The training data set of the industry data party cannot be detected by the pre-trained model party in the TEE system 401, thus protecting the data security of both parties.

[0187] Compared with the related art, the embodiment of the present application adopts a centralized fine-tuning method of TEE technology, and the pre-trained model and fine-tuning training data are concentrated on one party, which improves the data transmission rate and data security; the embodiment of the present application reduces the demand for a specific GPU that supports the TEE environment during the fine-tuning training process. For the scenario where the pre-trained model party and the industry data party jointly conduct fine-tuning training, the embodiment of the present application can protect the data security of all parties under the premise of reducing the use of GPU resources in the TEE environment. This can greatly promote the actual deployment and application of the TEE solution in the case of GPU resource shortage.

[0188] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0189] Based on the artificial intelligence model fine-tuning method proposed in the above embodiment, the present application embodiment also provides a TEE joint computing system, such as Figure 4 As shown, the system is used to fine-tune the split artificial intelligence model; the split artificial intelligence model includes a model head, a model middle and a model tail; the system includes a TEE system 401 and a normal system 402.

[0190] The TEE system 401 is used to train the model head and the model tail; the TEE system 401 includes a first computing resource and a first volatile storage resource that can support the TEE environment.

[0191] The common system 402 is used to train the middle part of the model; the common system 402 includes a second computing resource and a second volatile storage resource.

[0192] The TEE joint computing system provided in this embodiment can implement the artificial intelligence model fine-tuning method performed by the TEE joint computing system provided in the above embodiment.

[0193] Based on the artificial intelligence model fine-tuning method proposed in the above embodiment, the embodiment of the present application also proposes an artificial intelligence model fine-tuning device, such as Fig.13 As shown, Fig.13 A structural schematic diagram of an artificial intelligence model fine-tuning device is shown, and the artificial intelligence model fine-tuning device is applied to a TEE joint computing system, and the device includes:

[0194] The receiving module 1301 is used to receive the training data set and the split artificial intelligence model; the split artificial intelligence model includes a model head, a model middle and a model tail.

[0195] The loading module 1302 is used to load the model header and the model tail into the TEE system of the TEE joint computing system, and load the middle part of the model into the ordinary system of the TEE joint computing system; wherein the TEE system includes a first computing resource and a first volatile storage resource that can support the TEE environment; the ordinary system includes a second computing resource and a second volatile storage resource.

[0196] The fine-tuning module 1303 is used to fine-tune the artificial intelligence model based on the training data set, the TEE system, and the ordinary system.

[0197] In practical applications, the receiving module 1301 , the loading module 1302 , and the fine-tuning module 1303 may be implemented based on a processor and a communication device.

[0198] In some embodiments, the split artificial intelligence model is sent by the pre-trained model party; the training data set is sent by the industry data party, and the artificial intelligence model fine-tuning device also includes a sending module, which is used to send a first key to the pre-trained model party and a second key to the industry data party. The receiving module 1301 is specifically used to receive the training data set encrypted based on the second key uploaded by the industry data party, and receive the split artificial intelligence model sent by the pre-trained model party; wherein the split artificial intelligence model includes a model middle part, a model head encrypted based on the first key, and a model tail encrypted based on the first key. The fine-tuning module 1303 is also used to decrypt the model head encrypted by the first key, the model tail encrypted by the first key, and the training data set encrypted by the second key through the TEE system.

[0199] In some embodiments, the model head includes at least the input layer and the first hidden layer of the artificial intelligence model; the model middle includes at least the second hidden layer of the artificial intelligence model; the model tail includes at least the output layer and the third hidden layer of the artificial intelligence model; the first hidden layer includes at least the first hidden layer of the artificial intelligence model; the third hidden layer includes at least the last hidden layer of the artificial intelligence model; the second hidden layer includes other hidden layers except the first hidden layer and the third hidden layer. The fine-tuning module 1303 is specifically used to input the sample data in the training data set into the model head for calculation through the TEE system to obtain the first hidden state value output by the first hidden layer; send the first hidden state value to the ordinary system; input the first hidden state value into the middle of the model through the ordinary system to calculate to obtain the second hidden state value output by the second hidden layer; send the second hidden state value to the TEE system 401; input the second hidden state value into the model tail through the TEE system 401 to calculate to obtain the prediction result; compare the annotation result in the training data set with the prediction result to obtain the comparison result; the comparison result indicates the difference between the annotation result and the prediction result; fine-tune the artificial intelligence model based on the comparison result.

[0200] In some embodiments, the fine-tuning module 1303 is specifically used to send the comparison result to the output layer at the tail of the model, and calculate the error gradient of each layer in the tail of the model in sequence from the output layer to the third hidden layer; update the model parameters of the tail of the model based on the error gradient of each layer in the tail of the model; send the error gradient of the first layer in the third hidden layer to the last layer of the second hidden layer of the ordinary system; through the ordinary system, calculate the error gradient of each layer in the middle of the model in sequence from the last layer of the second hidden layer to the first layer of the second hidden layer; update the model parameters of the middle of the model based on the error gradient of each layer in the middle of the model; send the error gradient of the first layer in the second hidden layer to the last layer of the first hidden layer in the TEE system; through the TEE system, calculate the error gradient of each layer in the head of the model in sequence from the last layer of the first hidden layer to the input layer; update the model parameters of the model head based on the error gradient of each layer in the model head.

[0201] In some embodiments, the first computing resource includes a first GPU that can support a TEE environment; the sending module is also used to send the memory size of the first GPU to the pre-trained model party; the memory size of the first GPU is used to enable the pre-trained model party to determine the number of first hidden layers, second hidden layers, and third hidden layers.

[0202] In some embodiments, the fine-tuning module 1303 is specifically used to fine-tune the model head and the model tail based on the first volatile storage resource and the third computing resource when the sum of the GPU memory sizes required for the model head and the model tail is greater than the memory size of the first GPU; the third computing resource is the computing resource in the first computing resource excluding the first GPU; when the sum of the GPU memory sizes required for the model head and the model tail is less than or equal to the memory size of the first GPU, fine-tune the model head and the model tail based on the first GPU.

[0203] Based on the artificial intelligence model fine-tuning method proposed in the above embodiment, the embodiment of the present application also proposes another artificial intelligence model fine-tuning device, such as Fig.14 As shown, Fig.14 A schematic diagram of the structure of another artificial intelligence model fine-tuning device is shown, which is applied to a pre-training model, and the device includes:

[0204] The splitting module 1401 is used to split the artificial intelligence model into a model head, a model middle and a model tail.

[0205] The sending module 1402 is used to send the split artificial intelligence model to the TEE joint computing system, so that the TEE joint computing system can fine-tune the artificial intelligence model according to the artificial intelligence model fine-tuning method executed by the TEE joint computing system given in the above embodiment.

[0206] In practical applications, the splitting module 1401 and the sending module 1402 can be implemented based on a processor and a communication device.

[0207] In some embodiments, the model head includes at least the input layer and the first hidden layer of the artificial intelligence model; the model middle includes at least the second hidden layer of the artificial intelligence model; the model tail includes at least the output layer and the third hidden layer of the artificial intelligence model; the first hidden layer includes at least the first hidden layer of the artificial intelligence model; the third hidden layer includes at least the last hidden layer of the artificial intelligence model; the second hidden layer is the other hidden layers except the first hidden layer and the third hidden layer. Splitting module 1401 is specifically used to receive the memory size of the first GPU sent by the TEE joint computing system; the first GPU is the GPU in the TEE system in the TEE joint computing system; obtain the memory size required for the input layer, output layer, and each hidden layer of the artificial intelligence model; split the artificial intelligence model based on the memory size required for the input layer, output layer, and each hidden layer of the artificial intelligence model, and the memory size of the first GPU.

[0208] In some embodiments, the splitting module 1401 is specifically used to use the input layer and the first hidden layer as the model head; the second hidden layer as the middle part of the model; the third hidden layer and the output layer as the model tail; calculate the first memory size; the first memory size represents the sum of the memory sizes required for the model head and the model tail; when the difference between the memory size of the first GPU and the first memory size is greater than a preset difference, increase the number of layers of the first hidden layer and / or the third hidden layer, and update the first memory size until the difference between the memory size of the first GPU and the first memory size is less than a preset difference; wherein the preset difference is greater than 0.

[0209] It should be noted that the description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the same method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.

[0210] It should be noted that in the embodiments of the present application, if the above method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium, including a number of instructions to enable a computer device (which can be a terminal, a server, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0211] An embodiment of the present application further provides a computer storage medium, on which computer executable instructions are stored, and the computer executable instructions are used to implement any one of the artificial intelligence model fine-tuning methods provided in the above embodiments.

[0212] Correspondingly, an embodiment of the present application further provides a computer program product, which includes computer executable instructions, and the computer executable instructions are used to implement any one of the artificial intelligence model fine-tuning methods provided in the above embodiments.

[0213] In some embodiments, the functions or modules included in the device provided in the embodiments of the present application can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.

[0214] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

[0215] The methods disclosed in the various method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0216] The features disclosed in the various product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0217] The features disclosed in the various method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0218] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0219] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A method for fine-tuning an artificial intelligence model, characterized in that: Applied to a trusted execution environment (TEE) joint computing system, the method includes: Receiving a training data set and a split artificial intelligence model; the split artificial intelligence model includes a model head, a model middle, and a model tail; Loading the model header and the model tail into the TEE system of the TEE joint computing system, and loading the model middle into the common system of the TEE joint computing system; wherein the TEE system includes a first computing resource and a first volatile storage resource capable of supporting the TEE environment; and the common system includes a second computing resource and a second volatile storage resource; The artificial intelligence model is fine-tuned based on the training data set, the TEE system, and the ordinary system.

2. The method according to claim 1, characterized in that The split artificial intelligence model is sent by the pre-trained model party; the training data set is sent by the industry data party; before receiving the training data set and the split artificial intelligence model, the method further includes: Sending a first key to the pre-trained model party, and sending a second key to the industry data party; The receiving training data set and the split artificial intelligence model include: Receive the training data set encrypted by the second key uploaded by the industry data party, and receive the split artificial intelligence model sent by the pre-trained model party; wherein the split artificial intelligence model includes a model middle part, a model head encrypted by the first key, and a model tail encrypted by the first key; After the model header and the model tail are loaded into the TEE system of the TEE joint computing system, the method further includes: The TEE system decrypts the model header encrypted by the first key, the model tail encrypted by the first key, and the training data set encrypted by the second key.

3. The method according to claim 1, characterized in that The model head includes at least the input layer and the first hidden layer of the artificial intelligence model; the middle part of the model includes at least the second hidden layer of the artificial intelligence model; the model tail includes at least the output layer and the third hidden layer of the artificial intelligence model; the first hidden layer includes at least the first layer of the hidden layer of the artificial intelligence model; the third hidden layer includes at least the last layer of the hidden layer of the artificial intelligence model; the second hidden layer includes other hidden layers except the first hidden layer and the third hidden layer.

4. The method according to claim 3, characterized in that The fine-tuning of the artificial intelligence model based on the training data set, the TEE system, and the common system includes: Through the TEE system, the sample data in the training data set is input into the model head for calculation to obtain the first hidden state value output by the first hidden layer; sending the first hidden state value to the common system; By means of the common system, the first hidden state value is input into the middle part of the model for calculation to obtain a second hidden state value output by the second hidden layer; Sending the second hidden state value to the TEE system; Through the TEE system, the second hidden state value is input into the tail of the model for calculation to obtain a prediction result; Comparing the annotation results in the training data set with the prediction results to obtain a comparison result; the comparison result indicates the difference between the annotation results and the prediction results; The artificial intelligence model is fine-tuned based on the comparison results.

5. The method according to claim 4, characterized in that The fine-tuning of the artificial intelligence model based on the comparison result includes: Sending the comparison result to the output layer of the model tail, and sequentially calculating the error gradient of each layer in the model tail in the order from the output layer to the third hidden layer; Update the model parameters of the model tail based on the error gradient of each layer in the model tail; Sending the error gradient of the first layer in the third hidden layer to the last layer of the second hidden layer of the conventional system; By means of the common system, the error gradient of each layer in the middle part of the model is calculated in sequence from the last layer of the second hidden layer to the first layer of the second hidden layer; Updating model parameters in the middle portion of the model based on the error gradient of each layer in the middle portion of the model; Sending the error gradient of the first layer in the second hidden layer to the last layer of the first hidden layer in the TEE system; By means of the TEE system, the error gradient of each layer in the model head is calculated in sequence from the last layer of the first hidden layer to the input layer; Model parameters of the model head are updated based on the error gradient of each layer in the model head.

6. The method according to claim 3, characterized in that The first computing resource includes a first graphics processor GPU capable of supporting a TEE environment; Before receiving the split artificial intelligence model, the method further includes: Sending the memory size of the first GPU to the pre-trained model party; The memory size of the first GPU is used to enable the pre-trained model to determine the number of layers of the first hidden layer, the second hidden layer, and the third hidden layer.

7. The method according to claim 6, characterized in that The fine-tuning of the artificial intelligence model based on the training data set, the TEE system, and the common system includes: When the sum of the memory sizes of the GPU required for the model head and the model tail is greater than the memory size of the first GPU, fine-tuning the model head and the model tail based on the first volatile storage resource and the third computing resource; the third computing resource is a computing resource in the first computing resource excluding the first GPU; When the sum of the memory sizes of the GPU required by the model head and the model tail is less than or equal to the memory size of the first GPU, the model head and the model tail are fine-tuned based on the first GPU.

8. The method according to claim 1, characterized in that: The TEE joint computing system is deployed together with the artificial intelligence model before the split, or the TEE joint computing system is deployed separately from the artificial intelligence model before the split.

9. A method for fine-tuning an artificial intelligence model, characterized in that: Applied to the pre-training model, the method includes: Split the artificial intelligence model into the model head, model middle and model tail; Send the split artificial intelligence model to the TEE joint computing system, so that the TEE joint computing system fine-tunes the artificial intelligence model according to the method described in any one of claims 1 to 8.

10. The method according to claim 9, characterized in that The model head includes at least the input layer and the first hidden layer of the artificial intelligence model; the middle part of the model includes at least the second hidden layer of the artificial intelligence model; the model tail includes at least the output layer and the third hidden layer of the artificial intelligence model; the first hidden layer includes at least the first layer of the hidden layer of the artificial intelligence model; the third hidden layer includes at least the last layer of the hidden layer of the artificial intelligence model; the second hidden layer is the other hidden layers excluding the first hidden layer and the third hidden layer.

11. The method according to claim 10, characterized in that The splitting of the artificial intelligence model includes: Receive the memory size of a first GPU sent by the TEE joint computing system; the first GPU is a GPU in a TEE system in the TEE joint computing system; Obtain the memory size required for each of the input layer, output layer, and hidden layer of the artificial intelligence model; The artificial intelligence model is split based on the memory size required for each of the input layer, output layer, and hidden layer of the artificial intelligence model, and the memory size of the first GPU.

12. The method according to claim 11, characterized in that The splitting of the artificial intelligence model based on the memory size occupied by each layer of the input layer, the output layer, and the hidden layer of the artificial intelligence model and the memory size of the first GPU includes: The input layer and the first hidden layer are used as the head of the model; the second hidden layer is used as the middle of the model; the third hidden layer and the output layer are used as the tail of the model; Calculate a first memory size; the first memory size represents the sum of the memory sizes required to be occupied by the head of the model and the tail of the model; When the difference between the memory size of the first GPU and the first memory size is greater than a preset difference, increase the number of the first hidden layer and / or the third hidden layer, and update the first memory size until the difference between the memory size of the first GPU and the first memory size is less than the preset difference; wherein the preset difference is greater than 0.

13. A TEE joint computing system, characterized in that: The system is used to fine-tune the split artificial intelligence model; the split artificial intelligence model includes a model head, a model middle and a model tail; the system includes a TEE system and a common system; wherein, The TEE system is used to train the model head and the model tail; the TEE system includes a first computing resource and a first volatile storage resource capable of supporting a TEE environment; The common system is used to train the middle part of the model; the common system includes a second computing resource and a second volatile storage resource.

14. An artificial intelligence model fine-tuning device, characterized in that: Applied to a TEE joint computing system, the device comprises: A receiving module, used to receive a training data set and a split artificial intelligence model; the split artificial intelligence model includes a model head, a model middle and a model tail; A loading module, used to load the model header and the model tail into the TEE system of the TEE joint computing system, and load the model middle into the common system of the TEE joint computing system; wherein the TEE system includes a first computing resource and a first volatile storage resource capable of supporting the TEE environment; and the common system includes a second computing resource and a second volatile storage resource; A fine-tuning module is used to fine-tune the artificial intelligence model based on the training data set, the TEE system, and the ordinary system.

15. An artificial intelligence model fine-tuning device, characterized in that: Applied to the pre-training model, the device comprises: A splitting module is used to split the artificial intelligence model into a model head, a model middle, and a model tail; A sending module is used to send the split artificial intelligence model to the TEE joint computing system, so that the TEE joint computing system can fine-tune the artificial intelligence model according to the method described in any one of claims 1 to 8.

16. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method described in any one of claims 1 to 8 or any one of claims 9 to 12 is implemented.

17. 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 method according to any one of claims 1 to 8 or any one of claims 9 to 12.