Text data enhancement method, device, computer equipment and storage medium

By building a transfer matrix and joint training in the language model, the problem of lack of constraints in the merging of label data and text data in the existing technology is solved, and high-quality enhanced text data is generated, which improves the performance of the deep learning model.

CN114238557BActive Publication Date: 2025-01-07ZHEJIANG BAIYING TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111312250.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-08
Publication Date
2025-01-07
Estimated Expiration
2041-11-08

AI Technical Summary

Technical Problem

During the training process of existing language models, the merging of label data and text data lacks effective constraints, resulting in the confusion of label relationships of generated synthetic data and the inability to effectively improve the performance of deep learning models, especially under low resource conditions.

Method used

By entering the label data and text data into the language model, linearized data is generated and transfer matrix is ​​constructed. The GradNorm algorithm is used to jointly train the language model and conditional random field to ensure that the transfer relationship between label data is effectively constrained, thereby generating high-quality enhanced text data.

Benefits of technology

By building the transfer matrix and joint training, the relationship between label data is effectively constrained, and the generated enhanced text data quality improvement is improved, which reduces the risk of overfitting and improves the performance of deep learning models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114238557B_ABST
    Figure CN114238557B_ABST
Patent Text Reader

Abstract

The present application relates to the field of artificial intelligence technology, and in particular to a method, device, computer equipment and storage medium for text data enhancement, the method comprising: inputting label data and text data into a language model, and outputting enhanced text data associated with the text data; wherein the language model is trained based on linearized data generated by merging label data and text data, and a transfer matrix constructed based on label data, and the transfer matrix contains the transfer relationship between the label data. The language model of the present invention is trained based on linearized data generated by merging label data and text data, and a transfer matrix constructed based on label data, and controls the rationality and effectiveness of the generated enhanced text data, thereby improving the quality of the enhanced text data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a text data enhancement method, apparatus, computer equipment and storage medium. Background Art

[0002] Training language models often has a great impact on the performance of deep learning models, especially in tasks where text data labeling is difficult and costly. Therefore, data augmentation technology has been widely used to improve the performance of deep learning models under low-resource conditions.

[0003] The existing language model training method first completes the linearization merger of label data and text data, and then linearizes the label data corresponding to each bit of the text data. After the language model training is completed based on the linearized data, the language model is used to generate synthetic data.

[0004] Since the label data is simply merged with the text data, the transfer relationship between the label data lacks good constraints, and there are disadvantages such as the label relationship of the synthetic data is relatively chaotic. Summary of the invention

[0005] Based on this, it is necessary to provide a text data enhancement method, device, computer equipment and storage medium to address the above technical problems.

[0006] In a first aspect, an embodiment of the present invention provides a text data enhancement method, comprising:

[0007] Inputting the label data and the text data into a language model, and outputting enhanced text data associated with the text data;

[0008] The language model is trained based on linearized data generated by merging label data and text data and a transfer matrix constructed based on label data, and the transfer matrix contains transfer relations between the label data.

[0009] In one embodiment, the linearized data is obtained by placing the label data at corresponding words in the text data.

[0010] In one embodiment, the language model is trained in the following manner:

[0011] Use the linearized data as input to the initial language model and calculate the first loss value;

[0012] Use the last layer of the initial language model as the input of the transfer matrix and calculate the second loss value;

[0013] The first loss value and the second loss value are combined based on the GradNorm algorithm to train the initial language model to obtain a trained language model.

[0014] In one embodiment, after inputting the label data and the text data into the language model and outputting the enhanced text data associated with the text data, the method further includes:

[0015] Delete duplicates and arrange enhanced text data that does not conform to preset rules.

[0016] In a second aspect, an embodiment of the present invention provides a text data enhancement device, comprising:

[0017] A data enhancement module, used to input the label data and the text data into the language model, and output enhanced text data associated with the text data;

[0018] The language model is trained based on linearized data generated by merging label data and text data and a transfer matrix constructed based on label data, and the transfer matrix contains transfer relations between the label data.

