A method and system for extracting small-sample knowledge from vertical domains based on large-model enhancement

By using a large language model enhancement method and high-quality labeled samples for data augmentation and training, the problem of insufficient generalization ability of knowledge extraction in small sample scenarios is solved. This achieves low-cost and efficient knowledge extraction and graph construction, which is applicable to manufacturing, aerospace, medical and other fields.

CN117216291BActive Publication Date: 2025-11-14XI AN JIAOTONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311188252.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-14
Publication Date
2025-11-14
Estimated Expiration
2043-09-14

AI Technical Summary

Technical Problem

Existing technologies lack generalization ability in knowledge extraction methods with small sample sizes and require a large amount of labeled data, making them difficult to apply in fields such as manufacturing, aerospace, and healthcare.

Method used

By acquiring high-quality labeled samples in the target domain, data augmentation is performed using a large language model to generate a second high-quality labeled sample, and a knowledge extraction model is trained to extract entities and relationships from unstructured text, thereby constructing a target knowledge graph.

Benefits of technology

It reduces data annotation costs, improves the model's sustainable learning and generalization capabilities, and can be flexibly applied to various vertical industry scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117216291B_ABST
    Figure CN117216291B_ABST
Patent Text Reader

Abstract

This application provides a method and system for extracting small-sample knowledge from vertical domains based on large-model augmentation, relating to the field of artificial intelligence. The method includes: acquiring a first high-quality labeled sample from the target domain, and augmenting the first high-quality labeled sample with data based on a pre-trained large language model to obtain a second high-quality labeled sample from the target domain; training a knowledge extraction model using multiple entities extracted from the second high-quality labeled sample, and the relationships between every two entities as training samples; and extracting knowledge from unstructured text in the target domain input to the knowledge extraction model based on the knowledge extraction model to obtain a target knowledge graph for the target domain. This application not only reduces the human resource cost of data annotation but also enables the knowledge extraction model to have stronger sustainable learning and generalization capabilities, thus allowing for flexible application to various scenarios in vertical domains and exhibiting good scalability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and in particular to a method and system for extracting small-sample knowledge from vertical domains based on large model enhancement. Background Technology

[0002] With the rapid development of big data and artificial intelligence technologies, knowledge extraction has become one of the key tasks in the fields of natural language processing and information retrieval. Knowledge extraction aims to extract structured knowledge from unstructured or semi-structured text data to form knowledge graphs, facilitating computer processing and understanding. Furthermore, the constructed knowledge graphs can be widely applied in information retrieval, recommendation systems, question answering, and other fields. Therefore, accurate and efficient knowledge extraction from real-world text data is a crucial issue.

[0003] However, current knowledge extraction schemes still have some shortcomings in small-sample scenarios. Firstly, they lack generalization ability. Traditional rule-based and pattern-based knowledge extraction methods may perform well for specific tasks and domains, but their generalization ability is limited when dealing with diverse and constantly changing data, requiring frequent manual updates of rules and patterns. Secondly, they rely on large amounts of labeled data. Machine learning-based knowledge extraction methods, especially deep learning methods, typically require a large amount of labeled data for training. However, in many practical applications, such as manufacturing, aerospace, healthcare, and education, high-quality labeled data is difficult to obtain, limiting the widespread application of these methods.

[0004] Therefore, there is an urgent need for a method for extracting small sample knowledge in vertical domains. Summary of the Invention

[0005] In view of the above problems, embodiments of this application provide a method and system for extracting small-sample knowledge in vertical domains based on large model enhancement, so as to overcome the above problems or at least partially solve the above problems.

[0006] In a first aspect, this application provides a method for extracting small-sample knowledge from vertical domains based on large-model enhancement, the method comprising:

[0007] A first high-quality labeled sample in the target domain is obtained, and data augmentation is performed on the first high-quality labeled sample based on a pre-trained large language model to obtain a second high-quality labeled sample in the target domain. The first high-quality labeled sample includes: a preset schema rule, a preset knowledge extraction training text corpus, and a preset knowledge graph corresponding to the preset knowledge extraction training text corpus.

[0008] A knowledge extraction model is trained using multiple entities extracted from the second high-quality labeled sample and the relationships between every two entities among the multiple entities as training samples.

[0009] Based on the knowledge extraction model, knowledge is extracted from the unstructured text of the target domain that is input into the knowledge extraction model to obtain the target knowledge graph of the target domain.

[0010] Optionally, the process of augmenting the first high-quality labeled samples based on a pre-trained large language model to obtain a second high-quality labeled sample in the target domain includes:

[0011] By inputting the first high-quality labeled sample into the large language model, a first target knowledge graph is obtained;

[0012] Based on the large language model, the first target knowledge graph is generalized to obtain target text corpus containing target knowledge extraction information.

[0013] The target text corpus is fused with the first high-quality labeled sample to obtain the second high-quality labeled sample.

