Inception module-based prompt fine tuning method

By inserting the prompt generator of the Inception module into the back of the pre-trained model and using a multi-scale bottleneck network for prompt fine-tuning, the problems of high resource consumption and limited representation capabilities in the existing technology are solved, and efficient training and generalization are achieved. promote.

CN118780341AInactive Publication Date: 2024-10-15CHENGDU UNIV OF INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410891816.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-04
Publication Date
2024-10-15
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing cue fine-tuning methods have problems such as high resource consumption, long training time, limited model representation capabilities, and catastrophic forgetting when adapting to downstream tasks. In particular, full fine-tuning and single cue generation strategies cannot fully capture task complexity and semantic features. resulting in limited performance.

Method used

Using the prompt fine-tuning method based on the Inception module, the prompt generator module is inserted into the middle and rear of the pre-trained model, information is processed through three bottleneck networks of different sizes, and only the parameters of the prompt generator module are updated to shorten the back propagation distance and reduce Computing resources and memory usage improve the model’s ability to capture task-specific information.

Benefits of technology

It significantly reduces computing resource consumption and training time, improves the model's ability to capture task-specific information and generalization, avoids the problem of catastrophic forgetting, and ensures the model's rapid adaptation and accurate learning on new tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118780341A_ABST
    Figure CN118780341A_ABST
Patent Text Reader

Abstract

The invention relates to an Inception module-based prompt fine tuning method, which comprises the following steps of: inserting a prompt network for downstream tasks into a pre-training model, the network comprising continuous prompts for randomly selecting a pre-training model vocabulary to initialize and a plurality of bottleneck networks which are connected with the continuous prompts, are gradually increased in size and are provided with upper and lower projections; the shape of the single continuous prompt vector is similar to that of an Inception module, and the effect of efficiently expanding the depth and width of the single continuous prompt vector is achieved. When the pre-training model is finely adjusted for the downstream task, the trunk model is frozen, so that only the prompt network can perform parameter updating, as the prompt network is placed at the middle rear part of the pre-training model, the loss of task related information with a short distance in the back propagation process is less, and meanwhile, the training time and the memory occupation are optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing, and in particular to a prompt fine-tuning method based on an Inception module. Background Art

[0002] With the popularity of large data sets and powerful computing resources, deep learning models have developed rapidly, resulting in pre-trained models with huge parameter sizes across multiple fields. However, the expansion rate of model size is nearly two orders of magnitude faster than computing resources, and the continued increase in the size of these pre-trained models has brought about a significant increase in training and deployment costs. Therefore, efficient training of large pre-trained models becomes particularly important, among which prompt fine-tuning is a simple and parameter-efficient method. Prompt fine-tuning is one of the additional efficient fine-tuning methods. The purpose is to freeze most of the backbone parameters of the pre-trained model during training, and only train and update the parameters of the newly added prompt matrix. In actual application scenarios, there is great application prospect in making pre-trained models more efficient to adapt to various downstream tasks.

[0003] One of the typical methods to adapt a pre-trained language model to downstream tasks is full parameter fine-tuning, which is to fine-tune all parameters of the pre-trained model. Efficient parameter fine-tuning methods are proposed to reduce the workload of adapting the pre-trained basic model to downstream tasks. These techniques can be divided into four types in terms of parameter selection: additional fine-tuning, selection-based fine-tuning, re-parameterization-based fine-tuning, and hybrid fine-tuning. Additional fine-tuning introduces additional trainable parameters into the original model, such as inserting a small-scale neural network module into the model and only fine-tuning this small part of the parameters; selective fine-tuning specifies that certain specific parameters in the original model become trainable, while other parameters are frozen. This method does not introduce any new parameters into the model, nor does it change the structure of the model, but directly specifies some parameters to be optimized; re-parameterization fine-tuning is to re-parameterize the parameter fine-tuning process of the pre-trained model into an optimization process of a low-dimensional subspace, and satisfactory performance can be achieved by only fine-tuning the parameters in the subspace; the method of mixing the above different types of fine-tuning methods to further improve the performance of fine-tuning in downstream tasks is called hybrid fine-tuning.

