Knowledge graph construction method and device based on large language model, equipment and storage medium

By training the vertical field text data of the base large language model, the target large language model is generated, and the problems of predefined pattern information and instability of model output in knowledge graph construction are solved, and efficient and accurate knowledge graph construction is achieved.

CN120087461APending Publication Date: 2025-06-03PENG CHENG LAB
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411229184.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2025-06-03

AI Technical Summary

Technical Problem

The prior art faces the limitations of predefined pattern information and the instability of large language model output when building knowledge graphs, resulting in insufficient construction efficiency and accuracy of knowledge graphs.

Method used

The initial large language model is generated based on the base large language model and trained it using vertical domain text data to obtain the target large language model. Then, the detection text data is extracted using the target large language model, and the entity word and entity relationship triple data are obtained, and a vertical domain knowledge graph is finally constructed.

Benefits of technology

It improves the efficiency and accuracy of knowledge graph construction, and overcomes the limitations of predefined pattern information and instability of model output in traditional methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120087461A_ABST
    Figure CN120087461A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of knowledge graph construction, and discloses a knowledge graph construction method and device based on a large language model, equipment and a storage medium, and the method comprises the steps: generating an initial large language model based on a base large language model; obtaining vertical field text data, and training the initial large language model according to the vertical field text data to obtain a target large language model; extracting to-be-detected text data through the target large language model to obtain entity word and entity relationship triple data; and constructing a vertical domain knowledge graph based on the entity words and the entity relationship triple data. The knowledge graph construction efficiency and accuracy can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of knowledge graph construction, and particularly to a knowledge graph construction method, device, equipment and storage medium based on a large language model. Background Art

[0002] As a representation method of structured knowledge, a knowledge graph organizes entities and their relationships in the form of nodes and edges through a graph structure. It not only helps machines better understand and process complex information, but also greatly improves the efficiency of information retrieval, data analysis and decision support. For example, in the medical field, a knowledge graph can help doctors quickly obtain the association information between diseases, drugs and treatment plans, thereby improving the accuracy of diagnosis and treatment. In the industrial field, a knowledge graph can help enterprises integrate and manage scattered data resources, and also promotes cross-departmental collaboration and decision-making processes. However, the construction process of a knowledge graph is full of challenges. Traditional knowledge graph construction methods rely on expert knowledge and in-depth analysis of a large amount of text data, which is time-consuming and costly. With the explosive growth of data volume and the diversification of data types, traditional methods have become difficult to meet the need for quickly constructing high-quality knowledge graphs.

[0003] In recent years, with the remarkable progress of large language model technology, automated knowledge graph construction methods have begun to fully utilize the powerful natural language understanding capabilities of these models. These methods can automatically extract and construct entity-relationship triples from text by designing specific prompt information, thereby realizing the automated construction of a knowledge graph. To ensure the accuracy and reliability of the generated triples, these methods usually need to pre-define detailed schema information in the prompt information, including but not limited to entity types and relationship types. However, when dealing with complex text data with strong professionalism and large data volume, the pre-defined schema information may encounter problems of incomplete coverage or over-wide coverage. Specifically, when facing professional texts in a specific field, the pre-defined schema information may not be able to fully cover all relevant entities and relationships, resulting in omissions in the construction of the knowledge graph. On the contrary, if the schema definition is too broad, it may introduce irrelevant or incorrect entities and relationships, thus affecting the quality and accuracy of the knowledge graph.

[0004] The automated knowledge graph construction method based on large language models can greatly improve the construction efficiency of knowledge graphs. However, due to the randomness of large language models, the model may exhibit certain instability when repeatedly extracting entity-relationship triples. This problem may lead to outputs that do not meet the preset standards when performing formatting operations, such as generating a JSON structure with a fixed format, including format errors or generating information unrelated to standard JSON entries. These non-compliant results not only affect the validity of the knowledge graph but also may reduce the overall efficiency of the automated construction of the knowledge graph. It can be seen that although the automated knowledge graph construction method based on large language models can significantly improve the construction efficiency, it still faces challenges such as the limitations of predefined schema information and the instability of model outputs in practical applications. These challenges not only affect the accuracy and integrity of the knowledge graph but also may lead to a decrease in the efficiency of the automated construction process.

[0005] Therefore, how to effectively improve the construction efficiency and accuracy of knowledge graphs is an urgent problem to be solved currently.

[0006] The above content is only used to assist in understanding the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0007] The main purpose of this application is to provide a knowledge graph construction method, device, equipment, and storage medium based on large language models, aiming to solve the technical problem of how to effectively improve the construction efficiency and accuracy of knowledge graphs.

[0008] To achieve the above purpose, this application proposes a knowledge graph construction method based on large language models, and the method includes:

[0009] Generate an initial large language model based on a base large language model;

[0010] Obtain vertical domain text data, and train the initial large language model according to the vertical domain text data to obtain a target large language model;

[0011] Extract entity words and entity-relationship triple data from the text data to be detected through the target large language model;

[0012] Construct a vertical domain knowledge graph based on the entity words and the entity-relationship triple data.

[0013] In one embodiment, the generating an initial large language model based on a base large language model includes:

[0014] Determine public information based on mass media information sources, and extract entity recognition data samples and relationship recognition data samples based on the public information;

[0015] Construct a dataset based on the entity recognition data sample and the relationship recognition data sample;

[0016] Train the base large language model through the dataset and optimize the model parameters to obtain an initial large language model.

[0017] In one embodiment, the obtaining vertical domain text data and training the initial large language model according to the vertical domain text data to obtain a target large language model includes:

[0018] Determine vertical domain text data based on professional information sources;

[0019] Perform preprocessing operations on the vertical domain text data to obtain preprocessed vertical domain text data, where the preprocessing operations include at least one of removing noise data, correcting error data, and standardizing text formats;

[0020] Annotate entity words and entity relationship triples in the preprocessed vertical domain text data to obtain annotated vertical domain text data;

[0021] Train the initial large language model through the annotated vertical domain text data to obtain a target large language model.

[0022] In one embodiment, the extracting entity words and entity relationship triple data from the text data to be detected through the target large language model includes:

[0023] Obtain first prompt information and input the first prompt information into the target large language model to obtain a pattern definition pair;

[0024] Perform pattern retrieval according to the pattern definition pair to obtain target pattern information, where the target pattern information includes target entity types and target relationship types;