[0014] Optionally, the step of obtaining the first target knowledge graph by inputting the first high-quality labeled sample into the large language model includes:

[0015] A first prompt instruction is set for the preset schema rule;

[0016] Based on the first prompt instruction, the large language model is guided to expand the preset knowledge graph according to the preset schema rules to obtain the first target knowledge graph.

[0017] Optionally, the generalization process performed on the first target knowledge graph based on the large language model to obtain target text corpus containing target knowledge extraction information includes:

[0018] A second prompt instruction is set for the knowledge extraction training text corpus;

[0019] Based on the second prompt instruction, the large language model is guided to generalize the text corpus in the first target knowledge graph according to the preset knowledge graph to obtain the target text corpus.

[0020] Optionally, the step of training a knowledge extraction model using multiple entities extracted from the second high-quality labeled samples, and the relationships between every two entities among the multiple entities, as training samples includes:

[0021] Based on the preset schema rules, multiple entities and the relationships between every two entities are extracted from the second high-quality labeled sample;

[0022] Each entity and the entities that have a relationship with it are combined to obtain multiple initial knowledge triples. Each initial knowledge triple includes: a head entity, a relationship, and a tail entity.

[0023] A multilayer perceptron function is used to determine the correctness of the relations in multiple initial knowledge triples;

[0024] The knowledge extraction model is obtained by training the initial knowledge triples in multiple initial knowledge triples whose relations are correctly determined using the cross-entropy loss function.

[0025] Optionally, the step of extracting knowledge from the unstructured text of the target domain input to the knowledge extraction model based on the knowledge extraction model to obtain a target knowledge graph of the target domain includes:

[0026] Multiple target sentences are input into the knowledge extraction model to obtain target knowledge triples corresponding to each target sentence;

[0027] By fusing all the target knowledge triples, the target knowledge graph is obtained.

[0028] Optionally, after fusing all the target knowledge triples to obtain the target knowledge graph, the method further includes:

[0029] A third prompt instruction is set for the preset knowledge extraction training text corpus and the preset knowledge graph;

[0030] Based on the third prompt instruction, the preset knowledge graph is generalized according to the preset schema rules to obtain multiple new knowledge triples;

[0031] The preset schema rules are used to validate multiple newly added knowledge triples, and newly added knowledge triples that do not conform to the preset schema rules are corrected.

[0032] Optionally, the method further includes:

[0033] Multiple newly added knowledge triples that conform to the preset schema rules, as well as the newly added knowledge triples after error correction, are added to the target knowledge graph to update the target knowledge graph.

[0034] Optionally, the method further includes:

[0035] The knowledge extraction model is updated by using multiple newly added knowledge triples and their corresponding preset knowledge extraction training text corpora as new training samples.

[0036] A second aspect of this application provides a system for implementing the vertical domain small-sample knowledge extraction method based on large model enhancement as described in the first aspect of this application, the system comprising:

[0037] The data augmentation subsystem is used to acquire a first high-quality labeled sample in the target domain, and to perform data augmentation on the first high-quality labeled sample based on a pre-trained large language model to obtain a second high-quality labeled sample in the target domain. The first high-quality labeled sample includes: preset schema rules, preset knowledge extraction training text corpus, and preset knowledge graph corresponding to the preset knowledge extraction training text corpus.

[0038] The knowledge extraction model training subsystem is used to train a knowledge extraction model using multiple entities extracted from the second high-quality labeled sample and the relationship between every two entities among the multiple entities as training samples.

[0039] The knowledge extraction model reasoning subsystem is used to extract knowledge from unstructured text in the target domain that is input into the knowledge extraction model, based on the knowledge extraction model, to obtain a target knowledge graph of the target domain.

[0040] The beneficial effects of the embodiments of this application are as follows:

[0041] This application provides a method for extracting small-sample knowledge in a vertical domain based on large-scale model augmentation. The method includes: acquiring a first high-quality labeled sample in a target domain, and performing data augmentation on the first high-quality labeled sample based on a pre-trained large-scale language model to obtain a second high-quality labeled sample in the target domain. The first high-quality labeled sample includes: preset schema rules, preset knowledge extraction training text corpus, and a preset knowledge graph corresponding to the preset knowledge extraction training text corpus; training a knowledge extraction model using multiple entities extracted from the second high-quality labeled sample and the relationships between every two entities as training samples; and extracting knowledge from unstructured text in the target domain input to the knowledge extraction model based on the knowledge extraction model to obtain a target knowledge graph in the target domain.

[0042] (1) In this embodiment of the application, a small number of first high-quality labeled samples are augmented by a large language model to obtain a large number of second high-quality labeled samples, thereby reducing the manpower cost requirement for data labeling;

[0043] (2) The knowledge extraction model is trained by using the second high-quality labeled sample as the training sample in the large language model, which makes the knowledge extraction model have stronger sustainable learning ability and generalization ability.