[0004] There are three types of additional fine-tuning methods that are optimized for prompt fine-tuning methods. The first is adapter tuning, which reduces training costs by introducing adapter modules to specific layers (or all layers) of a pre-trained base model. During the fine-tuning process, the backbone of the pre-trained model remains frozen, and the adapter modules are used to acquire task-specific knowledge. The second is prompt tuning, which designs task-specific prompts for each task, with the aim of replacing traditional fine-tuning of parameters of a pre-trained large base model. By adjusting the input prompts, this method significantly reduces the resources and time required for fine-tuning. The third is prefix tuning, which introduces a trainable, task-specific prefix part to each layer of a large base model. This technique aims to reduce the cost of tuning by limiting the update of parameters in this prefix.

[0005] Full fine-tuning is the further training of a neural network model that has been pre-trained on a large-scale dataset. This process improves the performance of the model on a specific downstream task by adjusting all trainable parameters of the model. Full fine-tuning is usually performed after the pre-training phase of the model. The purpose is to use the general knowledge obtained in the pre-training phase and further optimize the representation ability of the model through task-specific data. Full fine-tuning requires retraining all parameters of the model, which is the same number of parameters involved in the pre-training phase. Due to the large number of parameters, this process usually consumes a lot of computing resources and time, resulting in a significant increase in training costs. In addition, full fine-tuning may also require a large amount of data and storage space to support complex model architectures and training processes. During the full fine-tuning process, the model may suffer from catastrophic forgetting problems.

[0006] Prompt Tuning uses carefully designed prompt words, namely prompts, to guide the model's attention so that it can generate or recognize relevant information for a specific task. Prompt Tuning introduces only a small number of trainable parameters, which are usually associated with the input layer of the model to adjust or adapt the model's representation space to better suit specific task requirements. Although Prompt Tuning adapts to specific tasks by introducing a small number of trainable parameters, this approach may not fully capture all the complexities of the task. Since Prompt Tuning mainly relies on the representation power of the pre-trained model and only fine-tunes the input layer, this may lead to limited representation capabilities of the model on new tasks, thereby affecting its final performance accuracy. At the same time, its convergence speed is slower than other parameter-efficient fine-tuning methods.

[0007] Late Prompt Tuning (LPT) takes a unique approach by inserting late prompts into the middle layers of the base model, rather than the input layer or all layers, to shorten the back-propagation distance. LPT methods typically rely on a single prompt generation strategy, which may result in limited adaptability and generalization of prompts when faced with diverse downstream tasks. A single prompt generation approach may not be able to fully capture the information requirements and semantic features unique to different tasks, thus affecting the performance of the model on specific tasks. In addition, a lack of in-depth understanding of task characteristics and customized considerations in the prompt design process may further limit the expressiveness and flexibility of the model.

[0008] Residual Prompt Tuning (RPT) is an example of using residual reparameterization to stabilize the prompt tuning process. It uses a randomly initialized autoencoder and connects a residual link. Although RPT aims to improve the learning efficiency of the model through residual connections, it does not effectively shorten the backpropagation path. This means that during training, the gradient signal may still be difficult to effectively backpropagate to the deep layers of the network, thereby affecting the learning dynamics and convergence performance of the model. At the same time, RPT may sacrifice the accuracy of the model to a certain extent. Compared with the tuning method of this scheme, RPT has a relatively high total number of parameters due to the introduction of an additional bottleneck network with a fixed size. Under resource-constrained conditions, the increased number of parameters may become a limiting factor in practical applications. Summary of the invention