[0025] Extract entity words and entity relationship triple data from the text data to be detected through the target large language model according to the target pattern information.

[0026] In one embodiment, the obtaining first prompt information and inputting the first prompt information into the target large language model to obtain a pattern definition pair includes:

[0027] Generate first prompt information according to example text, triple format, and the text data to be detected, and input the first prompt information into the target large language model to obtain relationship triples;

[0028] Generate a second prompt message based on the text data to be detected and the relational triple, and input the second prompt message into the target large language model to obtain a pattern definition pair, where the pattern definition pair consists of a relationship type and a relationship definition.

[0029] In one embodiment, the pattern retrieval based on the pattern definition pair to obtain target pattern information includes:

[0030] Obtain the vector similarity between the pattern definition pair and the pattern information in the pattern information definition group;

[0031] Determine the candidate pattern information in the pattern information definition group according to the vector similarity;

[0032] Determine the target relationship type based on the pattern definition pair and the candidate pattern information;

[0033] Determine the target pattern information according to the target relationship type.

[0034] In one embodiment, the determining the target pattern information based on the pattern definition pair and the candidate pattern information includes:

[0035] When the candidate pattern information does not meet the preset conditions, determine the target relationship type according to the pattern definition pair;

[0036] When the candidate pattern information meets the preset conditions, determine the target relationship type according to the candidate pattern information.

[0037] In addition, to achieve the above object, the present application also proposes a knowledge graph construction device based on a large language model, and the knowledge graph construction device based on the large language model includes:

[0038] A generation module, configured to generate an initial large language model based on a base large language model;

[0039] A training module, configured to obtain vertical domain text data and train the initial large language model according to the vertical domain text data to obtain a target large language model;

[0040] An extraction module, configured to extract entity words and entity relationship triple data from the text data to be detected through the target large language model;

[0041] A construction module, configured to construct a vertical domain knowledge graph based on the entity words and the entity relationship triple data.

[0042] In addition, to achieve the above object, the present application also proposes a knowledge graph construction device based on a large language model, the device includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program is configured to implement the steps of the knowledge graph construction method based on the large language model as described above.

[0043] In addition, to achieve the above object, the present application also proposes a storage medium, the storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium, and when the computer program is executed by a processor, it implements the steps of the knowledge graph construction method based on the large language model as described above.

[0044] In addition, to achieve the above object, the present application also provides a computer program product, the computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps of the knowledge graph construction method based on the large language model as described above.

[0045] The present application provides a knowledge graph construction method based on a large language model. The present application first generates an initial large language model based on a base large language model; obtains vertical domain text data, and trains the initial large language model according to the vertical domain text data to obtain a target large language model; extracts the text data to be detected through the target large language model to obtain entity words and entity relationship triple data; constructs a vertical domain knowledge graph based on the entity words and the entity relationship triple data, which can effectively improve the efficiency and accuracy of knowledge graph construction.

[0046] In summary, it can be seen that the present application trains the initial large language model generated according to the base large language model by using vertical domain text data. The target large language model obtained through training can quickly and accurately extract entity words and entity relationship triple data from the text data to be detected, and then can quickly and accurately construct a vertical domain knowledge graph, overcoming the technical defects of poor efficiency and accuracy in current knowledge graph construction, and can effectively improve the efficiency and accuracy of knowledge graph construction. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.

