Domain knowledge graph construction method and system based on generative large language model

By automatically generating triple information for domain knowledge graphs using generative large language models, the problem of tedious manual annotation is solved, the integrity and interpretability of knowledge graphs are improved, and implicit relations and knowledge can be extracted.

CN116860987BActive Publication Date: 2026-03-31中电通商数字技术(上海)有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-13
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

When constructing domain knowledge graphs, existing technologies involve arduous manual annotation work, resulting in high labor costs and difficulty in effectively extracting implicit relationships and knowledge.

Method used

A generative large language model is adopted, which learns the triplet prompt information of the domain knowledge graph through the pre-trained GPT model, and automatically generates entity relationship and attribute information, reducing manual annotation work.

Benefits of technology

It enables the automated generation of triple information for domain knowledge graphs, improving the completeness and interpretability of knowledge graphs, extracting implicit relationships and knowledge, and reducing manual costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116860987B_ABST
    Figure CN116860987B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a domain knowledge graph construction method, system, device and storage medium based on a generative large language model, comprising the following steps: S1, constructing a generative large language model, the generative large language model is pre-trained by a large language model training module; S2, analyzing the use demand of the domain knowledge graph, and constructing a triple template of the domain knowledge graph; S3, pre-understanding the domain knowledge, collecting entity information of the domain knowledge graph to be generated based on the domain knowledge, and generating an entity list; S4, taking the template as prompt information of the generative large language model, and inputting the prompt information and the entity list into the generative large language model to obtain knowledge description information of each entity on the entity list based on the template; and S5, exporting and storing the knowledge description information, and generating the domain knowledge graph. The embodiment of the application can effectively solve the problem of knowledge extraction difficulty, thereby reducing the creation difficulty threshold of the domain knowledge graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of Internet technology, and more specifically, to a method, system, electronic device, and storage medium for constructing a domain knowledge graph based on a generative large language model. Background Technology

[0002] Knowledge graphs are structured representations of information, allowing the representation of complex relationships between entities and their attributes in a human-readable and machine-readable manner. This makes them well-suited for representing massive amounts of knowledge and supporting efficient querying and analysis of that knowledge. However, because open knowledge graphs integrate knowledge from multiple fields and disciplines, while they possess general applicability, their depth of knowledge is far from sufficient for specialized applications. Therefore, various industries are actively exploring the construction of domain-specific knowledge graphs within their vertical domains.

[0003] Previously, the basic steps in building a knowledge graph included knowledge extraction, knowledge representation, and knowledge fusion. In this process, knowledge extraction involves extracting useful knowledge from massive amounts of data; knowledge representation visualizes information such as entities, attributes, and relationships to facilitate storage, retrieval, and analysis within the graph; and knowledge fusion integrates and merges knowledge from different domains and sources to form a more complete and accurate knowledge graph. Therefore, building a knowledge graph is a complex data processing process. Thus, constructing a complete and usable domain knowledge graph requires extracting useful knowledge from massive amounts of industry data. However, knowledge extraction from massive amounts of industry data is a time-consuming and labor-intensive task. Therefore, simplifying the workload of knowledge extraction has become a pressing technical bottleneck in the industry.

[0004] One solution involves manually annotating a portion of the corpus and then using deep learning algorithms for supervised training on the annotated corpus to generate an entity relation extraction model. This model is then used for named entity recognition and relation attribute extraction on the remaining corpus. However, to enhance the model's predictive performance, it's necessary to annotate as much corpus as possible to cover various named entity recognition examples, making manual annotation a still arduous task. Furthermore, manual annotation requires mutual supervision through redundant annotations to reduce the error rate. This doubles the amount of corpus data that needs annotation, significantly increasing the manual cost of knowledge graph generation. Summary of the Invention

[0005] In view of this, embodiments of this application propose a method, system, electronic device, and storage medium for constructing a domain knowledge graph based on a generative large language model. This method utilizes a generative large language model to learn the triplet prompts of the domain knowledge graph. Based on prior learning from encyclopedic corpus data, it automatically understands the prompts for the triplet expressions required for constructing the domain knowledge graph, thereby quickly generating domain-specific triplet information and avoiding tedious manual annotation work. The technical solution is as follows:

[0006] According to one aspect of the embodiments of this application, a method for constructing a domain knowledge graph based on a generative large language model includes: Step S1: Constructing a generative large language model, wherein the generative large language model is pre-trained and generated through a large language model training module; Step S2: Analyzing the usage requirements of the domain knowledge graph and constructing a triplet template for the domain knowledge graph; Step S3: Pre-understanding the domain knowledge and, based on the domain knowledge, collecting entity information of the domain knowledge graph to be generated and generating an entity list; Step S4: Using the template as prompt information for the generative large language model and inputting it along with the entity list into the generative large language model to obtain knowledge description information for each entity in the entity list based on the template; Step S5: Exporting and storing the knowledge description information and generating the domain knowledge graph.

[0007] In one exemplary embodiment, the triplet template includes an entity relationship triplet template and an entity attribute triplet template. Analyzing the application scenarios of the domain knowledge graph, the entities in the entity list are classified according to the entity relationship triplet to be generated and the entity attribute triplet to be generated, and the corresponding triplet template of the category is used as prompt information.

[0008] In one exemplary embodiment, the knowledge description information includes: entity description information, relationship description information, and attribute description information.

[0009] In one exemplary embodiment, the exported knowledge description information is stored, specifically including: Step 51: storing the exported knowledge description information in an intermediate data storage module; Step 52: extracting the triplet information of entity relationships or entity attributes for each entity in the entity list from the intermediate data storage module; Step 53: storing the triplet information and corresponding description information in a structured manner into a graph database. In one exemplary embodiment, a domain knowledge graph is generated based on the triplet information stored in the graph database.

[0010] In one exemplary embodiment, the method for constructing a generative large language model specifically includes: Step 11: collecting domain knowledge as a corpus; Step 12: preprocessing the data in the corpus, including word segmentation, removal of invalid data, and punctuation marks; Step 13: encoding the word segments and constructing a word segmentation table based on the encoding; Step 14: using a Transformer model to construct an initial model of the generative large language model; Step 15: training and optimizing the generative large language model using the encoded corpus to obtain the generative large language model.

[0011] In one exemplary implementation, the generative large language model is the GPT model.

[0012] According to another aspect of the embodiments of this application, a domain knowledge graph construction system based on a generative large language model is provided, comprising: a large language model generation module, a triplet template construction module, an entity information collection module, a knowledge description information generation module, and a knowledge graph construction module; the large language model generation module is used to test and tune candidate generative large language models using test corpora to obtain a generative large language model with domain knowledge; the triplet template construction module is used to analyze the usage requirements of the knowledge graph and construct triplet templates for the domain knowledge graph; the entity information collection module is used to understand the domain knowledge in advance and, based on the domain knowledge, collect entity information of the domain knowledge graph to be generated and generate an entity list; the knowledge description information generation module is used to use the template as prompt information for the generative large language model and input it along with the entity list into the generative large language model to obtain knowledge description information for each entity in the entity list based on the template; the knowledge graph construction module is used to export the knowledge description information for storage and generate the domain knowledge graph.

[0013] In one exemplary embodiment, the system further includes: a triplet template comprising an entity relation triplet template and an entity attribute triplet template; the triplet template construction module is also used to analyze the application scenarios of the domain knowledge graph, classify the entities in the entity list according to the entity relation triplet to be generated and the entity attribute triplet to be generated, and apply the corresponding triplet template of the category as prompt information.

[0014] In one exemplary embodiment, the knowledge graph construction module is further configured to store the exported knowledge description information in an intermediate data storage module; extract the triple information of entity relations or entity attributes of each entity in the entity list from the intermediate data storage module; store the triple information and corresponding description information in a structured manner into a graph database; and generate a domain knowledge graph based on the triple information stored in the graph database.