[0009] In view of the shortcomings of the existing technology, a prompt fine-tuning method based on the Inception module is proposed. The prompt fine-tuning method inserts a prompt generator module for downstream tasks into the pre-trained model. When fine-tuning the pre-trained model for downstream tasks, the backbone model is frozen so that only the prompt generator module can update parameters. The prompt generator module has three bottleneck networks with different bottleneck sizes connected in the Inception-Resnet manner to realize information processing at multiple scales. Because the prompt generator module is placed in the middle and rear part of the pre-trained model, the task-related information loss is small due to the short distance during the back propagation process, and the training time and memory usage are reduced. Specifically, it includes:

[0010] Step 1: Collect a dataset. The dataset is a public dataset or a dataset constructed by collecting short text data for a specific task.

[0011] Step 2: If you choose a public dataset, skip step 2. If you use self-collected data, execute step 2 and have the annotators annotate it to obtain an annotated dataset.

[0012] Step 3: Add masked prompt templates to all original sentences in the dataset obtained in step 1 or 2, and then combine the masked prompt templates with the original sentences as the input data of the basic pre-training model RoBERTa input ;

[0013] Step 4: For different specific tasks, construct the corresponding spatial answer map V and use the spatial answer map V to map the true label y true Replace the answers to the training and test samples of downstream tasks to transform the classification task into a task of predicting word probabilities;

[0014] Step 5: Preset the parameters of the basic pre-training model. The basic pre-training model takes RoBERTa as an example, but is not limited to RoBERTa. Initialize the RoBERTa model. The RoBERTa model parameters at least include the learning rate, random inactivation, number of training rounds, and prompt insertion layer.

[0015] Step 6: First, freeze the backbone of the pre-trained model, that is, cancel the gradient of the backbone parameters, customize a prompt generator module and make it trainable, that is, open the gradient of the prompt generator module, allow it to perform gradient updates in the back-propagation phase, and restrict the input and output dimensions of the prompt generator module, specifically set to the hidden layer dimensions of the pre-trained model;

[0016] Step 7: RoBERTa the input data obtained in step 3 input , the position information Pos is sent to the word embedding layer to obtain the word embedding vector h in ;

[0017] Step 8: Embed the word vector h obtained in step 7 in Send it to the pre-trained basic model initialized in step 5. Take the RoBERTa model as an example. The RoBERTa model is an encoder model with 24 layers. The word embedding vector h in Input each layer in turn and determine whether the layer is a hint adding layer. If it is a hint adding layer, the hint generator module generates hints. Then, based on the hidden vector h output by the previous layer, the generated hints are merged to obtain a new hidden vector h new , the new hidden vector h new Replace the original hidden vector h and continue to input the encoder model of the remaining layers to obtain the last hidden vector h end ;

[0018] Step 9: The last hidden vector h obtained in step 8 end And the position of the mask in the masked hint template in step 3 is used to calculate the masked hidden vector h mask , combining the two to get the final hidden vector h out;

[0019] Step 10: The final hidden vector h out Send it to the RoBERTa model head to get the final prediction result y pre ;

[0020] Step 11: Calculate the predicted result y through cross entropy loss pre and the true label y in step 4 true The difference is passed back to the entire pre-trained model with the prompt generator module through back propagation, and the weights and biases of the prompt generator module are updated;

[0021] Step 12: Continuously iterate step 6 to step 11, stop training when the cross entropy loss value converges or reaches the specified round, and save the trained prompt generator module;

[0022] Step 13: The trained prompt generator module is an additional module of the current pre-trained model under the training data set subtask. When the pre-trained model is used for this task in the future, you only need to load the trained prompt generator module into the pre-trained model.

[0023] According to a preferred embodiment, the prompt generator module includes three bottleneck networks with different bottleneck sizes, the bottleneck network includes an upper projection module, a rectified linear unit activation module, and a lower projection module, wherein:

[0024] The up-projection module is used to perform linear transformation of the hidden vector in high-dimensional space;

