Pre-training model fine-tuning method, device and equipment based on debiasing domain abstraction

By obtaining downstream task data sets and designing departial prompt words, the pre-trained model is fine-tuned, which solves the problem of insufficient understanding of the pre-trained model in downstream tasks, and improves the correlation and execution efficiency of the model and downstream tasks.

CN118520925BActive Publication Date: 2024-12-13MILITARY SECRECY QUALIFICATION EXAMINATION & CERTIFICATION CENT
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410979228.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-12-13
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

It is difficult for pre-trained models to accurately understand the specific domain knowledge domain of downstream tasks in downstream tasks, resulting in low correlation between the model and downstream tasks and affecting execution efficiency.

Method used

By obtaining downstream task data sets, departing domain abstract representations of departing knowledge domains are determined, preset departing prompt words are designed, and pre-trained models are fine-tuned in combination with sample training sets. The model is optimized using verification and test sets to ensure that the model and downstream are Relevance of tasks.

Benefits of technology

The accuracy and execution efficiency of the pre-trained model for downstream tasks is improved, so that it has strong correlation with downstream tasks and can effectively handle corresponding tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118520925B_ABST
    Figure CN118520925B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, device and equipment for fine-tuning a pre-trained model based on debiased domain abstraction, including: obtaining a downstream task data set, wherein the downstream task data set includes a sample training set, a sample verification set and a sample test set; determining a debiased domain abstract representation based on the sample training set and the pre-trained model, and determining a prompt learning training set based on preset debiased prompt words, debiased domain abstract representation and the sample training set; fine-tuning the pre-trained model based on the prompt learning training set; evaluating and adjusting the pre-trained model based on the prompt learning verification set; and model testing the pre-trained model based on the prompt learning test set. Thus, the actual distribution of the pre-trained model and the knowledge domain related to the downstream task is combined, the complete target domain of the downstream task is approximated by debiasing, and the complete target domain is used as a prompt to provide unambiguous guidance for the pre-trained model, so that the fine-tuned pre-trained model has a strong correlation with the downstream task and can effectively perform the corresponding task processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to the field of computer application technology, and in particular, to a method, apparatus and device for fine-tuning a pre-trained model based on debiased domain abstraction. Background Art

[0002] The pre-trained model is an initial model for the early stage of task processing. An initial model is pre-trained on an original task to facilitate the use of the model on the target task. The initial model is adjusted according to the characteristics of the target task to achieve the purpose of improving the target task.

[0003] In related technologies, pre-trained models generally use a large amount of general data for pre-training. Since the model is affected by the abstract and general understanding of the upstream task training during the pre-training process, it is unable to accurately understand the specific domain tasks of the downstream tasks, making it impossible for the model to capture the true distribution of the knowledge domain related to the downstream tasks, affecting the model's execution efficiency for downstream tasks.

[0004] Therefore, using the existing method, the obtained pre-trained model has a low correlation with the downstream tasks, making it difficult to accurately perform the corresponding tasks. Summary of the invention

[0005] The embodiments described herein provide a method, apparatus, and device for fine-tuning a pre-trained model based on debiasing domain abstraction, which overcome the above-mentioned problems.

[0006] In a first aspect, according to the content of the present disclosure, a method for fine-tuning a pre-trained model based on debiasing domain abstraction is provided, comprising:

[0007] Acquire a downstream task data set, wherein the downstream task data set includes: a sample training set, a sample verification set, and a sample test set, wherein the sample training set includes: first task data and a first task label corresponding to the first task data, the sample verification set includes: second task data and a second task label corresponding to the second task data, and the sample test set includes: third task data and a third task label corresponding to the third task data;

[0008] Based on the sample training set and the pre-trained model, determining a debiased domain abstract representation of a debiased knowledge domain corresponding to the downstream task, the pre-trained model corresponds to the downstream task, and the debiased knowledge domain is determined based on debiased real distribution data of the original knowledge domain corresponding to the downstream task;

[0009] Based on the preset debiasing prompt word, the debiasing domain abstract representation and the sample training set, determining a prompt learning training set corresponding to the downstream task, wherein the prompt learning training set includes: prompt learning training data and a learning label corresponding to the prompt learning training data, the prompt learning training data is used to describe the first task data and the auxiliary prompt word corresponding to the first task data, and the learning label corresponding to the prompt learning training data corresponds to the first task label corresponding to the first task data;

[0010] Fine-tuning the pre-trained model based on the prompt learning training set;

[0011] Based on the prompt learning validation set obtained from the sample validation set, evaluating and adjusting the pre-training model to optimize the pre-training model;

[0012] Based on the prompt learning test set obtained from the sample test set, the pre-trained model is tested to obtain a pre-trained model that meets the task accuracy requirement.

[0013] In a second aspect, according to the content of the present disclosure, a pre-trained model fine-tuning device based on debiased domain abstraction is provided, comprising:

[0014] An acquisition module is used to acquire a downstream task data set, wherein the downstream task data set includes: a sample training set, a sample verification set and a sample test set, wherein the sample training set includes: first task data and a first task label corresponding to the first task data, the sample verification set includes: second task data and a second task label corresponding to the second task data, and the sample test set includes: third task data and a third task label corresponding to the third task data;

[0015] A first determination module is used to determine, based on the sample training set and the pre-trained model, a debiased domain abstract representation of a debiased knowledge domain corresponding to the downstream task, wherein the pre-trained model corresponds to the downstream task, and the debiased knowledge domain is determined based on debiased real distribution data of an original knowledge domain corresponding to the downstream task;

