Open domain personalized information extraction system and method based on large model
By building prompt templates and tree structure parsing modules, the problems of low information extraction efficiency and poor interpretability in the existing technology are solved, and automated information extraction and high accuracy are achieved. An open domain personalized information extraction system suitable for multiple industry scenarios .
Patent Information
- Application Number
- CN202310596560.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-25
- Publication Date
- 2024-08-27
AI Technical Summary
Existing open domain information extraction technology has problems such as high labor costs, difficulty in covering all situations, strong dependence on domain experts, a large amount of annotated data and time based on machine learning, poor interpretability of deep learning methods, and high consumption of computing resources.
An open domain personalized information extraction system based on large models is used to automatically extract information from unstructured text data by building prompt templates and tree structure parsing modules, and filter unqualified triples using tree structure parsing and post-processing modules. Improve information processing efficiency and accuracy.
It realizes automated information extraction, reduces the need for manual intervention, improves the efficiency and accuracy of information processing, and is highly scalable and suitable for multiple industry scenarios.
Smart Images

Figure CN118550983A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of large models, and in particular to an open domain personalized information extraction system and method based on large models. Background Art
[0002] Existing open domain information extraction technologies mainly include rule templates, machine learning-based methods and deep learning methods.
[0003] Rule templates use the domain knowledge of human experts to construct rules and apply them in practical applications, which have the advantages of strong interpretability and easy understanding. However, rule templates have the disadvantages of high labor costs, difficulty in covering all situations, and strong dependence on domain experts.
[0004] Machine learning-based methods can automatically learn features and process relatively complex language structures. However, machine learning-based methods require a large amount of labeled data for training, and often take a long time to train the model, and may not be effective when faced with a variety of tasks.
[0005] Deep learning methods build neural network models to automatically learn language features and can process complex language structures, and can adapt to a variety of different fields and tasks. However, deep learning methods require a large amount of data and computing resources for training, and have a certain black box nature and poor interpretability.
[0006] Aiming at the defects in the existing open domain information extraction technology, a large model-based open domain personalized information extraction system and method are proposed to solve the above problems. Summary of the invention
[0007] To solve the above problems, the present invention provides the following technical solutions:
[0008] An open domain personalized information extraction system based on a large model, comprising:
[0009] Template library, which can build prompt templates so that the output of large language models has a tree structure;
[0010] A tree structure parsing module that can perform tree structure parsing on the output data of a large language model;
[0011] The post-processing module can filter the incomplete tree structure data in the data generated by the tree structure parsing module.
[0012] A method for extracting personalized information from an open domain based on a large model comprises the following steps:
[0013] S1. Construct a prompt template based on the sentences that need to be extracted and the extraction order of sentence graph information and event information, and import it into the large language model;
[0014] S2, the tree structure parsing module parses the output results of the large language model into triples through the tree structure parsing algorithm;
[0015] S3. The post-processing module filters the triples output by the tree structure parsing module and removes unqualified triples.
[0016] Based on the above technical solution, the present invention can also be improved as follows.
[0017] Furthermore, in S1, the input prompt template in the prompt template includes:
[0018] Input1: Extract graph information;
[0019] Input2: extract event information;
[0020] Input3: Extract graph information and event information.
[0021] Furthermore, the output prompt template in the prompt template includes:
[0022] Output1 for Input1;
[0023] Output2 for Input2;
[0024] Output3 for Input3.
[0025] Furthermore, in S1, when the sentence to be extracted is input into the prompt template, the prompt template at this time is:
[0026] Input: input, Output:.
[0027] Furthermore, graph type information is used to describe the common sense of the world, that is, the stable and unchanging relationship between two elements, and event type information is used to describe real events.
[0028] Furthermore, in S1, the input prompt template, the output prompt template, and the prompt template for importing the sentence of information to be extracted are spliced through delimiters and input into the large language model.
[0029] Furthermore, in S2, the step of parsing the output of the large language model by the tree structure parsing module includes:
[0030] S2-1. Use the ParentedTree function in the NLTK library to convert the string output by the large language model into a tree structure;
[0031] S2-2. Starting from the root node relationship of the obtained tree structure, traverse in sequence to obtain the head entity and the tail entity and construct the knowledge triple.
[0032] Furthermore, in the tree structure, the root of the subtree is the relationship, the child nodes of the root are the head entity, and the child nodes of the head entity are all the tail entities.
[0033] Furthermore, in S3, the post-processing module removes triples that do not appear in the input text of the large language model under the following conditions:
[0034] Condition 1: The content of the knowledge triples obtained in S2-2 does not completely exist in the text input to the large language model;
[0035] Condition 2: The knowledge triples obtained in S2-2 have the same head entity, relation, and tail entity;
[0036] When the content of the knowledge triplet obtained in S2-2 satisfies both condition 1 and condition 2, the knowledge triplet is eliminated.
[0037] Beneficial Effects
[0038] Compared with the prior art, the system in the present invention guides the large model to generate meaningful answers in a prompt manner, automatically extracts valuable information from massive unstructured text data without human intervention, and greatly improves the efficiency and accuracy of information processing.
[0039] At the same time, the template can also be easily extended to other fields, such as replacing the graph template and event template with a financial template and a medical template. It has high scalability and can be applied to various industries, thus providing a wide range of application scenarios. In actual use, the system can also extract personalized information according to user needs to provide more accurate results. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for describing the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0041] Figure 1 This is a structural block diagram of the present invention. DETAILED DESCRIPTION
[0042] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.
[0043] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.
[0044] The present invention discloses an open domain personalized information extraction system based on a large model, comprising a template library capable of constructing prompt templates, a tree structure parsing module capable of performing tree structure parsing on output data of the large model, and a post-processing module capable of filtering incomplete tree structure data in data generated by parsing the tree structure parsing module.
[0045] Through the constructed prompt template, this system can guide the output answers of the large model, so that the answers of the large language model can be in a tree structure, so as to facilitate the subsequent screening of effective answers of the large language model.
[0046] To further explain the above system in more detail, a method for extracting personalized information from an open domain based on a large model is now disclosed, comprising the following steps:
[0047] S1. Construct a prompt template based on the sentences that need to extract information and the extraction order of sentence graph information and event information, and import it into the large language model.
[0048] Specifically, the construction of the prompt template includes the following steps:
[0049] S1-1. Build the input prompt template:
[0050] Input1: Extract graph information. Graph information is used to describe the common sense of the world. There is a stable and unchanging relationship between two elements, such as (China, capital, Beijing).
[0051] Input2: Extract event type information. Event type information is used to describe real events, such as (Xiao Ming, attendance, meeting).
[0052] Input3: Extract graph information and event information.
[0053] S1-2. Build output prompt template:
[0054] Output1 for Input1.
[0055] Output2 for Input2.
[0056] Output3 for Input3.
[0057] S1-3, input the sentence to be extracted into the prompt template. The prompt template at this time is:
[0058] Input: input, Output.
[0059] S1-4, concatenate the input prompt template, the output prompt template, and the prompt template obtained in S1-3 through the separator [sep], and use the concatenated data as the input of the large language model.
[0060] S2. The tree structure parsing module parses the output results of the large language model into triples through a tree structure parsing algorithm.
[0061] The steps of parsing the output of the large language model by the tree structure parsing module in S2 include:
[0062] S2-1. Use the ParentedTree function in the NLTK library to convert the string output by the large language model into a tree structure. In the tree structure, each relationship corresponds to a subtree. The root of the subtree is the relationship, the child node of the root is the head entity, and the child nodes of the head entity are all the tail entities.
[0063] S2-2. Starting from the root node relationship of the obtained tree structure, traverse in sequence to obtain the head entity and the tail entity and construct the knowledge triple.
[0064] S3, the post-processing module filters the triples output by the tree structure parsing module, and when the content of the knowledge triple obtained in S2-2 satisfies both condition 1 and condition 2, the knowledge triple is eliminated.
[0065] The specific conditions are as follows:
[0066] Condition 1: The content of the knowledge triples obtained in S2-2 does not completely exist in the text input to the large language model.
[0067] Condition 2: The knowledge triples obtained in S2-2 have the same head entity, relation, and tail entity.
[0068] Compared with the method based on machine learning, the present invention can prompt the large language model to output structured information including event information and graph information by constructing a structured output prompt, which helps to improve the ability of open domain information extraction on the basis of better interpretability. Moreover, the template can be easily extended to other fields. For example, the graph template and event template can be replaced by financial field template and medical field template, etc. It has high scalability and is easy to deploy and develop. The output of the tree structure ensures that the large model can fully understand the intention of the task and achieve high-quality information extraction.
[0069] Embodiment 1:
[0070] In the above-mentioned open domain personalized information extraction system based on a large model, the prompt template can make the information data output by the large language model present a tree structure. The information extraction of news information is taken as an example.
[0071] The input prompt template at this time is:
[0072] Input1: Extract graph information.
[0073] Input2: Extract event information.
[0074] Input3: Extract graph and event information.
[0075] The output prompt template at this time is:
[0076] Output3 for Input3.
[0077] Output1 for Input1.
[0078] Output2 for Input2.
[0079] From the output prompt template, we can see that the above output information obviously has a tree structure.
[0080] Embodiment 2:
[0081] To provide a more detailed explanation of the tree structure, unlike Example 1, when multiple triplets have a common relationship, the output prompt data of the large model is still a tree structure. The following are two examples of triplets: (China, capital, Beijing) and (Japan, capital, Tokyo).
[0082] The tree structure of (China, capital, Beijing), (Japan, capital, Tokyo) is as follows:
[0083]
【
【Capital
【China
Beijing
【Japan
Tokyo
[0084] Among them, each relationship corresponds to a subtree, the root of the subtree is the relationship, the child node of the root is the head entity, and the child nodes of the head entity are all the tail entities.
[0085] Embodiment 3:
[0086] Different from Example 2, when multiple triples have common entities and relationships, the output prompt data of the large model is also a tree structure, taking the two triples (China, adjacent, Mongolia) and (China, adjacent, Russia) as examples.
[0087] The tree structure of (China, adjacent, Mongolia), (China, adjacent, Russia) is as follows:
[0088]
【
【Adjacent to
China
Mongolia
Russia
[0089] Embodiment 4:
[0090] Different from Example 3, the user can train the large language model by a few-shot logging method, which includes the following steps:
[0091] T1. Select a small number of text sentences and annotate them to guide the system to generate meaningful answers.
[0092] T2. Input the annotated text sentences into the system of the present invention.
[0093] T3. Obtain and record the output results in the system of the present invention.
[0094] Compared with deep learning and machine learning-based methods, this embodiment can guide the model to generate meaningful answers by giving a small amount of annotated text, which can be used as an example for the model to learn. In the long-term working process, only a small amount of annotated text is needed to enable the system to automatically extract valuable information from massive unstructured text data, without manual intervention, and without providing a large amount of annotated data and time to train the model, effectively improving the efficiency and accuracy of information processing.
[0095] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. An open domain personalized information extraction system based on a large model, characterized in that: include: Template library, which can build prompt templates so that the output of large language models has a tree structure; A tree structure parsing module that can perform tree structure parsing on the output data of a large language model; The post-processing module can filter the incomplete tree structure data in the data generated by the tree structure parsing module.
2. A method for extracting personalized information from an open domain based on a large model, characterized in that: The steps include: S1. Construct a prompt template based on the sentences that need to be extracted and the extraction order of sentence graph information and event information, and import it into the large language model; S2, the tree structure parsing module parses the output of the large language model into triples through a tree structure parsing algorithm; S3. The post-processing module filters the triples output by the tree structure parsing module and removes unqualified triples.
3. The method for extracting personalized information from an open domain according to claim 2, characterized in that: In S1, the input prompt template in the prompt template includes: Input1: Extract graph information; Input2: extract event information; Input3: Extract graph information and event information.
4. The method for extracting personalized information from an open domain according to claim 2, characterized in that: In S1, the output prompt template in the prompt template includes: Output1 for Input1; Output2 for Input2; Output3 for Input3.
5. The method for extracting personalized information from an open domain according to claim 2, characterized in that: The graph type information is used to describe the common sense of the world, that is, the relationship between two elements is stable and unchanging, and the event type information is used to describe real events.
6. The method for extracting personalized information from an open domain according to claim 2, characterized in that: In S1, when the sentence to be extracted is input into the prompt template, the prompt template at this time is: Input: input, Output:.
7. The method for extracting personalized information from an open domain according to claim 2, characterized in that: In S1, the input prompt template, the output prompt template, and the prompt template for importing the sentence of information to be extracted are spliced through delimiters and input into the large language model.
8. The method for extracting personalized information from an open domain according to claim 2, characterized in that: In S2, the step of parsing the output of the large language model by the tree structure parsing module includes: S2-1. Use the ParentedTree function in the NLTK library to convert the string output by the large language model into a tree structure; S2-2. Starting from the root node relationship of the obtained tree structure, traverse in sequence to obtain the head entity and the tail entity and construct the knowledge triple.
9. The method for extracting open domain personalized information according to claim 8, characterized in that: In the tree structure, the root of the subtree is the relationship, the child nodes of the root are the head entity, and the child nodes of the head entity are all the tail entities.
10. The method for extracting open domain personalized information according to claim 2, characterized in that: In S3, the post-processing module removes the triples that do not appear in the input text of the large language model under the following conditions: Condition 1: The content of the knowledge triples obtained in S2-2 does not completely exist in the text input to the large language model; Condition 2: The knowledge triples obtained in S2-2 have the same head entity, relation, and tail entity; When the content of the knowledge triple obtained in S2-2 satisfies both condition 1 and condition 2, the knowledge triple is eliminated.