[0015] In one exemplary embodiment, the large language model generation module is further configured to collect domain knowledge as a corpus; preprocess the data in the corpus, including segmenting the data into words, removing invalid data and punctuation marks; encode the segmented words and construct a segmentation table based on the encoding; select a Transformer model to construct an initial model of the generative large language model; and train and optimize the generative large language model using the encoded corpus to obtain the generative large language model.

[0016] In one exemplary implementation, the generative large language model is the GPT model.

[0017] According to another aspect of the embodiments of this application, an electronic device is provided, including: at least one processor, at least one memory, and at least one communication bus, wherein the memory stores a computer program, and the processor reads the computer program from the memory through the communication bus; the computer program is executed by the processor to implement the above-described method for constructing a domain knowledge graph based on a generative large language model.

[0018] According to another aspect of the embodiments of this application, a storage medium is provided on which a computer program is stored, and the computer program is executed by the processor of a computer to implement the above-described method for constructing a domain knowledge graph based on a generative large language model.

[0019] The beneficial effects of the technical solution provided in this application are:

[0020] 1. Generative large language models are used to automatically and on a large scale generate triple information for the domain knowledge graph, thereby avoiding manual annotation or extraction of the generated domain knowledge graph data.

[0021] 2. By using generative large language models to learn domain knowledge, not only can triple information of the knowledge graph be generated, but also entity descriptions of triple information can be generated, thereby filling the domain knowledge graph and improving the interpretability and usability of the domain knowledge graph.

[0022] 3. Using a generative large language model pre-trained with encyclopedia corpus as the training set as the baseline model, and then using the corpus of this domain for domain transfer, can improve the completeness and accuracy of triples in this vertical domain.

[0023] 4. When extracting entity relationships, the GPT model used in this application can infer implicit relationships between entities by learning the contextual information of the corpus during pre-training. This overcomes the limitations of existing technologies, which can only extract explicitly stated entity relationships from texts but cannot extract implicit relationships and implicit knowledge.

[0024] 5. Because it can extract implicit relationships and implicit knowledge, it greatly supplements the completeness of the domain knowledge graph and improves the underlying support of the domain knowledge graph for knowledge reasoning ability. Attached Figure Description

[0025] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.

[0026] Figure 1 This application provides an exemplary flowchart illustrating a method for constructing a domain knowledge graph based on a generative large language model.

[0027] Figure 2 This application provides an exemplary schematic diagram of a domain knowledge graph construction system based on a generative large language model.

[0028] Figure 3 This is a schematic diagram of an electronic device according to an exemplary embodiment. Detailed Implementation

[0029] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.

[0030] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application's specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.

[0031] A domain knowledge graph refers to the collection of information, knowledge, and rules within a specific domain (such as healthcare, finance, or law), presented visually to help users better understand and apply that domain's knowledge. As mentioned earlier, constructing a usable domain knowledge graph requires extracting useful knowledge from massive amounts of industry data. This extraction necessitates manual annotation of the corpus; due to the domain's specialized nature, this annotation work requires professionals within the industry to ensure accuracy. Therefore, the challenging nature of knowledge extraction has become a bottleneck in the technological development of domain knowledge graphs.

[0032] To address this issue, embodiments of this application provide a method for constructing a domain knowledge graph based on a generative large language model, focusing on solving the problem of difficult knowledge extraction during the construction of such a domain knowledge graph. Accordingly, the method and system for constructing a domain knowledge graph based on a generative large language model can also be deployed on electronic devices, such as computer devices configured with a von Neumann architecture, for example, desktop computers, laptops, servers, etc. Simultaneously, the method and system for constructing a domain knowledge graph based on a generative large language model can also be stored in a storage medium, such as a hard drive, CD-ROM, cloud storage, etc.

[0033] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0034] This domain knowledge graph construction method based on generative large language models is deployed in electronic devices. For ease of explanation, this embodiment will take the electronic device as a cloud storage server with computing capabilities as an example.

[0035] Please see Figure 1 An exemplary embodiment of this application provides a method for constructing a domain knowledge graph based on a generative large language model, which includes the following steps:

[0036] Step S1: Construct a generative large language model, which is pre-trained using a large language model training module; wherein, the generative large language model is a GPT model.