[0016] A second determination module is used to determine a prompt learning training set corresponding to the downstream task based on a preset debiasing prompt word, the debiasing domain abstract representation and the sample training set, wherein the prompt learning training set includes: prompt learning training data and a learning label corresponding to the prompt learning training data, the prompt learning training data is used to describe the first task data and the auxiliary prompt word corresponding to the first task data, and the learning label corresponding to the prompt learning training data corresponds to the first task label corresponding to the first task data;

[0017] A fine-tuning module, configured to fine-tune the pre-trained model based on the prompt learning training set;

[0018] An evaluation module, configured to evaluate and adjust the pre-trained model based on a prompt learning verification set obtained from the sample verification set, so as to optimize the pre-trained model;

[0019] The testing module is used to perform model testing on the pre-trained model based on the prompt learning test set obtained from the sample test set to obtain a pre-trained model that meets the task accuracy requirement.

[0020] In a third aspect, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the pre-trained model fine-tuning method based on debiasing domain abstraction in any of the above embodiments are implemented.

[0021] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the pre-trained model fine-tuning method based on debiasing domain abstraction in any of the above embodiments are implemented.

[0022] The pre-trained model fine-tuning method based on debiasing domain abstraction provided in the embodiment of the present application obtains a downstream task data set, wherein the downstream task data set includes: a sample training set, a sample verification set and a sample test set, wherein the sample training set includes: first task data and a first task label corresponding to the first task data, the sample verification set includes: second task data and a second task label corresponding to the second task data, and the sample test set includes: third task data and a third task label corresponding to the third task data; based on the sample training set and the pre-trained model, a debiasing domain abstract representation of a debiasing knowledge domain corresponding to the downstream task is determined, the pre-trained model corresponds to the downstream task, and the debiasing knowledge domain is determined based on the debiasing real distribution data of the original knowledge domain corresponding to the downstream task; based on a preset debiasing prompt word , debiasing domain abstract representation and sample training set, determine the prompt learning training set corresponding to the downstream task, the prompt learning training set includes: prompt learning training data and learning labels corresponding to the prompt learning training data, the prompt learning training data is used to describe the first task data and the auxiliary prompt words corresponding to the first task data, and the learning labels corresponding to the prompt learning training data correspond to the first task labels corresponding to the first task data; based on the prompt learning training set, fine-tune the pre-trained model; based on the prompt learning verification set obtained from the sample verification set, evaluate and adjust the pre-trained model to optimize the pre-trained model; based on the prompt learning test set obtained from the sample test set, test the pre-trained model to obtain a pre-trained model that meets the task accuracy requirements. In this way, combined with the actual distribution of the pre-trained model and the knowledge domain related to the downstream task, the complete target domain of the downstream task is approximated by debiasing, and the complete target domain is used as a prompt to provide unambiguous guidance for the pre-trained model, so that the fine-tuned pre-trained model has a strong correlation with the downstream task and can effectively perform the corresponding task processing.

[0023] The above description is only an overview of the technical solution of the embodiment of the present application. In order to more clearly understand the technical means of the embodiment of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly described below. It should be noted that the drawings described below only relate to some embodiments of the present disclosure, but are not intended to limit the present disclosure, wherein:

[0025] Figure 1 It is a flowchart of a method for fine-tuning a pre-trained model based on debiasing domain abstraction provided by the present disclosure;

[0026] Figure 2It is a structural schematic diagram of a pre-training model fine-tuning device based on debiasing domain abstraction provided by the present disclosure;

[0027] Figure 3 It is a structural schematic diagram of a computer device provided by the present disclosure.

[0028] It should be noted that the elements in the drawings are schematic and not drawn to scale. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work also fall within the scope of protection of the present disclosure.

[0030] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by a person skilled in the art to which the subject matter of the present disclosure belongs. It will be further understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the specification and the relevant art, and will not be interpreted in an idealized or overly formal form unless otherwise explicitly defined herein. As used herein, a statement that two or more parts are "connected" or "coupled" together shall mean that the parts are joined together directly or through one or more intermediate components.

[0031] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase "embodiments" in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0032] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists, A and B exist at the same time, and B exists. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. Terms such as "first" and "second" are only used to distinguish one component (or a part of a component) from another component (or another part of a component).

[0033] In the description of the present application, unless otherwise specified, “plurality” means more than two (including two), and similarly, “plurality groups” means more than two (including two).

[0034] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0035] Figure 1 is a flow chart of a method for fine-tuning a pre-trained model based on debiasing domain abstraction provided by an embodiment of the present disclosure, such as Figure 1 As shown in FIG, the specific process of the pre-training model fine-tuning method based on debiasing domain abstraction includes:

[0036] S110, obtaining a downstream task data set, where the downstream task data set includes: a sample training set, a sample verification set, and a sample test set.

[0037] Among them, the sample training set includes: first task data and the first task label corresponding to the first task data, the sample verification set includes: second task data and the second task label corresponding to the second task data, and the sample test set includes: third task data and the third task label corresponding to the third task data.

[0038] The first task data is used to describe a part of historical task data corresponding to the downstream task, that is, the first task data includes multiple first sub-task data; the second task data is used to describe another part of historical task data corresponding to the downstream task, that is, the second task data includes multiple second sub-task data; the third task data is used to describe another part of historical task data corresponding to the downstream task, that is, the third task data includes multiple third sub-task data.