[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.

[0049] Figure 1 This is a schematic flowchart provided for the first embodiment of the method for constructing a knowledge graph based on a large language model in this application;

[0050] Figure 2 This is the overall flowchart provided for the first embodiment of the method for constructing a knowledge graph based on a large language model in this application;

[0051] Figure 3 This is a schematic flowchart provided for the second embodiment of the method for constructing a knowledge graph based on a large language model in this application;

[0052] Figure 4 This is a schematic diagram of the module structure of the device for constructing a knowledge graph based on a large language model in the embodiment of this application;

[0053] Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the method for constructing a knowledge graph based on a large language model in the embodiment of this application.

[0054] The realization of the purpose, functional features, and advantages of this application will be further described in conjunction with the embodiments with reference to the accompanying drawings. Detailed implementation manners

[0055] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of this application and are not used to limit this application.

[0056] To better understand the technical solutions of this application, the following will be described in detail in conjunction with the accompanying drawings of the specification and specific implementation manners.

[0057] The main solution of the embodiment of this application is: generating an initial large language model based on a base large language model; obtaining vertical domain text data, and training the initial large language model according to the vertical domain text data to obtain a target large language model; extracting the text data to be detected through the target large language model to obtain entity words and entity relationship triple data; constructing a vertical domain knowledge graph based on the entity words and the entity relationship triple data.

[0058] The automated knowledge graph construction method based on large language models can greatly improve the construction efficiency of knowledge graphs. However, due to the randomness of large language models, the model may show certain instability when repeatedly extracting entity relationship triples. This problem may lead to outputs that do not meet the preset standards when performing formatting operations, such as generating a fixed-format JSON structure, including format errors or generating information unrelated to standard JSON entries. These non-compliant results not only affect the validity of the knowledge graph but also may reduce the overall efficiency of the automated construction of the knowledge graph. It can be seen that although the automated knowledge graph construction method based on large language models can significantly improve the construction efficiency, it still faces challenges such as the limitations of predefined schema information and the instability of model outputs in practical applications. These challenges not only affect the accuracy and integrity of the knowledge graph but also may lead to a decrease in the efficiency of the automated construction process. Therefore, how to effectively improve the construction efficiency and accuracy of the knowledge graph is an urgent problem to be solved currently.

[0059] In this application, the initial large language model generated according to the base large language model is trained using vertical domain text data. The target large language model obtained through training can quickly and accurately extract entity words and entity relationship triple data from the text data to be detected, and then can quickly and accurately construct a vertical domain knowledge graph, overcoming the technical defects of poor construction efficiency and accuracy of the current knowledge graph, and can effectively improve the construction efficiency and accuracy of the knowledge graph.

[0060] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication, and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or an electronic device capable of implementing the above functions, a knowledge graph construction device based on a large language model, etc. Hereinafter, a knowledge graph construction device based on a large language model will be taken as an example to illustrate this embodiment and the following embodiments.

[0061] Based on this, an embodiment of this application provides a knowledge graph construction method based on a large language model, referring to Figure 1 , Figure 1 is a schematic flowchart of the first embodiment of the knowledge graph construction method based on a large language model of this application.

[0062] In this embodiment, the knowledge graph construction method based on a large language model includes steps S10 to S40:

[0063] Step S10, generating an initial large language model based on the base large language model.

[0064] It should be noted that the base large language model refers to a large language model that has been pre-trained and has certain language processing capabilities. It is a large language model built on general knowledge for processing interactive dialogue tasks. For example, ChatGLM-4-9b has achieved very good results on benchmark data such as Chinese Alignment AlignBench, Instruction Compliance IFeval, and Engineering Code NaturalCode Bench.

[0065] It can be understood that the initial large language model refers to a large language model enhanced for knowledge graph construction tasks. It is a model obtained by further training on a specific task or domain based on the base large language model. In the process of generating the initial large language model, transfer learning techniques can be used to transfer the knowledge of the base large language model to new tasks or domains.

[0066] It is worth noting that by adopting a task adaptation training strategy for the base large language model and using a large-scale publicly available information extraction fine-tuning dataset to train the model, it is ensured that the model can achieve task professionalism. After model training, it can provide more accurate and reliable results in subsequent automated construction of vertical domain knowledge graphs, reduce the generation of invalid or redundant characters, and improve the effectiveness of automated construction of knowledge graphs.

[0067] In a feasible implementation manner, step S10 may include: determining public information based on mass media information sources, and extracting entity recognition data samples and relationship recognition data samples based on the public information; constructing a dataset according to the entity recognition data samples and the relationship recognition data samples; training the base large language model and optimizing model parameters through the dataset to obtain an initial large language model.

[0068] It should be noted that mass media information sources refer to a wide range of information channels including news, social media, blogs, forums, etc. These channels generate a large amount of text data every day. This data not only contains rich entity information such as person names, place names, and organization names, but also implies complex entity relationships such as superior-subordinate relationships, cooperation relationships, and competition relationships. By mining the public information in these mass media information sources, rich and diverse entity recognition data samples and relationship recognition data samples can be obtained. Some entity recognition data samples from the large-scale publicly available information extraction fine-tuning dataset are as follows:

[0069] {

[0070] "instruction":"{\"instruction\":\"You are an expert specialized in entity extraction. Please extract entities that conform to the schema definition from the input. Return an empty list for entity types that do not exist. Please answer in the format of a JSON string.\",\"schema\":[\"education background\",\"native place\",\"ethnic group\",\"person's name\",\"major\",\"organization\",\"nationality\",\"position\"],\"input\":\"Currently serving as the deputy general manager and chief accountant of Yunnan Yunwei Group Co., Ltd., and a director of Yunnan Yunwei Co., Ltd.\"}",

[0071] "output":"{\"education background\":[],\"native place\":[],\"ethnic group\":[],\"person's name\":[],\"major\":[],\"organization\":[],\"nationality\":[],\"position\":[\"deputy general manager\",\"chief accountant\",\"director\"]}"

[0072] }

[0073] Some relationship recognition data samples from the fine-tuning dataset for large-scale public information extraction are as follows:

[0074] {

[0075] "instruction":"{\"instruction\":\"You are an expert specialized in relationship extraction. Please extract relationship triples that conform to the schema definition from the input. Return an empty list for relationships that do not exist. Please answer in the format of a JSON string.\",\"schema\":[\"establishment date\",\"producer\",\"professional code\",\"floor area\"],\"input\":\"Kaiping Shuikou Weide Plastic and Hardware Factory is located in Shuinuancheng, Shuikou Town, Kaiping City. The company was established in 2006 and is an individual-owned enterprise specializing in the production of bathroom plastic products.\"}",

[0076] "output":"{\"establishment date\":[{\"subject\":\"Kaiping Shuikou Weide Plastic and Hardware Factory\",\"object\":\"2006\"}],\"producer\":[],\"professional code\":[],\"floor area\":[]}"

[0077] }

[0078] It is understandable that natural language processing technology is used to preprocess the text in the mass media information source, including word segmentation, part-of-speech tagging, named entity recognition, etc., to extract potential entities and relationships. The extracted entities and relationships are labeled to form structured data samples. When constructing the dataset, it is necessary to ensure the diversity and representativeness of the data to cover as wide a range of fields and scenarios as possible. At the same time, in order to improve the generalization ability of the model, it is also necessary to perform appropriate enhancement processing on the data, such as data augmentation, noise addition, etc., to extract a fine-tuning dataset from large-scale public information.

[0079] It is worth noting that in order to improve the understanding and processing ability of the large language model for the knowledge graph, a fine-tuning dataset extracted from large-scale public information is used to train the base large language model. The constructed dataset is used to train the base large language model and optimize the model parameters, that is, by iteratively optimizing the model parameters, a large language model with certain general domain entity recognition and relationship extraction capabilities is generated, laying a foundation for the subsequent construction of the vertical domain knowledge graph. In this stage, various optimization algorithms can be adopted, such as the gradient descent method, Adam optimizer, etc., to continuously adjust the model parameters to better meet the requirements of the knowledge graph construction task. Through multiple rounds of iterative training, we can gradually improve the performance of the model until a satisfactory initial large language model is obtained.

[0080] In the specific implementation, using ChatGLM-4-9b as the base large language model can achieve fast fine-tuning with only a small amount of vertical domain data, significantly reducing the cost of domain migration. The large-scale information extraction fine-tuning dataset used for training uses high-quality texts such as newspapers, social media, and news websites as the corpus source, further reducing the interference caused by mixed text data.

[0081] Step S20: Obtain vertical domain text data, and train the initial large language model according to the vertical domain text data to obtain a target large language model.

[0082] It should be noted that vertical domain text data refers to text data related to specific industries or fields, such as medical, financial, educational, etc. These data usually contain rich professional knowledge and terms, which are crucial for constructing a vertical domain knowledge graph.

[0083] It is understandable that the target large language model is a professional large language model used to construct a vertical domain knowledge graph. The knowledge graph construction task enhanced large language model is fine-tuned using vertical domain text annotation data to generate a professional large language model for constructing a vertical domain knowledge graph, which can improve the model's understanding ability of professional domain text and ultimately improve the accuracy of the model's autonomous construction of the knowledge graph.

[0084] In a feasible implementation manner, step S20 may include: determining vertical domain text data based on professional information sources; performing a preprocessing operation on the vertical domain text data to obtain preprocessed vertical domain text data, where the preprocessing operation includes at least one of removing noise data, correcting error data, and standardizing text formats; annotating entity words and entity relationship triples in the preprocessed vertical domain text data to obtain annotated vertical domain text data; and training the initial large language model with the annotated vertical domain text data to obtain a target large language model.

[0085] It should be noted that professional information sources generally refer to those information sources that focus on a specific industry or field and have highly professional and targeted content, including academic journals, industry reports, professional websites, patent databases, etc. This embodiment does not make specific restrictions on this. Collect and clean a small batch of vertical domain professional text data from professional information sources, and extract entity words, entity relationship triples, and pattern information definitions of the cleaned text data to provide high-quality training data for subsequent model fine-tuning.

[0086] It can be understood that since each vertical industry field has a large number of professional vocabulary and industry knowledge, using a large language model for general domain knowledge graph construction will encounter difficulties when processing data in a specific field (such as industry, law, or finance). Therefore, for a specific vertical domain, select and collect relevant small batches of raw text data. These data are from authoritative information sources such as professional literature, industry reports, and technical documents. In addition, to ensure the quality and relevance of the data, a strict data screening and preprocessing process is adopted, including removing noise data, correcting error data, and standardizing text formats, to reduce biases and uncertainties in the training process. Remove noise data, such as advertisements, duplicate content, irrelevant links, etc. These data will not only not improve the model performance but may also introduce interference. Correct error data, including spelling mistakes, grammar mistakes, factual mistakes, etc., to ensure the accuracy and reliability of the data. Standardize text formats, including unified encoding, format adjustment, punctuation processing, etc., to facilitate subsequent data processing and model training.

[0087] It should be noted that in order to improve the automated construction performance of the knowledge graph of the task-enhanced large language model in a specific domain, entity words and entity relationship triples are annotated on the open-source manual text data annotation tool doccano. Among them, the specific annotation process for entity words is as follows: 1) Create a project and select sequence annotation; 2) Create entity types according to the text; 3) Select entity words and annotate the entity types for the entity words. The specific annotation process for entity relationship triples is as follows: 1) Create a project, select sequence annotation, and check the relationship annotation; 2) Create relationship types according to the text; 3) Select the relationship type and click on the corresponding head and tail entities to complete the relationship annotation. After the annotation is completed, the annotated data can be exported. The annotated data is saved in the same text file, with each example occupying one line and stored in jsonl format. Finally, the entity types and relationship types are extracted as schema information and saved as a.csv format file to provide some training data for the schema retrieval module within the standardized framework of the knowledge graph autonomous construction.