[0037] A generative language model is a natural language processing model that learns the structure and rules of language from historical data and then uses these rules to generate new language content. Existing generative language models include BERT and GPT. To reduce training costs, an exemplary embodiment of this application pre-trains the generative language model using a large language model training module. The training set used for pre-training is a massive encyclopedic corpus from the Internet. An optional implementation is to select GPT version 3.5 or higher as the baseline model for constructing the generative large language model. For ease of explanation, an exemplary embodiment of this application will continue to illustrate using the GPT 3.5 model as an example.

[0038] Because the GPT3.5 model is pre-trained on a massive encyclopedic corpus, it possesses inherent prior knowledge for adaptation in most domains. Therefore, when applied to vertical domains, only a small amount of test data is needed for model testing and optimization to achieve ideal generative results. This significantly reduces the workload compared to the corpus preparation task required for training existing triplet extraction models, thus reducing resource consumption. Therefore, the specific steps for constructing this generative large language model include:

[0039] Step 11: Collect domain knowledge as a corpus;

[0040] Step 12: Preprocess the data in the corpus, including word segmentation, removal of invalid data, and punctuation.

[0041] Step 13: Encode the word segment and construct a word segmentation table based on the encoding;

[0042] Step 14: Use the Transformer model to construct the initial model of this generative large language model;

[0043] Step 15: Train and fine-tune the generative large language model using the encoded corpus to generate the generative large language model.

[0044] Step S2: Analyze the usage requirements of knowledge graphs in this domain and construct a triplet template for knowledge graphs in this domain.

[0045] Specifically, knowledge graph triple types include: [entity-relationship-entity], [entity-attribute-value], etc. Due to the varying needs of knowledge graph construction across different domains, different triple types are required to represent entities and their relationships. For example, in the healthcare domain, entities include medical institutions, doctors, patients, drugs, and diseases; doctors and patients may have relationships such as diagnosis and treatment, and doctors and medical institutions may have a hierarchical relationship. Therefore, in the healthcare domain, the [entity-relationship-entity] triple is a common type of triple representing entities and their relationships. In the financial domain, entities include financial institutions such as banks, securities firms, insurance companies, and investment firms, as well as products and services; banks and securities firms may have relationships involving financing, and banks and insurance companies may have relationships involving customer relationship management. Therefore, in the financial domain, the [entity-attribute-value] triple is a common type of triple representing entities and their relationships. Therefore, before constructing a domain knowledge graph, it is necessary to first analyze the usage requirements of the knowledge graph based on the application scenarios of the domain, thereby determining the types of triples that may need to be constructed. Based on the determined triple types, a triple template for the domain knowledge graph is then constructed. This triple template will serve as a prompt for the generative large language model, guiding it to generate target triple information. One possible implementation is that the triple template can be constructed using triple paradigms. For example, in the medical field, to extract triples from the medical examination item "ankle joint anteroposterior and lateral views," the template can be constructed as follows:

[0046] Primary location: Lower limbs;

[0047] Secondary location: Ankle joint;

[0048] Examination method: Anteroposterior and lateral views;

[0049] In the subsequent triple extraction, only the next entity, i.e. the next "first-level part", needs to be input; the generative large language model can then automatically generate the triple information of the entity according to the template.

[0050] Step S3: Understand the knowledge of the domain in advance, and based on the knowledge of the domain, collect entity information to generate the knowledge graph of the domain, and generate an entity list.

[0051] Specifically, the process involves first understanding the knowledge in the domain, then collecting entity information for generating the knowledge graph of that domain, and finally creating an entity list. The specific steps include:

[0052] Step 31: Collect business data in this field, which includes textual data. For example, in the legal field, focus on collecting legal provisions and case precedents and judgments published on authoritative websites; in the medical field, focus on collecting patient information and diagnosis and examination information from medical institutions.