[0039] It can be understood that the first task data, the second task data and the third task data respectively belong to different parts of the historical task data corresponding to the downstream tasks, that is, the first subtask data, the second subtask data and the third subtask data are different from each other, and accordingly, the first task data, the second task data and the third task data are different from each other.

[0040] Downstream tasks are the target tasks that the pre-trained model needs to actually solve, such as image category determination, data domain determination, data validity identification, etc.

[0041] The sample training set can be used as model training data to train the pre-trained model; the sample verification set can be used as model verification data to verify the data of the pre-trained model obtained through training; the sample test set can be used as model test data to test the model results of the pre-trained model that has successfully verified the data, so as to ensure the output validity of the pre-trained model.

[0042] S120. Based on the sample training set and the pre-trained model, determine the debiased domain abstract representation of the downstream task corresponding to the debiased knowledge domain.

[0043] The pre-trained model corresponds to the downstream task. The pre-trained model is a large language model selected based on the task execution of the downstream task. For example, when the downstream task is image category determination, the pre-trained model can be a category determination model.

[0044] The debiased knowledge domain is the knowledge domain related to the downstream task obtained after debiasing analysis and processing of all knowledge domains corresponding to the downstream task. The debiased knowledge domain can be determined based on the debiased real distribution data of the original knowledge domain corresponding to the downstream task. Therefore, by performing debiased domain abstraction on the debiased knowledge domain, the corresponding debiased domain abstract representation is obtained.

[0045] In some embodiments, based on the sample training set and the pre-trained model, determining that the downstream task corresponds to the debiased domain abstract representation of the debiased knowledge domain includes:

[0046] The first task data included in the sample training set is input into the pre-training model to obtain a sample representation corresponding to the first task data.

[0047] Among them, the pre-trained model can be used as an encoder , the sample training set The data samples in (i.e., the first task data) are input into the encoder , and the corresponding sample is expressed as: Finally, the sample representation corresponding to all data samples in the sample training set is obtained as: ,in, i The sample training set The i Task data.

[0048] Based on the Gaussian mixture model, distribution modeling is performed on the sample representation corresponding to the first task data to obtain a modeled distribution representation associated with the sample representation corresponding to the first task data.

[0049] Among them, the modeling distribution representation associated with the sample representation corresponding to the first task data can be represented by the probability density value, mean vector, covariance matrix and weight corresponding to each Gaussian component in the fitted Gaussian mixture model.

[0050] For example, a Gaussian mixture model (GMM) may be a pre-built model used to model the distribution of sample representations in a sample training set, as shown in formula (1).

[0051] (1)

[0052] In formula (1), is the number of Gaussian components determined by the number of sample categories, Represents the probability density value corresponding to each Gaussian component in the fitted GMM, Represents the mean vector corresponding to each Gaussian component in the fitted GMM, Represents the covariance matrix corresponding to each Gaussian component in the fitted GMM, Represents the weight corresponding to each Gaussian component in the fitted GMM.

[0053] Based on the modeling distribution representation associated with the sample representation corresponding to the first task data, the debiased true distribution data of the original knowledge domain corresponding to the downstream task is obtained; the debiased true distribution data of the original knowledge domain corresponding to the downstream task is uniformly sampled to obtain the debiased domain abstract representation of the downstream task corresponding to the debiased knowledge domain.

[0054] Among them, obtaining the debiased true distribution data of the original knowledge domain corresponding to the downstream task based on the modeling distribution representation associated with the sample representation corresponding to the first task data may include: using the Stein Variational Gradient Descent (SVGD) algorithm to approximate the debiased true distribution data of the original knowledge domain corresponding to the downstream task based on the modeling distribution representation associated with the sample representation corresponding to the first task data.

[0055] For example, H The initial particles required for SVGD input can be used as: , M is the number of particles, It can be used as the target distribution required by SVGD input, and the initial particles are iteratively updated to approximate the target distribution (i.e., to debias the real distribution data), as shown in formula (2).

[0056] (2)

[0057] In formula (2), l Indicates the current iteration number, Indicates l The step size for the iteration, k Represents the RBF kernel.

[0058] Thus, the knowledge domain related to the downstream task contained in the pre-trained model is approximated based on the downstream task data, and the approximated knowledge domain that can be regarded as debiased is abstracted to obtain the debiased domain abstraction of the debiased knowledge domain. .

[0059] S130, determining a prompt learning training set corresponding to a downstream task based on the preset debiasing prompt words, the debiasing domain abstract representation, and the sample training set.

[0060] The prompt learning training set includes prompt learning training data and learning labels corresponding to the prompt learning training data.

[0061] The prompt learning training data is used to describe the first task data and the auxiliary prompt words corresponding to the first task data, that is, the prompt learning training data consists of the first task data and the auxiliary prompt words corresponding to the first task data.

[0062] The learning label corresponding to the prompt learning training data corresponds to the first task label corresponding to the first task data. That is, the learning label corresponding to a training data in the prompt learning training data is the same as the first task label corresponding to the first task data associated with the training data.

[0063] By designing prompts that can convert downstream task objectives into tasks of the pre-training model in the pre-training stage (i.e., preset debiasing prompt words), and integrating debiasing domain abstraction into the preset debiasing prompt words, it is convenient to determine a sample training set with prompt learning performance.

[0064] In some embodiments, based on the preset debiasing prompt words, the debiasing domain abstract representation and the sample training set, determining the prompt learning training set corresponding to the downstream task includes:

[0065] An information labeling template related to the first task data is obtained, and the information labeling template is associated with a first task label corresponding to the first task data; a preset debiasing prompt word is added to the information labeling template as an auxiliary prompt word; and prompt learning is performed on the first task data based on the information labeling template to obtain a prompt learning training set corresponding to the downstream task.

[0066] For example, before adding the preset debiasing prompt words as auxiliary prompt words to the information markup template, debiasing domain abstraction can also be used Initialize the preset debiasing prompt words to unify the preset debiasing prompt words and debiasing domain abstraction The data format between .

[0067] The information tag template is a pre-constructed template that matches the given input x A related template containing the [MASK] tag , add the preset debiasing prompt words as auxiliary prompt words to the template In addition, a mapping relationship between the real label space and the label word space corresponding to [MASK] can be established: , M ( y ) represents the true labely The corresponding label word.

[0068] Based on the information labeling template, the first task data is prompted for learning, and a prompt learning training set corresponding to the downstream task is obtained, as shown in formula (3).

[0069] (3)

[0070] In formula (3), To prompt the learning training set, It includes the [MASK] tag and auxiliary prompt words for debiasing prompts.

[0071] Therefore, the sample training set is templated using preset debiasing cue words and debiasing domain abstract representation, so that the obtained cue learning training set has a strong correlation with the downstream tasks.

[0072] S140, fine-tuning the pre-trained model based on the prompt learning training set.

[0073] The pre-trained model is fine-tuned to adapt to downstream tasks by processing the model input data and prompt words into a form that the pre-trained model can recognize until it converges or reaches the preset conditions.

[0074] In some embodiments, fine-tuning the pre-trained model based on the prompt learning training set includes:

[0075] The prompt learning training set is input into the pre-training model, and the corresponding task prediction result is determined based on the output result of the pre-training model; a preset loss function is used to calculate the loss value between the task prediction result and the corresponding first task label; based on the loss value between the task prediction result and the corresponding first task label, the pre-training model is fine-tuned until the fine-tuned pre-training model meets the preset loss requirement.

[0076] For example, Input into the pre-trained model to calculate the corresponding prediction result M ( y ), and use formula (4) to calculate the prediction results M ( y ) and the true label y The cross entropy loss between .

[0077] (4)

[0078] By J Gradient backpropagation is performed to update the parameters of the task-specific head to minimize the loss function, thus obtaining a fine-tuned pre-trained model.

[0079] S150, based on the prompt learning validation set obtained from the sample validation set, evaluate and adjust the pre-trained model.

[0080] Among them, based on the prompt learning verification set obtained from the sample verification set, the pre-trained model is evaluated and adjusted to achieve model optimization of the pre-trained model.

[0081] In some embodiments, based on a prompt learning validation set obtained from a sample validation set, evaluating and adjusting the pre-trained model includes:

[0082] The sample verification set is processed based on the information labeling template to obtain the prompt learning verification set; the prompt learning verification set is input into the pre-trained model, and the corresponding model evaluation result is determined based on the output result of the pre-trained model; based on the model evaluation result, the pre-trained model is fine-tuned again until the fine-tuned pre-trained model meets the preset performance requirements.

[0083] The prompt learning verification set includes prompt learning verification data and learning labels corresponding to the prompt learning verification data.

[0084] The prompt learning verification data is used to describe the second task data and the auxiliary prompt words corresponding to the second task data, that is, the prompt learning verification data consists of the second task data and the auxiliary prompt words corresponding to the second task data, and the auxiliary prompt word composition corresponding to the second task data is a debiased prompt word pre-constructed based on the second task data.

[0085] The learning label corresponding to the prompt learning verification data corresponds to the second task label corresponding to the second task data, that is, the learning label corresponding to a verification data in the prompt learning verification data is the same as the second task label corresponding to the second task data associated with this verification data.

[0086] For example, through the template Convert sample validation set input to input suitable for prompt learning , which contains the [MASK] tag and the auxiliary words for debiasing prompts; all the data in the sample validation set Input into the pre-trained model to obtain its corresponding model evaluation result; if the model evaluation result does not meet the preset performance requirements, adjust the model hyperparameters again to fine-tune the model until the performance of the pre-trained model on the sample validation set no longer improves.

[0087] The preset performance requirements can be used to describe that the performance of the pre-trained model on the sample validation set no longer improves (that is, the performance parameters are stable within a certain preset range), so that the optimized pre-trained model can have stronger and more stable performance.

[0088] S160: Perform model testing on the pre-trained model based on the prompt learning test set obtained from the sample test set.

[0089] Among them, based on the prompt learning test set obtained from the sample test set, the pre-trained model is tested to obtain a pre-trained model that meets the task accuracy requirements.

[0090] This embodiment addresses the specific problem that the pre-trained model may incorrectly locate the knowledge distribution corresponding to the target domain in the general knowledge embedding space. It approximates the complete target domain of the downstream task in a debiased manner, and then abstracts these domains to generate discriminative cues, thereby providing unambiguous guidance for the pre-trained model, aiming to learn cues containing domain discriminative information to counter the interference of domain-irrelevant knowledge.

[0091] The model fine-tuning method in this embodiment is robust to pre-trained models and can achieve robust prompt learning on pre-trained models of different scales. At the same time, it is suitable for problems involving "sub-knowledge domains". Its wide applicability provides new ideas for solving related tasks in the fields of natural language processing and computer vision.

[0092] In some embodiments, the pre-trained model is tested based on a prompt learning test set obtained from a sample test set, including:

[0093] The sample test set is processed based on the information labeling template to obtain a prompt learning test set; the prompt learning test set is input into the pre-training model, and the corresponding task prediction result is determined based on the output result of the pre-training model, and the task prediction result is used to describe the task prediction accuracy of the downstream task; if the task prediction result indicates that the task prediction accuracy of the downstream task meets the preset prediction requirements, it is determined that the fine-tuning of the pre-training model is completed, and a pre-training model that meets the task accuracy requirements is obtained.

[0094] The prompt learning test set includes prompt learning test data and learning labels corresponding to the prompt learning test data.

[0095] The prompt learning test data is used to describe the third task data and the auxiliary prompt words corresponding to the third task data, that is, the prompt learning test data consists of the third task data and the auxiliary prompt words corresponding to the third task data, and the auxiliary prompt word composition corresponding to the third task data becomes a debiased prompt word constructed in advance based on the third task data.

[0096] There is no correlation between the preset debiasing prompt words corresponding to the first task data, the preset debiasing prompt words corresponding to the second task data, and the preset debiasing prompt words corresponding to the third task data, that is, the preset debiasing prompt words corresponding to the first task data, the preset debiasing prompt words corresponding to the second task data, and the preset debiasing prompt words corresponding to the third task data are different from each other.

[0097] The learning label corresponding to the prompt learning test data corresponds to the third task label corresponding to the third task data, that is, the learning label corresponding to a test data in the prompt learning test data is the same as the third task label corresponding to the third task data associated with this test data.

[0098] For example, through the template Convert sample test set inputs into inputs suitable for prompt learning , which contains the [MASK] tag and the auxiliary words for debiasing prompts; all the data in the sample test set Input into the model for task prediction and obtain the task prediction result to obtain the accuracy index of the pre-trained model in task prediction.

[0099] In some embodiments, the method of this embodiment further includes:

[0100] If the task prediction result indicated by the task prediction accuracy of the downstream task does not meet the preset prediction requirements, the setting parameters of the pre-trained model are adjusted; until the task prediction result output by the pre-trained model indicates that the task prediction accuracy of the downstream task meets the preset prediction requirements.

[0101] Among them, the preset prediction requirement can be used to describe that the prediction accuracy of the pre-trained model exceeds a preset value, so that the tested pre-trained model has a higher execution accuracy when executing downstream tasks, thereby improving the execution efficiency of downstream tasks.

[0102] The pre-trained model fine-tuning method based on debiasing domain abstraction provided in the embodiment of the present application obtains a downstream task data set, wherein the downstream task data set includes: a sample training set, a sample verification set and a sample test set, wherein the sample training set includes: first task data and a first task label corresponding to the first task data, the sample verification set includes: second task data and a second task label corresponding to the second task data, and the sample test set includes: third task data and a third task label corresponding to the third task data; based on the sample training set and the pre-trained model, a debiasing domain abstract representation of a debiasing knowledge domain corresponding to the downstream task is determined, the pre-trained model corresponds to the downstream task, and the debiasing knowledge domain is determined based on the debiasing real distribution data of the original knowledge domain corresponding to the downstream task; based on a preset debiasing prompt word , debiasing domain abstract representation and sample training set, determine the prompt learning training set corresponding to the downstream task, the prompt learning training set includes: prompt learning training data and learning labels corresponding to the prompt learning training data, the prompt learning training data is used to describe the first task data and the auxiliary prompt words corresponding to the first task data, and the learning labels corresponding to the prompt learning training data correspond to the first task labels corresponding to the first task data; based on the prompt learning training set, fine-tune the pre-trained model; based on the prompt learning verification set obtained from the sample verification set, evaluate and adjust the pre-trained model to optimize the pre-trained model; based on the prompt learning test set obtained from the sample test set, test the pre-trained model to obtain a pre-trained model that meets the task accuracy requirements. In this way, combined with the actual distribution of the pre-trained model and the knowledge domain related to the downstream task, the complete target domain of the downstream task is approximated by debiasing, and the complete target domain is used as a prompt to provide unambiguous guidance for the pre-trained model, so that the fine-tuned pre-trained model has a strong correlation with the downstream task and can effectively perform the corresponding task processing.

[0103] In summary, this embodiment divides the downstream task data set into a training set, a validation set, and a test set, all of which contain task data and their corresponding labels; selects a pre-trained model suitable for the downstream task, approximates the knowledge domain related to the downstream task contained in the pre-trained model based on the downstream task data, and performs a debiased domain abstraction on the approximated knowledge domain that can be regarded as debiased. Among them, the pre-trained model is used as an encoder to obtain the sample representation corresponding to the data sample in the training set; a Gaussian mixture model is constructed to model the sample representation distribution, and the Stein variational gradient descent algorithm is used to approximate the debiased true distribution of the knowledge domain corresponding to the downstream task, and uniform sampling is performed from the approximate debiased true distribution to obtain the debiased domain abstraction of the debiased knowledge domain corresponding to the downstream task. And design prompts that can convert downstream task goals into tasks of the pre-trained model in the pre-training stage, integrate debiasing domain abstraction into the prompts to guide the pre-trained model to locate the debiasing knowledge domain related to the downstream task; process the input data and prompts into a form acceptable to the pre-trained model, and fine-tune the pre-trained model so that it can adapt to downstream tasks until convergence or reaching the preset conditions; use the validation set to evaluate the model, adjust the model's hyperparameters, and repeat the above fine-tuning until the performance of the model on the validation set no longer improves; test the model on the test set to obtain the final task accuracy of the model. This embodiment can improve the performance of prompt learning in few-sample inference, and can more accurately utilize the knowledge required for downstream tasks already included in the pre-trained model, thereby improving the performance of the model on specific tasks, which has an inspiring and promoting effect on the development of natural language processing, computer vision and other fields.