[0044] (3) The knowledge extraction model generated by the large language model can be flexibly applied to various scenarios in vertical fields and has good scalability. Attached Figure Description

[0045] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application 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.

[0046] Figure 1 This is a flowchart illustrating the steps of a vertical domain small-sample knowledge extraction method based on large model enhancement provided in an embodiment of this application.

[0047] Figure 2 This is a flowchart illustrating a data augmentation process based on a large model, as provided in an embodiment of this application.

[0048] Figure 3 This is a flowchart illustrating the process of extracting entities and relationships between entities, as provided in an embodiment of this application.

[0049] Figure 4 This is a flowchart illustrating the text processing of a knowledge extraction model provided in an embodiment of this application.

[0050] Figure 5 This is a schematic diagram illustrating a knowledge extraction process in the field of additive manufacturing, provided in an embodiment of this application.

[0051] Figure 6 This is a schematic diagram of a vertical domain small-sample knowledge extraction system based on large model enhancement provided in an embodiment of this application;

[0052] Figure 7 This is a schematic diagram of the knowledge extraction process of a small sample knowledge extraction system provided in an embodiment of this application. Detailed Implementation

[0053] Exemplary embodiments of this application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.

[0054] In a first aspect, this application provides a method for extracting small-sample knowledge from vertical domains based on large-model enhancement, the method comprising:

[0055] Step S101: Obtain the first high-quality labeled sample in the target domain, and perform data augmentation on the first high-quality labeled sample based on the pre-trained large language model to obtain the second high-quality labeled sample in the target domain. The first high-quality labeled sample includes: preset schema rules, preset knowledge extraction training text corpus, and preset knowledge graph corresponding to the preset knowledge extraction training text corpus.

[0056] Step S102: Using multiple entities extracted from the second high-quality labeled sample, and the relationship between every two entities among the multiple entities as training samples, a knowledge extraction model is trained.

[0057] Step S103: Based on the knowledge extraction model, extract knowledge from the unstructured text of the target domain input to the knowledge extraction model to obtain the target knowledge graph of the target domain.

[0058] Specifically, in this embodiment, it is first necessary to obtain a first high-quality labeled sample of the target domain. This first high-quality labeled sample contains a small amount of manually labeled text data. Each labeled text data includes a preset schema rule (i.e., predefined rules for indicating entity and relation types), a preset knowledge extraction training text corpus, and a preset knowledge graph corresponding to the preset knowledge extraction training text corpus. In practical applications, the so-called target domain refers to the domain corresponding to the currently obtained text corpus and vertical domains related to that domain.

[0059] Furthermore, the first high-quality labeled sample is input into a pre-trained large language model. The large language model is used to augment the first high-quality labeled sample to obtain the second high-quality labeled sample. By augmenting the first high-quality labeled sample with a small amount of sample data through the large language model, the sample data is expanded. That is, the first high-quality labeled sample with a small amount of sample data is augmented through the large language model, so that the first high-quality labeled sample is expanded into the second high-quality labeled sample with more sample data, thereby reducing the manpower cost required for data annotation.

[0060] Furthermore, multiple entities and relationships between them are extracted from the second high-quality labeled samples. These entities and relationships are used as training samples to train the knowledge extraction model. In practical applications, the data-augmented second high-quality labeled samples can be input into a pre-trained BERT model to obtain the token representation corresponding to each labeled sample in the second high-quality labeled samples. The BERT model generates a vector representation for each sample's token, which contains contextual information. It is important to note that the token representation here and the embedding representation described below refer to the same concept, both used to represent the vectorized representation of text elements such as words, entities, and sentences. These representations aim to map text information into a continuous vector space so that computers can understand and process text data.

[0061] From the token representation obtained in the previous step, extract the possible entity types and relationships between entities. In practical applications, sequence labeling or relation extraction methods are typically used, and this application does not specify a particular method. After extracting the entities and relationships between entities from each labeled sample in the second high-quality labeled sample, the correctness of the relationships between entities is determined according to preset schema rules. It should be noted that the schema is a predefined rule used to verify whether the extracted entities and relationships conform to the expected types. Based on the verification results of the preset schema rules, calculate the model error and update the model parameters through backpropagation. In this way, the model will continuously optimize to better capture the complex contextual relationships of the vertical domain. Repeat the above steps until the model converges or reaches the predetermined number of training iterations. Finally, the trained lightweight knowledge extraction model will be able to accurately extract entities and relationships between entities from unstructured text in the vertical domain, providing a foundation for subsequent knowledge reasoning and applications.

[0062] In the above steps, after the knowledge extraction model is trained, structured knowledge can be extracted from unstructured text through the knowledge extraction model, and a target knowledge graph of the target domain can be constructed based on the extracted structured knowledge.

[0063] Specifically, unstructured text from the target domain is input into a knowledge extraction model. The model extracts knowledge from the unstructured text, thereby extracting multiple entities and relationships between them. These entities and their relationships are then used to construct a target knowledge graph for the target domain.