[0053] Step 32: Analyze the application scenarios of constructing the knowledge graph in this domain and determine the entity selection dimensions. For example, for a knowledge graph in the medical field, the application scenarios may be disease-assisted diagnosis or drug-assisted recommendation. Therefore, when selecting entities, disease-related entities, symptom-related entities, sign-related entities, examination-related entities, treatment-related entities, and drug entities can be used as selection dimensions.

[0054] Step 33: Based on the entity filtering dimensions, perform semantic understanding on the business data of this domain, extract entity information to be generated into the knowledge graph of this domain, and generate an entity list after collection and organization.

[0055] Another possible implementation is that this part of the work can also be based on existing structured databases; for example, some systems collect business data from the front end, and after data governance, store it in a structured database, so that entities can be collected from the structured database and an entity list can be built.

[0056] Furthermore, since triplet templates include entity-relationship triplet templates and entity-attribute triplet templates, it is necessary to analyze the application scenarios of the domain knowledge graph. Entities in the entity list should be categorized according to the entity-relationship triplets to be generated and the entity-attribute triplets to be generated, and the corresponding triplet templates should be applied as prompts. For example, for the physical characteristic entity "lower limb," to construct a knowledge graph node that allows querying the next level of physical characteristics of the lower limb, "lower limb" should be categorized into the triplet template type "entity-relationship-entity." Once the knowledge graph node is established, the result should be a directed node of "lower limb -> secondary body part -> ankle joint." For the physical characteristic entity "ankle joint," to construct a knowledge graph node that allows querying the examination methods of the ankle joint, "ankle joint" should be categorized into the triplet template type "entity-attribute-value." Once the knowledge graph node is established, the result should be an undirected node of "ankle joint-examination method-anteroposterior and lateral views."

[0057] Step S4: Use the template as a prompt for the generative large language model and input it along with the entity list into the generative large language model to obtain knowledge description information for each entity in the entity list based on the template.

[0058] Specifically, based on the template type adapted to the entity list, the template is input as a prompt into the generative large language model, followed by the named entities of the entity list, thereby obtaining the knowledge description information for each entity in the entity list based on the template. Depending on the template type used, this knowledge description information includes: entity description information, relation description information, and attribute description information. The data type of this knowledge description information can be a text description containing triple information (i.e., structured data-like) or triple information generated according to the template format (structured data).

[0059] Step S5: Export the knowledge description information for storage and generate a knowledge graph for the domain.

[0060] Specifically, if the data type of the knowledge description information is textual description information containing triple information, then the specific steps for exporting and storing the knowledge description information to generate a knowledge graph for this domain include:

[0061] Step 51: Store the exported knowledge description information in the intermediate data storage module;

[0062] Step 52: Extract the triplet information of entity relationships or entity attributes for each entity in the entity list from the intermediate data storage module;

[0063] Step 53: Store the triplet information and its corresponding description information in a structured manner into the graph database;

[0064] Step 54: Generate a domain knowledge graph based on the triple information stored in the graph database.

[0065] Please refer to Figure 2 An exemplary embodiment of this application discloses a domain knowledge graph construction system 200 based on a generative large language model, including: a large language model generation module 210, a triplet template construction module 220, an entity information collection module 230, a knowledge description information generation module 240, and a knowledge graph construction module 250.

[0066] The large language model generation module 210 is used to test and tune candidate generative large language models using test corpora to obtain a generative large language model 260 with domain knowledge. Specifically, the large language model generation module 210 is also used to collect domain knowledge as a corpus; preprocess the data in the corpus, including word segmentation, removal of invalid data and punctuation; encode the word segments and construct a word segmentation table based on the encoding; select a Transformer model to construct an initial model of the generative large language model; and train and optimize the generative large language model using the encoded corpus to obtain the generative large language model. One possible implementation is to use the GPT model for the generative large language model.

[0067] The triplet template construction module 220 is used to analyze the usage requirements of the domain knowledge graph and construct triplet templates for the domain knowledge graph. One possible implementation is that the triplet templates include entity relationship triplet templates and entity attribute triplet templates. The triplet template construction module is also used to analyze the application scenarios of the domain knowledge graph, classify the entities in the entity list according to the entity relationship triplets to be generated and the entity attribute triplets to be generated, and apply the corresponding triplet template of the category as prompt information.