[0104] Figure 2 A structural schematic diagram of a pre-trained model fine-tuning device based on debiasing domain abstraction is provided for this embodiment, wherein the pre-trained model fine-tuning device based on debiasing domain abstraction may include: an acquisition module 210, a first determination module 220, a second determination module 230, a fine-tuning module 240, an evaluation module 250 and a testing module 260.

[0105] The acquisition module 210 is used to acquire a downstream task data set, which includes: a sample training set, a sample verification set and a sample test set. The sample training set includes: first task data and a first task label corresponding to the first task data. The sample verification set includes: second task data and a second task label corresponding to the second task data. The sample test set includes: third task data and a third task label corresponding to the third task data.

[0106] The first determination module 220 is used to determine the debiased domain abstract representation of the debiased knowledge domain corresponding to the downstream task based on the sample training set and the pre-trained model. The pre-trained model corresponds to the downstream task, and the debiased knowledge domain is determined based on the debiased real distribution data of the original knowledge domain corresponding to the downstream task.

[0107] The second determination module 230 is used to determine the prompt learning training set corresponding to the downstream task based on the preset debiasing prompt words, the debiasing domain abstract representation and the sample training set, the prompt learning training set includes: prompt learning training data and learning labels corresponding to the prompt learning training data, the prompt learning training data is used to describe the first task data and the auxiliary prompt words corresponding to the first task data, and the learning labels corresponding to the prompt learning training data correspond to the first task labels corresponding to the first task data.

[0108] The fine-tuning module 240 is used to fine-tune the pre-trained model based on the prompt learning training set.

[0109] The evaluation module 250 is used to evaluate and adjust the pre-trained model based on the prompt learning validation set obtained from the sample validation set to optimize the pre-trained model.

[0110] The testing module 260 is used to perform model testing on the pre-trained model based on the prompt learning test set obtained from the sample test set to obtain a pre-trained model that meets the task accuracy requirement.

[0111] In this embodiment, optionally, the first determining module 210 is specifically configured to:

[0112] The first task data included in the sample training set is input into the pre-training model to obtain the sample representation corresponding to the first task data; distribution modeling is performed on the sample representation corresponding to the first task data based on the Gaussian mixture model to obtain the modeling distribution representation associated with the sample representation corresponding to the first task data; based on the modeling distribution representation associated with the sample representation corresponding to the first task data, the debiased true distribution data of the original knowledge domain corresponding to the downstream task is obtained; the debiased true distribution data of the original knowledge domain corresponding to the downstream task is uniformly sampled to obtain the debiased domain abstract representation of the downstream task corresponding to the debiased knowledge domain.

[0113] In this embodiment, optionally, the second determining module 230 is specifically configured to:

[0114] An information labeling template related to the first task data is obtained, and the information labeling template is associated with a first task label corresponding to the first task data; a preset debiasing prompt word is added to the information labeling template as an auxiliary prompt word; and prompt learning is performed on the first task data based on the information labeling template to obtain a prompt learning training set corresponding to the downstream task.

[0115] In this embodiment, optionally, the fine-tuning module 240 is specifically used to:

[0116] The prompt learning training set is input into the pre-training model, and the corresponding task prediction result is determined based on the output result of the pre-training model; a preset loss function is used to calculate the loss value between the task prediction result and the corresponding first task label; based on the loss value between the task prediction result and the corresponding first task label, the pre-training model is fine-tuned until the fine-tuned pre-training model meets the preset loss requirement.

[0117] In this embodiment, optionally, the evaluation module 250 is specifically configured to:

[0118] The sample verification set is processed based on the information labeling template to obtain a prompt learning verification set, which includes: prompt learning verification data and learning labels corresponding to the prompt learning verification data, the prompt learning verification data is used to describe the second task data and the auxiliary prompt words corresponding to the second task data, and the learning labels corresponding to the prompt learning verification data correspond to the second task labels corresponding to the second task data; the prompt learning verification set is input into the pre-trained model, and the corresponding model evaluation result is determined based on the output result of the pre-trained model; based on the model evaluation result, the pre-trained model is fine-tuned again until the fine-tuned pre-trained model meets the preset performance requirements.

[0119] In this embodiment, optionally, the testing module 260 is specifically used to:

[0120] The sample test set is processed based on the information labeling template to obtain a prompted learning test set, which includes: prompted learning test data and learning labels corresponding to the prompted learning test data, the prompted learning test data is used to describe the third task data and the auxiliary prompt words corresponding to the third task data, and the learning labels corresponding to the prompted learning test data correspond to the third task labels corresponding to the third task data; the prompted learning test set is input into the pre-trained model, and the corresponding task prediction result is determined based on the output result of the pre-trained model, and the task prediction result is used to describe the task prediction accuracy of the downstream task; if the task prediction result indicates that the task prediction accuracy of the downstream task meets the preset prediction requirements, it is determined that the fine-tuning of the pre-trained model is completed, and a pre-trained model that meets the task accuracy requirements is obtained.

[0121] In this embodiment, optionally, the testing module 260 is specifically used to:

[0122] If the task prediction result indicated by the task prediction accuracy of the downstream task does not meet the preset prediction requirements, the setting parameters of the pre-trained model are adjusted; until the task prediction result output by the pre-trained model indicates that the task prediction accuracy of the downstream task meets the preset prediction requirements.