[0088] In the specific implementation, in order to improve the understanding ability of the task-enhanced large language model for specific domain text corpora during the construction of the knowledge graph and reduce the difficulty of autonomous construction of the vertical domain knowledge graph, the model is fine-tuned using the annotated small batch of vertical domain text data. Among them, the model is fine-tuned on two NVIDIA GeForce RTX 3090 graphics cards. The software environment for fine-tuning is Ubuntu20.04, Python3.8, Cuda12.1.1, Pytorch12.1.1. The LORA fine-tuning strategy is adopted, with the batch_size set to 1, the learning rate set to 1e-5, and the gradient accumulation set to 8 during fine-tuning. After fine-tuning, the model can accurately capture and understand the professional terms and context relationships in a specific domain, thereby improving the accuracy and efficiency of the knowledge graph autonomous construction.

[0089] Step S30, extract the entity words and entity relationship triple data from the text data to be detected through the target large language model.

[0090] It should be noted that the target large language model will analyze the input text data, identify the entity words and the relationships between the entities, and represent them in the form of triples. The entity relationship triple data usually includes three parts: the subject, the predicate, and the object. For example, "Apple Inc.", "produces", "iPhone". Entity words refer to the words with clear meanings and importance in a specific domain, such as company names, product names, technical terms, etc. Entity relationships describe the specific relationships between entities, and these relationships can be causal, temporal, spatial, functional, etc. Through the processing of the target large language model, the implicit information in the text data can be transformed into a structured knowledge representation, providing a basis for subsequent knowledge graph construction.

[0091] In specific implementation, in order to improve the accuracy of automatic generation of schema information and the stability of autonomous construction of the knowledge graph, a standardized framework for autonomous construction of the knowledge graph is designed to guide the professional large language model for constructing the vertical domain knowledge graph to accurately generate schema information. By combining the standardized framework for autonomous construction of the knowledge graph with the target large language model (i.e., the professional large language model for constructing the vertical domain knowledge graph), entity words and entity-relationship triple data can be extracted from the text data to be detected. The standardized framework for autonomous construction of the knowledge graph includes a schema retrieval module, a preliminary information extraction module, a schema definition module, and a schema normalization module. Among them, the schema retrieval module uses a fine-tuned text embedding model (i.e., the large language model enhanced for the knowledge graph construction task); the preliminary information extraction module, the schema definition module, and the schema normalization module use the fine-tuned professional large language model for constructing the vertical domain knowledge graph.

[0092] Step S40, construct a vertical domain knowledge graph based on the entity words and the entity-relationship triple data.

[0093] It should be noted that the knowledge graph is a data organization and knowledge representation method, which represents the complex relationships between entities through a graph structure. The core of the knowledge graph is to transform information into structured data, which is convenient for computers to understand and process. The vertical domain knowledge graph refers to the knowledge graph for a specific industry or field, such as medical, financial, educational, etc. Different from the general knowledge graph, the vertical domain knowledge graph focuses on a specific field and can provide more in-depth and professional knowledge information. The vertical domain knowledge graph has wide application value in information retrieval, intelligent recommendation, decision support, etc. The constructed vertical domain knowledge graph can be used for tasks such as intelligent question answering, data analysis, and knowledge discovery. For example, in the medical field, the knowledge graph can assist doctors in quickly obtaining disease-related information and improving the diagnosis efficiency; in the financial field, the knowledge graph can be used for risk assessment and investment decision support.

[0094] It can be understood that by selecting a suitable graph database, such as Neo4j, JanusGraph, etc., and importing the entity words and entity-relationship triple data into the graph database, the final vertical domain knowledge graph is built, realizing a fully automated process from text data input to knowledge graph output, including functions such as entity-relationship triple extraction, knowledge graph construction, and storage, greatly improving the construction efficiency and accuracy, and providing strong technical support for knowledge management in the vertical domain.