[0068] The entity information collection module 230 is used to understand the domain knowledge in advance, and based on the domain knowledge, collect entity information to be generated into the domain knowledge graph, and generate an entity list.

[0069] The knowledge description information generation module 240 is used to use the template as prompt information for the generative large language model and input it into the generative large language model together with the entity list to obtain knowledge description information based on the template for each entity in the entity list.

[0070] The knowledge graph construction module 250 is used to export and store knowledge description information and generate a domain knowledge graph. Specifically, the knowledge graph construction module 250 is also used to store the exported knowledge description information in an intermediate data storage module; extract the triple information of entity relations or entity attributes of each entity in the entity list from the intermediate data storage module; store the triple information and corresponding description information in a structured manner into a graph database; and generate a domain knowledge graph based on the triple information stored in the graph database.

[0071] In summary, the beneficial effects of the technical solution provided by the embodiments of this application include: automatically generating triple information of the domain knowledge graph using a generative large language model, thereby avoiding manual annotation or extraction of data in the domain knowledge graph to be generated. Utilizing a generative large language model to learn domain knowledge can not only generate triple information of the domain knowledge graph, but also generate entity descriptions of the triple information, thus filling the domain knowledge graph and improving its interpretability and usability. Using a generative large language model pre-trained with encyclopedia corpus as the training set as the baseline model, and then using domain corpus for domain transfer, can improve the completeness and accuracy of triples in the vertical domain. Furthermore, when extracting entity relationships using the GPT model adopted in this application, it can rely on learning the contextual information of the corpus during pre-training to infer implicit relationships between entities, overcoming the limitations of existing technologies that can only extract explicitly stated entity relationships from text, but cannot extract implicit relationships and implicit knowledge. Because it enables the extraction of implicit relationships and implicit knowledge, it greatly supplements the completeness of the domain knowledge graph and improves the underlying support of the domain knowledge graph for knowledge reasoning ability.

[0072] Please see Figure 3 An exemplary embodiment of this application provides an electronic device 4000, which may be a computer, server, virtual machine, etc. Figure 3 The electronic device 4000 includes at least one processor 4001, at least one communication bus 4002, and at least one memory 4003. The processor 4001 and memory 4003 are connected, for example, via the communication bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, which can be used for data interaction between the electronic device and other electronic devices, such as sending and / or receiving data. The memory 4003 stores a computer program, and the processor 4001 reads the computer program from the memory 4003 via the communication bus; when the computer program is executed by the processor 4001, it implements the aforementioned domain knowledge graph construction method based on a generative large language model. It should be noted that in practical applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of this application.

[0073] In addition, another example of this application provides a storage medium storing a computer program that, when executed by a processor, implements the domain knowledge graph construction method based on a generative model in the above embodiments.