[0123] The pre-trained model fine-tuning device based on debiased domain abstraction provided in the present disclosure can execute the above method embodiments. Its specific implementation principles and technical effects can be found in the above method embodiments, and the present disclosure will not repeat them here.

[0124] The present application also provides a computer device. Figure 3 , Figure 3 This is a basic structural block diagram of the computer device in this embodiment.

[0125] The computer device includes a memory 310 and a processor 320 that are connected to each other through a system bus. It should be noted that the figure only shows a computer device with a memory 310 and a processor 320, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0126] Computer devices can be computing devices such as desktop computers, notebooks, PDAs, and cloud servers. Computer devices can interact with users through keyboards, mice, remote controls, touch pads, or voice control devices.

[0127] The memory 310 includes at least one type of readable storage medium, and the readable storage medium includes a non-volatile memory or a volatile memory, such as a flash memory, a hard disk, a multimedia card, a card-type memory (such as an SD or DX memory, etc.), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc., and the RAM may include a static RAM or a dynamic RAM. In some embodiments, the memory 310 may be an internal storage unit of a computer device, such as a hard disk or a memory of the computer device. In other embodiments, the memory 310 may also be an external storage device of a computer device, such as a plug-in hard disk, a smart memory card (SMC), a secure digital (SD) card, or a flash card (Flash Card), etc., equipped on the computer device. Of course, the memory 310 may also include both an internal storage unit of the computer device and an external storage device thereof. In this embodiment, the memory 310 is generally used to store an operating system and various application software installed on the computer device, such as the program code of the above method, etc. In addition, the memory 310 may also be used to temporarily store various data that have been output or are to be output.

[0128] The processor 320 is generally used to perform the overall operation of the computer device. In this embodiment, the memory 310 is used to store program codes or instructions, the program code includes computer operation instructions, and the processor 320 is used to execute the program codes or instructions stored in the memory 310 or process data, such as running the program code of the above method.

[0129] In this article, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus system can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0130] Another embodiment of the present application also provides a computer-readable medium, which may be a computer-readable signal medium or a computer-readable medium. A processor in a computer reads a computer-readable program code stored in the computer-readable medium, so that the processor can execute the functional actions specified in each step or a combination of steps in the above method; and generate a device for implementing the functional actions specified in each block or a combination of blocks in the block diagram.

[0131] Computer-readable media include but are not limited to electronic, magnetic, optical, electromagnetic, infrared memory or semiconductor systems, devices or apparatuses, or any appropriate combination of the foregoing, the memory is used to store program codes or instructions, the program codes include computer operating instructions, and the processor is used to execute the program codes or instructions of the above methods stored in the memory.

[0132] For the definitions of memory and processor, please refer to the description of the aforementioned computer device embodiment and will not be repeated here.

[0133] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0134] Each functional unit or module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional unit.

[0135] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., and other media that can store program codes.

[0136] In the claims, any reference symbols placed between brackets shall not be construed as limiting the claims. The word "comprising" described in the present application does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application can be implemented with the aid of hardware comprising several different elements and with the aid of a suitably programmed computer. In a unit claim that lists a number of devices, several units of these devices may be embodied by the same hardware item. The use of first, second, and third, etc. does not indicate any order, and these words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.

[0137] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A pre-trained model fine-tuning method based on debiased domain abstraction, characterized in that: include: Acquire a downstream task data set, wherein the downstream task data set includes: a sample training set, a sample verification set, and a sample test set, wherein the sample training set includes: first task data and a first task label corresponding to the first task data, the sample verification set includes: second task data and a second task label corresponding to the second task data, and the sample test set includes: third task data and a third task label corresponding to the third task data; Based on the sample training set and the pre-trained model, determining a debiased domain abstract representation of a debiased knowledge domain corresponding to the downstream task, the pre-trained model corresponds to the downstream task, and the debiased knowledge domain is determined based on debiased real distribution data of the original knowledge domain corresponding to the downstream task; Based on the preset debiasing prompt word, the debiasing domain abstract representation and the sample training set, determining a prompt learning training set corresponding to the downstream task, wherein the prompt learning training set includes: prompt learning training data and a learning label corresponding to the prompt learning training data, the prompt learning training data is used to describe the first task data and the auxiliary prompt word corresponding to the first task data, and the learning label corresponding to the prompt learning training data corresponds to the first task label corresponding to the first task data; Fine-tuning the pre-trained model based on the prompt learning training set; Based on the prompt learning validation set obtained from the sample validation set, evaluating and adjusting the pre-training model to optimize the pre-training model; Based on the prompt learning test set obtained from the sample test set, the pre-trained model is tested to obtain a pre-trained model that meets the task accuracy requirement, and the pre-trained model is used for image category determination; Wherein, determining the debiased domain abstract representation of the debiased knowledge domain corresponding to the downstream task based on the sample training set and the pre-trained model includes: Inputting the first task data included in the sample training set into the pre-training model to obtain a sample representation corresponding to the first task data; Performing distribution modeling on the sample representation corresponding to the first task data based on a Gaussian mixture model to obtain a modeled distribution representation associated with the sample representation corresponding to the first task data; Obtaining debiased true distribution data of the original knowledge domain corresponding to the downstream task based on the modeled distribution representation associated with the sample representation corresponding to the first task data; The debiased real distribution data of the original knowledge domain corresponding to the downstream task is uniformly sampled to obtain a debiased domain abstract representation of the debiased knowledge domain corresponding to the downstream task.