[0064] In a preferred embodiment, the process of augmenting the first high-quality labeled sample based on a pre-trained large language model to obtain a second high-quality labeled sample in the target domain includes: inputting the first high-quality labeled sample into the large language model to obtain a first target knowledge graph; generalizing the first target knowledge graph based on the large language model to obtain a target text corpus containing target knowledge extraction information; and fusing the target text corpus with the first high-quality labeled sample to obtain the second high-quality labeled sample.

[0065] Specifically, a first set of high-quality labeled samples, containing a small number of labeled samples, is input into a pre-trained large language model. This first set of high-quality labeled samples mainly includes pre-defined schema rules, pre-defined knowledge extraction training text corpus, and a pre-defined knowledge graph. By inputting the first set of high-quality labeled samples into the large language model, a first target knowledge graph is obtained. It is important to note that this knowledge graph is a structured knowledge representation extracted from the first set of high-quality labeled samples, containing information about the relationships between entities. Based on the large language model, the first target knowledge graph is generalized. This generalization process can involve operations such as substitution, transformation, or expansion of entities and relationships to obtain target text corpus containing target knowledge extraction information. The generalized target text corpus is then fused with the first set of high-quality labeled samples, thus combining the enhanced target text corpus with the original labeled samples to form a second set of high-quality labeled samples in the target domain.

[0066] In a preferred embodiment, the step of inputting the first high-quality labeled sample into the large language model to obtain the first target knowledge graph includes: setting a first prompt instruction for the preset schema rules; and based on the first prompt instruction, guiding the large language model to expand the preset knowledge graph according to the preset schema rules to obtain the first target knowledge graph.

[0067] Specifically, a first prompt instruction, Prompt1, is set for the preset schema rules. For example, the first prompt instruction, Prompt1, could be: "You are a natural language processing corpus augmentation program. Please understand and augment the following knowledge graph corpus based on the given schema, without overgeneralizing." The first prompt instruction is input into the large language model, guiding the large language model to expand the preset knowledge graph according to the preset schema rules. The preset knowledge graph is then input into the large language model, thereby obtaining the expanded first target knowledge graph.

[0068] In a preferred embodiment, the step of generalizing the first target knowledge graph based on the large language model to obtain target text corpus containing target knowledge extraction information includes: setting a second prompt instruction for the knowledge extraction training text corpus; and guiding the large language model to generalize the text corpus in the first target knowledge graph according to the preset knowledge graph based on the second prompt instruction to obtain the target text corpus.

[0069] Specifically, a second prompt instruction, Prompt2, is set for the knowledge extraction training text corpus. For example, "You are a natural language processing corpus augmentation program. Please generate labeled corpus for the knowledge extraction task based on the given labeled corpus style and in combination with the knowledge graph. Do not overgeneralize." The second prompt instruction is input into the large language model, guiding the large language model to generalize the text corpus in the first target knowledge graph according to the preset knowledge graph, and generate the target text corpus. It should be noted that the target text corpus is the text corpus containing the target knowledge extraction information.

[0070] Figure 2 A flowchart illustrating a data augmentation process based on a large model, as provided in this application embodiment. (Refer to...) Figure 2 As shown, firstly, a first prompt instruction Prompt1 is designed based on the preset schema rules; then, the first prompt instruction Prompt1 is used to guide the large language model to expand the preset knowledge graph to obtain the first target knowledge graph; next, a second prompt instruction Prompt2 is set based on the knowledge extraction training text corpus; finally, the second prompt instruction Prompt2 is used to guide the large language model to expand the text corpus, and finally, the second high-quality labeled sample is obtained.

[0071] In a preferred embodiment, the step of training a knowledge extraction model using multiple entities extracted from the second high-quality labeled sample and the relationships between every two entities as training samples includes: extracting multiple entities and the relationships between every two entities from the second high-quality labeled sample according to the preset schema rules; combining each entity and entities with which it has relationships to obtain multiple initial knowledge triples, each initial knowledge triple including a head entity, a relationship, and a tail entity; using a multilayer perceptron function to determine the correctness of the relationships in the multiple initial knowledge triples; and using a cross-entropy loss function to train the initial knowledge triples in which the relationships are determined to be correct to obtain the knowledge extraction model.

[0072] Specifically, in this embodiment, the second high-quality labeled sample can be understood as mainly containing sentence content and knowledge triples. For example, one sample in the second high-quality labeled sample is the sentence "Automotive parts, considering safety, mostly use 316L stainless steel printing materials", and the knowledge triple "Automotive parts, materials, 316L stainless steel". Taking one sample in the second high-quality labeled sample as an example, the specific process of processing this sample through the knowledge extraction model includes: inputting the sentence in the sample into a pre-trained BERT model, encoding the sentence through the BERT model, and obtaining the embedding representation H = BERT(x1, x2, ..., x...). n ), where X i This represents the content at the i-th position in the sentence.