[0025] The rectified linear unit activation module is used to update the activation of the transformed vector in high-dimensional space;

[0026] The down-projection module is used to map the activated updated vector from the high-dimensional space back to the original dimensional space.

[0027] Compared with the prior art, the present invention has the following beneficial effects:

[0028] 1. The present invention adopts the strategy of freezing the backbone model when fine-tuning the pre-trained model, only allowing the prompt network to update parameters, thereby achieving the technical effect of significantly reducing computing resource consumption and training time, while reducing memory usage and improving the efficiency of the training process.

[0029] 2. The present invention innovatively combines continuous prompts with the bottleneck network of the Inception block shape to achieve efficient expansion of the depth and width of the input prompt vector. This structural design not only enhances the model's ability to capture task-specific information, but also improves the model's expressiveness and generalization when processing complex tasks.

[0030] 3. The present invention optimizes the back propagation path by placing the prompt generator module in the middle and rear parts of the pre-trained model, effectively reduces the loss of task-related information, avoids the catastrophic forgetting problem that may occur in full fine-tuning, and ensures the model's rapid adaptation and accurate learning of new tasks during the fine-tuning process. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 is a processing flow chart of the fine-tuning method of the present invention;

[0032] Figure 2 It is a network structure diagram of the prompt generator module of the present invention. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. In addition, in the following description, the description of well-known structures and technologies is omitted to avoid unnecessary confusion of the concept of the present invention.

[0034] The following is a detailed description with reference to the accompanying drawings.

[0035] The Inception module of the present invention refers to: the Inception module is a special network structural unit in deep learning, which first appeared in Google's Inception network (also known as GoogLeNet). The design goal of the Inception block is to improve the expressiveness of the convolutional neural network (CNN) while maintaining computational efficiency. The core idea of ​​the Inception block is to apply convolution kernels of different scales in parallel, and then splice the outputs of these convolution layers in the channel dimension, so that the network can learn features of different scales at the same time. In the present invention, bottleneck networks of different sizes are used instead of convolution kernels of different scales to achieve the effect of efficiently expanding the depth and width of a single continuous prompt vector.

[0036] The token of the present invention refers to: In the field of natural language processing (NLP), a token generally refers to a basic processing unit in a text.

[0037] The present invention optimizes the prompt fine-tuning in efficient parameter fine-tuning. In the original prompt fine-tuning, because it is placed at the input end of the model, the distance of back propagation is far, and more task-related information is lost during the propagation process. At the same time, the prompt generation method is relatively simple, which makes its convergence speed and performance relatively low. The present invention shortens the back propagation distance by inserting the prompt into the back layer of the model, and further innovatively proposes a connection method of Inception-like blocks to connect bottleneck networks of different sizes to process information at different scales. On the basis of efficient parameters, it improves the accuracy of subtasks while accelerating the training speed and reducing video memory usage.

[0038] Figure 1 The following is a detailed description of the technical solution of the present invention in conjunction with the accompanying drawings.

[0039] Step 1: Collect the dataset. The dataset can be a public dataset, such as the GLUE dataset and the SuperGLUE dataset, or a dataset constructed by collecting short text data for a specific task. The self-constructed dataset is constructed by using crawler technology to collect sentences in the field to be studied.

[0040] Step 2: If you choose a public dataset, skip step 2. If you use self-collected data, execute step 2 and have the labelers label it to obtain a labeled dataset.

[0041] Annotators need to mark the corresponding labels according to the actual tasks. Taking the task of classifying two-sentence relations as an example, the labels include implication and non-implication.

[0042] Step 3: Add masked prompt templates to all original sentences in the dataset obtained in step 1 or 2, and then combine the masked prompt templates with the original sentences as the input data of the basic pre-training model RoBERTa inpt .