[0019] In one embodiment, the linearized data is obtained by placing the label data at corresponding words in the text data.

[0020] In one embodiment, the language model is trained in the following manner:

[0021] Use the linearized data as input to the initial language model and calculate the first loss value;

[0022] Use the last layer of the initial language model as the input of the transfer matrix and calculate the second loss value;

[0023] The first loss value and the second loss value are combined based on the GradNorm algorithm to train the initial language model to obtain a trained language model.

[0024] In one embodiment, it further includes:

[0025] The data processing module is used to delete duplicates and arrange the enhanced text data that does not conform to the preset rules.

[0026] In a third aspect, an embodiment of the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the first aspect when executing the computer program.

[0027] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the processor implements the steps of the first aspect when executing the computer program.

[0028] The above method, apparatus, computer device and storage medium output enhanced text data associated with the text data by inputting label data and text data into a language model; wherein the language model is trained based on linearized data generated by merging label data and text data and a transfer matrix constructed based on label data, and the transfer matrix contains the transfer relationship between the label data. The language model of the present invention is trained based on linearized data generated by merging label data and text data and a transfer matrix constructed based on label data, and controls the rationality and effectiveness of the generated enhanced text data, thereby improving the quality of the enhanced text data. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 A diagram showing an application environment of a text data enhancement method in an embodiment;

[0030] Figure 2 Schematic diagram of a flow chart of a text data enhancement method in one embodiment;

[0031] Figure 3 A flow chart of a language model training method in one embodiment;

[0032] Figure 4 The figure is a diagram of the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0034] The text data enhancement method provided in this application can be applied to Figure 1 In the application environment shown. The terminal 102 communicates with the server 104 through a network. The terminal 102 first inputs the label data and the text data into the language model, outputs the enhanced text data associated with the text data, and then sends the enhanced text data to the server 104. The terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the server 104 can be implemented as an independent server or a server cluster consisting of multiple servers.

[0035] In one embodiment, if Figure 2 As shown, a text data enhancement method is provided, which is applied to Figure 1 The following is an example of a terminal in the example, including:

[0036] S202: inputting the label data and the text data into a language model, and outputting enhanced text data associated with the text data;

[0037] The language model is trained based on linearized data generated by merging label data and text data and a transfer matrix constructed based on label data, and the transfer matrix contains transfer relations between the label data.

[0038] In the NER task, the data set is in the form of a line of text corresponding to a line of labels. The practice of placing the label corresponding to each word in the sentence after the word is called linearization.

[0039] Since the language model trained by the prior art has the problem of output independence, only the generative dependency relationship between words in a sentence is modeled, but the transfer relationship between the label data contained in the words is not modeled. To solve this problem, a conditional random field, that is, a matrix, is introduced in this embodiment to constrain the legal transfer relationship between label data. And the language model and the conditional random field are jointly trained in the form of multi-task.

[0040] The transfer matrix is ​​a square matrix with both rows and columns containing label data. The transfer probability between label data can be modeled through this matrix. By training this matrix, the transfer matrix can learn the transfer probability between label data from the training data set. The transfer probability can be considered as the constraints learned by the transfer matrix. These constraints contribute to ensuring the effectiveness of the final predicted entity label data sequence.

[0041] In one embodiment, the linearized data is obtained by placing the label data in the corresponding words in the text data. Synthetic data generated based on a wider semantic space than rules introduces more diversity, thereby reducing the risk of overfitting when downstream task models use these synthetic data.

[0042] In one embodiment, if Figure 3 As shown, the language model is trained in the following way:

[0043] S302: Using the linearized data as input of the initial language model, calculating a first loss value;

[0044] S304: Using the last layer of the initial language model as the input of the transfer matrix, calculating the second loss value;

[0045] S306: Based on the GradNorm algorithm, the first loss value and the second loss value are combined to train an initial language model to obtain a trained language model.

[0046] In order to balance the imbalance of loss values ​​between tasks in multi-tasks, which causes the overall training to be dominated by a single task, in this embodiment, the GradNorm algorithm is introduced to balance the loss values ​​of multiple tasks. GradNorm is used to effectively synthesize and control the loss values ​​in the multi-task mechanism, solving the problem that the loss value of a single task in the multi-task mechanism is too large, thereby dominating the overall loss value.