[0073] Based on the preset schema rules, multiple entities and the relationships between each pair of entities are extracted from the sentence.

[0074] For entity extraction, in this application, to improve the efficiency of the knowledge extraction model, only entity types within the preset schema rules are extracted. It should be noted that entity extraction can be viewed as table filling; the length of the input sentence represents the table length and the number of columns, respectively. The elements in the table are shown in Formula 1 below:

[0075]

[0076] in, Let represent the probability that the i-th and j-th positions in the sentence are the start and end positions of the k-th entity type; σ represents the sigmoid activation function; Linear is the linear activation function; E i =w i h i +b i This represents the position i as the starting position of the entity; E represents i transpose of; E j The representation that the j-th position is the starting position of the entity; h i =BERT(x i ) represents the vector representation of the content at the i-th position in the sentence; w i b is the weight matrix; i This indicates the offset.

[0077] In this application, for relation extraction, in order to extract more accurate and comprehensive information, relation extraction refers to extracting relationships that conform to preset schema rules from the entities extracted in the preceding steps. First, the entities extracted in the preceding steps are divided into head entity s and tail entity o, and the embedding representation corresponding to head entity s is E. s The embedding representation of the tail entity o is E. o Next, the BERT model is used to encode the relations to obtain R = {R i |R i =BERT(r) i )}, where i∈(1,m) represents the m relation types existing in the schema. In practical applications, in order to fully explore the deep semantic relationships between entities and relations, this embodiment constructs an entity-text context-aware relation representation, as shown in Formula 2:

[0078]

[0079] Where LayerNorm is the layer normalization function, R s =Att(RW Q E s W K E s W V ) represents the union representation of the head entity s; R o =Att(RW Q E o W K E o W V R represents the union relation of the tail entity o; c =Att(RW Q HW K HW V ) represents the union relation of text c, Att represents the attention mechanism function; W K W Q and W V E represents the weight matrix of the attention mechanism function Att; s E represents the embedded representation of the head entity; o H represents the embedding representation of the tail entity; H represents the embedding representation of the sentence.

[0080] Using Formulas 1 and 2 above, entities and the relationships between them can be extracted from the samples. In this embodiment, to fully utilize the interactive information between entities and their relationships, firstly, entity embeddings and relation embeddings are combined to obtain the interactive information between entities and their relationships. In practical applications, when extracting knowledge from sentences in the second high-quality labeled sample, it is usually necessary to map entities and their relationships into a vector space to obtain entity embeddings and relation embeddings, which contain the semantic information of the relationships between entities. Secondly, a multilayer perceptron function is used to classify the relationships between entities. That is, by taking the interactive information between entities and their relationships as input, processing it through multiple hidden layers and the action of activation functions, a classification result is finally output, which is used to indicate whether the relationship between entities is correct or not.

[0081] Specifically, each entity and its related entities are combined to obtain multiple initial knowledge triples. Each initial knowledge triple includes a head entity, a tail entity, and the relationship between them. Taking one set of initial knowledge triples as an example, the initial knowledge triple containing a head entity, a relationship, and a tail entity is defined as follows: i ,r k ,o j >, and determine the correctness of the relationship between the three using the following formula 3:

[0082]

[0083] Wherein, φ(s) i ,r k ,o j The ) represents the correctness score of the relationship among the three; MLP represents the multilayer perceptron function; This represents the vector concatenation operation.

[0084] The method of using multilayer perceptron function mechanism to determine the correctness of entities and relationships between entities extracts interactive information by embedding the relationships between entities and processing it through multilayer perceptron function. This yields a classification result of the correctness of the relationships between entities, which can help improve the accuracy and effectiveness of knowledge extraction tasks.

[0085] After obtaining the correctness classifications of multiple entities and their relationships, the correctness of the entities and their relationships is determined based on the correctness scores. For example, the top-ranked correctness scores can be selected, and the corresponding entities and their relationships can be used as training samples to obtain the knowledge extraction model. Specifically, the model is trained using the following formula 4:

[0086]

[0087] ​Where 1 represents the true value; i ,r k ,o j > represents the initial knowledge triplet; φ(s) i ,r k ,o j The score indicates the correctness of the relationship between the three.

[0088] like Figure 3 A flowchart illustrating the process of extracting entities and relationships between entities is provided in this application embodiment, as follows: Figure 3 As shown: First, based on the BERT model, the vector representation of the second high-quality labeled sample is obtained, and entity extraction and potential relationship extraction between entities are performed from these vector representations. Finally, the correctness of entities and relationships between entities is determined by combining the preset schema rules.

[0089] In a preferred embodiment, the step of extracting knowledge from unstructured text in the target domain input to the knowledge extraction model, based on the knowledge extraction model, to obtain a target knowledge graph of the target domain, includes:

[0090] Multiple target sentences are input into the knowledge extraction model to obtain target knowledge triples corresponding to each target sentence;

[0091] By fusing all the target knowledge triples, the target knowledge graph is obtained.

[0092] Specifically, the knowledge extraction model obtained based on the above steps will input multiple target sentences extracted from multiple text corpora into the knowledge extraction model to obtain target knowledge triples corresponding to each target sentence, and then merge all the target knowledge triples to obtain a target knowledge graph.

[0093] In a preferred embodiment, after fusing all the target knowledge triples to obtain the target knowledge graph, the method further includes:

[0094] A third prompt instruction is set for the preset knowledge extraction training text corpus and the preset knowledge graph;

[0095] Based on the third prompt instruction, the preset knowledge graph is generalized according to the preset schema rules to obtain multiple new knowledge triples;

[0096] The preset schema rules are used to validate multiple newly added knowledge triples, and newly added knowledge triples that do not conform to the preset schema rules are corrected.

[0097] ​Specifically, by inputting unstructured text into an updated knowledge extraction model, a target knowledge graph corresponding to the text can be obtained. This target knowledge graph is an unpurified knowledge graph that contains structured entities extracted from the text and information about the relationships between entities. Then, based on a preset knowledge extraction training text corpus and a preset knowledge graph, a third prompt text, Prompt3, is set, for example: "You are a natural language processing corpus verification program. Please generate new knowledge triples that conform to the preset schema rules based on the given knowledge graph and the corresponding text. Do not overgeneralize." Prompt3 is input into the large language model to guide it in generating multiple new knowledge triples. These new knowledge triples are then validated according to the preset schema rules to determine whether they meet the specific structure and constraints under the preset schema rules. If some new knowledge triples are found to be inconsistent with the preset schema rules, error correction operations are required, i.e., these non-compliant new knowledge triples are modified or deleted to ensure the consistency and accuracy of the knowledge graph.

[0098] In a preferred embodiment, multiple newly added knowledge triples conforming to the preset schema rules, as well as the corrected newly added knowledge triples, are added to the target knowledge graph to update the target knowledge graph.

[0099] Specifically, in this embodiment, newly added knowledge triples conforming to preset schema rules, as well as newly added knowledge triples after error correction, are added to the target knowledge graph. This process can be viewed as merging these new knowledge points into the existing knowledge graph, thereby expanding and updating the target knowledge graph. It should be noted that the expanded and updated target knowledge graph can be considered a refined large knowledge graph. By updating the target knowledge graph, it becomes richer and more accurate because it includes new knowledge extracted from unstructured text and corrected knowledge after error correction. This process is a continuous iterative process, constantly updated with the addition of new data and knowledge sources to maintain the knowledge graph in the most up-to-date and accurate state.

[0100] In a preferred embodiment, the knowledge extraction model is updated by using multiple newly added knowledge triples and the preset knowledge extraction training text corpus corresponding to each of the multiple newly added knowledge triples as new training samples.

[0101] Specifically, in this embodiment, newly added knowledge triples that have passed verification and error correction are paired with their respective corresponding preset knowledge extraction training text corpora. It is important to note that these training text corpora are the original text corpora used in previous steps to generate the new knowledge. Then, these paired new knowledge triples and training text corpora are used as new training samples to update the parameters of the knowledge extraction model. This means that the model will be retrained using this new data so that it can better learn how to extract entities and relations from text and how to generate correct knowledge triples. Through multiple iterations of training, the model will gradually adjust its parameters to better adapt to the new knowledge and training text corpora, thereby improving the model's accuracy and robustness.

[0102] Figure 4 A flowchart illustrating the text processing of a knowledge extraction model provided in this application embodiment is shown below. Figure 4 As shown, firstly, knowledge is extracted from the input text using a knowledge extraction model. This extraction mainly involves extracting knowledge triples. By fusing the extracted knowledge triples, a large knowledge graph before purification is obtained. Then, based on a large language model, the extracted knowledge triples are validated and updated to obtain a purified large knowledge graph. Finally, the knowledge extraction model is updated using the knowledge triples in the purified knowledge graph, resulting in a continuously improving knowledge extraction model.

[0103] For example, such as Figure 5 The diagram shown is a schematic representation of a knowledge extraction process in the field of additive manufacturing provided in an embodiment of this application. (Refer to...) Figure 5 As shown: In the field of additive manufacturing, the first input is the annotation results in the field of additive manufacturing, that is, the first high-quality annotation sample, including: the annotation corpus in the field of additive manufacturing, that is, the corpus of training text corpus, the preset schema rules in the field of additive manufacturing, and the preset small knowledge graph in the field of additive manufacturing.