[0043] The original sentence s in the dataset is [w1,…,w i ,…,w n ] consists of n words, as shown below. The classification word to be predicted is [mask], which is inserted between the two sentences of the two-sentence relationship classification task to form a hard prompt. The input of the model is a sentence starting with [CLS] and separated by [SEP], which is expressed as follows:

[0044] prompt:{S1}? [mask],{S2}. (1)

[0045] RoBERTa input =[CLS]+prompt+[SEP] (2)

[0046] Among them, prompt refers to the prompt template, S1 refers to sentence one in the dataset, and S2 refers to sentence two in the dataset.

[0047] Step 4: For different specific tasks, construct the corresponding spatial answer map V and use the spatial answer map V to map the true label y true Replace the answers to the training samples and test samples of the downstream tasks to transform the classification task into a task of predicting word probabilities.

[0048] Step 5: Preset the parameters of the basic pre-training model. The basic pre-training model of the present invention takes RoBERTa as an example, but the method is not limited to RoBERTa. Initialize the RoBERTa model. The RoBERTa model parameters include at least the learning rate, random inactivation, the number of training rounds, and the prompt insertion layer.

[0049] In the technical solution of the present invention, preferably, the learning rate is 1*10 -3 , random dropout 0.1, number of training rounds 10, number of layers inserted 16.

[0050] Step 6: First, freeze the backbone of the pre-trained model, that is, cancel the gradient of the backbone parameters, customize a prompt generator module and make it trainable, that is, open the gradient of the prompt generator module, allow it to perform gradient updates in the back-propagation phase, and restrict the input and output dimensions of the prompt generator module, specifically set to the hidden layer dimensions of the pre-trained model;

[0051] The basic principle followed by the bottleneck dimensions from front to back is that the dimensions at both ends are large and the dimensions in the middle are small. In the present invention, preferably, they are set to 64, 128, and 512 respectively.

[0052] Step 7: RoBERTa the input data obtained in step 3 input , the position information Pos obtained from the position encoding module of the pre-trained model is sent to the word embedding layer to obtain the word embedding vector h in , the mathematical expression is as follows:

[0053] h in =Embedding(RoBERTa input ,Pos) (3)

[0054] Step 8: Embed the word vector h obtained in step 7 in Send it to the pre-trained basic model initialized in step 5. Take the RoBERTa model as an example. The RoBERTa model is an encoder model with 24 layers. The word embedding vector h inInput each layer in turn and determine whether the layer is a hint adding layer. The hint adding layer of the present invention is set at the 16th layer. If it is a hint adding layer, the hint generator module generates hints. Then, based on the hidden vector h output by the previous layer, the generated hints are merged to obtain a new hidden vector h new , the new hidden vector h new Replace the original hidden vector h and continue to input the encoder model of the remaining layers to obtain the last hidden vector h end , the mathematical expression is as follows:

[0055] h=RoBERTa 1-16 (h in ) (4)

[0056] Prompt Generator=φ1(p)+φ2(p)+φ3(p)+p (5)

[0057] h new =h+Prompt Generator(p) (6)

[0058] h end =RoBERTa 17-24 (h new ) (7)

[0059] Among them, φ1 represents a small-sized bottleneck network, φ2 represents a medium-sized bottleneck network, and φ3 represents a large-sized bottleneck network.

[0060] Step 9: The last hidden vector h obtained in step 8 end And the position of [MASK] in the masked prompt template in step 3 is used to calculate the masked hidden vector h mask , combining the two to get the final hidden vector h out , the mathematical expression is as follows:

[0061] h out =[h end +h mask ] (8)

[0062] Step 10: The final hidden vector h out Send it to the RoBERTa model head to get the final prediction result y pre , the mathematical expression is as follows:

[0063] y pre =softmac(Wh out +b) (9)

[0064] Step 11: Calculate the predicted result y through cross entropy loss pre and the true label y in step 4 trueThe difference is passed back to the entire pre-trained model with the prompt generator module through back propagation, and the weights and biases of the prompt generator module are updated;