[0095] As Figure 2 shown, Figure 2This is the overall flowchart of the method for constructing a knowledge graph based on a large language model. The overall process of the method for constructing a knowledge graph based on a large language model includes: First, generate an enhanced large language model for knowledge graph construction tasks. This model is generated by training a base large language model on a publicly available large-scale information extraction dataset to ensure that the model has extensive knowledge understanding and processing capabilities. Second, collect and clean a small batch of vertical domain professional text data, and manually extract entity words, entity relationship triples, and pattern information definition pairs from the cleaned text data to provide high-quality training data for subsequent model fine-tuning. Then, use the small batch of labeled vertical domain text data to fine-tune the enhanced large language model for knowledge graph construction tasks to generate a professional large language model for constructing a vertical domain knowledge graph, making it more adaptable to the knowledge structure and language features of a specific domain. Next, design a standardized framework for autonomous knowledge graph construction to guide the professional large language model for constructing a vertical domain knowledge graph to accurately generate pattern information. Finally, input the text data to be extracted into the professional large language model for constructing a vertical domain knowledge graph. The model outputs entity words and entity relationship triple data, generates a knowledge graph, and stores it in a Neo4j graph database.

[0096] This embodiment provides a method for constructing a knowledge graph based on a large language model. In this embodiment, an initial large language model is first generated based on a base large language model; vertical domain text data is obtained, and the initial large language model is trained according to the vertical domain text data to obtain a target large language model; the target large language model is used to extract the text data to be detected to obtain entity words and entity relationship triple data; a vertical domain knowledge graph is constructed based on the entity words and the entity relationship triple data, which can effectively improve the efficiency and accuracy of knowledge graph construction.

[0097] In summary, in this embodiment, the initial large language model generated according to the base large language model is trained using vertical domain text data. The target large language model obtained through training can quickly and accurately extract entity words and entity relationship triple data from the text data to be detected, and then can quickly and accurately construct a vertical domain knowledge graph, overcoming the technical defects of poor efficiency and accuracy in current knowledge graph construction, and effectively improving the efficiency and accuracy of knowledge graph construction.

[0098] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar content as in the above-mentioned first embodiment can be referred to the above introduction and will not be repeated hereinafter. On this basis, please refer to Figure 3 , step S30 further includes steps S301 - S303:

[0099] Step S301, obtain a first prompt message, and input the first prompt message into the target large language model to obtain a pattern definition pair.

[0100] It should be noted that the prompt information refers to a text segment used to guide a large language model to generate specific outputs. In this embodiment, the first prompt information includes instructions and examples for describing the requirements for constructing a vertical domain knowledge graph, so as to help the target large language model understand the format and content of the pattern definition pairs to be generated.

[0101] It can be understood that the pattern definition pair consists of a relationship type and a relationship definition. The relationship type describes the category of the relationship between entities, while the relationship definition provides a specific description of the relationship. For example, in the knowledge graph of the medical industry field, the relationship type may be "power type", and the relationship definition is "the subject entity uses the power or energy type specified by the object entity".

[0102] In a specific implementation, the preliminary information extraction module sends the first prompt information to a professional large language model for constructing a vertical domain knowledge graph. The professional large language model generates triples according to this prompt information, and the generation result will be sent to the pattern definition module to further obtain the result of the pattern definition, that is, the pattern definition pair.

[0103] In a feasible implementation manner, step S301 may include: generating the first prompt information according to the example text, the triple format, and the text data to be detected, and inputting the first prompt information into the target large language model to obtain relationship triples; generating the second prompt information according to the text data to be detected and the relationship triples, and inputting the second prompt information into the target large language model to obtain the pattern definition pair, where the pattern definition pair consists of a relationship type and a relationship definition.

[0104] It should be noted that the example text is a text segment used to demonstrate the requirements for constructing a vertical domain knowledge graph, which contains specific examples of entity relationships. The triple format defines the structure of the entity word and the entity relationship triple data, that is, [subject, relationship, object], that is, [entity 1, relationship type, entity 2]. By combining the example text, the triple format, and the text data to be detected, more accurate first prompt information can be generated, so as to guide the target large language model to generate corresponding results according to the instruction content.

[0105] In a specific implementation, the first prompt information can be set as:

[0106] "Given a text, extract the relationship triples in the form of [subject, relationship, object]. Here is an example:

[0107] Text: The ALCO RS-3 with a length of 17,068.8 millimeters is equipped with a diesel-electric transmission.

[0108] Triple: [['ALCO RS-3', 'Power Type', 'Diesel - Electric Transmission'], ['ALCO RS-3', 'Length', '17068.8 (mm)']].

[0109] Now, extract triples from the following text: "The throughput of the Paul Wurth dezincing machine is 200 sheets per hour."

[0110] The professional large - language model will generate a triple [['Paul Wurth dezincing machine', 'Throughput', '200 sheets per hour']], and this generation result will be sent to the pattern definition module.

[0111] The pattern definition module takes the output triples of the preliminary information extraction module as input, generates a second prompt message, and inputs it to the professional large - language model for constructing a vertical - domain knowledge graph. The second prompt message is set as:

[0112] "Given a text and a list of relational triples extracted from it, write a definition for each existing relation. Next is an example:

[0113] Text: The ALCO RS - 3 with a length of 17068.8 mm is equipped with a diesel - electric transmission. Triple: [['ALCO RS - 3', 'Power Type', 'Diesel - Electric Transmission'], ['ALCO RS - 3', 'Length', '17068.8 (mm)']].

[0114] Definition: Power Type: The main entity uses the power or energy type specified by the object entity. Now write a definition for each existing relation in the triples extracted from the following text:

[0115] Text: "{The throughput of the Paul Wurth dezincing machine is 200 sheets per hour.}". Triple: [['Paul Wurth dezincing machine', 'Throughput', '200 sheets per hour']]"

[0116] After that, the professional large - language model will generate the following pattern definition result according to this prompt message: "Throughput: It refers to the quantity or volume that the main entity can process or complete per unit time.", and then, the result of pattern definition will be used as the input of the pattern normalization module.

[0117] Step S302, perform pattern retrieval according to the pattern definition to obtain target pattern information, where the target pattern information includes target entity types and target relation types.

[0118] It should be noted that the pattern normalization module inputs the pattern definition result into the pattern retrieval module. The pattern retrieval module performs pattern retrieval based on the pattern definition to determine the target pattern information. The target pattern information includes the target entity type and the target relationship type. The target relationship type is the relationship type in the pattern definition pair or the relationship type in the candidate pattern information obtained by pattern retrieval.