2. The method according to claim 1, characterized in that The step of determining the prompt learning training set corresponding to the downstream task based on the preset debiasing prompt word, the debiasing domain abstract representation, and the sample training set includes: Acquire an information marking template related to the first task data, wherein the information marking template is associated with a first task tag corresponding to the first task data; Adding the preset debiasing prompt word as an auxiliary prompt word to the information marking template; Prompt learning is performed on the first task data based on the information labeling template to obtain a prompt learning training set corresponding to the downstream task.

3. The method according to claim 2, characterized in that The step of fine-tuning the pre-trained model based on the prompt learning training set includes: Inputting the prompt learning training set into the pre-training model, and determining the corresponding task prediction result based on the output result of the pre-training model; Using a preset loss function, calculate the loss value between the task prediction result and the corresponding first task label; Based on the loss value between the task prediction result and the corresponding first task label, the pre-trained model is fine-tuned until the fine-tuned pre-trained model meets the preset loss requirement.

4. The method according to claim 3, characterized in that The step of evaluating and adjusting the pre-trained model based on the prompt learning validation set obtained from the sample validation set includes: The sample verification set is processed based on the information tagging template to obtain a prompt learning verification set, wherein the prompt learning verification set includes: prompt learning verification data and a learning label corresponding to the prompt learning verification data, the prompt learning verification data is used to describe the second task data and the auxiliary prompt word corresponding to the second task data, and the learning label corresponding to the prompt learning verification data corresponds to the second task label corresponding to the second task data; Inputting the prompt learning verification set into the pre-training model, and determining a corresponding model evaluation result based on an output result of the pre-training model; Based on the model evaluation result, the pre-trained model is fine-tuned again until the fine-tuned pre-trained model meets the preset performance requirements.

5. The method according to claim 3, characterized in that: The step of performing a model test on the pre-trained model based on a prompt learning test set obtained from the sample test set includes: The sample test set is processed based on the information labeling template to obtain a prompt learning test set, wherein the prompt learning test set includes: prompt learning test data and learning labels corresponding to the prompt learning test data, the prompt learning test data is used to describe the third task data and the auxiliary prompt words corresponding to the third task data, and the learning labels corresponding to the prompt learning test data correspond to the third task labels corresponding to the third task data; Inputting the prompt learning test set into the pre-training model, and determining a corresponding task prediction result based on an output result of the pre-training model, wherein the task prediction result is used to describe the task prediction accuracy of the downstream task; If the task prediction result indicates that the task prediction accuracy of the downstream task meets the preset prediction requirement, it is determined that the fine-tuning of the pre-trained model is completed, and a pre-trained model that meets the task accuracy requirement is obtained.

6. The method according to claim 5, characterized in that Also includes: If the task prediction result indicates that the task prediction accuracy of the downstream task does not meet the preset prediction requirement, adjusting the setting parameters of the pre-training model; Until the task prediction result output by the pre-training model indicates that the task prediction accuracy of the downstream task meets the preset prediction requirement.

7. A pre-trained model fine-tuning device based on debiased domain abstraction, characterized in that: include: An acquisition module is used to acquire a downstream task data set, wherein the downstream task data set includes: a sample training set, a sample verification set and a sample test set, wherein the sample training set includes: first task data and a first task label corresponding to the first task data, the sample verification set includes: second task data and a second task label corresponding to the second task data, and the sample test set includes: third task data and a third task label corresponding to the third task data; A first determination module is used to determine, based on the sample training set and the pre-trained model, a debiased domain abstract representation of a debiased knowledge domain corresponding to the downstream task, wherein the pre-trained model corresponds to the downstream task, and the debiased knowledge domain is determined based on debiased real distribution data of an original knowledge domain corresponding to the downstream task; A second determination module is used to determine a prompt learning training set corresponding to the downstream task based on a preset debiasing prompt word, the debiasing domain abstract representation and the sample training set, wherein the prompt learning training set includes: prompt learning training data and a learning label corresponding to the prompt learning training data, the prompt learning training data is used to describe the first task data and the auxiliary prompt word corresponding to the first task data, and the learning label corresponding to the prompt learning training data corresponds to the first task label corresponding to the first task data; A fine-tuning module, configured to fine-tune the pre-trained model based on the prompt learning training set; An evaluation module, configured to evaluate and adjust the pre-trained model based on a prompt learning verification set obtained from the sample verification set, so as to optimize the pre-trained model; A testing module, used for performing a model test on the pre-trained model based on a prompt learning test set obtained from the sample test set, so as to obtain a pre-trained model that meets the task accuracy requirement, wherein the pre-trained model is used for image category determination; Wherein, the first determining module is specifically used to: Inputting the first task data included in the sample training set into the pre-training model to obtain a sample representation corresponding to the first task data; Performing distribution modeling on the sample representation corresponding to the first task data based on a Gaussian mixture model to obtain a modeled distribution representation associated with the sample representation corresponding to the first task data; Obtaining debiased true distribution data of the original knowledge domain corresponding to the downstream task based on the modeled distribution representation associated with the sample representation corresponding to the first task data; The debiased real distribution data of the original knowledge domain corresponding to the downstream task is uniformly sampled to obtain a debiased domain abstract representation of the debiased knowledge domain corresponding to the downstream task.

8. A computer device, characterized in that: It includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, a pre-trained model fine-tuning method based on debiasing domain abstraction as described in any one of claims 1 to 6 is implemented.