[0065] Step 12: Continuously iterate step 6 to step 11, stop training when the cross entropy loss value converges or reaches the specified round, and save the trained prompt generator module;

[0066] Step 13: The trained prompt generator module is an additional module of the current pre-trained model under the training data set subtask. When the pre-trained model is used for this task in the future, you only need to load the trained prompt generator module into the pre-trained model.

[0067] like Figure 2 As shown in the figure, it is a schematic diagram of the structure of the prompt generator module proposed in the present invention, which is used to optimize prompt fine-tuning. The present invention calls it Late Inception Prompt Tuning (LIPT). Specifically, LIPT projects the prompt embedding sequence p composed of n tokens into the re-parameterized sequence P′. The mathematical expression is as follows:

[0068] P′=[P′1,…,P′ n ]=[Φ(P1),…,Φ(P n )] (10)

[0069] Where Φ(·) is a reparameterized network with an Inception residual structure, and Φ(·) is applied independently to the token corresponding to each prompt word:

[0070] Φ(P i )=φ1(P i )+φ2(P i )+φ3(P i )+P i , i∈{1…n} (11)

[0071] Among them, Φ j (·), j∈{1,2,3} network is a bottleneck network composed of two multi-layer perceptrons, and then three bottleneck networks with different bottleneck sizes are connected in the Inception-Resnet way to form a prompt generator module, specifically including: a small-size bottleneck network, a medium-size bottleneck network, and a large-size bottleneck network. During the training process, a fixed-length continuous prompt randomly selected from the vocabulary of the pre-trained model passes through the prompt generator module. Specifically, each bottleneck network of different sizes includes an upper projection module, a lower projection module, and a rectified linear unit activation module ReLU.

[0072] The training goal is to maximize the log-likelihood of the correct output y given the input text x concatenated with the reparameterized soft prompt p:

[0073]

[0074] The organization of Inception residual blocks plays a key role in improving performance and accelerating convergence in LIPT. Inception residual combines the advantages of Inception module and residual module, and further improves the performance and training depth of the network by introducing residual connections in Inception module. Specifically, Inception residual adds cross-layer residual connections on the basis of Inception module. These connections can skip an Inception module and directly pass the input to the next layer. It is assumed that feedforward neural network modules with different bottleneck sizes can enable the model to carry information of different levels after random initialization more flexibly.

[0075] One of the main advantages of the architecture of the present invention is that feedforward neural network modules with large bottleneck dimensions (such as 800 in RPT) tend to increase significantly in the number of parameters, while the present invention decomposes a large bottleneck network into multiple small networks without causing an uncontrolled surge in computational complexity.

[0076] Another practically useful aspect of this design is that it fits the intuition that information should be processed at different scales and then aggregated so that the next stage can abstract features from different scales simultaneously.

[0077] The current version of the Inception residual architecture is limited to bottleneck sizes of 64, 128, and 256, but this decision was based more on convenience than necessity. This also means that the proposed architecture is a combination of all these layers, with the output of the feed-forward neural network module group connected into a single output vector that forms the input to the next stage. The main idea of ​​the Inception architecture is based on finding out how to approximate and cover the best local sparse structures in the network with easily available dense components. This structure not only helps alleviate the gradient vanishing problem, allowing the network to effectively train deeper models, but also enhances the network's feature representation capabilities, as the residual connections make it easier for the network to learn useful feature representations.

[0078] It should be noted that the above specific embodiments are exemplary, and those skilled in the art can come up with various solutions inspired by the disclosure of the present invention, and these solutions also belong to the disclosure scope of the present invention and fall within the protection scope of the present invention. Those skilled in the art should understand that the present invention description and its drawings are illustrative and do not constitute a limitation of the claims. The protection scope of the present invention is defined by the claims and their equivalents.

Claims