[0119] In a feasible implementation manner, step S302 may include: obtaining the vector similarity between the pattern definition pair and the pattern information in the pattern information definition group; determining the candidate pattern information in the pattern information definition group according to the vector similarity; determining the target relationship type based on the pattern definition pair and the candidate pattern information; and determining the target pattern information according to the target relationship type.

[0120] It should be noted that the pattern retrieval module uses the fine-tuned text embedding model gte-qwen2-7B-instruct, that is, the large language model enhanced for the knowledge graph construction task. During fine-tuning, InfoNCE is used as the loss function for the model to distinguish the correct relationship from the wrong relationship between text pairs, and the definition is as shown in Equation 1:

[0121]

[0122] where cos represents the cosine similarity and N represents the negative sample set. For the positive sample text pair (h + ,r + ), a prompt template is designed For example, to extract the relationship within the text from the given text, the given text is {h +}. r + represents the relationship existing within the text. During fine-tuning, this loss function is minimized to obtain the best pattern search effect. The fine-tuning data consists of two parts. One part is the previously annotated pattern information (i.e., the pattern information definition pairs in the vertical domain). The other part is the pattern information definition pairs extracted from the DuIE dataset. The two parts form the pattern information definition group. After fine-tuning the pattern retrieval module, this module can provide more accurate pattern information for pattern normalization.

[0123] It can be understood that the prompt information of the pattern normalization module can be:

[0124] "Given a piece of text, extract the relationship triples and the definition of the relationship from it. Through the context analysis of the given text, if there is a more appropriate result in the candidate pattern information, select the most appropriate relationship to replace it.

[0125] Text: {The processing capacity of the Paul Wurth dezincing machine is 200 sheets per hour.}.

[0126] Triple: ['Paul Wurth zinc stripping machine', 'Throughput', '200 pieces per hour'].

[0127] "Throughput": Refers to the quantity or volume that the subject entity can process or complete within a unit of time.

[0128] Candidate mode information:

[0129] 1. "Production volume": Refers to the total amount of items, data, or energy produced, manufactured, or output by the subject entity within a specific time period.

[0130] 2. "Production capacity": Refers to the maximum quantity that the subject entity can produce within a certain time.

[0131] 3. "Productivity": Refers to the quantity of products produced by the subject entity per unit time.

[0132] 4. None of them are suitable.

[0133] In a feasible implementation manner, determining the target mode information based on the mode definition pair and the candidate mode information includes: when the candidate mode information does not meet the preset conditions, determining the target relationship type according to the mode definition pair; when the candidate mode information meets the preset conditions, determining the target relationship type according to the candidate mode information.

[0134] It should be noted that the preset condition means that the relationship type in the candidate mode information is more suitable than the relationship type in the mode definition pair. When the relationship type in the candidate mode information is not more suitable than the relationship type in the mode definition pair, that is, when the professional large language model finds that the current mode information definition pair is already the most suitable, the relationship type in the mode information definition pair is used as the target relationship type and finally as the relationship in the entity relationship triple. When the relationship type in the candidate mode information is more suitable than the relationship type in the mode definition pair, the relationship type in the candidate mode information is used as the target relationship type and finally as the relationship in the entity relationship triple.

[0135] In specific implementation, after the prompt information is input into the professional large language model for constructing the vertical domain knowledge graph, when the relationship type in the candidate mode information is more suitable than the relationship type in the mode definition pair, the model converts the relationship to ['Paul Wurth zinc stripping machine', 'Productivity', '200 pieces per hour']. The "Productivity" in this result emphasizes the production volume per unit time more and is more in line with the relationship between the entity words. In addition, when the professional large language model finds that the current mode information definition pair is already the most suitable and there is no current mode information definition pair in the mode information definition group, the mode information definition pair is stored in the mode information definition group to further improve the autonomy of constructing the vertical domain knowledge graph.

[0136] Step S303: Extract the text data to be detected by the target large language model according to the target pattern information, and obtain entity words and entity relationship triple data.

[0137] It should be noted that the target pattern information includes the definition of entity words, the classification of entity relationships, and the attributes of entity relationships. The definition of entity words covers the semantic scope, category, and application scenarios of entity words to ensure accurate identification of key entities in the text during the extraction process. The classification of entity relationships is divided according to the logical connections between entities, such as causal relationships, temporal relationships, and spatial relationships, etc., so as to accurately capture the internal connections between entities during the extraction process. The attributes of entity relationships further refine the specific characteristics of entity relationships, such as the strength, directionality, and time span of the relationship, etc., so that the extracted triple data is more rich and accurate.

[0138] It can be understood that the extracted entity words and entity relationship triple data are integrated to form a preliminary knowledge graph. During the integration process, it is necessary to perform consistency verification on the triple data to ensure the accuracy and integrity of the data. In addition, it is also necessary to perform deduplication and optimization processing on the data to avoid the introduction of redundant and incorrect information. The target large language model is used to optimize the preliminary knowledge graph. The model will combine the context and domain knowledge base to dynamically adjust and optimize the entity words and entity relationships to improve the coverage and accuracy of the knowledge graph.

[0139] In specific implementation, the retrieval accuracy of the pattern retrieval module is improved by using the pattern information definition group. By designing specific prompt information, the professional large language model for constructing the vertical domain knowledge graph is required to generate entity relationship triples. At the same time, the pattern retrieval module detects whether the "relationship" in the entity relationship triple is reasonable. If it is not reasonable, it can be extracted and replaced from the pattern information definition group; if it is reasonable and there is no such pattern information definition pair in the pattern information definition group, then this pattern information definition pair is added to the pattern information definition group. Finally, the entity relationship triples in the vertical domain will be stored in the neo4j graph database, realizing the highly autonomous construction of the knowledge graph with high accuracy.

[0140] In this embodiment, the target large language model generates pattern definition pairs according to the prompt information and performs pattern retrieval to determine the target pattern information, and then accurately extracts the entity words and entity relationship triple data in the text data to be detected, realizing the autonomous, efficient, and accurate construction of the knowledge graph.

[0141] It should be noted that the above examples are only for understanding this application and do not constitute a limitation on the method for constructing a knowledge graph based on a large language model of this application. Based on this technical concept, more forms of simple transformations are within the protection scope of this application.

[0142] The present application also provides a knowledge graph construction device based on a large language model. Please refer to Figure 4 The knowledge graph construction device based on the large language model includes:

[0143] A generation module 10, configured to generate an initial large language model based on a base large language model.

[0144] A training module 20, configured to obtain vertical domain text data and train the initial large language model according to the vertical domain text data to obtain a target large language model.

[0145] An extraction module 30, configured to extract the to-be-detected text data through the target large language model to obtain entity words and entity relationship triple data.

[0146] A construction module 40, configured to construct a vertical domain knowledge graph based on the entity words and the entity relationship triple data.

[0147] This embodiment provides a knowledge graph construction device based on a large language model. In this embodiment, an initial large language model is first generated based on a base large language model; vertical domain text data is obtained, and the initial large language model is trained according to the vertical domain text data to obtain a target large language model; the to-be-detected text data is extracted through the target large language model to obtain entity words and entity relationship triple data; and a vertical domain knowledge graph is constructed based on the entity words and the entity relationship triple data, which can effectively improve the efficiency and accuracy of knowledge graph construction.

[0148] In summary, in this embodiment, the initial large language model generated according to the base large language model is trained by using vertical domain text data. The target large language model obtained through training can quickly and accurately extract entity words and entity relationship triple data from the to-be-detected text data, and then can quickly and accurately construct a vertical domain knowledge graph, overcoming the technical defects of poor efficiency and accuracy in current knowledge graph construction, and can effectively improve the efficiency and accuracy of knowledge graph construction.

[0149] Optionally, the generation module 10 is further configured to determine public information based on a mass media information source, extract an entity recognition data sample and a relationship recognition data sample based on the public information; construct a data set according to the entity recognition data sample and the relationship recognition data sample; and train and optimize model parameters of the base large language model through the data set to obtain an initial large language model.

[0150] Optionally, the training module 20 is further configured to determine vertical domain text data based on a professional information source; perform preprocessing operations on the vertical domain text data to obtain preprocessed vertical domain text data, where the preprocessing operations include at least one of removing noise data, correcting error data, and standardizing text formats; label entity words and entity relationship triples in the preprocessed vertical domain text data to obtain labeled vertical domain text data; and train the initial large language model with the labeled vertical domain text data to obtain a target large language model.

[0151] Optionally, the extraction module 30 is further configured to obtain a first prompt message and input the first prompt message into the target large language model to obtain a pattern definition pair; perform pattern retrieval according to the pattern definition pair to obtain target pattern information, where the target pattern information includes a target entity type and a target relationship type; and extract entity words and entity relationship triple data from the text data to be detected by the target large language model according to the target pattern information.

[0152] Optionally, the extraction module 30 is further configured to generate a first prompt message according to an example text, a triple format, and the text data to be detected, and input the first prompt message into the target large language model to obtain a relationship triple; generate a second prompt message according to the text data to be detected and the relationship triple, and input the second prompt message into the target large language model to obtain a pattern definition pair, where the pattern definition pair is composed of a relationship type and a relationship definition.

[0153] Optionally, the extraction module 30 is further configured to obtain a vector similarity between the pattern definition pair and pattern information in a pattern information definition group; determine candidate pattern information in the pattern information definition group according to the vector similarity; determine a target relationship type based on the pattern definition pair and the candidate pattern information; and determine target pattern information according to the target relationship type.

[0154] Optionally, the extraction module 30 is further configured to determine a target relationship type according to the pattern definition pair when the candidate pattern information does not meet a preset condition; and determine a target relationship type according to the candidate pattern information when the candidate pattern information meets the preset condition.

[0155] The knowledge graph construction device based on a large language model provided by this application adopts the knowledge graph construction method based on a large language model in the above embodiment, and can solve the technical problem of how to effectively improve the efficiency and accuracy of knowledge graph construction. Compared with the prior art, the beneficial effects of the knowledge graph construction device based on a large language model provided by this application are the same as those of the knowledge graph construction method based on a large language model provided by the above embodiment, and other technical features in the knowledge graph construction device based on a large language model are the same as the features disclosed in the method of the above embodiment, which will not be elaborated here.

[0156] This application provides a knowledge graph construction device based on a large language model. The knowledge graph construction device based on a large language model includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the knowledge graph construction method based on a large language model in the first embodiment above.

[0157] Next, refer to Figure 5 , which shows a schematic structural diagram of a knowledge graph construction device based on a large language model suitable for implementing the embodiments of this application. The knowledge graph construction device based on a large language model in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The knowledge graph construction device shown is only an example and should not impose any limitation on the functions and usage scope of the embodiments of this application.

[0158] As Figure 5As shown, the large language model-based knowledge graph construction device may include a processing device 1001 (such as a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1002 or the program loaded from the storage device 1003 into the random access memory (RAM) 1004. In the RAM 1004, various programs and data required for the operation of the large language model-based knowledge graph construction device are also stored. The processing device 1001, the ROM 1002, and the RAM 1004 are connected to each other through a bus 1005. The input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems may be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the large language model-based knowledge graph construction device to communicate with other devices wirelessly or wiredly to exchange data. Although the figure shows a large language model-based knowledge graph construction device with various systems, it should be understood that it is not required to implement or have all the shown systems. More or fewer systems may be implemented or had alternatively.

[0159] In particular, according to the embodiments disclosed in the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program codes for executing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device, or installed from the storage device 1003, or installed from the ROM 1002. When the computer program is executed by the processing device 1001, the above functions defined in the methods of the embodiments disclosed in the present application are executed.

[0160] The knowledge graph construction device based on the large language model provided by this application adopts the knowledge graph construction method based on the large language model in the above embodiments, and can solve the technical problem of how to effectively improve the efficiency and accuracy of knowledge graph construction. Compared with the prior art, the beneficial effects of the knowledge graph construction device based on the large language model provided by this application are the same as those of the knowledge graph construction method based on the large language model provided by the above embodiments, and other technical features in the knowledge graph construction device based on the large language model are the same as the features disclosed in the method of the previous embodiment, which will not be elaborated here.

[0161] It should be understood that each part disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in a suitable manner in any one or more embodiments or examples.

[0162] As mentioned above, only the specific implementation manners of this application are described, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed in this application can easily think of changes or substitutions, which should all be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

[0163] This application provides a computer-readable storage medium with computer-readable program instructions (i.e., computer programs) stored thereon, and the computer-readable program instructions are used to execute the knowledge graph construction method based on the large language model in the above embodiments.

[0164] The computer-readable storage medium provided by this application can be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or components, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or flash memory, optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this embodiment, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, device, or component. The program code contained on the computer-readable storage medium can be transmitted by any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0165] The above computer-readable storage medium can be included in a knowledge graph construction device based on a large language model; it can also exist independently without being assembled into a knowledge graph construction device based on a large language model.

