Method for training information extraction model, information extraction method and device

By using a learning framework that progresses from easy to difficult, the information extraction model is trained step by step. By utilizing sub-tasks of the target task and combined training data, the problem of insufficient accuracy of the unified information extraction model in extracting complex types of targets is solved, and information extraction with high accuracy and versatility is achieved.

CN116644311BActive Publication Date: 2026-06-02ALIBABA (CHINA) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ALIBABA (CHINA) CO LTD
Filing Date
2023-04-18
Publication Date
2026-06-02

Smart Images

  • Figure CN116644311B_ABST
    Figure CN116644311B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a method and device for training an information extraction model. The main technical solution comprises: obtaining training data of a target task; determining a subtask of the target task; training an information extraction model using training data of the subtask until a preset first training end condition is met; determining combined training data of the target task; further training the information extraction model based on the already trained information extraction model using the combined training data until a preset second training end condition is met; and further training the information extraction model based on the already trained information extraction model using the training data of the target task to obtain an information extraction model for information extraction. The present application provides a learning framework from easy to difficult for the information extraction model, which can significantly improve the information extraction accuracy of the information extraction model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of artificial intelligence and natural language processing technology, and in particular to a method, method and apparatus for training an information extraction model. Background Technology

[0002] Information extraction (IE) refers to the process of using information extraction models to extract specific types of targets from text, thereby automatically classifying, extracting, and reconstructing massive amounts of content, such as named entity recognition, entity relationship extraction, event extraction, and sentiment extraction.

[0003] Traditional information extraction techniques mostly train models for specific types of targets, resulting in poor generalization. To address this issue, unified information extraction techniques have been proposed, which use a single model to solve extraction tasks for various information types. Existing unified information extraction schemes all employ a one-step generation approach, but this method suffers from poor target accuracy, especially when extracting complex target types. Summary of the Invention

[0004] In view of this, this application provides a method for training an information extraction model, an information extraction method, and an apparatus, thereby improving the accuracy of information extraction.

[0005] This application provides the following solution:

[0006] Firstly, a method for training an information extraction model is provided, the method comprising:

[0007] Acquire training data for the target task, wherein the training data for the target task includes multiple first training samples, wherein the first training samples include first text samples and target samples corresponding to the first extraction conditions specified by the target task and labeled for the first text samples;

[0008] The subtasks of the target task are determined, and the information extraction model is trained using the training data of the subtasks until a preset first training termination condition is met. The training data of the subtasks includes multiple second training samples. The second training samples include second text samples and target samples corresponding to the second extraction conditions specified by the subtasks for the second text samples. The second extraction conditions are some of the sub-conditions in the first extraction conditions.

[0009] Determine the combined training data for the target task, the combined training data including multiple third training samples, the third training samples being obtained by merging more than one first training sample; using the combined training data, further train the information extraction model based on the already trained model until a preset second training termination condition is met.

[0010] The information extraction model is further trained using the training data of the target task to obtain an information extraction model for information extraction.

[0011] According to one achievable method in an embodiment of this application, the second text sample in the second training sample is the first text sample in the first training sample selected from the training data of the target task; the target sample in the second training sample is the part corresponding to the second extraction condition in the target sample of the selected first training sample.

[0012] The third training sample includes a third text sample and a target sample corresponding to the first extraction condition specified by the target task for the third text sample. The third text sample is obtained by merging the first text samples from the selected multiple first training samples, and the target sample in the third text sample is obtained by merging the target samples from the selected multiple first training samples.

[0013] According to one achievable method in the embodiments of this application, when training the information extraction model using the training data of the sub-task, the second text sample in the second training sample is used as the input text of the information extraction model, and the training objective is to minimize the difference between the target information corresponding to the second extraction condition extracted by the information extraction model from the input text and the target sample in the second training sample.

[0014] When training the information extraction model using the combined training data, the text samples in the third training sample are used as the input text of the information extraction model. The training objective is to minimize the difference between the target information corresponding to the first extraction condition extracted by the information extraction model from the input text and the target sample in the third training sample.

[0015] When training the information extraction model using the training data of the target task, the first text sample in the first training sample is used as the input text of the information extraction model. The training objective is to minimize the difference between the target information corresponding to the first extraction condition extracted by the information extraction model from the input text and the target sample in the first training sample.

[0016] According to one achievable method in an embodiment of this application, the information extraction model adopts a sequence-to-sequence model;

[0017] The input sequence of the information extraction model includes extraction condition information and the input text, wherein the extraction condition information is the information of the first extraction condition or the information of the second extraction condition.

[0018] The output sequence of the information extraction model includes target information, or includes target information and its corresponding target type information.

[0019] According to one achievable method in an embodiment of this application, the extraction condition information includes:

[0020] The target type information extracted, or,

[0021] Extracted target type information and instance information corresponding to some target types.

[0022] Secondly, a method for training an entity triple extraction model is provided, the method comprising:

[0023] The training data for the entity triple extraction task is obtained. The training data for the entity triple extraction task includes multiple first training samples. The first training samples include first text samples and entity triple samples corresponding to the first extraction conditions specified by the entity triple extraction task for the first text samples. The entity triples include head entities and their entity types, tail entities and their entity types, and the relationship between head entities and tail entities.

[0024] The subtasks of the entity triple extraction task are determined, and the entity triple extraction model is trained using the training data of the subtasks until a preset first training termination condition is met. The training data of the subtasks includes multiple second training samples. The second training samples include second text samples and target samples corresponding to the second extraction conditions specified by the subtasks for the second text samples. The second extraction conditions are some sub-conditions in the first extraction conditions.

[0025] Determine the combined training data for the entity triple extraction task. The combined training data includes multiple third training samples, which are obtained by merging more than one first training sample. Using the combined training data, further train the entity triple extraction model based on the already trained model until a preset second training termination condition is met.

[0026] Using the training data from the entity triple extraction task, the entity triple extraction model is further trained based on the already trained model to obtain an entity triple extraction model for extracting entity triple information.

[0027] According to one achievable method in an embodiment of this application, the target sample corresponding to the second extraction condition specified for the subtask annotating the second text sample includes at least one of the following:

[0028] The entity words and their entity types in the second text sample;

[0029] Entity relation words in the second text sample;

[0030] The second text sample specifies a triple of head entity type or head entity word, which includes head entity, tail entity, and the relationship between head entity and tail entity;

[0031] The second text sample specifies a triple of a relation type, which includes a head entity, a tail entity, and the relationship between the head entity and the tail entity.

[0032] Thirdly, a method for training an emotion extraction model is provided, the method comprising:

[0033] Acquire training data for the sentiment extraction task. The training data for the sentiment extraction task includes multiple first training samples. The first training samples include first text samples and sentiment element samples corresponding to the first extraction conditions specified by the sentiment extraction task and labeled for the first text samples.

[0034] The subtasks of the sentiment extraction task are determined, and the sentiment extraction model is trained using the training data of the subtasks until a preset first training termination condition is met. The training data of the subtasks includes multiple second training samples. The second training samples include second text samples and sentiment element samples corresponding to the second extraction condition specified by the subtask for the second text samples. The second extraction condition is a part of the sub-conditions in the first extraction condition.

[0035] Determine the combined training data for the emotion extraction task, the combined training data including multiple third training samples, the third training samples being obtained by merging more than one first training sample; using the combined training data, further train the already trained emotion extraction model until a preset second training termination condition is met.