1. A prompt fine-tuning method based on the Inception module, characterized in that: The prompt fine-tuning method inserts a prompt generator module for downstream tasks into the pre-trained model. When fine-tuning the pre-trained model for the downstream task, the backbone model is frozen so that only the prompt generator module can perform parameter updates. The prompt generator module has three bottleneck networks with different bottleneck sizes connected in the Inception-Resnet manner to achieve multi-scale information processing. Since the prompt generator module is placed in the middle and rear parts of the pre-trained model, the task-related information loss is small during the back propagation process with a short distance, and the training time and memory usage are reduced. Specifically, the method includes: Step 1: Collect a dataset, which is a public dataset or a dataset constructed by collecting short text data for a specific task; Step 2: If you choose a public dataset, skip step 2. If you use self-collected data, execute step 2 and have the annotators annotate it to obtain an annotated dataset. Step 3: Add masked prompt templates to all original sentences in the dataset obtained in step 1 or 2, and then combine the masked prompt templates with the original sentences as input data for the basic pre-trained model RoBERTa input ; Step 4: For different specific tasks, construct the corresponding spatial answer map V and use the spatial answer map V to map the true label y true Replace the answers to the training and test samples of downstream tasks to transform the classification task into a task of predicting word probabilities; Step 5: Preset the parameters of the basic pre-training model. The basic pre-training model takes RoBERTa as an example, but is not limited to RoBERTa. Initialize the RoBERTa model. The RoBERTa model parameters at least include the learning rate, random inactivation, number of training rounds, and prompt insertion layer. Step 6: First, freeze the backbone of the pre-trained model, that is, cancel the gradient of the backbone parameters, customize a prompt generator module and make it trainable, that is, open the gradient of the prompt generator module, allow it to perform gradient updates in the back-propagation phase, and restrict the input and output dimensions of the prompt generator module, specifically set to the hidden layer dimensions of the pre-trained model; Step 7: RoBERTa the input data obtained in step 3 input , the position information Pos is sent to the word embedding layer to obtain the word embedding vector h in ; Step 8: Embed the word vector h obtained in step 7 in Send it to the pre-trained basic model initialized in step 5. Take the RoBERTa model as an example. The RoBERTa model is an encoder model with 24 layers. The word embedding vector h in Input each layer in turn and determine whether the layer is a hint adding layer. If it is a hint adding layer, the hint generator module generates hints. Then, based on the hidden vector h output by the previous layer, the generated hints are merged to obtain a new hidden vector h new , the new hidden vector h new Replace the original hidden vector h and continue to input the encoder model of the remaining layers to obtain the last hidden vector h end ; Step 9: The last hidden vector h obtained in step 8 end And the position of the mask in the masked hint template in step 3 is used to calculate the masked hidden vector h mask , combining the two to get the final hidden vector h out ; Step 10: The final hidden vector h out Send it to the RoBERTa model head to get the final prediction result y pre ; Step 11: Calculate the predicted result y through cross entropy loss pre and the true label y in step 4 true The difference is passed back to the entire pre-trained model with the prompt generator module through back propagation, and the weights and biases of the prompt generator module are updated; Step 12: Continuously iterate step 6 to step 11, stop training when the cross entropy loss value converges or reaches a specified round, and save the trained prompt generator module; Step 13: The trained prompt generator module is an additional module of the current pre-trained model under the training data set subtask. When the pre-trained model is used for this task in the future, you only need to load the trained prompt generator module into the pre-trained model.

2. The prompt fine-tuning method according to claim 1, characterized in that: The prompt generator module includes three bottleneck networks with different bottleneck sizes, wherein the bottleneck network includes an upper projection module, a rectified linear unit activation module, and a lower projection module, wherein: The up-projection module is used to perform a linear transformation of the hidden vector in a high-dimensional space; The rectified linear unit activation module is used to activate and update the transformed vector in the high-dimensional space; The down-projection module is used to map the activated updated vector from the high-dimensional space back to the original dimensional space.