[0166] The above computer-readable storage medium carries one or more programs. When the one or more programs are executed by a knowledge graph construction device based on a large language model, the knowledge graph construction device based on a large language model is caused to: generate an initial large language model based on a base large language model; obtain vertical domain text data, and train the initial large language model according to the vertical domain text data to obtain a target large language model; extract entity words and entity relationship triple data from the text data to be detected through the target large language model; construct a vertical domain knowledge graph based on the entity words and the entity relationship triple data.

[0167] Computer program code for performing the operations of this application can be written in one or more programming languages or combinations thereof. The above-mentioned programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, by using an Internet service provider to connect through the Internet).

[0168] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks can occur in a different order than that marked in the accompanying drawings. For example, two consecutively represented blocks can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0169] The modules described in the embodiments of this application can be implemented in software or in hardware. Among them, the name of the module does not constitute a limitation on the unit itself in some cases.

[0170] The readable storage medium provided in this application is a computer-readable storage medium. The computer-readable storage medium stores computer-readable program instructions (i.e., computer programs) for performing the above-mentioned knowledge graph construction method based on a large language model, and can solve the technical problem of how to effectively improve the efficiency and accuracy of knowledge graph construction. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the knowledge graph construction method based on a large language model provided in the above embodiments, and will not be elaborated here.

[0171] The present application also provides a computer program product, including a computer program which, when executed by a processor, implements the steps of the knowledge graph construction method based on a large language model as described above.

[0172] The computer program product provided by the present application can solve the technical problem of how to effectively improve the efficiency and accuracy of knowledge graph construction. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as those of the knowledge graph construction method based on a large language model provided in the above embodiments, and will not be elaborated herein.

[0173] The above are only partial embodiments of the present application, and thus do not limit the patent scope of the present application. Any equivalent structural transformation made under the technical concept of the present application by using the content of the specification and drawings of the present application, or any direct / indirect application in other related technical fields, is included in the patent protection scope of the present application.

Claims

1. A knowledge graph construction method based on a large language model, characterized in that: The method comprises: Generate an initial large language model based on the base large language model; Acquire vertical field text data, and train the initial large language model according to the vertical field text data to obtain a target large language model; The target large language model is used to extract the text data to be detected to obtain entity words and entity relationship triple data; A vertical domain knowledge graph is constructed based on the entity words and the entity relationship triple data.

2. The method according to claim 1, characterized in that The generating an initial large language model based on the base large language model includes: Determining public information based on mass media information sources, and extracting entity recognition data samples and relationship recognition data samples based on the public information; Constructing a data set according to the entity recognition data sample and the relationship recognition data sample; The base large language model is trained and model parameters are optimized using the data set to obtain an initial large language model.

3. The method according to claim 1, characterized in that The acquiring of vertical field text data and training of the initial large language model according to the vertical field text data to obtain a target large language model includes: Determine vertical field text data based on professional information sources; Performing a preprocessing operation on the vertical field text data to obtain preprocessed vertical field text data, wherein the preprocessing operation includes at least one of removing noise data, correcting error data, and standardizing text format; Annotating entity words and entity relationship triples in the preprocessed vertical field text data to obtain annotated vertical field text data; The initial large language model is trained using the annotated vertical field text data to obtain a target large language model.

4. The method according to claim 1, characterized in that The extracting of the to-be-detected text data by the target large language model to obtain entity words and entity relationship triple data includes: Acquire first prompt information, and input the first prompt information into the target large language model to obtain a pattern definition pair; Performing a pattern search according to the pattern definition to obtain target pattern information, wherein the target pattern information includes a target entity type and a target relationship type; The target large language model is used to extract the text data to be detected according to the target pattern information to obtain entity words and entity relationship triple data.

5. The method according to claim 4, characterized in that The obtaining of the first prompt information and inputting the first prompt information into the target large language model to obtain a pattern definition pair includes: Generate first prompt information according to the sample text, the triple format and the text data to be detected, and input the first prompt information into the target large language model to obtain a relation triple; Second prompt information is generated according to the text data to be detected and the relationship triples, and the second prompt information is input into the target large language model to obtain a pattern definition pair, wherein the pattern definition pair is composed of a relationship type and a relationship definition.

6. The method according to claim 4, characterized in that The step of performing a pattern search according to the pattern definition to obtain target pattern information includes: Obtaining vector similarity between the pattern definition pair and the pattern information in the pattern information definition group; Determine the pattern information to be selected in the pattern information definition group according to the vector similarity; Determine a target relationship type based on the pattern definition pair and the selected pattern information; Target mode information is determined according to the target relationship type.

7. The method as claimed in claim 6, characterized in that The determining the target mode information based on the mode definition pair and the selected mode information includes: When the selected mode information does not meet the preset condition, determining the target relationship type according to the mode definition; When the to-be-selected mode information satisfies a preset condition, a target relationship type is determined according to the to-be-selected mode information.

8. A knowledge graph construction device based on a large language model, characterized in that: The knowledge graph construction device based on the large language model includes: A generation module, used to generate an initial large language model based on the base large language model; A training module, used to obtain vertical field text data, and train the initial large language model according to the vertical field text data to obtain a target large language model; An extraction module, used to extract the text data to be detected through the target large language model to obtain entity words and entity relationship triple data; A construction module is used to construct a vertical domain knowledge graph based on the entity words and the entity relationship triple data.

9. A knowledge graph construction device based on a large language model, characterized in that: The knowledge graph construction device based on a large language model includes: a memory, a processor, and a knowledge graph construction program based on a large language model stored in the memory and executable on the processor, wherein the knowledge graph construction program based on a large language model is configured to implement the knowledge graph construction method based on a large language model as described in any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium stores a knowledge graph construction program based on a large language model, and when the knowledge graph construction program based on a large language model is executed by a processor, the knowledge graph construction method based on a large language model as described in any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Life significance sense detection method and device

    CN120596640A

  • A method and device for detecting the meaning of life

    CN120596640B

  • Large language model driven spatio-temporal dynamic information monitoring method and system

    CN121681793A