[0104] Furthermore, using the first prompt instruction Prompt1, the pre-set small knowledge graph is expanded based on the large language model to obtain the expanded knowledge graph. The knowledge graph before expansion includes knowledge triples such as <automotive parts, materials, 316L stainless steel> and <home appliances, materials, ALSI aluminum alloy>. The knowledge graph after expansion includes knowledge triples such as <automotive parts, materials, 316L stainless steel>, <home appliances, materials, ALSI aluminum alloy>, <mechanical and electrical equipment, materials, ALSI aluminum alloy>, and <injection molds, materials, mold steel>. Using the second prompt command Prompt2, the annotated corpus is expanded based on the large language model to obtain the expanded annotated corpus. For example, if the original annotated corpus is {text:“Automotive parts, considering safety, mostly use 316L stainless steel for printing.”,triple:[automotive parts,material,316L stainless steel]}, then the expanded text corpus includes: {text:“Automotive parts, considering safety, mostly use 316L stainless steel for printing.”,triple:[automotive parts,material,316L stainless steel]}, {text:“Household appliances are generally made of relatively inexpensive materials and are mostly printed using 316L stainless steel.”,triple:[household appliances,material,316L stainless steel]}...{text:“Injection molds need to have high temperature resistance, so it is best to use special mold steel materials for printing.”,triple:[injection mold,material,mold steel]}. Furthermore, each text corpus is encoded, and different entities and relationships between entities are extracted from the encoded corpus. By combining the entities and relationships between entities, a large-scale knowledge graph in the field of additive manufacturing is finally obtained.

[0105] This application provides a method for extracting small-sample knowledge in a vertical domain based on large-scale model augmentation. The method includes: acquiring a first high-quality labeled sample in a target domain, and performing data augmentation on the first high-quality labeled sample based on a pre-trained large-scale language model to obtain a second high-quality labeled sample in the target domain. The first high-quality labeled sample includes: preset schema rules, preset knowledge extraction training text corpus, and a preset knowledge graph corresponding to the preset knowledge extraction training text corpus; training a knowledge extraction model using multiple entities extracted from the second high-quality labeled sample and the relationships between every two entities as training samples; and extracting knowledge from unstructured text in the target domain input to the knowledge extraction model based on the knowledge extraction model to obtain a target knowledge graph in the target domain. This application embodiment uses a large language model to augment a small number of first high-quality labeled samples to obtain a larger number of second high-quality labeled samples, reducing the manpower cost required for data labeling. The knowledge extraction model is trained using the second high-quality labeled samples as training samples by the large language model, which enables the knowledge extraction model to have stronger sustainable learning and generalization capabilities. The knowledge extraction model generated by the large language model can be flexibly applied to various scenarios in vertical fields and has good scalability.

[0106] Based on the same inventive concept, a second aspect of the embodiments of this application provides a system for a vertical domain small-sample knowledge extraction method based on large model enhancement, the system as follows: Figure 6 As shown, it includes: a data augmentation subsystem, a knowledge extraction model training subsystem, and a knowledge extraction model inference subsystem. The data augmentation subsystem is used to acquire a first high-quality labeled sample in the target domain and, based on a pre-trained large language model, augment the first high-quality labeled sample to obtain a second high-quality labeled sample in the target domain. The first high-quality labeled sample includes: preset schema rules, preset knowledge extraction training text corpus, and a preset knowledge graph corresponding to the preset knowledge extraction training text corpus. The knowledge extraction model training subsystem is used to train a knowledge extraction model using multiple entities extracted from the second high-quality labeled sample and the relationships between every two entities as training samples. The knowledge extraction model inference subsystem is used to extract knowledge from unstructured text in the target domain input to the knowledge extraction model based on the knowledge extraction model to obtain a target knowledge graph in the target domain.

[0107] Figure 7 A schematic diagram of the knowledge extraction process of a small-sample knowledge extraction system provided in this application is shown below. Figure 7As shown, a small number of high-quality labeled samples from the target vertical domain are input into the data augmentation subsystem to obtain a large number of high-quality labeled samples from the target vertical domain. The large number of high-quality labeled samples are then input into the knowledge extraction model training subsystem to train the knowledge extraction model. Next, unstructured text corpus is input into the knowledge extraction model inference subsystem to obtain a large knowledge graph of the target vertical domain. Based on the knowledge triples in the large knowledge graph of the target vertical domain, the knowledge extraction model is continuously updated with parameters by the knowledge extraction model training subsystem, so that the knowledge extraction model is continuously improved, thereby improving the accuracy and robustness of the model.

[0108] Each embodiment in this specification focuses on the differences from other embodiments. For the same or similar parts between the embodiments, please refer to each other.

[0109] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0110] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0111] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0112] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0113] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.

