A pre-training model fine-tuning method, device, equipment and storage medium
By using a pre-defined statistical language model for screening and denoising, the problem of low-quality sample data for downstream tasks was solved, resulting in the expansion of high-quality sample data and the improvement of model performance.
Patent Information
- Application Number
- CN202210684822.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-16
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2042-06-16
AI Technical Summary
In existing technologies, the low quality and noise of sample data associated with downstream tasks lead to poor model fine-tuning and overfitting, thus failing to guarantee model performance.
Data domain analysis is performed using a pre-set statistical language model to select sample data that matches the target downstream domain. The first fine-tuning model is then used for denoising. Subsequently, the pre-trained model is fine-tuned again based on the denoised sample data to determine the second fine-tuning model.
The quality of the expanded sample data was improved, the model fine-tuning effect was enhanced, and the performance of the downstream task models was ensured.
Smart Images

Figure CN115049003B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of super deep learning technology, and in particular, to a pre-training model fine-tuning method, device, equipment and storage medium. Background Art
[0002] With the rapid development of computer technology, pre-trained models have gradually become a research hotspot in the industry due to their large parameter scale, strong general capabilities, and good comprehensive performance. Fine-tuning pre-trained models for downstream tasks is the main way to use large-scale pre-trained models to solve downstream tasks.
[0003] Since there is less training sample data for downstream tasks, it is often difficult to achieve ideal results by directly using the training sample data of downstream tasks to fine-tune the pre-trained model. At present, in order to solve the problem of insufficient training sample data for downstream tasks, large-scale sample data associated with downstream tasks is usually obtained, and the data set is expanded and fine-tuned by mixing it with actual sample data.
[0004] However, in the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0005] Since the quality of the sample data associated with the downstream tasks is not high and contains a lot of noise, the fine-tuning effect obtained by directly mixing it with the actual sample data is poor, and the model is prone to overfitting, and the model performance of the downstream task model obtained by fine-tuning cannot be guaranteed. Summary of the invention
[0006] The embodiments of the present invention provide a pre-training model fine-tuning method, apparatus, device and storage medium to improve the quality of expanded sample data, thereby improving the fine-tuning effect and ensuring the model performance of the downstream task model obtained by fine-tuning.
[0007] In a first aspect, an embodiment of the present invention provides a pre-training model fine-tuning method, comprising:
[0008] Acquire first sample data associated with a target downstream task;
[0009] Based on a preset statistical language model, performing data domain analysis on the first sample data, and determining second sample data matching a target downstream domain from the first sample data based on the domain analysis result;
[0010] Based on the actual sample data corresponding to the target downstream task, fine-tune the pre-trained model to determine a first fine-tuned model;
[0011] Based on the first fine-tuning model, denoising the second sample data to obtain denoised third sample data;
[0012] Based on the third sample data and the actual sample data, the first fine-tuning model is fine-tuned again to determine a second fine-tuning model, and a target downstream task model is determined based on the second fine-tuning model.
[0013] In a second aspect, an embodiment of the present invention further provides a pre-training model fine-tuning device, comprising:
[0014] A first sample data acquisition module, used to acquire first sample data associated with a target downstream task;
[0015] a second sample data determination module, configured to perform data domain analysis on the first sample data based on a preset statistical language model, and determine second sample data matching a target downstream domain from the first sample data based on the domain analysis result;
[0016] A first fine-tuning model determination module, configured to fine-tune the pre-trained model based on actual sample data corresponding to the target downstream task to determine a first fine-tuning model;
[0017] A third sample data determination module, configured to perform denoising processing on the second sample data based on the first fine-tuning model to obtain denoised third sample data;
[0018] The target downstream task model determination module is used to further fine-tune the first fine-tuning model based on the third sample data and the actual sample data, determine the second fine-tuning model, and determine the target downstream task model based on the second fine-tuning model.
[0019] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0020] one or more processors;
[0021] A memory for storing one or more programs;
[0022] When the one or more programs are executed by the one or more processors, the one or more processors implement the pre-training model fine-tuning method provided in any embodiment of the present invention.
[0023] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a pre-trained model fine-tuning method as provided in any embodiment of the present invention.
[0024] The embodiments of the above invention have the following advantages or beneficial effects:
[0025] By performing data domain analysis on the first sample data associated with the target downstream task based on a preset statistical language model, and determining the second sample data matching the target downstream domain from the first sample data based on the domain analysis result, that is, obtaining the second sample data strongly related to the target downstream domain, and using the first fine-tuning model that fine-tunes the pre-trained model based on the actual sample data, denoising the second sample data to obtain the denoised third sample data, so that based on the preset statistical language model and the self-calibration method, the third sample data that is strongly related to the target downstream domain and does not have noise can be obtained, which greatly improves the quality of the expanded sample data. Based on the third sample data and the actual sample data, the first fine-tuning model is fine-tuned again to determine the second fine-tuning model, and the target downstream task model is determined based on the second fine-tuning model, so that the model fine-tuning effect can be improved, and then the model performance of the downstream task model obtained by fine-tuning can be guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0027] Figure 1 is a flowchart of a pre-training model fine-tuning method provided by an embodiment of the present invention;
[0028] Figure 2 is a flowchart of another pre-training model fine-tuning method provided by an embodiment of the present invention;
[0029] Figure 3 It is a structural schematic diagram of a pre-training model fine-tuning device provided by an embodiment of the present invention;
[0030] Figure 4 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0031] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0032] Figure 1The present invention provides a flowchart of a method for fine-tuning a pre-trained model. This embodiment is applicable to the case where a pre-trained model is fine-tuned based on a downstream task, especially to the scenario where a pre-trained model is fine-tuned based on a downstream translation task. The method can be performed by a pre-trained model fine-tuning device, which can be implemented by software and / or hardware and integrated into an electronic device. Figure 1 As shown, the method specifically comprises the following steps:
[0033] S110: Acquire first sample data associated with a target downstream task.
[0034] The target downstream task may refer to a specific downstream task to be fine-tuned. For example, the target downstream task may be, but is not limited to, a translation task, so as to fine-tune the pre-trained model based on the translation task to obtain a translation model. The first sample data may refer to a large amount of sample data that is relevant to the target downstream task and is easily obtained.
[0035] Specifically, for the target downstream task, each first sample data similar to the actual sample data corresponding to the target downstream task, that is, the first sample data set, can be obtained. This embodiment can obtain each first sample data that belongs to the same or similar task as the target downstream task, but has a coarser granularity and is easier to obtain. For example, if the target downstream task is a fine-grained aspect-level sentiment analysis task, the first sample data (large data volume) of the sentence-level sentiment analysis that belongs to the sentiment analysis task but has a coarser granularity can be obtained, so as to use the first sample data to perform sample expansion on the actual sample data.
[0036] S120: Perform data domain analysis on the first sample data based on a preset statistical language model, and determine second sample data matching the target downstream domain from the first sample data based on the domain analysis result.
[0037] Among them, the target downstream field may refer to a specific field to which the target downstream task is applied. The preset statistical language model may be a pre-set model for analyzing the data field to which the sample data belongs. For example, the preset statistical language model may be a model for predicting whether the input data belongs to the target downstream field. The preset statistical language model in this embodiment may be obtained by training in advance using the actual sample data corresponding to the target downstream task, so that the degree of relevance of each first sample data to the target downstream field can be determined based on the preset statistical language model.
[0038] Specifically, since the data fields corresponding to the obtained first sample data are relatively broad, it is necessary to perform field screening on the first sample data based on a preset statistical language model in order to obtain second sample data that is the same or similar to the target downstream field, thereby improving the quality of the expanded sample data.
[0039] It should be noted that by screening the second sample data that is similar to the target downstream domain, the problem of catastrophic forgetting of knowledge caused by large domain differences can be avoided during subsequent fine-tuning, thereby greatly improving the model fine-tuning effect.
[0040] Exemplarily, S120 may include: inputting each first sample data into a preset statistical language model for data domain analysis, determining the probability value that the data domain corresponding to each first sample data is the target downstream domain; based on each probability value and a preset probability value threshold range, determining the second sample data matching the target downstream domain from each first sample data.
[0041] Among them, the probability value may refer to the degree of relevance between the data field corresponding to the first sample data and the target downstream field. In this embodiment, the probability value may be represented by a numerical value of 0-1. For example, the larger the probability value, the more relevant it is to the target downstream field. The probability value may also be represented by logarithmic probability. For example, the output probability value is a negative number, and the closer it is to 0, the more relevant it is to the target downstream field. The preset probability value threshold range may be a pre-set probability value range corresponding to the sample data matching the target downstream field. For example, when the probability value is represented by logarithmic probability, the preset probability value threshold range may be set to: [-50, -10].
[0042] Specifically, for each first sample data, the first sample data can be input into a pre-trained preset statistical language model for data domain analysis, and based on the output of the preset statistical language model, the probability value that the data domain corresponding to the first sample data is the target downstream domain can be obtained, and the probability value can be detected whether it is within the preset probability value threshold range. If so, it indicates that the first sample data is strongly correlated with the target downstream domain, and the first sample data can be used as the second sample data. Similarly, each second sample data that is the same or similar to the target downstream domain can be screened out from each first sample data, that is, the second sample data set.
[0043] S130. Fine-tune the pre-trained model based on actual sample data corresponding to the target downstream task to determine a first fine-tuning model.
[0044] Specifically, the large-scale pre-trained model can be fine-tuned for the first time based on the actual sample data and the corresponding actual labels corresponding to the target downstream task, that is, the first training, to obtain the first fine-tuned model. For example, each actual sample data is input into the pre-trained model, and based on the output of the pre-trained model, the corresponding prediction result is obtained, and based on the loss function, the training error is determined according to the prediction result and the actual label, and the training error is back-propagated to the pre-trained model, and the model parameters in the pre-trained model are adjusted until the preset convergence condition is reached, such as when the number of iterations is equal to the preset number, or when the training error changes tend to be stable, it is determined that the fine-tuning of the pre-trained model is completed, and the first fine-tuned model is obtained.
[0045] Among them, the loss function can be but is not limited to the cross entropy loss function L, which can be expressed as follows:
[0046]
[0047] Among them, y and p represent the actual label and prediction result corresponding to the actual sample data respectively; i and j represent the sample index and label category index in the actual sample data set respectively.
[0048] S140: Based on the first fine-tuning model, perform denoising on the second sample data to obtain denoised third sample data.
[0049] Specifically, since there is a lot of noise in the second sample data that is associated with and strongly correlated to the target downstream task, the first fine-tuning model is used to denoise each second sample data to obtain each third sample data without noise in the second sample data, that is, the third sample data set, thereby improving the quality of the expanded third sample data.
[0050] Exemplarily, S140 may include: inputting each second sample data into the first fine-tuning model to determine the output result corresponding to each second sample data; based on the output result and actual label corresponding to each second sample data, denoising each second sample data to obtain denoised third sample data.
[0051] Specifically, the first fine-tuning model can be used to re-label the second sample data that is strongly relevant to each field, and based on the re-labeled output results and the actual labels of the original labels, the noisy sample data in each second sample data can be removed to obtain denoised third sample data.
[0052] Exemplarily, based on the output results and actual labels corresponding to each second sample data, denoising each second sample data to obtain denoised third sample data can include: detecting whether the output result corresponding to each second sample data and the corresponding actual label are consistent; and determining each second sample data whose detected output result is consistent with the actual label as the denoised third sample data.
[0053] Specifically, the second sample data whose output results are consistent with the actual label are selected, and the second sample data whose output results are inconsistent with the actual label are removed, thereby realizing the denoising operation of the second sample data through self-calibration. Without human intervention, a large amount of third sample data with higher quality is automatically and quickly obtained, thereby improving the quality of the expanded sample data while expanding the downstream task sample data.
[0054] S150. Based on the third sample data and the actual sample data, fine-tune the first fine-tuning model again to determine a second fine-tuning model, and determine a target downstream task model based on the second fine-tuning model.
[0055] Specifically, the third sample data that is strongly related to the target downstream field and does not contain noise can be mixed with the actual sample data to expand the amount of actual sample data, so that the first fine-tuning model is retrained based on the expanded large amount of sample data, that is, fine-tuned again. The fine-tuning process is similar to the first fine-tuning process, so that the fine-tuned second fine-tuning model can be obtained, thereby improving the fine-tuning effect. In this embodiment, the second fine-tuning model can be directly used as the target downstream task model finally obtained, so as to use the target downstream task model to process the corresponding downstream tasks, thereby ensuring the model performance of the target downstream task model.
[0056] The technical solution of this embodiment performs data domain analysis on the first sample data associated with the target downstream task based on a preset statistical language model, and determines the second sample data matching the target downstream field from the first sample data based on the field analysis result, that is, obtains the second sample data strongly related to the target downstream field, and uses the first fine-tuning model that fine-tunes the pre-trained model based on the actual sample data to denoise the second sample data to obtain the denoised third sample data, so that based on the preset statistical language model and the self-calibration method, the third sample data that is strongly related to the target downstream field and does not have noise can be obtained, which greatly improves the quality of the expanded sample data. Based on the third sample data and the actual sample data, the first fine-tuning model is fine-tuned again to determine the second fine-tuning model, and the target downstream task model is determined based on the second fine-tuning model, so that the model fine-tuning effect can be improved, and then the model performance of the downstream task model obtained by fine-tuning can be guaranteed.
[0057] On the basis of the above technical solution, "based on the third sample data and the actual sample data, fine-tuning the first fine-tuning model again to determine the second fine-tuning model" in S150 may include: based on the third sample data, fine-tuning the first fine-tuning model again to determine the third fine-tuning model; based on the actual sample data, fine-tuning the third fine-tuning model again to determine the second fine-tuning model.
[0058] Specifically, the first fine-tuning model is first fine-tuned based on the third sample data, and based on the obtained third fine-tuning model, the third fine-tuning model is fine-tuned again based on the actual sample data. Thus, by utilizing the two-stage fine-tuning method, a second fine-tuning model with better fine-tuning effect can be obtained, further avoiding the influence of pseudo-noise in the third sample data on the fine-tuning effect, and further ensuring the model performance of the downstream task model.
[0059] Figure 2 This is a flowchart of another pre-training model fine-tuning method provided by an embodiment of the present invention. Based on the above embodiments, this embodiment further optimizes the step of "determining the target downstream task model based on the second fine-tuning model". The explanations of the terms that are the same or corresponding to the above embodiments are not repeated here.
[0060] See also Figure 2 Another pre-training model fine-tuning method provided in this embodiment specifically includes the following steps:
[0061] S210: Acquire first sample data associated with a target downstream task.
[0062] S220: Perform data domain analysis on the first sample data based on a preset statistical language model, and determine second sample data matching the target downstream domain from the first sample data based on the domain analysis result.
[0063] S230. Fine-tune the pre-trained model based on actual sample data corresponding to the target downstream task to determine a first fine-tuning model.
[0064] S240: Based on the first fine-tuning model, perform denoising on the second sample data to obtain denoised third sample data.
[0065] S250: Based on the third sample data and the actual sample data, fine-tune the first fine-tuning model again to determine a second fine-tuning model.
[0066] S260: Acquire actual test data, and use the second fine-tuning model as the current fine-tuning model.
[0067] The actual test data may be real data used to test the downstream model. The actual test data is closer to the application data processed in the model application stage. In this embodiment, the label information of the sample data used to train the model can be directly stored in the training side, while the training side does not store the label information of the test data.
[0068] Specifically, actual test data without label information corresponding to the target downstream task can be obtained, and the second fine-tuning model can be used as the initial model of the current fine-tuning model, so that subsequent first-iteration learning can be performed based on the actual test data and the second fine-tuning model, thereby effectively reducing the domain difference between the sample data used for model training and the test data, and further improving the model performance.
[0069] S270: Based on the current fine-tuning model, annotate the actual test data to obtain annotated current test data.
[0070] Specifically, each actual test data may be tested based on the current fine-tuning model, and the corresponding actual test data may be labeled based on the test result, so that the current test data with labels may be obtained.
[0071] Exemplarily, S270 may include: inputting actual test data into the current fine-tuning model to determine the test results corresponding to the actual test data; and labeling the test results corresponding to the actual test data as pseudo labels to obtain the labeled current test data.
[0072] Specifically, each actual test data can be input into the test result output by the current fine-tuning model as a pseudo label for the corresponding actual test data, so that a current test data set with pseudo labels can be constructed.
[0073] S280: Based on the annotated current test data and actual sample data, fine-tune the current fine-tuning model again to update the current fine-tuning model.
[0074] Specifically, the current test data set with pseudo labels is mixed with the actual sample data, the current fine-tuning model is retrained, and the fine-tuning model obtained after retraining is updated to the current fine-tuning model for the next iterative learning. Through the conductive learning method, the knowledge learned on the actual sample data can be generalized to the actual test data of the target downstream task, thereby effectively reducing the domain difference between the actual sample data and the actual test data, and further improving the performance of the model on the actual test data.
[0075] S290, check whether the preset test stop condition is currently met, if so, execute step S291, if not, return to execute step S270.
[0076] Among them, the preset test stop condition may include: the number of iterations is equal to the preset number or the current fine-tuning model performance reaches the preset performance.
[0077] Specifically, if it is detected that the preset test stop condition is not met, the current test data can be re-labeled based on the current fine-tuned model and the current fine-tuned model can be fine-tuned again by returning to execute steps S270-S280 until the preset test stop condition is met, and step S291 is executed.
[0078] S291. Use the current fine-tuning model as the target downstream task model.
[0079] Specifically, when the preset test stop condition is currently met, it indicates that the model performance of the current fine-tuning model is optimal. At this time, the current fine-tuning model can be used as the target downstream task model.
[0080] The technical solution of this embodiment is to use the second fine-tuning model as the current fine-tuning model, and based on the current fine-tuning model, annotate the actual test data to obtain the annotated current test data, and based on the annotated current test data and the actual sample data, fine-tune the current fine-tuning model again, update the current fine-tuning model, and return to execute the step of annotating the actual test data based on the current fine-tuning model until the preset test stop condition is met, and use the current fine-tuning model as the target downstream task model, so as to effectively reduce the domain difference between the actual sample data and the actual test data, further improve the performance of the model on the actual test data, and then improve the model performance of the target downstream task model finally obtained.
[0081] The following is an embodiment of a pre-trained model fine-tuning device provided in an embodiment of the present invention. The device and the pre-trained model fine-tuning methods of the above-mentioned embodiments belong to the same inventive concept. For details not described in detail in the embodiment of the pre-trained model fine-tuning device, please refer to the embodiment of the above-mentioned pre-trained model fine-tuning method.
[0082] Figure 3 This is a schematic diagram of the structure of a pre-training model fine-tuning device provided in an embodiment of the present invention. This embodiment is applicable to the situation where the pre-training model is fine-tuned based on downstream tasks, especially to the scenario where the pre-training model is fine-tuned based on downstream translation tasks. Figure 3 As shown, the device specifically includes: a first sample data acquisition module 310, a second sample data determination module 320, a first fine-tuning model determination module 330, a third sample data determination module 340 and a target downstream task model determination module 350.
[0083] Among them, the first sample data acquisition module 310 is used to acquire the first sample data associated with the target downstream task; the second sample data determination module 320 is used to perform data domain analysis on the first sample data based on a preset statistical language model, and determine the second sample data matching the target downstream domain from the first sample data based on the domain analysis result; the first fine-tuning model determination module 330 is used to fine-tune the pre-trained model based on the actual sample data corresponding to the target downstream task and determine the first fine-tuning model; the third sample data determination module 340 is used to denoise the second sample data based on the first fine-tuning model to obtain the denoised third sample data; the target downstream task model determination module 350 is used to fine-tune the first fine-tuning model again based on the third sample data and the actual sample data, determine the second fine-tuning model, and determine the target downstream task model based on the second fine-tuning model.
[0084] The technical solution of this embodiment performs data domain analysis on the first sample data associated with the target downstream task based on a preset statistical language model, and determines the second sample data matching the target downstream field from the first sample data based on the field analysis result, that is, obtains the second sample data strongly related to the target downstream field, and uses the first fine-tuning model that fine-tunes the pre-trained model based on the actual sample data to denoise the second sample data to obtain the denoised third sample data, so that based on the preset statistical language model and the self-calibration method, the third sample data that is strongly related to the target downstream field and does not have noise can be obtained, which greatly improves the quality of the expanded sample data. Based on the third sample data and the actual sample data, the first fine-tuning model is fine-tuned again to determine the second fine-tuning model, and the target downstream task model is determined based on the second fine-tuning model, so that the model fine-tuning effect can be improved, and then the model performance of the downstream task model obtained by fine-tuning can be guaranteed.
[0085] Optionally, the second sample data determination module 320 is specifically configured to:
[0086] Each first sample data is input into a preset statistical language model for data domain analysis to determine the probability value that the data domain corresponding to each first sample data is the target downstream domain; based on each probability value and a preset probability value threshold range, second sample data matching the target downstream domain is determined from each first sample data.
[0087] Optionally, the third sample data determination module 340 includes:
[0088] A second sample data input unit, used for inputting each second sample data into the first fine-tuning model to determine an output result corresponding to each second sample data;
[0089] The third sample data determining unit is used to perform denoising processing on each second sample data based on the output result and the actual label corresponding to each second sample data to obtain denoised third sample data.
[0090] Optionally, the third sample data determining unit is specifically configured to: detect whether an output result corresponding to each second sample data is consistent with a corresponding actual label; and determine each second sample data whose detected output result is consistent with the actual label as the denoised third sample data.
[0091] Optionally, the target downstream task model determination module 350 includes:
[0092] The second fine-tuning model determination unit is used to: fine-tune the first fine-tuning model again based on the third sample data to determine the third fine-tuning model; fine-tune the third fine-tuning model again based on the actual sample data to determine the second fine-tuning model.
[0093] Optionally, the target downstream task model determination module 350 further includes:
[0094] The target downstream task model determination unit is used to: obtain actual test data and use the second fine-tuning model as the current fine-tuning model; based on the current fine-tuning model, annotate the actual test data to obtain the annotated current test data; based on the annotated current test data and actual sample data, fine-tune the current fine-tuning model again, update the current fine-tuning model, and return to execute the step of annotating the actual test data based on the current fine-tuning model; when the preset test stop condition is met, use the current fine-tuning model as the target downstream task model.
[0095] Optionally, the target downstream task model determination unit is specifically used to: input actual test data into the current fine-tuning model to determine the test results corresponding to the actual test data; label the test results corresponding to the actual test data as pseudo labels to obtain the labeled current test data.
[0096] The pre-trained model fine-tuning device provided in the embodiment of the present invention can execute the pre-trained model fine-tuning method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the pre-trained model fine-tuning method.
[0097] It is worth noting that in the embodiment of the above-mentioned pre-trained model fine-tuning device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0098] Figure 4A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 4 A block diagram of an exemplary electronic device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 4 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0099] like Figure 4 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).
[0100] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0101] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0102] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 4 not shown, usually called a "hard drive"). Although Figure 4 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0103] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0104] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 12, and / or may communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0105] The processing unit 16 executes various functional applications and data processing by running the program stored in the system memory 28, for example, implementing a pre-training model fine-tuning method provided in an embodiment of the present invention, the method comprising:
[0106] Acquire first sample data associated with a target downstream task;
[0107] Based on a preset statistical language model, performing data domain analysis on the first sample data, and based on the domain analysis result, determining second sample data matching the target downstream domain from the first sample data;
[0108] Based on actual sample data corresponding to the target downstream task, fine-tune the pre-trained model to determine a first fine-tuned model;
[0109] Based on the first fine-tuning model, denoising the second sample data to obtain denoised third sample data;
[0110] Based on the third sample data and the actual sample data, the first fine-tuning model is fine-tuned again to determine the second fine-tuning model, and the target downstream task model is determined based on the second fine-tuning model.
[0111] Of course, those skilled in the art will understand that the processor can also implement the technical solution of the pre-training model fine-tuning method provided in any embodiment of the present invention.
[0112] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the steps of the pre-training model fine-tuning method provided in any embodiment of the present invention are implemented. The method includes:
[0113] Acquire first sample data associated with a target downstream task;
[0114] Based on a preset statistical language model, performing data domain analysis on the first sample data, and based on the domain analysis result, determining second sample data matching the target downstream domain from the first sample data;
[0115] Based on actual sample data corresponding to the target downstream task, fine-tune the pre-trained model to determine a first fine-tuned model;
[0116] Based on the first fine-tuning model, denoising the second sample data to obtain denoised third sample data;
[0117] Based on the third sample data and the actual sample data, the first fine-tuning model is fine-tuned again to determine the second fine-tuning model, and the target downstream task model is determined based on the second fine-tuning model.
[0118] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0119] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0120] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0121] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0122] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0123] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A pre-training model fine-tuning method, characterized in that: include: Acquire first sample data associated with a target downstream task; Based on a preset statistical language model, performing data domain analysis on the first sample data, and based on the domain analysis result, determining second sample data matching the target downstream domain from the first sample data; Based on the actual sample data corresponding to the target downstream task, fine-tune the pre-trained model to determine a first fine-tuning model; Based on the first fine-tuning model, denoising the second sample data to obtain denoised third sample data; Based on the third sample data and the actual sample data, the first fine-tuning model is fine-tuned again to determine a second fine-tuning model, and a target downstream task model is determined based on the second fine-tuning model.
2. The method according to claim 1, characterized in that The performing data domain analysis on the first sample data based on a preset statistical language model, and determining second sample data matching a target downstream domain from the first sample data based on a domain analysis result, includes: Input each of the first sample data into a preset statistical language model to perform data domain analysis, and determine a probability value of the data domain corresponding to each of the first sample data being a target downstream domain; Based on each of the probability values and a preset probability value threshold range, second sample data matching the target downstream domain is determined from each of the first sample data.
3. The method according to claim 1, characterized in that The step of performing denoising on the second sample data based on the first fine-tuning model to obtain denoised third sample data includes: Input each of the second sample data into the first fine-tuning model, and determine an output result corresponding to each of the second sample data; Based on the output results and actual labels corresponding to each second sample data, each second sample data is denoised to obtain denoised third sample data.
4. The method according to claim 3, characterized in that The denoising process is performed on each second sample data based on the output result and the actual label corresponding to each second sample data to obtain the denoised third sample data, including: Check whether the output result corresponding to each second sample data is consistent with the corresponding actual label; Each second sample data whose detected output result is consistent with the actual label is determined as the third sample data after denoising.
5. The method according to claim 1, characterized in that The further fine-tuning of the first fine-tuning model based on the third sample data and the actual sample data to determine the second fine-tuning model includes: Based on the third sample data, fine-tune the first fine-tuning model again to determine a third fine-tuning model; Based on the actual sample data, the third fine-tuning model is fine-tuned again to determine a second fine-tuning model.
6. The method according to any one of claims 1 to 5, characterized in that: The determining a target downstream task model based on the second fine-tuning model includes: Acquire actual test data, and use the second fine-tuning model as the current fine-tuning model; Based on the current fine-tuning model, the actual test data is labeled to obtain labeled current test data; Based on the annotated current test data and the actual sample data, fine-tune the current fine-tuning model again, update the current fine-tuning model, and return to execute the step of annotating the actual test data based on the current fine-tuning model; When the preset test stop condition is met, the current fine-tuned model is used as the target downstream task model.
7. The method according to claim 6, characterized in that The step of labeling the actual test data based on the current fine-tuning model to obtain the labeled current test data includes: Inputting the actual test data into the current fine-tuning model to determine the test results corresponding to the actual test data; The test results corresponding to the actual test data are labeled as pseudo labels to obtain labeled current test data.
8. A pre-training model fine-tuning device, characterized in that: include: A first sample data acquisition module, used to acquire first sample data associated with a target downstream task; a second sample data determination module, configured to perform data domain analysis on the first sample data based on a preset statistical language model, and determine second sample data matching a target downstream domain from the first sample data based on the domain analysis result; A first fine-tuning model determination module, configured to fine-tune the pre-trained model based on actual sample data corresponding to the target downstream task to determine a first fine-tuning model; A third sample data determination module, configured to perform denoising processing on the second sample data based on the first fine-tuning model to obtain denoised third sample data; The target downstream task model determination module is used to further fine-tune the first fine-tuning model based on the third sample data and the actual sample data, determine the second fine-tuning model, and determine the target downstream task model based on the second fine-tuning model.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the pre-trained model fine-tuning method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the pre-training model fine-tuning method as described in any one of claims 1-7 is implemented.
Citation Information
Patent Citations
Pre-training language model generation method and device, electronic equipment and storage medium
CN113705187A
Text classification method based on semi-supervised transfer learning
CN113807171A