[0047] In one embodiment, after inputting the label data and the text data into the language model and outputting the enhanced text data associated with the text data, the method further includes:

[0048] Delete duplicates and arrange enhanced text data that does not conform to preset rules.

[0049] For example, when BIO annotation is used, the data starts with the I label. The last batch of synthetic data can be mixed with the Gold Data in a certain ratio in the form of oversampling. In most experiments conducted by the present invention, the best performance was obtained at a ratio of 4:1.

[0050] It should be understood that although Figure 1-3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-3 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0051] In one embodiment, the present invention provides a text data enhancement device, the device comprising:

[0052] A data enhancement module, used to input the label data and the text data into the language model, and output enhanced text data associated with the text data;

[0053] The language model is trained based on linearized data generated by merging label data and text data and a transfer matrix constructed based on label data, and the transfer matrix contains transfer relations between the label data.

[0054] In one embodiment, the linearized data is obtained by placing the label data at corresponding words in the text data.

[0055] In one embodiment, the language model is trained in the following manner:

[0056] Use the linearized data as input to the initial language model and calculate the first loss value;

[0057] Use the last layer of the initial language model as the input of the transfer matrix and calculate the second loss value;

[0058] The first loss value and the second loss value are combined based on the GradNorm algorithm to train the initial language model to obtain a trained language model.

[0059] In one embodiment, it further includes:

[0060] The data processing module is used to delete duplicates and arrange the enhanced text data that does not conform to the preset rules.

[0061] The specific definition of the text data enhancement device can be found in the definition of the text data enhancement method above, which will not be repeated here. Each module in the above-mentioned text data enhancement device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0062] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store motion detection data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in any of the above-mentioned text data enhancement method embodiments are implemented.

[0063] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0064] In one embodiment, 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 in any of the above-mentioned text data enhancement method embodiments are implemented.

[0065] In one embodiment, 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 in any of the above-mentioned text data enhancement method embodiments are implemented.

[0066] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0067] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

Claims

1. A text data enhancement method, characterized in that: include: Inputting the label data and the text data into a language model, and outputting enhanced text data associated with the text data; The language model is trained based on linearized data generated by combining label data and text data and a transfer matrix constructed based on label data, and the transfer matrix includes transfer relations between the label data; The linearized data is obtained by placing the label data in the corresponding words in the text data; The language model is specifically trained in the following manner: Use the linearized data as input to the initial language model and calculate the first loss value; Use the last layer of the initial language model as the input of the transfer matrix and calculate the second loss value; The first loss value and the second loss value are combined based on the GradNorm algorithm to train the initial language model to obtain a trained language model.

2. The method according to claim 1, characterized in that After inputting the label data and the text data into the language model and outputting the enhanced text data associated with the text data, the method further includes: Delete duplicates and arrange enhanced text data that does not conform to preset rules.

3. A text data enhancement device, characterized in that: include: A data enhancement module, used to input the label data and the text data into the language model, and output enhanced text data associated with the text data; The language model is trained based on linearized data generated by combining label data and text data and a transfer matrix constructed based on label data, and the transfer matrix includes transfer relations between the label data; The linearized data is obtained by placing the label data in the corresponding words in the text data; The language model is specifically trained in the following manner: Use the linearized data as input to the initial language model and calculate the first loss value; Use the last layer of the initial language model as the input of the transfer matrix and calculate the second loss value; The first loss value and the second loss value are combined based on the GradNorm algorithm to train the initial language model to obtain a trained language model.

4. The device according to claim 3, characterized in that Also includes: The data processing module is used to delete duplicates and arrange the enhanced text data that does not conform to the preset rules.

5. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 2 are implemented.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 2 are implemented.

Citation Information

Patent Citations

  • Address data labeling method and device, electronic equipment and storage medium

    CN111125365A

  • Event extraction method and system

    CN111694924A