[0114] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0115] The above provides a detailed description of a method and system for extracting small-sample knowledge in vertical domains based on large model enhancement. Specific examples are 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 method and its core ideas. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for extracting small-sample knowledge from vertical domains based on large model enhancement, characterized in that, The method includes: A first high-quality labeled sample in the target domain is obtained, and data augmentation is performed on the first high-quality labeled sample based on a pre-trained large language model to obtain a second high-quality labeled sample in the target domain. The first high-quality labeled sample includes: a preset schema rule, a preset knowledge extraction training text corpus, and a preset knowledge graph corresponding to the preset knowledge extraction training text corpus. The method of performing data augmentation on the first high-quality labeled samples based on a pre-trained large language model to obtain a second high-quality labeled sample in the target domain includes: By inputting the first high-quality labeled sample into the large language model, a first target knowledge graph is obtained; Based on the large language model, the first target knowledge graph is generalized to obtain target text corpus containing target knowledge extraction information. The target text corpus is fused with the first high-quality labeled sample to obtain the second high-quality labeled sample; The step of inputting the first high-quality labeled sample into the large language model to obtain the first target knowledge graph includes: A first prompt instruction is set for the preset schema rule; Based on the first prompt instruction, the large language model is guided to expand the preset knowledge graph according to the preset schema rules to obtain the first target knowledge graph; The first target knowledge graph is generalized based on the large language model to obtain target text corpus containing target knowledge extraction information, including: A second prompt instruction is set for the preset knowledge extraction training text corpus; Based on the second prompt instruction, the large language model is guided to generalize the text corpus in the first target knowledge graph according to the preset knowledge graph to obtain the target text corpus; A knowledge extraction model is trained using multiple entities extracted from the second high-quality labeled sample and the relationships between every two entities as training samples. The step of training a knowledge extraction model using multiple entities extracted from the second high-quality labeled sample, and the relationships between every two entities, as training samples, includes: Based on the preset schema rules, multiple entities and the relationships between every two entities are extracted from the second high-quality labeled sample; Each entity and the entities that have relationships with it are combined to obtain multiple initial knowledge triples. Each initial knowledge triple includes: a head entity, a relationship, and a tail entity. A multilayer perceptron function is used to determine the correctness of the relations in multiple initial knowledge triples; The knowledge extraction model is obtained by training the initial knowledge triples in multiple initial knowledge triples whose relations are correctly determined using the cross-entropy loss function. Based on the knowledge extraction model, knowledge is extracted from the unstructured text of the target domain that is input into the knowledge extraction model to obtain the target knowledge graph of the target domain.

2. The method for extracting small sample knowledge in a vertical domain according to claim 1, characterized in that, The step of extracting knowledge from unstructured text in the target domain input to the knowledge extraction model based on the knowledge extraction model to obtain a target knowledge graph in the target domain includes: Multiple target sentences are input into the knowledge extraction model to obtain target knowledge triples corresponding to each target sentence; By fusing all the target knowledge triples, the target knowledge graph is obtained.

3. The method for extracting small sample knowledge in a vertical domain according to claim 2, characterized in that, After fusing all the target knowledge triples to obtain the target knowledge graph, the method further includes: A third prompt instruction is set for the preset knowledge extraction training text corpus and the preset knowledge graph; Based on the third prompt instruction, the preset knowledge graph is generalized according to the preset schema rules to obtain multiple new knowledge triples; The preset schema rules are used to validate multiple newly added knowledge triples, and newly added knowledge triples that do not conform to the preset schema rules are corrected.

4. The method for extracting small sample knowledge in a vertical domain according to claim 3, characterized in that, The method further includes: Multiple newly added knowledge triples that conform to the preset schema rules, as well as the newly added knowledge triples after error correction, are added to the target knowledge graph to update the target knowledge graph.

5. The method for extracting small sample knowledge in a vertical domain according to claim 3 or 4, characterized in that, The method further includes: The knowledge extraction model is updated by using multiple newly added knowledge triples and their corresponding preset knowledge extraction training text corpora as new training samples.

6. A system for implementing the vertical domain small-sample knowledge extraction method based on large model enhancement as described in any one of claims 1-5, characterized in that, The system includes: The data augmentation subsystem is used to acquire a first high-quality labeled sample in the target domain, and to perform data augmentation on the first high-quality labeled sample based on a pre-trained large language model to obtain a second high-quality labeled sample in the target domain. The first high-quality labeled sample includes: preset schema rules, preset knowledge extraction training text corpus, and preset knowledge graph corresponding to the preset knowledge extraction training text corpus. The knowledge extraction model training subsystem is used to train a knowledge extraction model using multiple entities extracted from the second high-quality labeled sample and the relationship between every two entities among the multiple entities as training samples. The knowledge extraction model reasoning subsystem is used to extract knowledge from unstructured text in the target domain that is input into the knowledge extraction model, based on the knowledge extraction model, to obtain a target knowledge graph of the target domain.

Citation Information

Patent Citations

  • Natural language processing method and device based on knowledge guidance prefix fine tuning, computing equipment, and storage medium

    CN113987209A

  • Internet e-commerce complaint intelligent processing method based on big data knowledge graph

    CN116468048A