[0036] By using the training data from the aforementioned emotion extraction task, the already trained emotion extraction model is further trained to obtain an emotion extraction model for extracting emotion elements.

[0037] According to one achievable method in an embodiment of this application, the sentiment element sample corresponding to the second extraction condition specified for the subtask labeled with the second text sample includes at least one of the following:

[0038] The sentiment objects and sentiment words in the second text sample;

[0039] The second text sample specifies an emotion object type or an emotion triplet for an emotion object, wherein the emotion triplet includes an emotion object, an emotion word, and an emotion polarity;

[0040] The sentiment polarity in the second text sample;

[0041] The second text sample specifies the sentiment triplet of the sentiment polarity type.

[0042] Fourthly, a method for information extraction is provided, the method comprising:

[0043] Get the text to be extracted;

[0044] The text to be extracted is input into the information extraction model, and the target information corresponding to the preset first extraction condition extracted by the information extraction model from the text to be extracted is obtained.

[0045] The information extraction model described above is pre-trained using the method described in the first aspect above.

[0046] Fifthly, an apparatus for training an information extraction model is provided, the apparatus comprising:

[0047] The sample acquisition unit is configured to acquire training data for a target task. The training data for the target task includes multiple first training samples. The first training samples include first text samples and target samples corresponding to the first extraction conditions specified by the target task and labeled for the first text samples.

[0048] The first training unit is configured to determine a subtask of the target task and train an information extraction model using the training data of the subtask until a preset first training termination condition is met. The training data of the subtask includes multiple second training samples. The second training samples include second text samples and target samples corresponding to the second extraction conditions specified by the subtask for the second text samples. The second extraction conditions are some of the sub-conditions in the first extraction conditions.

[0049] The second training unit is configured to determine the combined training data for the target task, the combined training data including multiple third training samples, the third training samples being obtained by merging more than one first training sample; using the combined training data, further training is performed on the already trained information extraction model until a preset second training termination condition is met.

[0050] The third training unit is configured to further train the already trained information extraction model using the training data of the target task, to obtain an information extraction model for information extraction.

[0051] Sixthly, an information extraction device, the device comprising:

[0052] The text acquisition unit is configured to acquire the text to be extracted.

[0053] The information extraction unit is configured to input the text to be extracted into the information extraction model and obtain the target information corresponding to the preset first extraction condition extracted by the information extraction model from the text to be extracted.

[0054] The information extraction model is pre-trained by the apparatus described in the fifth aspect above.

[0055] According to a seventh aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any one of the first aspects.

[0056] According to the eighth aspect, an electronic device is provided, comprising:

[0057] One or more processors; and

[0058] A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any one of the first aspects above.

[0059] According to the specific embodiments provided in this application, the following technical effects are disclosed:

[0060] 1) This application provides an easy-to-difficult learning framework for information extraction models. First, the information extraction model is trained using sub-tasks of the target task, enabling it to learn simple and basic information extraction capabilities. Then, combined training data from the target task is used to learn complex instances, thereby improving information extraction capabilities. Finally, the final information extraction model is trained using the training data from the target task. This approach can significantly improve the information extraction accuracy of the information extraction model.

[0061] 2) In this application, the training data for the sub-tasks and the combined training data can be constructed using the training data for the target task, thus avoiding the manual cost of constructing additional training data.

[0062] 3) The information extraction model of this application adopts a sequence-to-sequence model, which transforms the information extraction task into the task of predicting text sequences that include target information, or text sequences that include both target information and target type information. This eliminates the need for special model design for different information extraction tasks, improves the versatility of the information extraction model, and fully utilizes the powerful generative capabilities of generative models.

[0063] Of course, any product implementing this application does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0064] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0065] Figure 1 This is a system architecture diagram applicable to the embodiments of this application;

[0066] Figure 2 A flowchart illustrating the method for extracting training information from a model provided in this application embodiment;

[0067] Figure 3 A flowchart of the information extraction method provided in the embodiments of this application;

[0068] Figure 4 A flowchart illustrating the training method for the entity triple extraction model provided in this application embodiment;

[0069] Figure 5 A flowchart illustrating the training method for the sentiment extraction model provided in this application embodiment;

[0070] Figure 6 A schematic block diagram of an apparatus for extracting training information from a model provided in an embodiment of this application;

[0071] Figure 7 A schematic block diagram of an information extraction device provided in the embodiments of this application;

[0072] Figure 8 A schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0073] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0074] The terminology used in the embodiments of this invention is for the purpose of describing particular embodiments only and is not intended to limit the invention. The singular forms “a,” “the,” and “the” as used in the embodiments of this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0075] It should be understood that the term "and / or" used in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0076] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."

[0077] To facilitate understanding of this application, a brief description of the system architecture to which this application applies will be given first. Figure 1 An exemplary system architecture that can be applied to embodiments of this application is shown, such as Figure 1 As shown, the system architecture includes a model training device that builds an information extraction model offline, and an information extraction device that performs information extraction online.

[0078] In this embodiment, after acquiring training data, the model training device pre-trains the information extraction model using the method provided in this application.

[0079] The information extraction model is used to extract target information that meets specified extraction conditions from the input text to be extracted. The target information can correspond to different content in different application scenarios, such as entity words, entity triples, sentiment elements, event information, etc., which will be detailed in subsequent embodiments. The information extraction device can use the above-described information extraction model to obtain target information that meets the specified extraction conditions from the text to be extracted.

[0080] The model training device and the information extraction device can be configured as separate servers, or they can be configured on the same server or server group, or they can be configured on a separate or the same cloud server. A cloud server, also known as a cloud computing server or cloud host, is a host product in the cloud computing service system, designed to address the shortcomings of traditional physical hosts and Virtual Private Servers (VPS) services, such as high management difficulty and weak service scalability. The model training device or information extraction device can also be configured on a computer terminal with strong computing capabilities.

[0081] In one common scenario, users can use a user terminal to interact with an information extraction device set up on the server. Various applications can be installed on the user terminal, such as voice interaction applications, web browser applications, and communication applications.

[0082] User terminals can be various electronic devices, including those with screens and those without. These include, but are not limited to, smartphones, tablets, smart speakers, smart TVs, PCs (Personal Computers), wearable devices, and so on.

[0083] Users can input text to be extracted through their user terminals. This text is sent over the network to an information extraction device on the server. The information extraction device then extracts the target information that meets the specified extraction criteria from the text and returns the target information to the user terminal. The specified extraction criteria can be user-defined or default.

[0084] It should be understood that Figure 1 The number of model training devices, information extraction devices, user terminals, and information extraction models shown in the diagram is merely illustrative. Depending on implementation needs, any number of model training devices, information extraction devices, user terminals, and information extraction models can be included.

[0085] Information extraction is essentially the process of extracting target information from natural language text based on specified extraction criteria, such as extracting target information of a specific type. Natural language is the primary tool for human communication and thought, and it is a challenge for artificial intelligence. Artificial intelligence's approach to information extraction mimics the human cognitive and learning process of natural language. Before extracting complex information from natural language text, humans always learn simple concepts and abilities first, and then gradually learn complex examples and abilities. Therefore, this application departs from the traditional one-step information extraction model training method, instead mimicking the human learning process and providing a novel learning framework that progresses from easy to difficult.

