Vertical domain document question and answer method and system based on knowledge graph enhanced large model
By building and using knowledge graphs in vertical fields to enhance the big model, the general big model's shortcomings in high precision and interpretability are solved, and more accurate and credible Q&A effects are achieved, especially in multi-step reasoning and relationship processing in complex fields.
Patent Information
- Application Number
- CN202411820671.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-03-18
AI Technical Summary
The existing technology has limitations in vertical fields and applications with high precision requirements. General large models are weak in interpretability when providing high-precision answers, cannot explain the source, the problem of complex data sources and logic is weak, the knowledge graph update speed is slow, and it needs to be retrained, the fact verification ability is weak, and the facts may be fabricated. The context adaptation cost is high in dependence on the graph dynamic maintenance, and the map update does not require retraining.
Using a vertical domain document question-and-answer method based on knowledge graph enhancement large models, we use the knowledge graph to construct and maintain the knowledge graph, extract key entities and relationships in the input text, dynamically build Prompt, and input it into the big model to generate answers.
It improves the scientificity and accuracy of model answers, avoids the "making up" or blurring of model generation chords, enhances the performance of large models in multi-step inference and complex relationship problems, reduces the complexity of information retrieval, and improves the efficiency of algorithm processing.
Smart Images

Figure CN119646026A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a vertical field document question and answer method based on a knowledge graph enhanced large model. Background Art
[0002] The general large models currently on the market (such as GPT-4, Chat GPT, C l aude, etc.) perform well in many scenarios, but still have certain limitations in some vertical fields and applications with high precision requirements. Compared with the large models combined with knowledge graph technology, the general large models have the following problems:
[0003] Comparison Dimensions Universal large model A large model combined with knowledge graph Depth of knowledge Broad but may not be precise enough Deep optimization in professional fields to provide high-precision answers Explainability Weak, unable to identify source Strong, clear data source and logic Complex problem handling Weak, especially in multi-entity detachment scenarios Strong, logical reasoning can be achieved through graph relationships Knowledge update speed Slow, need to retrain Fast, update directly through the map Fact Verification Ability Weak, may fabricate facts Strong, based on structured data to ensure accuracy Multi-turn dialogue consistency Prone to inconsistency Good, dependency graph dynamically maintains context Adaptation cost High, requires a lot of computing resources Low, graph update does not require retraining
[0004] Although large models combined with knowledge graph technology have significant advantages in improving accuracy and professionalism, there are still some shortcomings and challenges in practical applications.
[0005] 1. High construction and maintenance costs
[0006] Complex data collection and organization: Vertical fields usually require a large amount of high-quality domain data, and the collection, cleaning and organization of this data (such as entity labeling and relationship extraction) is very time-consuming and labor-intensive, especially in highly professional fields (such as medicine and law).
[0007] It is difficult to update the knowledge graph: The construction of the knowledge graph is an ongoing task. The knowledge in the field is updated quickly (such as new regulations and new technologies), and the graph needs to be maintained frequently, which increases the development and maintenance costs.
[0008] 2. Insufficient initial knowledge coverage
[0009] Cold start problem: Building a knowledge graph requires sufficiently rich and comprehensive data as a foundation. However, in areas where data is scarce (such as emerging technologies and niche areas of specific industries), the graph may not cover all the required knowledge, affecting the breadth and depth of question answering.
[0010] Long-tail questions: Even if the knowledge graph covers core domain knowledge, inaccurate or insufficient answers may still appear for rare questions or marginal knowledge.
[0011] 3. Dependency graph quality
[0012] Inaccurate knowledge extraction: In the knowledge extraction stage (entity recognition and relationship extraction), incorrect recognition or low-precision extraction may cause the knowledge graph to contain erroneous or incomplete information, which in turn affects the quality of the final answer.
[0013] Insufficient graph structure design: Poorly designed domain ontology (such as entity types and relationship definitions) may result in the knowledge graph being unable to fully express the complex knowledge logic in the domain.
[0014] 4. Limited ability to reason about complex problems
[0015] Difficulty in cross-domain reasoning: Knowledge graphs are generally built for a single vertical field, and it is difficult to perform efficient reasoning on problems that require the integration of knowledge from multiple fields.
[0016] Insufficient deep reasoning capabilities: For problems involving complex logical relationships and multi-step deductions, the knowledge graph query capability may be insufficient, and deviations may occur when relying on model completion.
[0017] 5. Performance bottlenecks and scalability issues
[0018] Conflict between query efficiency and scale: The larger the knowledge graph, the slower the query speed may be, especially in high-concurrency situations, requiring additional optimization of graph database performance.
[0019] Real-time challenges: The combination of complex queries and large models may increase computing latency and affect the system's response speed in real-time question-and-answer scenarios.
[0020] 6. Complexity of integration with large models
[0021] Difficulty in prompt design: How to organize the information retrieved from the knowledge graph into prompts that are consistent with the understanding of the large model while avoiding the introduction of redundant or ambiguous information is a complex problem.
[0022] Contextual integration problem: Reasonably integrating the information in the knowledge graph with the questions entered by the user requires careful debugging to ensure that the answers generated by the model are both accurate and natural.
[0023] 7. Limited versatility
[0024] Strong domain dependence: The construction of knowledge graphs is highly dependent on expertise in specific fields, so it is difficult to share across multiple fields, and the cost of cross-domain expansion is high.
[0025] Difficult to cover dynamic problems: The structured data storage method of knowledge graphs is suitable for static knowledge and cannot directly respond to highly dynamic or open problems (such as real-time events and complex scenarios).
[0026] 8. User experience may be limited
[0027] Over-reliance on structured answers: The information queried from knowledge graphs is often relatively structured, which may lead to a lack of flexibility or sophistication in the model’s answers, and the user experience is not as natural as the results generated by pure language models.
[0028] The answer is too "professional": For ordinary users, the content generated by the knowledge graph may appear too academic or obscure, which is not conducive to popular expression. Summary of the invention
[0029] The purpose of the present invention is to provide a vertical field document question and answer method and system based on a knowledge graph enhanced big model, so as to solve the above-mentioned problems existing in the prior art.
[0030] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0031] A vertical domain document question answering method based on a knowledge graph enhanced large model includes the following steps:
[0032] S1. Construction of knowledge graph:
[0033] Collect relevant data in vertical fields, clean and organize them; extract knowledge from the processed data, design domain ontology based on the knowledge extraction results, and construct and store knowledge graphs;
[0034] S2. Question answering based on knowledge graph:
[0035] Extract key entities and relationships from the input text, and query relevant information from the knowledge graph based on the key entities and relationships; dynamically build prompts based on the knowledge graph query results and questions, input the prompts into the big model, and generate answers.
[0036] Preferably, step S1 specifically includes the following contents:
[0037] S11. Comprehensively plan and screen data sources based on knowledge needs in specific fields; establish multi-source data collection channels and combine automation tools to update data streams in real time;
[0038] S12. For the collected data, use similarity calculation method to filter out duplicate data and redundant information; use natural language processing pipeline to perform structured processing on the data; convert the processed data into a standard format for storage;
[0039] S13, perform entity recognition on the data in standard format to identify key concept terms in the vertical field; then perform relationship extraction on the data to determine the relationship between entities;
[0040] S14. Based on the relationship between entities, design domain ontology and build knowledge graph;
[0041] S15. Store the knowledge graph in a graph database.
[0042] Preferably, step S13 specifically includes the following contents:
[0043] S131. Use pre-trained deep learning models for named entity recognition to accurately locate highly specialized conceptual nouns in vertical fields; for entities in specific fields, customize NER models, combine word vector embedding and context association to maximize recognition accuracy and coverage;
[0044] S132. Using dependency syntax analysis and graph neural network models, the complex relationships between entities are extracted layer by layer, and the entity relationship chain is constructed through semantic similarity matching and deep dependency relationship calculation;
[0045] S133. Compare and verify the extracted knowledge with the external authoritative knowledge base to correct potential errors; at the same time, use a custom ontology mapping algorithm to avoid relationship conflicts and ensure the uniqueness and authority of the data.
[0046] Preferably, step S14 specifically includes the following contents:
[0047] S141. In the domain ontology design, the domain-specific entity classification and its attributes are deeply defined to ensure the high specialization of the graph structure; in the attribute relationship setting, inference rules are used to add rule constraints to the attributes to build a complete knowledge graph framework;
[0048] S142. If there is a conflict between knowledge from multiple data sources, a dynamic ontology matching and conflict resolution algorithm is used to resolve the conflict through semantic matching and context similarity comparison to ensure the consistency of the ontology structure;
[0049] S143. The reasoning engine based on the ontology model introduces automatic reasoning rules to realize reasoning queries on complex problems and enhance the response capability.
[0050] Preferably, step S15 specifically includes the following contents:
[0051] S151. Select a suitable graph database and optimize its performance by assigning relationship weights and entity indexes; adopt node clustering strategy when designing the topology structure to improve data access efficiency;
[0052] S152. Use Neo4j's batch import tool to import data in parallel and perform consistency checks after import to ensure data integrity;
[0053] S153. For complex multi-hop query scenarios, use a graph database-specific query language and combine it with an indexing mechanism to optimize query speed and ensure the response performance of complex queries with multiple nodes and multiple relationships.
[0054] Preferably, step S2 specifically includes the following contents:
[0055] S21. Perform text analysis and syntactic analysis on the input text to determine the sentence structure and keywords; perform entity relationship extraction and semantic analysis on the input text to build a semantic association graph; perform context understanding and problem decomposition on the input text to extract the entities and relationships corresponding to the problem;
[0056] S22. Based on the keywords in the question, build a query statement in combination with the knowledge graph; implement extended query based on the semantic similarity algorithm and sort the query results;
[0057] S23. Dynamically construct a prompt based on the question and knowledge graph query results; input the generated prompt into the large language model, and generate an answer based on the knowledge graph background information.
[0058] Preferably, step S21 specifically includes the following contents:
[0059] S211, using a deep NLP preprocessing pipeline, first segmenting and POS-annotating the input text, removing stop words, and then performing deep dependency analysis to determine sentence structure and keywords;
[0060] S212. Use a customized NER model to extract key information from the text, and further use deep dependency analysis and syntactic parsing to build a semantic association graph to support complex multi-entity questions;
[0061] S213. If the question has multiple sub-questions, use the semantic decomposition model to parse the question into sub-questions layer by layer, and extract the corresponding entities and relationships respectively to meet the needs of multiple rounds of question and answer.
[0062] Preferably, step S22 specifically includes the following contents:
[0063] S221. Based on the keywords in the question, the dynamic query statements are automatically constructed using the graph entity and relationship information, and the accuracy of the query is ensured through fine-grained keyword matching;
[0064] S222. Automatically expand the query using semantic similarity algorithms, perform contextual expansion on question keywords, and ensure comprehensive retrieval of highly relevant information;
[0065] S223. Sort the returned graph query results by weight and confidence, and use a deep sorting algorithm to ensure that high-priority answers are presented first.
[0066] Preferably, step S23 specifically includes the following contents:
[0067] S231. Based on the query results of the question and knowledge graph, a templated prompt generation method is used to build a high-quality prompt, and the entity relationship information retrieved from the graph is automatically filled into the prompt to enhance the language model's understanding of the context.
[0068] S232, input the generated prompt into the large language model, combine the knowledge graph background information to generate accurate and professional answers, and improve the logic and explainability of intelligent question answering;
[0069] S233. In response to further questions from users, the previous context is retained, and follow-up questions are iterated in the large model. The continuity and accuracy of multiple rounds of questions and answers are ensured through dynamic prompt updates, and natural and fluent high-quality answers are output.
[0070] The present invention also aims to provide a vertical field document question answering system based on a knowledge graph enhanced large model, the system can implement the above-mentioned method, the system includes:
[0071] The construction module of the knowledge graph: collect relevant data in vertical fields, clean and organize them; extract knowledge from the processed data, design the domain ontology based on the knowledge extraction results, and construct and store the knowledge graph;
[0072] Question-answering module based on knowledge graph: extract key entities and relationships in the input text, query relevant information from the knowledge graph based on the key entities and relationships; dynamically build prompts based on the knowledge graph query results and questions, input the prompts into the big model, and generate answers.
[0073] The beneficial effects of the present invention are as follows: 1. By constructing a vertical domain knowledge graph, the data in the professional field is structured, and authoritative and reliable background information support is provided during question and answer, ensuring that the model answer is more scientific and accurate. 2. Aiming at the pain point that it is difficult for large models to accurately grasp complex domain knowledge, combined with the retrieval ability of the knowledge graph, the input question is deeply semantically analyzed, accurate information is obtained from the graph, and the model generation result is avoided from being "fabricated" or fuzzy. 3. Through the construction of prompts, the knowledge graph retrieval results are integrated into a reasonable input context, guiding the large model to generate answers that are logical and closely related to actual needs, especially in multi-step reasoning and complex relationship problems. 4. Massive professional field data is organized into graphs, combined with natural language processing technology, so that non-professional users can also easily obtain accurate information, thereby shortening the distance between users and complex professional knowledge. 5. Construct a question-and-answer system with knowledge graph as the core, support the whole process of text parsing, graph retrieval, and large model generation, and adapt to a variety of application scenarios (such as mobile assistants, intelligent customer service systems, online education platforms), and provide real-time and efficient user services. 6. Through systematic data collection, cleaning and organization, a structured knowledge graph is constructed, which solves the problem of scattered and difficult to use domain knowledge and improves the coverage of professional knowledge. 7. Using the knowledge graph as auxiliary information, combined with the clear context of entities and relationships, the accuracy and relevance of the large model's answers are greatly improved, and generalization errors are reduced. 8. Through prompt construction, the domain knowledge graph retrieval results are combined with user questions, which enhances the large model's understanding of the context and logical reasoning ability, making the answers more in line with actual needs. 9. The introduction of graph databases solves the problem of lagging traditional knowledge updates, and can flexibly expand the content of knowledge graphs and support dynamic updates of domain knowledge. 10. The knowledge graph greatly reduces the complexity of information retrieval and improves the efficiency of algorithm processing through efficient relationship queries and entity associations. 11. Through modular processes (such as data collection, cleaning, modeling, etc.) and algorithm integration, a clear and efficient development framework is provided, which reduces the difficulty and cost of developing vertical field question-and-answer systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 is a flow chart for constructing a knowledge graph in an embodiment of the present invention;
[0075] Figure 2 It is a question-answering flowchart based on the knowledge graph in an embodiment of the present invention. DETAILED DESCRIPTION
[0076] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation methods described herein are only used to explain the present invention and are not used to limit the present invention.
[0077] At present, the core design goals of large models are versatility and flexibility, while the goals of knowledge graphs are accuracy and logic. For example, in the medical field, users often ask complex and highly professional questions about disease symptoms, diagnostic methods, and drug use. Although traditional large language models can generate natural language answers, they are insufficient in knowledge depth and accuracy, and may give wrong or vague information due to lack of fine-grained knowledge. At present, although the knowledge graph combined with the large model algorithm has high accuracy and interpretability, it still has some defects. First, the cost of building and maintaining knowledge graphs is high, especially in complex fields that require a lot of manual participation. Second, the coverage of knowledge graphs is usually limited, and it is difficult to support diverse problems in open fields. Third, the integration efficiency of graphs and large models may be limited, and the query and interaction speeds have performance bottlenecks in high-concurrency scenarios. In addition, although the update speed of knowledge graphs is fast, the data quality needs to be guaranteed, otherwise it will affect the accuracy of the answers. Finally, the algorithm has high requirements for model adaptability and is difficult to directly migrate to different fields.
[0078] In this embodiment, in order to solve the problem of insufficient accuracy and professionalism in vertical document question and answer, especially when facing complex domain knowledge query and reasoning, traditional large language models (such as ChatGPT) may generate answers that are broad, lack details or are not authoritative enough. By combining knowledge graph technology with large language models, the present invention constructs an efficient, professional and user-friendly question and answer solution that is suitable for highly specialized scenarios such as medical, legal, financial, and educational. The method of the present invention specifically includes the following two parts:
[0079] 1. Construction of Knowledge Graph
[0080] Collect relevant data in vertical fields, clean and organize them; extract knowledge from the processed data, design domain ontology based on the knowledge extraction results, and build and store knowledge graphs. Figure 1 As shown, it specifically includes the following contents:
[0081] 1.1. Vertical field data collection
[0082] (1) Data source planning and screening: Based on the knowledge needs of a specific field, comprehensively plan and screen data sources to ensure the authority and coverage of knowledge graph data. Specifically, it includes:
[0083] a. Unstructured text data: such as academic papers, technical documents, professional forums, news, e-books, etc. Use deep directional web crawlers to crawl information to obtain sufficient and diverse data.
[0084] b. Semi-structured and structured data: Call API interfaces or databases to obtain open data sets, including industry reports, field patents, public databases, etc.
[0085] c. Industry-specific databases: Access field-specific data sources (such as clinical data in the medical field and judicial documents in the legal field) to enhance the professional depth of the map.
[0086] (2) Data collection and richness assurance
[0087] a. Establish a multi-source data collection pipeline and combine it with self-developed automation tools to update the data stream in real time to ensure the timeliness of the graph data.
[0088] b. During the collection process, domain keywords and subject word sets are set to ensure the accuracy and diversity of data acquisition and maximize the data breadth and detail richness of the map.
[0089] 1.2 Data cleaning and standardization
[0090] (1) Deduplication and Redundancy Filtering
[0091] We use our self-developed advanced similarity calculation method to filter out duplicate data and redundant information. This process ensures data uniqueness by setting similarity thresholds and model accuracy verification.
[0092] (2) Text preprocessing and standardization
[0093] a. Use natural language processing pipelines to structure the data to ensure that all content meets unified standards such as text segmentation, part-of-speech tagging, stop word filtering, and named entity replacement.
[0094] b. Use domain-specific vocabulary mapping tables to normalize synonyms and unique vocabulary to ensure consistency. The output format is structured JSON or CSV for efficient subsequent processing.
[0095] (3) Storage format conversion and data verification
[0096] The cleaned data is converted into standard formats such as JSON for storage, and data consistency checks are performed at the same time. The integrity and quality of structured data are ensured through field comparison and missing value filling.
[0097] 1.3 Knowledge Extraction and Automated Relationship Construction
[0098] (1) Entity Recognition
[0099] a. Use self-developed pre-trained deep learning models for named entity recognition to accurately locate highly specialized conceptual nouns in vertical fields (such as molecular names in biomedicine and financial terms in finance).
[0100] b. For domain-specific entities, we customize the NER model, combine word vector embedding and context association to maximize recognition accuracy and coverage.
[0101] (2) Relationship Extraction
[0102] a. Using dependency syntactic analysis and graph neural network (GNN) models, we extract complex relationships between entities layer by layer (such as "has therapeutic effects", "causes complications", etc.), and build a complete entity relationship chain through semantic similarity matching and deep dependency calculation.
[0103] b. Use the BERT-Bi LSTM-CRF model to extract complex relationships and perform contextual word frequency analysis to ensure the accuracy and professionalism of the relationship chain and avoid polysemy and ambiguous relationships.
[0104] (3) Knowledge verification and redundancy removal
[0105] The extracted knowledge is compared and verified with the external authoritative knowledge base to correct potential errors. At the same time, a custom ontology mapping algorithm is used to avoid relationship conflicts and ensure the uniqueness and authority of the data.
[0106] 1.4 Data Modeling and Domain Ontology Construction
[0107] (1) Domain ontology design
[0108] a. Ontology design includes core models such as entity types, attributes, and relationship types. By deeply defining domain-specific entity classifications (such as "disease", "drug", "symptom") and their attributes (such as "side effects", "pharmacological effects"), the graph structure is highly specialized.
[0109] b. In the attribute relationship setting, use reasoning rules (such as "priority ranking of disease treatment effects"), add rule constraints to the attributes, and build a complete domain knowledge framework.
[0110] (2) Ontology Mapping and Conflict Resolution
[0111] If there is a conflict between the knowledge of multiple data sources, the self-developed dynamic ontology matching and conflict resolution algorithm is used to resolve the conflict through semantic matching and context similarity comparison to ensure the consistency of the ontology structure.
[0112] (3) Automated reasoning rule setting
[0113] The reasoning engine based on the ontology model introduces automatic reasoning rules (such as "if drug A treats disease B, it has side effect C") to realize reasoning query of complex problems and enhance the system's response capability.
[0114] 1.5. Graph database construction and performance optimization
[0115] (1) Database configuration and modeling design
[0116] Select a suitable graph database and optimize its performance by assigning relationship weights and entity indexes. Use node clustering strategies (such as hierarchical storage of disease and drug categories) when designing the topology to improve data access efficiency.
[0117] (2) Data batch import and consistency check
[0118] Use Neo4j's batch import tool to import data in parallel and perform consistency checks after import to ensure data integrity.
[0119] (3) Query optimization and high-speed retrieval
[0120] For complex multi-hop query scenarios, we use a graph database-specific query language and combine it with an indexing mechanism to optimize query speed and ensure the response performance of complex multi-node and multi-relationship queries.
[0121] 2. Question Answering Based on Knowledge Graph
[0122] Extract key entities and relationships from the input text, query relevant information from the knowledge graph based on the key entities and relationships; dynamically build prompts based on the knowledge graph query results and questions, input the prompts into the big model, and generate answers. Figure 2 As shown, it specifically includes the following contents:
[0123] 2.1. Input text parsing
[0124] (1) Text segmentation and syntactic analysis:
[0125] A deep NLP preprocessing pipeline is used to first segment the input text and perform POS annotation, remove stop words, and then perform deep dependency analysis to determine sentence structure and keywords.
[0126] (2) Entity relationship extraction and semantic analysis:
[0127] A customized NER model is used to extract key information from the text, and deep dependency analysis and syntactic parsing are further used to build a semantic association graph to provide support for complex multi-entity questions.
[0128] (3) Context understanding and problem decomposition:
[0129] If a question has multiple sub-questions, use the semantic decomposition model to parse the question into sub-questions layer by layer, and extract the corresponding entities and relationships respectively to meet multi-round question and answer requirements.
[0130] 2.2 Knowledge Graph Query
[0131] (1) Automated query construction:
[0132] Based on the keywords in the question, the graph entities and relationship information are used to automatically construct dynamic query statements (such as Cypher statements), such as "the side effects of XX drug on YY disease". Fine-grained keyword matching ensures the accuracy of the query.
[0133] (2) Extended query and semantic matching:
[0134] Use the BERT-based Sentence Simi l ar ity algorithm to automatically expand queries and perform contextual expansion based on question keywords to ensure comprehensive retrieval of highly relevant information.
[0135] (3) Result sorting and optimization:
[0136] The returned graph query results are sorted by weight and confidence, and a deep sorting algorithm (a GNN-based Pagerank variant) is used to ensure that high-priority answers are presented first.
[0137] 2.3. Prompt construction and large model question answering
[0138] (1) Prompt dynamic construction
[0139] Based on the query results of the question and the knowledge graph, a templated prompt generation method is used to build a high-quality prompt, and the entity relationship information retrieved from the graph is automatically filled into the prompt to enhance the language model's understanding of the context.
[0140] (2) Large-scale question-answering generation
[0141] The generated prompt is input into the large language model, and combined with the background information of the knowledge graph to generate accurate and professional answers, thereby improving the logic and explainability of intelligent question and answer.
[0142] (3) Multiple rounds of questions and answers and answer optimization
[0143] In response to further questions from users, the previous context is retained, and follow-up questions are iterated in the large model. The continuity and accuracy of multiple rounds of questions and answers are ensured through dynamic prompt updates, and natural and fluent high-quality answers are output.
[0144] In this embodiment, a vertical field document question answering system based on a knowledge graph enhanced large model is provided. The system can implement the above-mentioned method. The system includes:
[0145] (1) Knowledge graph construction module: collect relevant data in vertical fields, clean and organize them; extract knowledge from the processed data, design the domain ontology based on the knowledge extraction results, and construct and store the knowledge graph;
[0146] (2) Question-answering module based on knowledge graph: extract key entities and relationships from the input text, query relevant information from the knowledge graph based on the key entities and relationships; dynamically build prompts based on the knowledge graph query results and questions, input the prompts into the big model, and generate answers.
[0147] By adopting the above technical solution disclosed in the present invention, the following beneficial effects are obtained:
[0148] The present invention provides a vertical field document question-and-answer method and system based on a knowledge graph-enhanced large model. By constructing a vertical field knowledge graph, the data in the professional field is structured, and authoritative and reliable background information support is provided during question-and-answer, ensuring that the model answer is more scientific and accurate. Aiming at the pain point that it is difficult for large models to accurately grasp complex field knowledge, combined with the retrieval ability of the knowledge graph, the input question is deeply semantically parsed, accurate information is obtained from the graph, and the model generation result is avoided from being "fabricated" or fuzzy. Through prompt construction, the knowledge graph retrieval results are integrated into a reasonable input context, guiding the large model to generate answers that are logical and closely related to actual needs, especially in multi-step reasoning and complex relationship problems. Massive professional field data is organized into graphs, combined with natural language processing technology, so that non-professional users can also easily obtain accurate information, thereby shortening the distance between users and complex professional knowledge. Construct a question-and-answer system with knowledge graph as the core, support the whole process of text parsing, graph retrieval, and large model generation, and adapt to a variety of application scenarios (such as mobile assistants, intelligent customer service systems, and online education platforms) to provide real-time and efficient user services. Through systematic data collection, cleaning and organization, a structured knowledge graph is constructed, which solves the problem of scattered and difficult to use domain knowledge and improves the coverage of professional knowledge. Using the knowledge graph as auxiliary information, combined with the clear context of entities and relationships, the accuracy and relevance of the large model's answers are greatly improved, and generalization errors are reduced. Through prompt construction, the domain knowledge graph retrieval results are combined with user questions, which enhances the large model's understanding of the context and logical reasoning ability, making the answers more in line with actual needs. The introduction of graph databases solves the problem of lagging traditional knowledge updates, can flexibly expand the content of knowledge graphs, and support dynamic updates of domain knowledge. Knowledge graphs greatly reduce the complexity of information retrieval and improve algorithm processing efficiency through efficient relationship queries and entity associations. Through modular processes (such as data collection, cleaning, modeling, etc.) and algorithm integration, a clear and efficient development framework is provided, which reduces the difficulty and cost of developing vertical field question-and-answer systems.
[0149] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be considered as the scope of protection of the present invention.
Claims
1. A vertical domain document question answering method based on a knowledge graph enhanced large model, characterized by: The following steps are included: S1. Construction of knowledge graph: Collect relevant data in vertical fields, clean and organize them; extract knowledge from the processed data, design domain ontology based on the knowledge extraction results, and construct and store knowledge graphs; S2. Question answering based on knowledge graph: Extract key entities and relationships from the input text, and query relevant information from the knowledge graph based on the key entities and relationships; Dynamically build prompts based on knowledge graph query results and questions, input the prompts into the big model, and generate answers.
2. According to claim 1, the vertical field document question answering method based on the knowledge graph enhanced large model is characterized by: Step S1 specifically includes the following contents: S11. Comprehensively plan and screen data sources based on knowledge needs in specific fields; establish multi-source data collection channels and combine automation tools to update data streams in real time; S12. For the collected data, use similarity calculation method to filter out duplicate data and redundant information; use natural language processing pipeline to perform structured processing on the data; Convert the processed data into a standard format for storage; S13, perform entity recognition on the data in standard format to identify key concept terms in the vertical field; then perform relationship extraction on the data to determine the relationship between entities; S14. Based on the relationship between entities, design domain ontology and build knowledge graph; S15. Store the knowledge graph in a graph database.
3. The vertical domain document question answering method based on the knowledge graph enhanced large model according to claim 2 is characterized by: Step S13 specifically includes the following contents: S131. Use pre-trained deep learning models for named entity recognition to accurately locate highly specialized conceptual nouns in vertical fields; for entities in specific fields, customize NER models, combine word vector embedding and context association to maximize recognition accuracy and coverage; S132. Using dependency syntax analysis and graph neural network models, the complex relationships between entities are extracted layer by layer, and the entity relationship chain is constructed through semantic similarity matching and deep dependency relationship calculation; S133. Compare and verify the extracted knowledge with the external authoritative knowledge base to correct potential errors; at the same time, use a custom ontology mapping algorithm to avoid relationship conflicts and ensure the uniqueness and authority of the data.
4. The vertical domain document question answering method based on the knowledge graph enhanced large model according to claim 2 is characterized by: Step S14 specifically includes the following contents: S141. In the domain ontology design, the domain-specific entity classification and its attributes are deeply defined to ensure the high specialization of the graph structure; in the attribute relationship setting, inference rules are used to add rule constraints to the attributes to build a complete knowledge graph framework; S142. If there is a conflict between knowledge from multiple data sources, a dynamic ontology matching and conflict resolution algorithm is used to resolve the conflict through semantic matching and context similarity comparison to ensure the consistency of the ontology structure; S143. The reasoning engine based on the ontology model introduces automatic reasoning rules to realize reasoning queries on complex problems and enhance the response capability.
5. The vertical domain document question answering method based on the knowledge graph enhanced large model according to claim 2 is characterized by: Step S15 specifically includes the following contents: S151. Select a suitable graph database and optimize its performance by assigning relationship weights and entity indexes; adopt node clustering strategy when designing the topology structure to improve data access efficiency; S152. Use Neo4j's batch import tool to import data in parallel and perform consistency checks after import to ensure data integrity; S153. For complex multi-hop query scenarios, use a graph database-specific query language and combine it with an indexing mechanism to optimize query speed and ensure the response performance of complex queries with multiple nodes and multiple relationships.
6. The vertical domain document question answering method based on the knowledge graph enhanced large model according to claim 1 is characterized by: Step S2 specifically includes the following contents: S21. Perform text analysis and syntactic analysis on the input text to determine the sentence structure and keywords; perform entity relationship extraction and semantic analysis on the input text to build a semantic association graph; perform context understanding and problem decomposition on the input text to extract the entities and relationships corresponding to the problem; S22. Based on the keywords in the question, build a query statement in combination with the knowledge graph; Implement extended query based on semantic similarity algorithm and sort the query results; S23. Dynamically construct a prompt based on the question and knowledge graph query results; input the generated prompt into the large language model, and generate an answer based on the knowledge graph background information.
7. The vertical domain document question answering method based on the knowledge graph enhanced large model according to claim 6 is characterized by: Step S21 specifically includes the following contents: S211, using a deep NLP preprocessing pipeline, first segmenting and POS-annotating the input text, removing stop words, and then performing deep dependency analysis to determine sentence structure and keywords; S212. Use a customized NER model to extract key information from the text, and further use deep dependency analysis and syntactic parsing to build a semantic association graph to support complex multi-entity questions; S213. If the question has multiple sub-questions, use the semantic decomposition model to parse the question into sub-questions layer by layer, and extract the corresponding entities and relationships respectively to meet the needs of multiple rounds of question and answer.
8. The vertical domain document question answering method based on the knowledge graph enhanced large model according to claim 6 is characterized by: Step S22 specifically includes the following contents: S221. Based on the keywords in the question, the dynamic query statements are automatically constructed using the graph entity and relationship information, and the accuracy of the query is ensured through fine-grained keyword matching; S222. Automatically expand the query using semantic similarity algorithms, perform contextual expansion on question keywords, and ensure comprehensive retrieval of highly relevant information; S223. Sort the returned graph query results by weight and confidence, and use a deep sorting algorithm to ensure that high-priority answers are presented first.
9. The vertical domain document question answering method based on the knowledge graph enhanced large model according to claim 6 is characterized by: Step S23 specifically includes the following contents: S231. Based on the query results of the question and knowledge graph, a templated prompt generation method is used to build a high-quality prompt, and the entity relationship information retrieved from the graph is automatically filled into the prompt to enhance the language model's understanding of the context. S232, input the generated prompt into the large language model, combine the knowledge graph background information to generate accurate and professional answers, and improve the logic and explainability of intelligent question answering; S233. In response to further questions from users, the previous context is retained, and follow-up questions are iterated in the large model. The continuity and accuracy of multiple rounds of questions and answers are ensured through dynamic prompt updates, and natural and fluent high-quality answers are output.
10. A vertical domain document question answering system based on a knowledge graph enhanced large model, characterized by: The system can implement the method described in any one of claims 1 to 9, and the system includes: The construction module of the knowledge graph: collect relevant data in vertical fields, clean and organize them; extract knowledge from the processed data, design the domain ontology based on the knowledge extraction results, and construct and store the knowledge graph; Knowledge graph-based question-answering module: extract key entities and relationships in the input text, and query relevant information from the knowledge graph based on the key entities and relationships; Dynamically build prompts based on knowledge graph query results and questions, input the prompts into the big model, and generate answers.
Citation Information
Cited By
Logical reasoning-driven knowledge graph enhanced large model generation method
CN120046711A
Knowledge Graph Enhanced Large Model Generation Method Driven by Logical Reasoning
CN120046711B
Advanced RAG auxiliary query and inference system with graph structure
CN120316212A
Question answer determination method and device, electronic equipment and computer storage medium
CN120508625A
Knowledge base management system and enhancement method
CN120525039A