Knowledge extraction method and device based on large model, equipment and medium
By using big models and thinking chain CoT prompts in the knowledge extraction method, the problem of relying on a large amount of labeled data is solved, the construction efficiency and accuracy of knowledge graphs is improved, the dependence on expert annotations is reduced, and the automation process of knowledge graphs is realized .
Patent Information
- Application Number
- CN202410936177.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-12-17
AI Technical Summary
The existing knowledge extraction methods rely on a large amount of labeled data, especially in vertical fields, requiring a large amount of manual labeling, which leads to high labor intensity and complexity, and imperfect construction of knowledge graphs in specific fields.
Using a knowledge extraction method based on big model, by obtaining the ontology and thinking chain CoT prompts of the preset field, adjusting and correcting the big model, gradually identifying and extracting entities and relationships in the natural language text of the preset field, and reducing the annotation of experts rely.
It significantly improves the accuracy and consistency of triple extraction, reduces dependence on expert annotations, promotes the automation process of knowledge graph construction, and improves the construction efficiency and quality of knowledge graphs in specific fields.
Smart Images

Figure CN119149752A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a large model-based knowledge extraction method, device, equipment and medium. Background Art
[0002] Knowledge Graph (KG) has a wide range of applications in modern information systems, including but not limited to traditional fields such as search engines, social media, and e-commerce, and has also gradually expanded to multiple industries such as finance, medical care, and education. A knowledge graph is a knowledge base consisting of three parts: head entities, tail entities, and the relationships between them. Extracting this knowledge from unstructured data is an important basis for building a knowledge graph. At present, knowledge graphs have demonstrated their powerful organization and association capabilities in various application scenarios, and can significantly improve the performance of tasks such as information retrieval, recommendation systems, and intelligent question and answering.
[0003] At present, the commonly used knowledge extraction methods rely on a large amount of labeled data and use deep learning algorithms to achieve extraction, that is, given the entity and relationship types to be extracted, the model is trained through supervised learning to obtain specific entities and relationships. For example, the classic algorithm for entity extraction is BiLSTM+CRF (bidirectional long short-term memory network plus conditional random field), and the representative algorithms for relationship extraction include convolutional neural network (CNN). Although these methods have improved the automation level of knowledge extraction to a certain extent, they are heavily dependent on a large amount of manual annotation, which is labor-intensive, and requires domain expertise when targeting vertical fields, which further increases the complexity of the annotation process. Although there are methods such as remote supervision and transfer learning to alleviate the problem of limited labeled data, these methods are not perfect for specific vertical fields. Therefore, the advancement of knowledge graphs in specific fields depends largely on the participation of industry experts, and data annotation has become a major obstacle to its progress. Summary of the invention
[0004] In order to solve the technical problem of relying on a large amount of labeled data for knowledge extraction, the present invention provides a knowledge extraction method, device, equipment and medium based on a large model.
[0005] In a first aspect, the present invention provides a knowledge extraction method based on a large model, the method comprising:
[0006] Acquire an ontology of a preset domain, wherein the ontology includes a plurality of knowledge representations, and the knowledge representations include entity types and relationship types of the preset domain;
[0007] Adjust and modify the large model through the thought chain CoT prompts, the natural language text and ontology of the preset domain;
[0008] According to the CoT prompt, the text to be extracted in the preset field is identified by the large model to obtain the triple information of the text to be extracted.
[0009] Based on the above technical solution, further, the large model is adjusted and corrected through the thought chain CoT prompt, the natural language text and ontology of the preset field, including:
[0010] Inputting the natural language text of the preset domain into the large model, and using the CoT prompt, gradually identifying entities and entity relationships in the natural language text of the preset domain;
[0011] Compare and align the entities and entity relationships in the identified natural language text of the preset domain with the ontology of the preset domain;
[0012] According to the comparison and alignment results, the large model is guided to be modified.
[0013] Based on the above technical solution, further, the natural language text of the preset field is input into the large model, and the entities and entity relationships in the natural language text of the preset field are gradually identified by using the CoT prompt, including:
[0014] Based on the CoT prompt and the plurality of knowledge representations of the preset domain, inputting the sample input text and the sample output text of the preset domain into the large model, so that the large model learns the triple standard output format of the preset domain;
[0015] The relevant entities and relationships in the natural language text of the preset domain are obtained by using the natural language text of the preset domain and the reasoning steps.
[0016] Based on the above technical solution, further, the use of the natural language text of the preset field and the reasoning steps to obtain the relevant entities and relationships in the natural language text of the preset field specifically includes:
[0017] Inputting the natural language text of the preset domain into the macro model;
[0018] According to the reasoning steps, the large model performs corresponding operations on the natural language text in the preset domain, and outputs relevant entities and relationships in the natural language text in the preset domain.
[0019] Based on the above technical solution, further, according to the reasoning step, the large model performs corresponding operations on the natural language text in the preset field, and outputs relevant entities and relationships in the natural language text in the preset field, including:
[0020] According to the sequential words of the reasoning steps in the guide words and the prompt statements of the reasoning process, the large model processes the natural language text in the preset field and outputs the relevant entities and relationships in the natural language text in the preset field.
[0021] Based on the above technical solution, further, according to the CoT prompt, the text to be extracted in the preset field is identified by the large model to obtain the triple information of the text to be extracted, including:
[0022] Obtain the text to be extracted in the preset field;
[0023] Using the CoT prompt, obtaining entities in the text to be extracted, and then extracting entity relationships in the text to be extracted;
[0024] After comparing the entities and entity relationships in the text to be extracted with the ontology of the preset domain, the triple information of the text to be extracted is output according to the triple standard output format of the preset domain.
[0025] In a second aspect, the present invention further provides a knowledge extraction device based on a large model, the device comprising:
[0026] A first processing module is used to obtain an ontology of a preset domain, wherein the ontology includes a plurality of knowledge representations, and the knowledge representations include entity types and relationship types of the preset domain;
[0027] The second processing module is used to adjust and modify the large model through the thinking chain CoT prompt, the natural language text and ontology of the preset field;
[0028] The third processing module is used to identify the text to be extracted in the preset field through the large model according to the CoT prompt, and obtain the triple information of the text to be extracted.
[0029] Based on the above technical solution, further, the second processing module is specifically used for the second processing module, specifically for inputting the natural language text of the preset field into the large model, and using the CoT prompt to gradually identify entities and entity relationships in the natural language text of the preset field;
[0030] Compare and align the entities and entity relationships in the identified natural language text of the preset domain with the ontology of the preset domain;
[0031] According to the comparison and alignment results, the large model is guided to be modified.
[0032] Based on the above technical solution, further, the second processing module is specifically used to input the sample input text and the sample output text of the preset field into the large model based on the CoT prompt and the multiple knowledge representations of the preset field, so that the large model learns the triple standard output format of the preset field;
[0033] The relevant entities and relationships in the natural language text of the preset domain are obtained by using the natural language text of the preset domain and the reasoning steps.
[0034] Based on the above technical solution, further, the second processing module is specifically used to input the natural language text of the preset field into the large model;
[0035] According to the reasoning steps, the large model performs corresponding operations on the natural language text in the preset domain, and outputs relevant entities and relationships in the natural language text in the preset domain.
[0036] Based on the above technical solution, further, the second processing module is specifically used to output relevant entities and relationships in the natural language text of the preset field after the large model processes the natural language text of the preset field according to the sequential words of the reasoning steps in the guide words and the prompt sentences of the reasoning process.
[0037] Based on the above technical solution, further, the third processing module is specifically used to obtain the text to be extracted in the preset field;
[0038] Using the CoT prompt, obtaining entities in the text to be extracted, and then extracting entity relationships in the text to be extracted;
[0039] After comparing the entities and entity relationships in the text to be extracted with the ontology of the preset domain, the triple information of the text to be extracted is output according to the triple standard output format of the preset domain.
[0040] In a third aspect, the present invention further provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the large model-based knowledge extraction method described in any one of the above technical solutions when executing the computer program.
[0041] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the large model-based knowledge extraction method described in any one of the above technical solutions is implemented.
[0042] The present invention provides a knowledge extraction method based on a large model, including obtaining an ontology of a preset domain, the ontology including multiple knowledge representations, the knowledge representation including entity types and relationship types of the preset domain; adjusting and correcting the large model through the CoT prompt of the thinking chain, the natural language text of the preset domain and the ontology; according to the CoT prompt, identifying the text to be extracted in the preset domain through the large model to obtain the triple information of the text to be extracted. The present invention significantly improves the accuracy and consistency of triple extraction, while reducing the dependence on expert annotations, and promoting the automation process of knowledge graph construction. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0044] In the attached picture:
[0045] Figure 1 It is a flowchart of a knowledge extraction method based on a large model provided by an embodiment of the present invention;
[0046] Figure 2 A schematic diagram of a flow chart of a knowledge extraction method based on a large model provided by an embodiment of the present invention;
[0047] Figure 3 A schematic diagram of a flow chart of a knowledge extraction method based on a large model provided by an embodiment of the present invention;
[0048] Figure 4 A module schematic diagram of a large model-based knowledge extraction device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0049] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present invention can be combined with each other without conflict.
[0050] The following detailed description is an exemplary description, which is intended to provide further detailed description of the present invention. Unless otherwise specified, all technical terms used in the present invention have the same meaning as those generally understood by those skilled in the art to which the present invention belongs. The terms used in the present invention are only for describing specific embodiments, and are not intended to limit the exemplary embodiments according to the present invention.
[0051] The following will be combined with the attached Figure 1 , a knowledge extraction method based on a large model provided by an embodiment of the present invention is described, comprising the following steps:
[0052] 110. Acquire an ontology of a preset domain, wherein the ontology includes a plurality of knowledge representations, and the knowledge representations include entity types and relationship types of the preset domain;
[0053] 120. Adjust and modify the large model through the CoT prompts of the thought chain, the natural language text and ontology of the preset domain;
[0054] 130. According to the CoT prompt, the text to be extracted in the preset field is identified by the large model to obtain triple information of the text to be extracted.
[0055] Based on the above embodiment, further, step 120 specifically includes:
[0056] 121. Input the natural language text of the preset domain into the large model, and use the CoT prompt to gradually identify entities and entity relationships in the natural language text of the preset domain;
[0057] 122. Compare and align the entities and entity relationships in the identified natural language text of the preset domain with the ontology of the preset domain;
[0058] 123. According to the comparison and alignment results, guide the large model to be corrected.
[0059] Specifically, the correction of the large model can be guided by inputting text including correct entities and entity relationships into the large model for correction, or there are other methods, which will not be described in detail in this embodiment.
[0060] Based on the above embodiment, further, step 121 specifically includes:
[0061] 1211. Based on the CoT prompt and the plurality of knowledge representations of the preset domain, inputting the sample input text and the sample output text of the preset domain into the large model, so that the large model learns the triple standard output format of the preset domain;
[0062] 1212. Obtain relevant entities and relationships in the natural language text of the preset domain by using the natural language text of the preset domain and the reasoning steps;
[0063] Based on the above embodiment, further, step 1212 specifically includes:
[0064] Inputting the natural language text of the preset domain into the macro model;
[0065] According to the reasoning steps, the large model performs corresponding operations on the natural language text in the preset domain, and outputs relevant entities and relationships in the natural language text in the preset domain.
[0066] The guiding words include the sequence words of the reasoning steps and the prompting sentences of the reasoning process.
[0067] Specifically, the instruction part (Instruction): This part is provided by the system role with detailed instructions, including information about the ontology (Ontology) and the chain of thought (CoT) process. The design goal of the instruction part is to clarify the task requirements and the expected output format. The specific contents include:
[0068] Information about the ontology: Details about the predefined entity types and relationship types in the domain.
[0069] Information about the CoT process: explains how to perform entity extraction and relation extraction through step-by-step reasoning. The instructions clearly indicate the operations that the model needs to perform at each step and the details that need to be paid attention to, ensuring that the model can understand and follow the predetermined reasoning path.
[0070] For example, the instruction part
[0071] The commands provided by the system role include:
[0072] Information about the entity, such as:
[0073] Entities: computers, software, people, companies, applications, file systems, etc.
[0074] Relationship: [application|maker|person] [software|platform|computer]
[0075] [File System | Manufacturer | Company]…
[0076] Steps in the CoT process:
[0077] You should think step by step and read sentences and instructions carefully.
[0078] First, identify the entity.
[0079] Then, find the relationship between them.
[0080] Finally, determine which entities and relations conform to the definition of the ontology.
[0081] Based on the above embodiment, further, according to the reasoning step, the large model performs corresponding operations on the natural language text in the preset field, and outputs the relevant entities and relationships in the natural language text in the preset field, including:
[0082] According to the sequential words of the reasoning steps in the guide words and the prompt statements of the reasoning process, the large model processes the natural language text in the preset field and outputs the relevant entities and relationships in the natural language text in the preset field.
[0083] Based on the above embodiment, further, step 130 specifically includes:
[0084] Obtain the text to be extracted in the preset field;
[0085] Utilizing the CoT reasoning step, obtaining entities in the text to be extracted, and then extracting entity relationships in the text to be extracted;
[0086] After comparing the entities and entity relationships in the text to be extracted with the ontology of the preset domain, the triple information of the text to be extracted is output according to the triple standard output format of the preset domain.
[0087] It should be understood that the present invention relates to the field of natural language processing and artificial intelligence technology, and in particular to a method and device for knowledge extraction based on a large model. By using deep learning and pre-trained language models, triples containing knowledge can be automatically identified and extracted from natural language texts, thereby improving the efficiency and accuracy of information retrieval and knowledge management.
[0088] In recent years, large language models (LLMs) have performed well in tasks such as natural language understanding and text generation. These models use their deep neural network architecture to capture complex patterns and implicit relationships in language, thus showing great potential in processing unstructured data. Through zero-shot learning, LLMs can extract triple knowledge directly from unstructured data according to instructions without further model training, thereby assisting the construction of knowledge graphs. However, the diversity of natural language expressions leads to unstable output results of generative models. For example, the text "StuffStephanie in the Incinerator (formerly known as In Deadly Heat) is a 1989 horror comedy written and directed by Don Nardo." describes the relationship between a movie and its director. Different words (such as "director" or "directed") can be used to express this relationship. When using LLM for triple extraction, if triples are obtained for similar sentences, changes may occur, such as [Stuff Stephanie in the Incinerator|Director|Don Nardo] and [Stuff Stephanie in the Incinerator|Director|Don Nardo]. When building a knowledge graph, it is necessary to align the semantically equivalent but differently expressed content, which can lead to some errors and affect the quality of the knowledge graph. In addition, when building a domain-specific knowledge graph, LLM may also extract many unnecessary triples from unstructured data, which need to be discriminated to filter out these triples, thereby increasing the workload in the knowledge graph construction process.
[0089] To address the above problems, this paper proposes to use ontology to guide LLMs that lack professional knowledge, and adopts Chain of Thought (CoT) to simulate the thinking process of humans understanding triple knowledge from unstructured data. This aims to guide LLMs to extract higher quality triples, thereby reducing the difficulty and workload of constructing domain-specific knowledge graphs.
[0090] Ontology defines a set of domain-specific conceptual frameworks and relational guidelines that guide the model to follow a predetermined structure when generating triples. This approach not only helps ensure that the extracted knowledge is consistent with the construction of the domain knowledge graph, but also reduces the diversity of extracting the same knowledge. By using thought chains in the triple extraction process, the model can better understand the requirements of complex tasks and follow logic and consistency when generating triples. This approach can be seen as a kind of "guidance" for the model, making it pay more attention to and abide by pre-set rules and standards during the generation process.
[0091] In summary, although existing knowledge extraction methods and large language models have achieved certain results in the construction of knowledge graphs, they still face the diversity and complexity of unstructured data processing. By introducing the guidance of ontology and thinking chain, the quality and consistency of knowledge extraction can be further improved, thus providing a more effective solution for the construction of knowledge graphs in specific fields.
[0092] The present invention proposes a knowledge extraction method combining ontology and chain of thought (CoT), which significantly improves the accuracy and consistency of knowledge extraction by guiding large language models (LLM) to think and learn more deeply in the process of information extraction. This method makes full use of the advantages of ontology in defining entities and relationships in the field, and the ability of chain of thought in simulating the step-by-step reasoning and verification process of humans. Through structured knowledge representation and step-by-step guided reasoning process, it overcomes the problems of unstable results and excessive diversity in traditional methods. In the specific implementation process, ontology provides a clear entity and relationship framework, limits and guides the knowledge extraction scope of LLM, and ensures the relevance and consistency of the extraction results; chain of thought helps the model to perform in-depth analysis and verification through step-by-step logical reasoning, ensuring the accuracy and logic of the generated triples. Combining these two technologies, the present invention realizes efficient and accurate knowledge extraction, greatly reduces the dependence on expert manual annotation and knowledge alignment, and provides strong technical support for the construction of knowledge graphs in various industries.
[0093] like Figure 2The comparison between the conventional method and the method of the present invention is shown, and the specific description is as follows:
[0094] Part A: Traditional methods
[0095] Traditional triple extraction methods rely on large language models (LLMs) to directly extract triples from natural language text. The specific process is as follows: ① Input natural language text: The user provides a natural language sentence or paragraph containing rich information. ② LLM understands and processes the text: LLM uses its pre-trained language understanding ability to analyze and understand the input text and identify the entities and potential relationships therein. ③ LLM generates a set of triples: Based on the understanding of the text, LLM extracts and generates structured information in the form of triples.
[0096] Although this method takes advantage of the powerful language understanding and generation capabilities of LLM, there are significant problems in practical applications. First, there may be multiple natural language expressions for a certain relationship between two entities, so LLM may generate multiple different expressions. Second, due to the diversity of natural languages and the generation mechanism of LLM, the output results are often unstable. For example, when faced with similar input sentences, LLM may generate slightly different triples.
[0097] The above differences require manual annotation and knowledge alignment by domain experts. This not only increases the complexity and workload of knowledge graph construction, but also makes building high-quality knowledge graphs more time-consuming and cumbersome. In addition, traditional methods often need to rely on a large amount of labeled data to train models when dealing with proper nouns and relations in vertical fields. However, the acquisition and processing of labeled data is itself a costly and time-consuming task, especially in fields that require expertise. In general, although traditional triple extraction methods can generate structured triples when processing natural language texts, due to the diversity and instability of the results, a lot of manual intervention and proofreading are required, and high-quality knowledge graphs cannot be efficiently constructed. These problems limit the widespread promotion and use of traditional methods in practical applications.
[0098] Part B: Methods of the Invention
[0099] The method of the present invention guides the model to think and learn more deeply in the process of information extraction by combining ontology and CoT to prompt LLM. The specific process is as follows: ① Input natural language text. ② Ontology provides a structured knowledge representation and defines entity types and relationships. ③ Through CoT prompts LLM to gradually identify entities, discover relationships between entities, and correspond to the ontology. ④ Generate consistent and accurate triples to reduce dependence on expert annotations.
[0100] It should be understood that the ontology in the present invention, as a structured form of knowledge representation, plays a vital role in the method of the present invention. It not only clearly defines the entity types in the field, but also describes in detail the relationship between these entities. The rule-based prior knowledge is embedded into the model through the ontology definition, guiding the behavior of the large model in identifying and extracting knowledge graph information. The specific functions include the following aspects:
[0101] Defining entities and relationships: Ontologies predefine various entity types and relationship types in a domain. For example, in the medical field, entity types include "disease", "symptoms", "treatment methods", etc., and relationship types include "cause", "relieve", "accompany", etc. These definitions provide a clear guiding framework for the model, enabling it to accurately identify and extract relevant entities and relationships when processing text.
[0102] Filtering and Guidance: Ontology acts as a "filter" or "compass" for the model and plays a key role in the knowledge extraction process. It helps the model filter out irrelevant information by providing clear entity and relationship standards, and focus on identifying and extracting relevant entities and relationships. In this way, the extracted triples not only meet the predefined domain standards, but also have a high degree of consistency. For example, when the model processes medical text, the ontology ensures that the extracted knowledge meets the professional standards of the medical field, thereby improving the consistency and accuracy of the knowledge graph construction.
[0103] Consistency checking and quality assessment: By comparing the output of the model with the ontology specification, errors or discrepancies in the extraction process can be quickly discovered and corrected. The ontology provides a standardized evaluation framework for checking whether the triples generated by the model meet the construction standards of the domain knowledge graph. If inconsistencies are found, the ontology can help identify the problem and guide the model to make corrections. For example, if the model deviates when extracting a relationship, the ontology can detect this problem through comparison and guide the model to generate triples that are more in line with the specification.
[0104] The present invention incorporates the Chain of Thought (CoT) method into the triple extraction process, which mainly includes the following steps:
[0105] Entity Extraction: First, the model identifies entities in the text. This step involves extracting specific types of nouns or phrases from natural language text that correspond to predefined domain entity types. For example, in a text related to movies, entities such as movie, director, and director are identified.
[0106] Relationship extraction: Next, the model discovers the relationships between these entities. By analyzing the semantics and context in the text, the model determines the associations between entities, such as "director" may have "directed" "movie", "movie" was "filmed at" a "location", etc. This step ensures that the extracted relationships reflect the actual information in the text.
[0107] Align to ontology: Finally, ensure that the extracted relationships are consistent with the ontology definition. The model compares and aligns the identified entities and relationships with the ontology to verify whether they meet the predefined domain standards and specifications. For example, ensure that the "director" relationship between "a certain director" and "a certain movie" is consistent with the relationship definition in the ontology. If there are inconsistencies or errors, the model will make corresponding adjustments and corrections.
[0108] Use the ICL prompt format, namely Instruction, Context, and Learning. The specific design is as follows:
[0109] Instruction: This part is provided by the system role with detailed instructions, including information about the ontology and the chain of thought (CoT) process. The design goal of the instruction part is to clarify the task requirements and the expected output format. The specific content includes information about the ontology and the CoT process:
[0110] Information about the ontology: Details about the predefined entity types and relationship types in the domain.
[0111] Information about the CoT process: explains how to perform entity extraction and relation extraction through step-by-step reasoning. The instructions clearly indicate the operations that the model needs to perform at each step and the details that need to be paid attention to, ensuring that the model can understand and follow the predetermined reasoning path.
[0112] Context: This part contains the natural language text entered by the user. The context part provides the model with specific text data, enabling it to extract knowledge in a real language environment. For example, a user may enter a sentence describing the relationship between a movie and a director. This part is designed to ensure that the model can accurately understand the meaning of the text and identify related entities and relationships.
[0113] Learning: This part provides sample outputs that show the format requirements for triple extraction in the domain. The learning part helps the model understand the expected output form of the task through specific examples. The sample output is presented in the form of triples. For example:
[0114] Sample input: "'Stuff Stephanie in the Incinerator', originally titled 'Stuff Stephanie in the Incinerator', is a 1989 horror comedy film written and directed by Don Naldo."
[0115] Sample output: [Stuff Stephanie in the Incinerator|Director|Don Naldo]
[0116] Through the design of the ICL prompt format, our method can effectively guide LLM to think and learn more deeply during the triple extraction process. The combination of the three enables the model to perform logical reasoning and generate high-quality knowledge triples based on the given prompts without relying on a large amount of training data. This method not only improves the accuracy and consistency of knowledge extraction, but also significantly reduces the reliance on manual annotation and intervention, and improves the efficiency and automation of knowledge graph construction.
[0117] like Figure 3 As shown in the figure, the process of guiding model reasoning through CoT and its integration with ontology is described, which specifically includes the following parts:
[0118] 1. Instruction part
[0119] The commands provided by the System role include:
[0120] ① Information about the entity, such as:
[0121] Entities: computers, software, people, companies, applications, file systems, etc.
[0122] Relationship: [application|maker|person] [software|platform|computer]
[0123] [File System | Manufacturer | Company]…
[0124] ② Steps related to the CoT process:
[0125] You should think step by step and read sentences and instructions carefully.
[0126] First, identify the entity.
[0127] Then, find the relationship between them.
[0128] Finally, determine which entities and relations conform to the definition of the ontology.
[0129] 2 Example section
[0130] The examples section shows a sample conversation of triplet extraction in the domain, and the required format of the model output.
[0131] For example:
[0132] Input: Windows Movie Maker is a discontinued video editing software program developed by Microsoft.
[0133] Sample output: [Windows Movie Maker | Manufacturer | Microsoft]
[0134] 3 User input part
[0135] The user enters a sentence to be extracted, for example:
[0136] NTFS (New Technology File System) is a proprietary journaling file system developed by Microsoft.
[0137] 4. Thinking Process
[0138] In the thinking process part, LLM, under the guidance of the previous sections, performs step-by-step reasoning, first extracting the entities present in the sentence, then extracting the possible relations between these entities, and finally mapping these triples to the predefined ontology, and finally generating the required triple output, [NTFS|Manufacturer|Microsoft].
[0139] The following is a detailed description of a specific embodiment:
[0140] Example 1: Triplet Extraction in the Motion Domain
[0141] Enter: Mark Hussey (born 11 May 1951) is a retired British professional wrestler who competed for Joint Promotions, All Star Wrestling and the second generation of BWF in the 1970s and 1980s under the name "Roller" Rocco, and in New Japan Pro Wrestling (NJPW) as the original Masked Black Tiger.
[0142] Ontology definition:
[0143] Entity Type: Person, Athlete, Team, Sport, ...
[0144] Relationship type: work, team affiliation, national affiliation...
[0145] CoT Tips:
[0146] The system role provides instructions: identify people, athletes, etc. in the text, and discover the relationship between these entities, and finally correspond to the ontology.
[0147] User role input text.
[0148] The sample role provides the output format.
[0149] Model output:
[0150] [Mark Hersey|Occupation|Professional Wrestler]
[0151] Example 2: Triple Extraction in the Field of Film
[0152] Input: Spirited Away (Japanese: 千と千尋の神隠し, Romanized: Sen to Chihiro no Kamikakushi, meaning "Spirited Away") is a 2001 Japanese animated fantasy film written and directed by Hayao Miyazaki and produced by Studio Ghibli for Tokuma Shoten, Nippon Television Network, Dentsu, Buena Vista Home Entertainment, Tohoku Shinsha, and Mitsubishi, and distributed by Toho.
[0153] Ontology Definition:
[0154] Entity Types: Theme, Person, Director, Release Date, Production Company, etc.
[0155] Relationship Types: Theme, Director, Publication Date, Production Company, On-screen Character, Screenwriter, etc.
[0156] CoT Prompt:
[0157] The system role provides instructions: Identify the theme, person, director, etc. in the text, discover the relationships between these entities, and correspond them to the ontology.
[0158] The example role provides the output format.
[0159] Model Output:
[0160] [Spirited Away|Theme|Fantasy Film]
[0161] [Spirited Away|Director|Hayao Miyazaki]
[0162] [Spirited Away|Release Date|July 20, 2001]
[0163] [Spirited Away|Production Company|Studio Ghibli]
[0164] [Spirited Away|Screenwriter|Hayao Miyazaki]
[0165] The present invention combines the ontology (Ontology) and CoT (Chain of Thought) methods, significantly improving the accuracy and consistency of triple extraction, while reducing the dependence on expert annotations, and promoting the automation process of knowledge graph construction. In specific fields such as medicine and film, the present invention demonstrates excellent performance, and can quickly and accurately extract high-quality triples from unstructured data, and then construct a knowledge graph that meets the needs of the field. This method not only improves the efficiency of data processing, but also can effectively deal with data sources with large amounts of information and high complexity, providing powerful tools for field experts and researchers to support their application in knowledge management and intelligent decision-making. Through the present invention, the automated construction and updating of knowledge graphs are realized, providing a reliable foundation for future data-driven research and innovation.
[0166] This paper introduces ontology and chain of thought (CoT) to effectively guide large language model (LLM) to extract triples, creating an efficient and accurate knowledge extraction method. The structured representation of ontology provides a clear knowledge framework, while chain of thought guides the model to deeply understand complex concepts and relationships through step-by-step reasoning, thereby significantly improving the quality and consistency of knowledge extraction, while reducing the need to rely on expert annotations.
[0167] By constructing a more accurate knowledge graph, the present invention can achieve more efficient data analysis and intelligent decision-making, and promote scientific and technological progress and innovation in commercial applications. Therefore, the present invention has important technical and commercial value in the current field of artificial intelligence and data science, and opens up new possibilities for future technological development.
[0168] like Figure 4 As shown, the present invention also provides a knowledge extraction device based on a large model, the device comprising:
[0169] A first processing module is used to obtain an ontology of a preset domain, wherein the ontology includes a plurality of knowledge representations, and the knowledge representations include entity types and relationship types of the preset domain;
[0170] The second processing module is used to adjust and modify the large model through the thinking chain CoT prompt, the natural language text and ontology of the preset field;
[0171] The third processing module is used to identify the text to be extracted in the preset field through the large model according to the CoT prompt, and obtain the triple information of the text to be extracted.
[0172] Based on the above embodiment, further, the second processing module is specifically used for the second processing module, specifically for inputting the natural language text of the preset field into the large model, and using the CoT prompt to gradually identify entities and entity relationships in the natural language text of the preset field;
[0173] Compare and align the entities and entity relationships in the identified natural language text of the preset domain with the ontology of the preset domain;
[0174] According to the comparison and alignment results, the large model is guided to be modified.
[0175] Based on the above embodiment, further, the second processing module is specifically used to input the sample input text and the sample output text of the preset field into the large model based on the CoT prompt and the multiple knowledge representations of the preset field, so that the large model learns the triple standard output format of the preset field;
[0176] The relevant entities and relationships in the natural language text of the preset domain are obtained by using the natural language text of the preset domain and the reasoning steps.
[0177] Based on the above embodiment, further, the second processing module is specifically used for
[0178] Inputting the natural language text of the preset domain into the macro model;
[0179] According to the reasoning steps, the large model performs corresponding operations on the natural language text in the preset domain, and outputs relevant entities and relationships in the natural language text in the preset domain.
[0180] Based on the above embodiment, further, the second processing module is specifically used to output relevant entities and relationships in the natural language text of the preset field after the large model processes the natural language text of the preset field according to the sequential words of the reasoning steps in the guide words and the prompt statements of the reasoning process.
[0181] Based on the above embodiment, further, the third processing module is specifically used to obtain the text to be extracted in the preset field;
[0182] Using the CoT prompt, obtaining entities in the text to be extracted, and then extracting entity relationships in the text to be extracted;
[0183] After comparing the entities and entity relationships in the text to be extracted with the ontology of the preset domain, the triple information of the text to be extracted is output according to the triple standard output format of the preset domain.
[0184] The present invention provides a knowledge extraction device based on a large model, comprising obtaining an ontology of a preset domain, wherein the ontology includes multiple knowledge representations, and the knowledge representations include entity types and relationship types of the preset domain; adjusting and correcting the large model through the CoT prompt of the thinking chain, the natural language text of the preset domain and the ontology; according to the CoT prompt, identifying the text to be extracted in the preset domain through the large model to obtain the triple information of the text to be extracted. The present invention significantly improves the accuracy and consistency of triple extraction, while reducing the dependence on expert annotations, and promoting the automation process of knowledge graph construction.
[0185] The present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements a large model-based knowledge extraction method described in any one of the above technical solutions.
[0186] The present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, a large model-based knowledge extraction method described in any one of the above technical solutions is implemented.
[0187] The above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit the same. Although the present invention has been described in detail with reference to the above embodiments, a person skilled in the art should understand that the specific implementation modes of the present invention can still be modified or replaced by equivalents, and any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be included in the scope of protection of the claims of the present invention.
Claims
1. A knowledge extraction method based on a large model, characterized in that: The method comprises: Acquire an ontology of a preset domain, wherein the ontology includes a plurality of knowledge representations, and the knowledge representations include entity types and relationship types of the preset domain; Adjust and modify the large model through the thought chain CoT prompts, the natural language text and ontology of the preset domain; According to the CoT prompt, the text to be extracted in the preset field is identified by the large model to obtain the triple information of the text to be extracted.
2. The method according to claim 1, characterized in that: The large model is adjusted and modified through the thought chain CoT prompt, the natural language text and ontology of the preset field, including: Inputting the natural language text of the preset domain into the large model, and using the CoT prompt, gradually identifying entities and entity relationships in the natural language text of the preset domain; Compare and align the entities and entity relationships in the identified natural language text of the preset domain with the ontology of the preset domain; According to the comparison and alignment results, the large model is guided to be modified.
3. The method according to claim 2, characterized in that The step of inputting the natural language text of the preset domain into the large model and using the CoT prompt to gradually identify entities and entity relationships in the natural language text of the preset domain includes: Based on the CoT prompt and the plurality of knowledge representations of the preset domain, inputting the sample input text and the sample output text of the preset domain into the large model, so that the large model learns the triple standard output format of the preset domain; The relevant entities and relationships in the natural language text of the preset domain are obtained by using the natural language text of the preset domain and the reasoning steps.
4. The method according to claim 3, characterized in that The obtaining of relevant entities and relationships in the natural language text of the preset domain by using the natural language text of the preset domain and the reasoning steps specifically includes: Inputting the natural language text of the preset domain into the macro model; According to the reasoning steps, the large model performs corresponding operations on the natural language text in the preset domain, and outputs relevant entities and relationships in the natural language text in the preset domain.
5. The method according to claim 4, characterized in that According to the inference step, the large model performs corresponding operations on the natural language text in the preset field, and outputs relevant entities and relationships in the natural language text in the preset field, including: According to the sequence words of the reasoning steps in the guide words and the prompt sentences of the reasoning process, the large model processes the natural language text in the preset field and outputs the relevant entities and relationships in the natural language text in the preset field.
6. The method according to claim 1, characterized in that According to the CoT prompt, the text to be extracted in the preset field is identified by the large model to obtain triple information of the text to be extracted, including: Obtain the text to be extracted in the preset field; Using the CoT prompt, obtaining entities in the text to be extracted, and then extracting entity relationships in the text to be extracted; After comparing the entities and entity relationships in the text to be extracted with the ontology of the preset domain, the triple information of the text to be extracted is output according to the triple standard output format of the preset domain.
7. A knowledge extraction device based on a large model, characterized in that: The device comprises: A first processing module is used to obtain an ontology of a preset domain, wherein the ontology includes a plurality of knowledge representations, and the knowledge representations include entity types and relationship types of the preset domain; The second processing module is used to adjust and modify the large model through the thinking chain CoT prompt, the natural language text and ontology of the preset field; The third processing module is used to identify the text to be extracted in the preset field through the large model according to the CoT prompt, and obtain the triple information of the text to be extracted.
8. The device according to claim 7, characterized in that The second processing module is specifically used to input the natural language text of the preset domain into the large model, and use the CoT prompt to gradually identify entities and entity relationships in the natural language text of the preset domain; Compare and align the entities and entity relationships in the identified natural language text of the preset domain with the ontology of the preset domain; According to the comparison and alignment results, the large model is guided to be modified.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the large model-based knowledge extraction method according to any one of claims 1 to 6 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the large model-based knowledge extraction method according to any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Large model triple extraction method based on entity large model knowledge injection
CN120067338A
A method for extracting triples from large entity models based on knowledge injection
CN120067338B
A Method for Constructing a Jewelry Valuation Knowledge Base Based on a Large Language Model
CN120562536B
Metro operation accident knowledge graph construction method and system, terminal and storage medium
CN121189452A
Subway operation accident knowledge graph construction method, system, terminal and storage medium
CN121189452B