[0086] Figure 2 This is a flowchart of a method for extracting training information from a model provided in an embodiment of this application. The method can be described by… Figure 1 The model training device in the system architecture shown is executed. For example... Figure 2 As shown, the method may include the following steps:

[0087] Step 202: Obtain training data for the target task. The training data for the target task includes multiple first training samples. The first training samples include first text samples and target samples corresponding to the first extraction conditions specified by the target task for the first text samples.

[0088] Step 204: Determine the subtasks of the target task, and train the information extraction model using the training data of the subtasks until the preset first training termination condition is met; the training data of the subtasks includes multiple second training samples, the second training samples include second text samples and target samples corresponding to the second extraction conditions specified by the subtask for the second text samples, and the second extraction conditions are some of the sub-conditions in the first extraction conditions.

[0089] Step 206: Determine the combined training data for the target task. The combined training data includes multiple third training samples, which are obtained by merging more than one first training sample. Using the combined training data, further train the information extraction model based on the already trained model until the preset second training termination condition is met.

[0090] Step 208: Using the training data of the target task, further train the information extraction model based on the already trained model to obtain the information extraction model used for information extraction.

[0091] As can be seen from the above process, this application provides an easy-to-difficult learning framework for information extraction models. First, the information extraction model is trained using sub-tasks of the target task, enabling it to learn simple and basic information extraction capabilities. Then, combined training data from the target task is used to learn complex instances, thereby improving information extraction capabilities. Finally, the final information extraction model is trained using the training data from the target task. This approach can significantly improve the information extraction accuracy of the information extraction model.

[0092] It should be noted that the terms "first," "second," etc., used in this disclosure do not imply any limitation in size, order, or quantity; they are merely used for descriptive convenience to differentiate between the three training samples. For example, "first training sample," "second training sample," and "third training sample" distinguish three training samples. Similarly, "first extraction condition" and "second extraction condition" distinguish two extraction conditions by their names. And so on.

[0093] The following describes each step in the above method flow. First, step 202, "obtaining training data for the target task," will be described in detail with reference to an embodiment.

[0094] The training data for the target task includes multiple first training samples. Each first training sample includes a first text sample and a target sample corresponding to the first extraction condition specified by the target task, labeled for that first text sample. The first text sample is natural language text. With the explosive growth of network data, text data is readily available, and large amounts of text data can be obtained in any data domain.

[0095] The first extraction condition specified for the target task is related to the specific task type. For example, the first extraction condition for a named entity recognition task could be to extract entities and their entity types. The first extraction condition for an entity triple task could be to extract entity triples, which include a head entity and its entity type, a tail entity and its entity type, and the relationship between the head and tail entities. The first extraction condition for an event extraction task could be to extract event information, which includes event trigger words and their corresponding event types, and event parameter words and their corresponding parameter types. The first extraction condition for a sentiment extraction task could be to extract sentiment elements of a preset type. The following is a description of these tasks:

[0096] Named Entity Recognition (NER) task: Given an input text T, the objective is to identify entity words in T and classify them into predefined entity types, i.e., extract {(e i ,c i )}, where e i c is the i-th entity word in T. i ∈C is e i Let C be the set of entity types. Entity types can be one or more combinations of entities such as person names, place names, organization names, work names, brand names, addresses, dates, etc. When the target task is a NER task, the target samples in the first training sample of the constructed target task training data are the entity words and their corresponding entity types in the first text sample.

[0097] Relation extraction (RE) is also known as entity triple extraction: given an input text T, RE is used to extract entity triples, i.e., extract... in This represents the head entity in the i-th triple. express entity type, This represents the tail entity in the i-th triplet. express The entity type, r i ∈R is and Let R be the set of relations. Then, when the target task is an RE task, in the training data constructed for the target task, the target sample in the first training sample is the entity triplet in the first text sample.

[0098] Event Extraction (EE) task: Given an input text T, extract event information from T, where each event information consists of an event trigger word and its corresponding event type, and event parameter words and their corresponding parameter types. in, It is the i-th event trigger word. It is its corresponding event type. This represents the parameter term for the j-th event of the i-th event. yes The parameter type, C event This includes all event and parameter types. Parameter types can include event subject, event object, occurrence time, occurrence location, etc. Therefore, when the target task is an EE task, the target sample in the first training sample of the constructed target task training data is the event information in the first text sample.

[0099] Sentiment extraction task: Given an input text T, extract sentiment elements from T. Sentiment elements can include sentiment objects, sentiment words, and sentiment polarities. Sentiment elements can be triples or quadruples. For example, extracting the triple {(a...} from T... i ,o i ,p i )}, or extract the quadruple {(c i ,a i ,o i ,p i )}, where a i This refers to the sentiment object in the i-th triple. The sentiment object, also known as the sentiment aspect, refers to the object to which the sentiment is directed. The sentiment object can be a transaction or an attribute of a transaction. For example, in the text "This dress doesn't look good," the sentiment object is the transaction "dress." Similarly, in the text "This dress is too small," the sentiment object is an attribute of a transaction, namely "the size of the dress." i ∈C absa c i It is a i Type. i `p` is the sentiment word in the i-th triplet. Sentiment words, also known as evaluation words or opinion words, refer to words that express emotions, evaluations, or opinions. For example, in the phrase "The apple is so sweet," the sentiment word is "sweet." i C represents the emotional polarity in the i-th triplet. Emotional polarity refers to several discrete values ​​that classify emotions, such as positive, negative, and neutral. absaIt is a set of emotion object types. So when the target task is an emotion extraction task, in the training data constructed for the target task, the target sample in the first training sample is the emotion element information labeled for the first text sample.

[0100] The following describes in detail step 204, namely "determine the sub-tasks of the target task, train the information extraction model using the training data of the sub-tasks, until the preset first training termination condition is met", with reference to the embodiments.

[0101] The "easy-to-difficult" framework provided in this application mainly includes three stages: a simple stage, a complex stage, and a main stage. This step corresponds to the simple stage in the "easy-to-difficult" framework. The subtasks of the target task aim to enable the model to learn the basic ability of information extraction. Therefore, the subtasks of the target task are related to the target task, are simpler than the target task, and can be decomposed from the target task.

[0102] Accordingly, the training data for the sub-task includes multiple second training samples, which include second text samples and target samples corresponding to the second extraction conditions specified by the sub-task for the second text samples. The second extraction conditions are some sub-conditions of the first extraction conditions.

[0103] Taking the RE task as an example, its first extraction condition includes: extracting the head entity and its entity type, the tail entity and its entity type, and the relationship between the head entity and the tail entity.

[0104] Subtasks that can be used to construct RE tasks include:

[0105] Subtask 1: Extract entity words and their entity types from text. That is, given input text T, the information extraction model can extract {(e...} from T. i ,c i Therefore, the training data for subtask 1 is the second text sample, and the entity words and their entity types in the second text sample.

[0106] Subtask 2: Extract relational terms from text. That is, given input text T, the information extraction model can extract {r} from T. i Therefore, the training data for subtask 2 consists of the second text sample and the entity relation words in the second text sample.

[0107] Subtask 3: Extract triples from text containing a specified head entity type or head entity word. Each triple includes the head entity, the tail entity, and the relationship between the head and tail entities. In other words, given the input text T and specified head entity types or head entity words, the information extraction model can extract triples from T containing head entities that match the specified head entity type or head entity word. Therefore, the training data for subtask 3 consists of the second text sample and the triples of the specified head entity type or head entity word in the second text sample.

[0108] Subtask 4: Extract triples of a specified relation type from the text. These triples include a head entity, a tail entity, and the relationship between the head and tail entities. In other words, given the input text T and the specified relation type, the information extraction model can extract triples from T that match the specified relation type. Therefore, the training data for subtask 4 is the second text sample and the triples of the specified relation type in the second text sample.

[0109] Subtasks 1 and 2 above help the information extraction model identify the substructures of entity triples, i.e., entities and entity relationships. Subtasks 3 and 4 help the model learn the dependencies between these substructures. It should be noted that, in addition to the four subtasks listed above, other subtasks can be constructed, such as extracting entity words of a specified entity type from text, etc., which will not be listed here.

[0110] As one possible approach, the training data for the aforementioned sub-tasks can be constructed separately. However, this approach requires additional human resources. Therefore, this application provides another, more preferred implementation method: utilizing existing training data for the target task to obtain training data for the sub-tasks. A first training sample can be selected from the training data of the target task, and a first text sample from the selected first training sample can be used as a second text sample; then, the portion corresponding to the second extraction condition in the target sample of the selected first training sample can be used as the target sample in the second text sample.

[0111] Taking the RE task as an example, the first text sample in its training data is T, and the first target sample corresponding to the first text sample is: For subtask 1, the second text sample in its training data is still T, and the second target sample is {(e i ,c i )}, where e i Source or c i For the corresponding or The other subtasks are similar. It can be seen that the training data for the subtasks can be directly obtained from the training data of the target task, eliminating the need to construct additional training data and saving human resources.

[0112] When training the information extraction model using subtasks, the second text sample in the second training sample is used as the input text for the information extraction model. The information extraction model then extracts the target information corresponding to the second extraction condition from the input text. The training objective is to minimize the difference between the extracted target information and the target sample in the second training sample. Besides this training objective, this application does not limit or exclude other available training objectives.

[0113] As one possible implementation method, the information extraction model provided in this application embodiment can adopt a generative seq2seq (sequence-to-sequence) model. The information extraction model takes a text sequence as input and outputs a text sequence. The input sequence of the information extraction model can include extraction condition information and input text. Specifically, for the subtask, the extraction condition information is the information of the second extraction condition. For the target task, the extraction condition information is the information of the first extraction condition. The output sequence of the information extraction model includes target information, or includes target information and its corresponding target type information.

[0114] The extraction condition information may include the target type information to be extracted, or it may include the target type information and instance information corresponding to some target types.

[0115] As one possible approach, the extraction condition information P can be composed of hint information, constraint information, and schema information. Hint information indicates which targets the task is to extract; for example, "[HE]" can indicate extracting entities, and "[HR]" can indicate extracting entity relationships. Constraint information indicates the specific target type to be extracted; for example, "[Ent]" can indicate the entity type to be extracted, and "[Rel]" can indicate the relationship type to be extracted. Following the entity or relationship types indicated by "[Ent]" and "[Rel]", further indications can be made of specific entity instances or relationship instances. Schema information is used to contain predefined target types, restricting the final extracted targets from these predefined target types; for example, "{ES}" can represent entity schema information, and "{RS}" can represent relationship schema information.

[0116] For example, the input sequence for an input information extraction model can be:

[0117] "[HE][HR][Ent]Name: Xiaoming{RS}{T}"

[0118] The above input sequence represents the extraction of entity triples from T, where the head entity of the entity triple is the name "Xiaoming", and the entity relation is selected from the relation schema information.

[0119] The output sequence corresponding to the above input sequence can be:

[0120] "{Name: Xiaoming (Works at: Company AA)}"

[0121] In this context, “Xiaoming” is the head entity, “AA Company” is the tail entity, and “Working at” represents the relationship between the head and tail entities.

[0122] The information extraction model involved in the embodiments of this application may include an encoder network and a decoder network.

[0123] The encoding network is used to encode the features of each token in the input text sequence to obtain the feature representation of each token.

[0124] The encoding network can first perform embedding processing on each token in the input text sequence. This embedding process can include at least word embedding and position embedding. Word embedding involves encoding each token into word vectors to obtain word vector representations. Position embedding involves encoding the position of each token in the input text sequence to obtain position representations.

[0125] Each token in a text sequence refers to an element that constitutes the text sequence. For a text sequence, if the text sequence is divided into character or word sequences, then the characters or words in the text sequence, as well as the start character and the separator, are all tokens.

[0126] The decoding network is used to perform decoding processing using the feature representation of each token, and the output is also a text sequence. This text sequence includes the target information extracted from the input text sequence, or includes the target information and its corresponding target type information.

[0127] The information extraction model described in this application embodiment can be trained based on a pre-trained language model, employing pre-trained language models such as T5 (Transfer Text-to-Text Transformer), BERT (Bidirectional Encoder Representation from Transformers), XLNet (an autoregressive model that achieves bidirectional contextual information through permutation of language models), and GPT (Generative Pre-Training) as the model framework. BERT is a bidirectional pre-trained language model that uses a Transformer Encoder as its model structure, effectively utilizing contextual information for feature learning. XLNet is a BERT-like model, a more generalized autoregressive pre-trained model. GPT uses a Transformer Decoder structure, retaining only masked multi-head attention within the Transformer Decoder. T5 is still an encoder-decoder structure consisting of stacked Transformer layers, but the Decoder has a standard attention layer after the self-attention layer. This standard attention layer will take the encoder's output into the attention calculation. The last layer of the Decoder outputs the probability of each token belonging to each preset target type through the Softmax classifier.

[0128] If only one subtask is used in the simple stage, the information extraction model is initialized and then trained using the training data from that subtask. If multiple subtasks are used in the simple stage, the information extraction model is initialized and then trained using each subtask separately, with each subtask further trained based on the information extraction model trained in the previous subtask.

[0129] During the training of each subtask, a loss function can be constructed using the training objective of each subtask, such as the maximum likelihood loss function. In each iteration, based on the value of the loss function, the model parameters of the information extraction model are updated using methods such as gradient descent until a preset first training termination condition is met. This first training termination condition may include, for example, the value of the loss function being less than or equal to a preset first loss function threshold, or the number of iterations reaching a preset first number threshold.

[0130] The following describes in detail step 206, namely, "determining the combined training data for the target task and further training the information extraction model based on the already trained model using the combined training data," with reference to an embodiment.

[0131] This step corresponds to the complex stage in the "from easy to difficult" framework provided in the embodiments of this application. It aims to construct training data that is more difficult than the target task, thereby helping the information extraction model learn more complex target information and context. Therefore, more difficult training data can be constructed by combining the first training samples from the training data of the target task, i.e., combined training data.

[0132] The combined training data includes multiple third training samples, each comprising a third text sample and a target sample corresponding to the first extraction condition specified for the target task, labeled on the third text sample. The third text sample can be obtained by merging the first text samples included in the selected multiple first training samples, and the target sample included in the third text sample is obtained by merging the target samples from the selected multiple first training samples.

[0133] For example, in the training data for the target task, there are two first training samples: (P, T1, S1) and (P, T2, S2), where P is the first extraction condition, T1 and T2 are the first text samples from the two first training samples, and S1 and S2 are the target information corresponding to the first text samples from the two first training samples. These two first training samples are combined to obtain a third training sample: (P, ),in This indicates a merged processing. Information extraction models trained using this combined training data can understand the combined information of the two initial training samples, thereby improving the understanding and extraction capabilities of the information extraction model.

[0134] The further training of the information extraction model in this step is based on the information extraction model obtained in the simple stage. During training in this step, the third text sample from the third training sample is used as the input text for the information extraction model. The training objective is to minimize the difference between the target information extracted by the information extraction model from the input text according to the first extraction condition and the target sample in the first training sample. Besides this training objective, this application does not limit or exclude other available training objectives.

[0135] For details regarding the structure of the information extraction model and the content and form of the input and output sequences, please refer to the relevant descriptions in the above embodiments, which will not be repeated here.

[0136] During the training process in this step, a loss function can be constructed using the aforementioned training objectives, such as the maximum likelihood loss function. In each iteration, based on the value of the loss function, the model parameters of the information extraction model are updated using methods such as gradient descent until a preset second training termination condition is met. This second training termination condition may include, for example, the value of the loss function being less than or equal to a preset second loss function threshold, or the number of iterations reaching a preset second number threshold.

[0137] The following describes step 208, namely, "using the training data of the target task to further train the already trained information extraction model to obtain an information extraction model for information extraction," in conjunction with an embodiment.

[0138] This step corresponds to the main task stage in the "from easy to difficult" framework provided in this application embodiment, and is used to train the information extraction model to achieve the target task. The further training of the information extraction model in this step is based on the information extraction model obtained in the complex stage. During training, the first text sample in the first training sample is used as the input text for the information extraction model. The training objective is to minimize the difference between the target information corresponding to the first extraction condition extracted by the information extraction model from the input text and the target sample in the first training sample. Besides this training objective, this application does not limit or exclude other available training objectives.

[0139] During the training process in this step, a loss function can be constructed using the aforementioned training objectives, such as the maximum likelihood loss function. In each iteration, based on the value of the loss function, the model parameters of the information extraction model are updated using methods such as gradient descent until a preset third training termination condition is met. This third training termination condition may include, for example, the value of the loss function being less than or equal to a preset third loss function threshold, or the number of iterations reaching a preset third number threshold.

[0140] After training the final information extraction model using the methods provided in the above embodiments, the information extraction model can be used for information extraction. For example... Figure 3 As shown, the information extraction process may include the following steps:

[0141] Step 302: Obtain the text to be extracted.

[0142] Step 304: Input the text to be extracted into the information extraction model, and obtain the target information corresponding to the preset first extraction condition extracted by the information extraction model from the text to be extracted.

[0143] In this step, the encoding network in the information extraction model encodes the features of each token in the input sequence (including the information of the first extraction condition and the text to be extracted) to obtain the feature representation of each token.

[0144] The encoding network can first perform embedding processing on each token in the input sequence. This embedding process can include at least word embedding and position embedding. Word embedding involves encoding each token into word vectors to obtain word vector representations. Position embedding involves encoding the position of each token in the input sequence to obtain position representations.

[0145] The decoding network is used to perform decoding processing using the feature representation of each token. The output is a text sequence, which is the target information corresponding to the first extraction condition extracted from the text to be extracted, or the target information and its corresponding target type information.

[0146] The methods provided in this application embodiment can be applied to various application scenarios, such as NER recognition, RE extraction, EE extraction, sentiment extraction, etc. The methods provided in this application embodiment will be described below using RE extraction and sentiment extraction as examples.

[0147] RE refers to the entity triplet extraction scenario:

[0148] The model training method in this scenario can be as follows: Figure 4 As shown, the steps include:

[0149] Step 402: Obtain training data for the entity triple extraction task. The training data for the entity triple extraction task includes multiple first training samples. The first training samples include first text samples and entity triple samples corresponding to the first extraction conditions specified by the entity triple extraction task for the first text samples. The entity triples include head entities and their entity types, tail entities and their entity types, and the relationship between head entities and tail entities.

[0150] The RE task is: given an input text T, extract entity triples, i.e., extract... in This represents the head entity in the i-th entity triple. express entity type, This represents the tail entity in the i-th triplet. express The entity type, r i ∈R is and The relationships between them are defined by R, where R is the set of relations. Therefore, in the training data for the constructed target task, the target samples in the first training sample are entity triples annotated against the first text sample. The aforementioned first extraction condition includes: extracting the head entity and its entity type, the tail entity and its entity type, and the relationship between the head and tail entities.

[0151] Step 404: Determine the subtasks of the entity triple extraction task, and train the entity triple extraction model using the training data of the subtasks until the preset first training termination condition is met; the training data of the subtasks includes multiple second training samples, the second training samples include second text samples and target samples corresponding to the second extraction conditions specified by the subtask for the second text samples, and the second extraction conditions are some of the sub-conditions in the first extraction conditions.

[0152] As described in previous embodiments, the subtasks that can be used to construct an RE task include:

[0153] Subtask 1: Extract entity words and their entity types from text. That is, given input text T, the entity triplet extraction model can extract {(e...} from T. i ,c i Therefore, the training data for subtask 1 is the second text sample, and the entity words and their entity types in the second text sample.

[0154] Subtask 2: Extract relational terms from text. That is, given input text T, the entity triple extraction model can extract {r} from T. i Therefore, the training data for subtask 2 consists of the second text sample and the entity relation words in the second text sample.

[0155] Subtask 3: Extract triples from text containing a specified head entity type or head entity word. Each triple includes the head entity, the tail entity, and the relationship between the head and tail entities. In other words, given the input text T and a specified head entity type or head entity word, the entity triple extraction model can extract triples from T whose head entities match the specified head entity type or head entity word. Therefore, the training data for subtask 3 consists of the second text sample and the triples of the specified head entity type or head entity word in the second text sample.

[0156] Subtask 4: Extract triples of a specified relation type from the text. These triples include a head entity, a tail entity, and the relation between the head and tail entities. In other words, given the input text T and the specified relation type, the entity triple extraction model can extract triples from T whose relation words conform to the specified relation type. Therefore, the training data for subtask 4 is the second text sample and the triples of the specified relation type in the second text sample.

[0157] Subtasks 1 and 2 above help the entity triple extraction model identify the substructures of entity triples, i.e., entities and entity relationships. Subtasks 3 and 4 help the model learn the dependencies between these substructures. It should be noted that, in addition to the four subtasks listed above, other subtasks can be constructed, such as extracting entity words of a specified entity type from text, etc., which will not be listed here.

[0158] In one preferred embodiment, a first training sample can be selected from the training data of the target task, and a first text sample from the selected first training sample can be used as a second text sample; then, the portion of the entity triplet sample of the selected first training sample corresponding to the second extraction condition can be used as the target sample in the second text sample. For example, if the first text sample in the training data is T, the first target sample corresponding to the first text sample is: For subtask 1, the second text sample in its training data is still T, and the second target sample is {(e i ,c i )}, where e i Source or c i For the corresponding or The other subtasks are similar. It can be seen that the training data for the subtasks can be directly obtained from the training data of the target task, eliminating the need to construct additional training data and saving human resources.

[0159] When training the entity triplet extraction model using subtasks, the second text sample from the second training sample is used as the input text for the entity triplet extraction model. The entity triplet extraction model then extracts the target information corresponding to the second extraction condition from the input text. The training objective is to minimize the difference between the extracted target information and the target sample in the second training sample.

[0160] Step 406: Determine the combined training data for the entity triplet extraction task. The combined training data includes multiple third training samples, which are obtained by merging more than one first training sample. Using the combined training data, further train the entity triplet extraction model based on the already trained model until the preset second training termination condition is met.

[0161] The combined training data includes multiple third training samples. Each third training sample includes a third text sample and entity triplet samples corresponding to the first extraction condition specified in the triplet extraction task for the third text samples. Specifically, the third text sample can be obtained by merging the first text samples included in multiple selected first training samples, and the entity triplet samples included in the third text sample are obtained by merging the entity triplet samples from multiple selected first training samples.

[0162] The further training of the entity triplet extraction model in this step is based on the entity triplet extraction model obtained in the simple stage. During training in this step, the third text sample in the third training sample is used as the input text of the entity triplet extraction model. The training objective is to minimize the difference between the entity triplet information corresponding to the first extraction condition extracted by the entity triplet extraction model from the input text and the entity triplet sample in the first training sample.

[0163] Step 408: Using the training data of the entity triple extraction task, further train the already trained entity triple model to obtain an entity triple extraction model for extracting entity triple information.

[0164] The further training of the entity triplet extraction model in this step is based on the entity triplet extraction model obtained in step 406. During training, the first text sample in the first training sample is used as the input text of the entity triplet extraction model. The training objective is to minimize the difference between the entity triplet information corresponding to the first extraction condition extracted by the entity triplet extraction model from the input text and the entity triplet sample in the first training sample.

[0165] After training the final entity triple extraction model using the method provided in the above embodiments, the entity triple extraction model can be used to extract entity triples, which can extract entity triple information from the text to be extracted, including the head entity and its entity type, the tail entity and its entity type, and the relationship between the head entity and the tail entity.

[0166] Emotion extraction scenario:

[0167] The model training method in this scenario can be as follows: Figure 5 As shown, the steps include:

[0168] Step 502: Obtain training data for the sentiment extraction task. The training data for the sentiment extraction task includes multiple first training samples. The first training samples include first text samples and sentiment element samples corresponding to the first extraction conditions specified by the sentiment extraction task for the first text samples.

[0169] Sentiment extraction task: Given an input text T, extract sentiment elements from T. Sentiment elements can include sentiment objects, sentiment words, and sentiment polarities. Sentiment elements can be triples or quadruples. For example, extracting the triple {(a...} from T... i ,o i ,p i )}, or extract the quadruple {(c i ,a i ,o i ,p i )}, where a i This refers to the sentiment object in the i-th triple. The sentiment object, also known as the sentiment aspect, refers to the object to which the sentiment is directed. The sentiment object can be a transaction or an attribute of a transaction. For example, in the text "This dress doesn't look good," the sentiment object is the transaction "dress." Similarly, in the text "This dress is too small," the sentiment object is an attribute of a transaction, namely "the size of the dress." i ∈C absa c i It is a i Type. i `p` is the sentiment word in the i-th triplet. Sentiment words, also known as evaluation words or opinion words, refer to words that express emotions, evaluations, or opinions. For example, in the phrase "The apple is so sweet," the sentiment word is "sweet." i C represents the emotional polarity in the i-th triplet. Emotional polarity refers to several discrete values ​​that classify emotions, such as positive, negative, and neutral. absa It is a set of emotion object types. Therefore, when the target task is emotion extraction, the target sample in the first training sample of the constructed target task training data is the emotion element information in the first text sample. The aforementioned first extraction condition includes: extracting emotion element information.

[0170] Step 504: Determine the subtasks of the sentiment extraction task, and train the sentiment extraction model using the training data of the subtasks until the preset first training termination condition is met; the training data of the subtasks includes multiple second training samples, the second training samples include second text samples and sentiment element samples corresponding to the second extraction condition specified by the subtask for the second text samples labeled with the second extraction condition, the second extraction condition is a part of the first extraction condition.

[0171] As described in previous embodiments, subtasks that can be constructed for the emotion extraction task include:

[0172] Subtask 1: Extract sentiment objects and sentiment words from text. That is, given input text T, the sentiment extraction model can extract {a} from T. i} and {oi Therefore, the training data for subtask 1 consists of the second text sample, and the sentiment objects and sentiment words in the second text sample.

[0173] Subtask 2: Extract sentiment triples from text for a specified sentiment object type or sentiment object. For example, given input text T and a specified sentiment object a (a is a specific instance of the sentiment object), the sentiment extraction model can extract {(a,o} from T. i ,p i Therefore, the training data for subtask 2 consists of the second text sample and the emotional triplet specifying the emotional object type or emotional object in the second text sample.

[0174] Subtask 3: Extracting sentiment polarity from text. That is, given input text T, the sentiment extraction model can extract the sentiment polarity {p} from T. i Therefore, the training data for subtask 3 is the second text sample and the sentiment polarity in that second text sample.

[0175] Subtask 4: Extract sentiment triples of a specified sentiment polarity from text. That is, given input text T and a specified sentiment polarity p (p is a specific type of sentiment polarity), the sentiment extraction model can extract sentiment triples {(a...} from T. i ,o i Therefore, the training data for subtask 4 is the second text sample and the sentiment triples of the specified sentiment polarity type in the second text sample.

[0176] Subtasks 1 and 3 above help the sentiment extraction model identify the substructures of sentiment triples, namely sentiment objects and sentiment words, or sentiment polarity. Subtasks 2 and 4 help the model learn the dependencies between these substructures. It should be noted that, in addition to the four subtasks listed above, other subtasks can be constructed, such as extracting sentiment objects and sentiment polarities from text, etc., which will not be listed here.

[0177] In one preferred embodiment, a first training sample can be selected from the training data of the target task, and a first text sample from the selected first training sample can be used as a second text sample; then, the portion corresponding to the second extraction condition in the sentiment triplet sample of the selected first training sample can be used as the target sample in the second text sample. For example, if the first text sample in the training data is T, the first target sample corresponding to the first text sample is: {(a i ,o i ,p i For subtask 1, the second text sample in its training data is still T, and the second target sample is {a}. i} and {oi The same applies to other subtasks. It can be seen that the training data for subtasks can be directly obtained from the training data of the target task, eliminating the need for additional training data construction and saving human resources.

[0178] When training the sentiment extraction model using subtasks, the second text sample from the second training sample is used as the input text for the sentiment extraction model. The sentiment extraction model then extracts the sentiment elements corresponding to the second extraction condition from the input text. The training objective is to minimize the difference between the extracted sentiment elements and the sentiment element samples in the second training sample.

[0179] Step 506: Determine the combined training data for the sentiment extraction task. The combined training data includes multiple third training samples, which are obtained by merging more than one first training sample. Using the combined training data, further train the sentiment extraction model based on the already trained model until the preset second training termination condition is met.

[0180] The combined training data includes multiple third training samples, which include third text samples and sentiment element samples corresponding to the first extraction conditions specified for the sentiment extraction task annotated for the third text samples. The third text samples can be obtained by merging the first text samples included in multiple selected first training samples, and the sentiment element samples included in the third text samples are obtained by merging the sentiment element samples from multiple selected first training samples.

[0181] The further training of the sentiment extraction model in this step is based on the sentiment extraction model obtained in the simple stage. During training in this step, the third text sample in the third training sample is used as the input text for the sentiment extraction model. The training objective is to minimize the difference between the sentiment element corresponding to the first extraction condition extracted by the sentiment extraction model from the input text and the sentiment element sample in the first training sample.

[0182] Step 508: Using the training data from the sentiment extraction task, further train the already trained sentiment extraction model to obtain a sentiment extraction model for extracting sentiment elements.

[0183] The further training of the sentiment extraction model in this step is based on the sentiment extraction model obtained in step 506. During training, the first text sample in the first training sample is used as the input text for the sentiment extraction model. The training objective is to minimize the difference between the sentiment element corresponding to the first extraction condition extracted by the sentiment extraction model from the input text and the sentiment element sample in the first training sample.

[0184] After training the final sentiment extraction model using the method provided in the above embodiments, the sentiment extraction model can be used to extract sentiment elements, such as sentiment objects, sentiment words, and sentiment polarity, from the text to be extracted.

[0185] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0186] According to another embodiment, an apparatus for training an information extraction model is provided. Figure 6 A schematic block diagram of an apparatus for extracting training information from a model according to one embodiment is shown. Figure 1 The model training device in the architecture shown. Figure 6 As shown, the device 600 includes: a sample acquisition unit 601, a first training unit 602, a second training unit 603, and a third training unit 604. The main functions of each component are as follows:

[0187] The sample acquisition unit 601 is configured to acquire training data for a target task. The training data for the target task includes multiple first training samples. The first training samples include first text samples and target samples corresponding to the first extraction conditions specified by the target task for the first text samples.

[0188] The first training unit 602 is configured to determine a subtask of the target task and train an information extraction model using the training data of the subtask until a preset first training termination condition is met. The training data of the subtask includes multiple second training samples. The second training samples include second text samples and target samples corresponding to the second extraction conditions specified by the subtask for the second text samples. The second extraction conditions are some of the sub-conditions in the first extraction conditions.

[0189] The second training unit 603 is configured to determine the combined training data for the target task. The combined training data includes multiple third training samples, which are obtained by merging more than one first training sample. Using the combined training data, the information extraction model is further trained on the basis of the already trained model until the preset second training termination condition is met.

[0190] The third training unit 604 is configured to further train the already trained information extraction model using the training data of the target task, so as to obtain an information extraction model for information extraction.

[0191] According to one achievable method in the embodiments of this application, the second text sample in the second training sample is the first text sample in the first training sample selected from the training data of the target task; the target sample in the second training sample is the part corresponding to the second extraction condition in the target sample of the selected first training sample.

[0192] The third training sample includes a third text sample and a target sample corresponding to the first extraction condition specified for the target task labeled for the third text sample. The third text sample is obtained by merging the first text samples from multiple selected first training samples, and the target sample in the third text sample is obtained by merging the target samples from multiple selected first training samples.

[0193] As one possible approach, when the first training unit 602 trains the information extraction model using the training data of the sub-task, it uses the second text sample in the second training sample as the input text of the information extraction model. The training objective is to minimize the difference between the target information corresponding to the second extraction condition extracted by the information extraction model from the input text and the target sample in the second training sample.

[0194] When training the information extraction model using combined training data, the second training unit 603 uses the text samples in the third training sample as the input text of the information extraction model. The training objective is to minimize the difference between the target information corresponding to the first extraction condition extracted by the information extraction model from the input text and the target sample in the third training sample.

[0195] When the third training unit 604 trains the information extraction model using the training data of the target task, it uses the first text sample in the first training sample as the input text of the information extraction model. The training objective is to minimize the difference between the target information corresponding to the first extraction condition extracted by the information extraction model from the input text and the target sample in the first training sample.

[0196] In one preferred embodiment, the information extraction model described above employs a sequence-to-sequence model. The input sequence of the information extraction model includes extraction condition information and input text, where the extraction condition information includes information about a first extraction condition or information about a second extraction condition. The output sequence of the information extraction model includes target information, or includes target information and its corresponding target type information.

[0197] The extraction condition information may include: the target type information to be extracted, or the target type information and instance information corresponding to some target types.

[0198] According to another embodiment, an information extraction device is provided. Figure 7 A schematic block diagram of an information extraction apparatus according to one embodiment is shown. Figure 7 As shown, the device 700 includes a text acquisition unit 701 and an information extraction unit 702. The main functions of each component are as follows:

[0199] The text acquisition unit 701 is configured to acquire the text to be extracted.

[0200] The information extraction unit 702 is configured to input the text to be extracted into the information extraction model and obtain the target information corresponding to the preset first extraction condition extracted by the information extraction model from the text to be extracted.

[0201] Among them, the information extraction model is composed of Figure 6 The device shown was pre-trained.

[0202] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0203] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0204] In addition, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.

[0205] And an electronic device, comprising:

[0206] One or more processors; and

[0207] A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method described in any of the foregoing method embodiments.

[0208] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method described in any of the foregoing method embodiments.

[0209] in, Figure 8 An exemplary architecture of an electronic device is shown, which may include a processor 810, a video display adapter 811, a disk drive 812, an input / output interface 813, a network interface 814, and a memory 820. The processor 810, video display adapter 811, disk drive 812, input / output interface 813, network interface 814, and memory 820 can communicate with each other via a communication bus 830.

[0210] The processor 810 can be implemented using a general-purpose CPU, microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits to execute relevant programs and implement the technical solution provided in this application.

[0211] The memory 820 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 820 can store the operating system 821 for controlling the operation of the electronic device 800, and the basic input / output system (BIOS) 822 for controlling the low-level operations of the electronic device 800. Additionally, it can store a web browser 823, a data storage management system 824, and a model training device / information extraction device 825, etc. The aforementioned model training device / information extraction device 825 can be the application program that specifically implements the aforementioned steps in this embodiment. In summary, when the technical solution provided in this application is implemented through software or firmware, the relevant program code is stored in the memory 820 and is called and executed by the processor 810.

[0212] The input / output interface 813 is used to connect input / output modules to enable information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.

[0213] Network interface 814 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0214] Bus 830 includes a pathway for transmitting information between various components of the device, such as processor 810, video display adapter 811, disk drive 812, input / output interface 813, network interface 814, and memory 820.

[0215] It should be noted that although the above-described device only shows the processor 810, video display adapter 811, disk drive 812, input / output interface 813, network interface 814, memory 820, bus 830, etc., in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the solution of this application, and does not necessarily include all the components shown in the figures.

[0216] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer program product. This computer program product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.

[0217] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for training an information extraction model, characterized in that, The method includes: Acquire training data for the target task, wherein the training data for the target task includes multiple first training samples, wherein the first training samples include first text samples and target samples corresponding to the first extraction conditions specified by the target task and labeled for the first text samples; The subtasks of the target task are determined, and the information extraction model is trained using the training data of the subtasks until a preset first training termination condition is met. The training data of the subtasks includes multiple second training samples. Each second training sample includes a second text sample and a target sample corresponding to a second extraction condition specified by the subtask and labeled for the second text sample. The second extraction condition is a subset of the first extraction condition. The second text sample in the second training sample is a first text sample selected from the first training samples in the training data of the target task. The target sample in the second training sample is a subset of the target samples in the selected first training samples that corresponds to the second extraction condition. Determine the combined training data for the target task, the combined training data including multiple third training samples, the third training samples being obtained by merging more than one first training sample; using the combined training data, further train the information extraction model based on the already trained model until a preset second training termination condition is met. The information extraction model is further trained using the training data of the target task to obtain an information extraction model for information extraction.

2. The method according to claim 1, characterized in that, The third training sample includes a third text sample and a target sample corresponding to the first extraction condition specified by the target task for the third text sample. The third text sample is obtained by merging the first text samples from the selected multiple first training samples, and the target sample in the third text sample is obtained by merging the target samples from the selected multiple first training samples.

3. The method according to claim 1, characterized in that, When training the information extraction model using the training data of the sub-task, the second text sample in the second training sample is used as the input text of the information extraction model. The training objective is to minimize the difference between the target information corresponding to the second extraction condition extracted by the information extraction model from the input text and the target sample in the second training sample. When training the information extraction model using the combined training data, the text samples in the third training sample are used as the input text of the information extraction model. The training objective is to minimize the difference between the target information corresponding to the first extraction condition extracted by the information extraction model from the input text and the target sample in the third training sample. When training the information extraction model using the training data of the target task, the first text sample in the first training sample is used as the input text of the information extraction model. The training objective is to minimize the difference between the target information corresponding to the first extraction condition extracted by the information extraction model from the input text and the target sample in the first training sample.

4. The method according to claim 3, characterized in that, The information extraction model adopts a sequence-to-sequence model; The input sequence of the information extraction model includes extraction condition information and the input text, wherein the extraction condition information is the information of the first extraction condition or the information of the second extraction condition. The output sequence of the information extraction model includes target information, or includes target information and its corresponding target type information.

5. The method according to claim 4, characterized in that, The extraction condition information includes: The extracted target type information, or, Extracted target type information and instance information corresponding to some target types.

6. A method for training an entity triple extraction model, characterized in that, The method includes: The training data for the entity triple extraction task is obtained. The training data for the entity triple extraction task includes multiple first training samples. The first training samples include first text samples and entity triple samples corresponding to the first extraction conditions specified by the entity triple extraction task for the first text samples. The entity triples include head entities and their entity types, tail entities and their entity types, and the relationship between head entities and tail entities. A subtask for entity triple extraction is determined, and an entity triple extraction model is trained using the training data of the subtask until a preset first training termination condition is met. The training data of the subtask includes multiple second training samples, each including a second text sample and a target sample corresponding to a second extraction condition specified by the subtask and labeled for that second text sample. The second extraction condition is a subset of the first extraction condition. The second text sample in the second training sample is a first text sample selected from the first training samples in the training data of the entity triple extraction task. The target sample in the second training sample is a portion of the target sample of the selected first training sample corresponding to the second extraction condition. Determine the combined training data for the entity triple extraction task. The combined training data includes multiple third training samples, which are obtained by merging more than one first training sample. Using the combined training data, further train the entity triple extraction model based on the already trained model until a preset second training termination condition is met. Using the training data from the entity triple extraction task, the entity triple extraction model is further trained based on the already trained model to obtain an entity triple extraction model for extracting entity triple information.

7. The method according to claim 6, characterized in that, The target samples corresponding to the second extraction condition specified for the subtask labeled with the second text sample include at least one of the following: The entity words and their entity types in the second text sample; Entity relation words in the second text sample; The second text sample specifies a triple of head entity type or head entity word, which includes head entity, tail entity, and the relationship between head entity and tail entity; The second text sample specifies a triple of a relation type, which includes a head entity, a tail entity, and the relationship between the head entity and the tail entity.

8. A method for training an emotion extraction model, characterized in that, The method includes: Acquire training data for the sentiment extraction task. The training data for the sentiment extraction task includes multiple first training samples. The first training samples include first text samples and sentiment element samples corresponding to the first extraction conditions specified by the sentiment extraction task and labeled for the first text samples. A subtask for sentiment extraction is determined, and a sentiment extraction model is trained using the training data of the subtask until a preset first training termination condition is met. The training data of the subtask includes multiple second training samples, each of which includes a second text sample and a sentiment element sample corresponding to a second extraction condition specified by the subtask and labeled for that second text sample. The second extraction condition is a subset of the first extraction condition. The second text sample in the second training sample is a first text sample selected from the first training sample in the training data of the sentiment extraction task. The target sample in the second training sample is the portion of the target sample of the selected first training sample corresponding to the second extraction condition. Determine the combined training data for the emotion extraction task, the combined training data including multiple third training samples, the third training samples being obtained by merging more than one first training sample; using the combined training data, further train the already trained emotion extraction model until a preset second training termination condition is met. By using the training data from the aforementioned emotion extraction task, the already trained emotion extraction model is further trained to obtain an emotion extraction model for extracting emotion elements.

9. The method according to claim 8, characterized in that, The sentiment element samples corresponding to the second extraction condition specified for the subtask labeled with the second text sample include at least one of the following: The sentiment objects and sentiment words in the second text sample; The second text sample specifies an emotion object type or an emotion triplet for an emotion object, wherein the emotion triplet includes an emotion object, an emotion word, and an emotion polarity; The sentiment polarity in the second text sample; The second text sample specifies the sentiment triplet of the sentiment polarity type.

10. A method for information extraction, characterized in that, The method includes: Get the text to be extracted; The text to be extracted is input into the information extraction model, and the target information corresponding to the preset first extraction condition extracted by the information extraction model from the text to be extracted is obtained. The information extraction model is pre-trained using the method described in any one of claims 1 to 5.

11. An apparatus for training an information extraction model, characterized in that, The device includes: The sample acquisition unit is configured to acquire training data for a target task. The training data for the target task includes multiple first training samples. The first training samples include first text samples and target samples corresponding to the first extraction conditions specified by the target task and labeled for the first text samples. The first training unit is configured to determine a subtask of the target task and train an information extraction model using the training data of the subtask until a preset first training termination condition is met. The training data of the subtask includes multiple second training samples. Each second training sample includes a second text sample and a target sample corresponding to a second extraction condition specified by the subtask and labeled for the second text sample. The second extraction condition is a subset of the first extraction condition. The second text sample in the second training sample is a first text sample selected from the training data of the target task. The target sample in the second training sample is a portion of the target sample of the selected first training sample corresponding to the second extraction condition. The second training unit is configured to determine the combined training data for the target task, the combined training data including multiple third training samples, the third training samples being obtained by merging more than one first training sample; using the combined training data, further training is performed on the already trained information extraction model until a preset second training termination condition is met. The third training unit is configured to further train the already trained information extraction model using the training data of the target task, to obtain an information extraction model for information extraction.

12. An information extraction device, characterized in that, The device includes: The text acquisition unit is configured to acquire the text to be extracted. The information extraction unit is configured to input the text to be extracted into the information extraction model and obtain the target information corresponding to the preset first extraction condition extracted by the information extraction model from the text to be extracted. The information extraction model is pre-trained by the device of claim 11.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 10.

14. An electronic device, characterized in that, include: One or more processors; as well as A memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method according to any one of claims 1 to 10.