[0074] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0075] The above are only some embodiments of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for constructing a domain knowledge graph based on a generative large language model, characterized in that, Comprise: Step S1: constructing a generative large language model, the generative large language model is pre-trained by a large language model training module; wherein, the generative large language model pre-trained by using encyclopedia corpus as training set is selected as baseline model, and domain migration is carried out by using domain corpus; Step S2: analyzing the use demand of the domain knowledge graph, constructing the triple template of the domain knowledge graph; Step S3: pre-understanding the domain knowledge, collecting entity information to be generated in the domain knowledge graph based on the domain knowledge, and generating entity list; Step S4: taking the template as the prompt information of the generative large language model, and inputting the template and the entity list into the generative large language model to obtain the knowledge description information of each entity on the entity list based on the template; Step S5: exporting and storing the knowledge description information, and generating the domain knowledge graph; Wherein, the triple template includes entity relationship class triple template and entity attribute class triple template; analyze the application scenario of the domain knowledge graph, classify the entities in the entity list according to the generated entity relationship class triple and the generated entity attribute class triple, and use the triple template corresponding to the applicable category as prompt information. 2.The method of claim 1, wherein the method is characterized by, The knowledge description information includes: entity description information, relationship description information and attribute description information. 3.The method of claim 1, wherein, The exporting and storing the knowledge description information, specifically includes: Step 51: storing the exported knowledge description information in an intermediate data storage module; Step 52: extracting the triple information of entity relationship or entity attribute of each entity in the entity list from the intermediate data storage module; Step 53: storing the triple information and corresponding description information in the graph database in a structured way. 4.The method of claim 3, wherein the method further comprises: determining a domain of the input sentence based on the domain knowledge graph; and selecting a pre-trained large language model corresponding to the domain of the input sentence. : generating the domain knowledge graph based on the triple information stored in the graph database. 5.The method of claim 1, wherein, The construction method of the generative large language model, specifically includes: Step 11: collecting domain knowledge as corpus; Step 12: preprocessing the data of the corpus, the preprocessing includes tokenizing data, removing invalid data, and punctuation; Step 13: encoding the tokenization and constructing a tokenization table based on the encoding; Step 14: selecting a Transformer model to construct an initial model of the generative large language model; Step 15: training and optimizing the generative large language model using the encoded corpus to generate the generative large language model. 6.The method of claim 1, wherein the method further comprises: The generative large language model is a GPT model. 7.A domain knowledge graph construction system based on a generative large language model, characterized in that, Comprise: Large language model generation module, triple template construction module, entity information collection module, knowledge description information generation module and knowledge graph construction module; The large language model generation module is used for testing and parameterizing the candidate generative large language model by using test corpus, so as to obtain a generative large language model with domain knowledge, wherein, the generative large language model pre-trained by using encyclopedia corpus as training set is selected as baseline model, and domain migration is carried out by using domain corpus; The triple template construction module is configured to analyze usage requirements of the domain knowledge graph, and construct triple templates of the domain knowledge graph. The entity information collection module is configured to pre-understand the domain knowledge, and collect entity information of the domain knowledge graph to be generated based on the domain knowledge, and generate an entity list. The knowledge description information generation module is configured to input the templates as prompt information of the generative large language model, and input the templates and the entity list into the generative large language model to obtain knowledge description information of each entity on the entity list based on the templates. The knowledge graph construction module is configured to export and store the knowledge description information, and generate the domain knowledge graph. The triple template construction module is further configured to analyze application scenarios of the domain knowledge graph, classify entities in the entity list according to to-be-generated entity relationship triplets and to-be-generated entity attribute triplets, and use the triple templates corresponding to the applicable categories as prompt information. 8.The large language model-based domain knowledge graph construction system of claim 7, wherein, The knowledge graph construction module is further configured to store the exported knowledge description information in an intermediate data storage module, and extract triple information of entity relationships or entity attributes of each entity in the entity list from the intermediate data storage module. The triple information and corresponding description information are stored in a graph database in a structured manner, and the domain knowledge graph is generated based on the triple information stored in the graph database. 9.The large language model-based domain knowledge graph construction system of claim 7, wherein, The large language model generation module is further configured to collect domain knowledge as a corpus, pre-process data of the corpus, the pre-processing including tokenization, removal of invalid data, and punctuation marks. The tokenization is encoded, and a tokenization table based on the encoding is constructed, a Transformer model is selected to construct an initial model of the generative large language model, and the generative large language model is trained and optimized using the encoded corpus to generate the generative large language model. 10.The large language model-based domain knowledge graph construction system of claim 7, wherein, The generative large language model is a GPT model.

11. An electronic device, comprising: Comprise: at least one processor, at least one memory, and at least one communication bus, wherein the memory has stored thereon a computer program, and the processor reads the computer program in the memory through the communication bus; the computer program is executed by the processor to implement the domain knowledge graph construction method based on the generative large language model according to any one of claims 1 to 6.

12. A storage medium, characterized by Comprise: a computer program is stored thereon, and the computer program is executed by a computer processor to implement the domain knowledge graph construction method based on the generative large language model according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Knowledge graph construction method based on Chinese electronic medical records

    CN113688255A

  • Answer acquisition method based on knowledge graph

    CN114896377A