Enhanced intelligent questioning and answering system for domain knowledge graph for port equipment maintenance
By building a knowledge graph-enhanced intelligent question-answering system in the field of port equipment maintenance, the problems of insufficient adaptability and dynamic knowledge integration of traditional RAG systems in professional fields have been solved, and efficient and accurate port equipment maintenance question-answering has been achieved, generating professional and insightful answers.
Patent Information
- Application Number
- CN202510880496.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-27
- Publication Date
- 2025-10-14
AI Technical Summary
In the field of port equipment maintenance, traditional RAG systems have difficulty in fully utilizing structured knowledge and deep logic, lack professional field adaptability, and have dynamic knowledge integration and evaluation bottlenecks, resulting in insufficient answer relevance and accuracy. In addition, the knowledge limitations of large language models make it difficult to meet professional depth requirements.
A domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance is constructed. Entities and relationships are extracted from multi-source files through the knowledge graph construction module, community detection is performed using the Leiden algorithm, and community reports are generated through the graph-enhanced knowledge graph retrieval module. Prompt tuning is performed in conjunction with a large language model to achieve accurate maintenance question-answering.
It significantly improves the question-answering system's ability to understand complex questions, cover key information points, and provide professional expressions, generating more comprehensive, multi-dimensional, and insightful answers, ensuring the authenticity and reliability of the content, and clearly revealing the relationship between information.
Smart Images

Figure CN120780807A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of port equipment maintenance, and more specifically, to a domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance. Background Art
[0002] Large language models: Large language models are a key technology in the field of artificial intelligence. Based on deep learning methods, they are trained on massive amounts of text data to capture the statistical patterns and semantic information of language. These models typically have billions or even trillions of parameters. They are capable of understanding the complex structure of natural language, generating fluent and relevant text content, and performing a variety of natural language processing tasks such as translation, summarization, and question-answering. Their core capability lies in capturing long-range dependencies and contextual information in text, demonstrating powerful language understanding and generation capabilities in a variety of application scenarios. Knowledge graphs: As a structured knowledge representation, knowledge graphs organize and store entities and their relationships in a graph format. They abstract real-world objects as nodes and the connections between them as edges, thereby constructing a vast semantic network. Knowledge graphs can clearly reveal the inherent connections between knowledge, addressing the shortcomings of traditional databases in relational querying and knowledge reasoning. They provide high-quality knowledge support for applications such as information retrieval, intelligent question-answering, and recommendation systems, and help enhance the depth of machine cognition and understanding of the world. RAG: Retrieval-Augmented Generation (RAG) is a technical framework that combines large-scale external knowledge bases with large language models. Before the language model generates text, this method first retrieves relevant knowledge fragments from massive documents or databases that are relevant to the task or input. This retrieved information is then fed into the language model as additional context, guiding it to generate more accurate, factual, and domain-specific responses or content. RAG effectively mitigates issues such as outdated knowledge, factual errors, and hallucinations that can plague large language models. Prompt-tuning: Prompt-tuning is a method for efficiently fine-tuning pre-trained language models. Unlike traditional full-parameter fine-tuning, prompt-tuning freezes most of the pre-trained model's parameters and instead learns and optimizes a small number of trainable prompt parameters added to the input to guide the model's adaptation to specific downstream tasks. This approach significantly reduces the computational cost and storage requirements of model fine-tuning, enabling fast and efficient customization and deployment of large language models even with limited resources, and demonstrates potential in few-shot learning scenarios.
[0003] Retrieval-augmented generation (RAG) combines a large language model (LLM) with external knowledge to improve the accuracy and reliability of generated content and support dynamic knowledge updates. Its typical process is: the retriever recalls knowledge fragments, which are then combined with the query to form enhanced prompts, and finally the LLM generates the answer.
[0004] Our work focuses on addressing three key pain points in current RAG applications in complex professional domains, aiming to build an efficient and accurate next-generation RAG system: Insufficient utilization of structured knowledge and deep logic: Traditional RAGs struggle to fully exploit the complex structured knowledge (such as knowledge graph relationships) and deep logic underlying information, hindering fine-grained reasoning performance. Lack of adaptability to professional domains and answer accuracy: General RAG models lack deep adaptation to specific domains (such as port equipment maintenance), resulting in insufficient relevance, accuracy, and expertise in answers. Bottlenecks in dynamic knowledge integration and domain assessment: There are obstacles to efficiently constructing and integrating dynamic domain knowledge, as well as reliably assessing the system's effectiveness and credibility in specific business scenarios. Traditional maintenance models for port equipment face challenges due to inefficiency, difficulty in knowledge transfer, and experience loss. Despite advances in intelligent maintenance technology, there are still deficiencies in integrating multi-source heterogeneous information, particularly unstructured text such as technical manuals and maintenance records, to support decision-making. Existing technologies such as case-based reasoning (CBR) and expert systems (ES) have their application value in specific scenarios, but they also have limitations. Large language models have great potential in the field of natural language processing, but their inherent "hallucination" problem is contrary to the precision and reliability required for port equipment maintenance. Any deviation may lead to serious consequences. At the same time, the knowledge limitations of general large language models also make it difficult to meet the professional depth requirements of port machinery maintenance. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance, which can generate more comprehensive, multi-dimensional and insightful answers, significantly improving the ability of the question-answering system in understanding complex problems, covering key information points and providing professional expressions, clearly revealing the complex relationships between information, and laying a solid foundation for accurate retrieval and question-answering.
[0006] The technical solution adopted by the present invention to solve its technical problem is: constructing a domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance, including a knowledge graph construction module and a graph-enhanced knowledge graph retrieval module;
[0007] The knowledge graph construction module is used to extract entities and relationships from multiple source files, optimize the knowledge graph, and detect communities;
[0008] The graph-enhanced knowledge graph retrieval module is used to generate community reports, match entity-text units, entity-relationships, and entity-community reports, and construct a context to be sent to the large language model to generate results.
[0009] According to the above solution, the problem system uses a knowledge graph construction algorithm to extract entities and relationships from multi-source files, optimize the knowledge graph, and detect communities, specifically including the following steps:
[0010] S1. Use customized text segmentation method to separate text units;
[0011] S2: Automatically read pre-processed text units and input them into a large language model. Using the designed customized prompt words, the large language model automatically recognizes and outputs entity-relationship-entity triples and the corresponding relationship importance scores.
[0012] S3. The initially extracted entities and relationships form the original graph and are then refined. Entity aggregation effectively merges different nodes pointing to the same real-world entity or the same entity from heterogeneous data sources.
[0013] S4. After forming the initial knowledge graph, apply the Leiden algorithm to perform community detection;
[0014] S5. Perform knowledge graph embedding and use the text embedding model to convert the nodes and relationships of the knowledge graph into low-dimensional dense vector representations.
[0015] According to the above scheme, in step S1, when there is clearly structured data, it is segmented in units of lines; when it comes to unstructured text data, semantic segmentation is applied to convert text fragments into vector embeddings that can capture their semantic information, and then the best segmentation point is found by calculating the similarity between these vectors.
[0016] According to the above scheme, in step S3, the entities and relationships initially extracted constitute the original graph, and the specific steps for performing the refined processing include the following steps:
[0017] S301, using LLM to automatically aggregate and abstract the description information of each entity in all text fragments, and generate a unified comprehensive description for each node;
[0018] S302, assigning edge relationship weights: Relationship instances are aggregated into edges, and edge weights are defined as follows:
[0019]
[0020] Among them, Q rrepresents the sum of the overall strength scores of all identified relation links based on entities, I represents the set of all identified relation instances, and w(e i ,e j ,r) represents each specific relation instance (e i ,e j ,r), the strength score of the specific relationship between the entity pair evaluated by the large language model, reflecting the LLM's judgment on the authenticity or significance of the relationship.
[0021] According to the above solution, in step S301, the description information of each entity in all text segments is automatically aggregated and abstracted using LLM to generate a unified comprehensive description for each node, which specifically includes the following steps:
[0022] S301a, extracting the original information, reviewing the segmented text units one by one, identifying the various entities contained therein, and generating an independent description that is closely related to the current context for each identified entity based on the specific context within the segment;
[0023] S301b. Perform standardization, analyzing all extracted entity names to identify expressions that have different literal expressions but actually refer to the same real-world object. Through entity linking, the diverse expressions are unified under a standardized name or unique identifier;
[0024] S301c, for the standardized entity, perform information aggregation, traverse all description information generated in the first part, and collect all context descriptions belonging to the same standardized entity;
[0025] S301d. A large language model is used again, shifting its task from "extraction" to "synthesis." Specific instructions are given as input a specific entity and all its aggregated descriptions, requiring the model to perform a high-level summarization task. After receiving the instructions, the model performs information fusion, thematic summarization, redundancy elimination, and neutralization, ultimately reconstructing those scattered, independent descriptions into a logically clear, comprehensive, and objectively presented summary.
[0026] S301e. The comprehensive description newly generated by the language model is established as the standard attribute of the entity node and is formally stored in the final constructed knowledge graph.
[0027] According to the above scheme, in step S4, the Leiden algorithm identifies communities by optimizing the modularity Q index:
[0028]
[0029] Among them, m is the total weight of the edge, A ijis the weight of edge (i, j), k i is the weighted degree of node i, c i is the q community of node i, δ(·) is the Kronecker function with resolution parameter γ = 1; the Leiden algorithm iteratively optimizes Q through local movement, refinement, and aggregation steps;
[0030] The Leiden algorithm is applied in a hierarchical manner. First, the top-level communities are detected on the entire graph. Then, sub-communities are recursively detected on the sub-graphs corresponding to each community until the modularity cannot be further optimized. A multi-level community structure is formed. The detected communities are submitted to the large language model, which generates corresponding community reports based on the specific content of each community.
[0031] According to the above solution, the problem system uses a graph-enhanced knowledge graph retrieval algorithm to generate community reports, matches entity-text units, entity-relationships, and entity-community reports, and constructs a context to send to the large language model to generate results. Specifically, the following steps are included:
[0032] S1. Perform entity-text unit retrieval and retrieve the most matching text unit as the subsequent context to be fed to the LLM model;
[0033] S2. Perform entity-relationship retrieval and calculate the relationship weight S(r) by integrating multiple factors:
[0034] S(r)=TypePriority(r)·W type +L(r)·W links +Q(r)
[0035] Among them, Q r Represents the relationship weight, L(r) represents the connectivity of the external relationship. If the relationship r belongs to the internal relationship, then TypePriority(r) is 1; if the relationship r belongs to the external relationship, then TypePriority(r) is 0, and the weight W type W links Ensure that the scoring priorities of the two different situations of internal and external relationships are given in the formula;
[0036] S3. Perform entity-community report retrieval to represent community reports that aggregate broader information. The weight FinalWeight (c) is determined as follows:
[0037]
[0038] Among them, this weight considers the total number of independent text units NU(c) covered by community c, combined with the preset ranking rank(c) of the community;
[0039] S4. Context construction: Filter text units that are highly relevant to user queries, the most important relationships, and the most representative community reports. Integrate heterogeneous information sources to build the input context of the LLM. Different types of information are assigned corresponding proportions based on their importance. The generated context clearly includes the ranking of the selected entities and the importance weights of the relationships. The constructed context and the user's query are fed into the large language model. Specific prompt words are used to enable the large model to complete the corresponding task and output the answer.
[0040] According to the above scheme, in step S1, the core task of the retrieval module begins with the accurate identification of the key entities of the user query (query, q). The matching degree between the identified entity e and the corresponding entity in the knowledge base is quantified by the entity matching degree FinalScore(q, e):
[0041] FinalScore(q,e)=SemanticScore(q,e)×EntityWeight(e)
[0042] Among them, the comprehensive semantic similarity of the score is SemanticScore(q,e), and the entity weight is EntityWeight(e). SemanticScore(q,e) is measured by the cosine similarity between the query vector and the entity description embedding; EntityWeight(e) is the independent text unit count NU(e) associated with entity e, which is given a weight after normalization. Specifically, Based on the degree of matching, the best matching text unit is retrieved and fed into the LLM model as the subsequent context.
[0043] According to the above scheme, the graph-enhanced knowledge graph retrieval algorithm adopts the intelligent framework of DomainKG-RAG in the field of port equipment maintenance and guarantee, relies on the pre-built or continuously improved knowledge graph in the field of port machinery maintenance, and realizes accurate maintenance question and answer based on the knowledge graph by prompt tuning of the large language model.
[0044] According to the above scheme, the intelligent framework of the DomainKG-RAG in the field of port equipment maintenance and support specifically includes the following steps:
[0045] S1. Prompt tuning is performed on large language models. By learning a small number of task-specific "soft prompt" embeddings, the pre-trained LLM with frozen parameters is guided to adapt to downstream tasks. By configuring independent prompts for different tasks, a single model can be flexibly deployed, alleviating catastrophic forgetting and achieving performance comparable to full parameter fine-tuning.
[0046] S2, prompt-tuning training, relies on structured training data, and the basic data unit is the "question-context-answer" triple. Among them, "question" refers to the user's natural language query in the port machinery maintenance scenario; "context" is the relevant knowledge retrieved from the port machinery maintenance DomainKG for this question; "answer" is a standard and domain-compliant answer to the user's question based on the provided context; the model is guided to use the contextual information retrieved from the domain knowledge graph to generate professional, reliable and targeted answers.
[0047] The implementation of the domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance of the present invention has the following beneficial effects:
[0048] 1. The DomainKG-RAG model of this invention demonstrates significant advantages in end-to-end evaluation, particularly in terms of the comprehensiveness, diversity, and empowerment of answers. Integrating domain-specific knowledge graphs provides broader and deeper background knowledge for large language models, thereby generating answers that cover more relevant information points, offer multi-dimensional perspectives, and are more insightful. DomainKG-RAG, with its significant advantages in providing comprehensive, diverse, insightful, and high-quality answers, received the highest overall score from LLM evaluators. The retrieved information is highly consistent with the query, and the generated content is factual and reliable.
[0049] 2. The present invention has demonstrated significant application effects in the professional field of port equipment maintenance. By deeply integrating the domain knowledge graph with the optimized large-scale language model, the framework can generate more comprehensive, multi-dimensional and insightful answers, significantly improving the question-answering system's ability to understand complex problems, cover key information points and provide professional expressions. The retrieved contextual information is more relevant to user questions, ensuring the authenticity and reliability of the generated content. The constructed structured knowledge index clearly reveals the complex relationships between information, laying a solid foundation for accurate retrieval and question-answering. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:
[0051] Figure 1 This is a schematic diagram of the knowledge graph index optimization and retrieval mechanism in DomainKG-RAG of the present invention;
[0052] Figure 2 This is a schematic diagram of the framework of the domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance according to the present invention;
[0053] Figure 3 This is an example of a single community knowledge graph indexed by the present invention. DETAILED DESCRIPTION
[0054] In order to have a clearer understanding of the technical features, objectives and effects of the present application, the specific embodiments of the present application will be described in detail with reference to the drawings.
[0055] As shown in the Figure 1-3 port equipment maintenance-oriented knowledge graph enhanced intelligent question answering system of the present application comprises a knowledge graph construction module and a graph-based knowledge graph retrieval module.
[0056] The knowledge graph construction module is used to extract entities and relationships from multi-source files, optimize the knowledge graph, and detect communities. The knowledge graph construction module adopts a knowledge graph construction algorithm, which specifically comprises the following steps:
[0057] S1, in order to more accurately process data from different sources, a customized text segmentation scheme is adopted. For data that has a clear structure itself, such as CSV files, directly use its inherent organization method for segmentation, usually in units of lines, which can naturally preserve the integrity and context relationship of the data. In the face of unstructured text data, the situation is more complex, and semantic segmentation method is used. The text segment is converted into a vector embedding that can capture its semantic information, and then the similarity between these vectors is calculated to find the best segmentation point. It can ensure that each unit after segmentation has high semantic cohesion, so as to better serve the subsequent analysis and processing. The key step is to convert the text segment into a vector embedding that captures deep semantic information. These embeddings are numerical representations in high-dimensional space, which learn the meaning of text through complex algorithms, and text segments with similar semantics are closer in vector space. Use advanced natural language processing models to encode text and generate semantic-rich vectors. Calculate the similarity between vectors (quantify the semantic association degree of different text segments). When the semantic similarity between adjacent text segments is lower than the preset threshold, it is regarded as a potential segmentation point. This segmentation strategy based on semantic similarity ensures that each text unit after final segmentation has high semantic cohesion, avoiding the problem of information fragmentation caused by relying only on punctuation or fixed-length segmentation, laying a solid foundation for subsequent analysis, retrieval and understanding work.
[0058] The historical records are preprocessed, only the required content is retained, the blank columns and incomplete columns are deleted, and the standard csv uft-8 (comma separated format) is converted. An example of the csv file is as follows
[0059]
[0060] S2. Entity and relationship extraction based on a large language model. The system automatically reads preprocessed text units and inputs them into a large language model using DeepSeek-R1-Distill-Qwen-32B. Through the designed customized prompt words, the large language model automatically recognizes and outputs entity-relationship-entity triples and the corresponding relationship importance scores.
[0061] S3. The initially extracted entities and relationships form the original graph and are then refined, including:
[0062] S3a. Point entity description aggregation: LLM is used to automatically aggregate and abstract the description information of each entity in all text fragments, generating a unified comprehensive description for each node. The specific content is as follows.
[0063] Raw Information Extraction: The language model examines each segmented text unit one by one. Within each segment, the model's core task is to identify the various entities contained within it and, based on the specific context within the segment, generate a separate, context-sensitive description for each identified entity. This step results in a large number of entities and their descriptions, all tied to a single scenario.
[0064] Entity Linking and Normalization: Before aggregating description information, the system performs a critical normalization step. It analyzes all extracted entity names and identifies those that, despite literal variations, refer to the same real-world object. Through entity linking, these diverse representations are unified under a standardized name or unique identifier. This process ensures the accuracy of subsequent aggregation, ensuring that all relevant information is accurately attributed to the correct entity.
[0065] Aggregating All Descriptions: After entity normalization, the system begins information aggregation for each normalized entity. It traverses all descriptions generated in the first step and collects all contextual descriptions belonging to the same normalized entity. Ultimately, each entity is associated with a collection of descriptive phrases. This collection comprehensively reflects all relevant contexts in which the entity appears across the entire document library.
[0066] LLM-driven aggregation and summarization: This is the core of the entire process. The system once again utilizes a large language model, shifting its task from "extraction" to "synthesis." The system uses specific instructions, taking as input an entity and all its aggregated descriptions, and instructing the model to perform high-level summarization tasks. Upon receiving these instructions, the model performs information fusion, thematic induction, redundancy elimination, and neutralization, ultimately reconstructing those scattered, independent descriptions into a comprehensive summary with clear logic, comprehensive content, and objective expression.
[0067] Update the graph node: This newly generated comprehensive description generated by the language model will be established as the standard attribute of the entity node. It will be officially stored in the final knowledge graph as the most authoritative node description, representing the comprehensive and refined identity information of the entity.
[0068] S3b, Edge Relationship Weight Assignment: Relationship instances are aggregated into edges. The edge weight is defined as follows:
[0069]
[0070] Among them, Q r represents the sum of the overall strength scores of all identified relation links based on entities, I represents the set of all identified relation instances, and w(e i ,e j ,r) means that for each specific relation instance (e i ,e j ,r), the strength score of the specific relationship between the entity pair evaluated by the large language model, which reflects the LLM's judgment on the authenticity or significance of the relationship.
[0071] Advantages of knowledge graph optimization: Entity aggregation aims to effectively merge different nodes pointing to the same real-world entity or the same entity from heterogeneous data sources. It can significantly eliminate data redundancy and improve the consistency and accuracy of data in the knowledge graph. The knowledge graph becomes more refined and reduces ambiguity, allowing users and machines to understand and utilize the knowledge more clearly. Edge aggregation focuses on summarizing and simplifying multiple edges with similar semantic relationships or forming similar paths in the graph. It can effectively reduce the structural complexity of the knowledge graph and significantly reduce the number of edges, thereby greatly improving the query efficiency of the graph and the performance of various analytical tasks. Edge aggregation also makes the relationship patterns between entities clearer and easier to understand. Through the optimization of entity aggregation and edge aggregation, the knowledge graph can achieve significant improvements in data quality, storage efficiency, query and analysis performance, and knowledge clarity, laying a solid foundation for its effective use in various intelligent applications.
[0072] S4. Hierarchical community detection: After forming the initial knowledge graph, the Leiden algorithm is applied to perform community detection. The Leiden algorithm identifies communities by optimizing the modularity Q index:
[0073]
[0074] Among them, m is the total weight of the edge, A ij is the weight of edge (i, j), k i is the weighted degree of node i, c iis the q community of node i, δ(·) is the Kronecker function, and the resolution parameter γ = 1. The Leiden algorithm iteratively optimizes Q through local movement, refinement, and aggregation steps.
[0075] The Leiden algorithm is applied in a hierarchical manner: first, top-level communities are detected on the entire graph. Then, sub-communities are recursively detected on the sub-graphs corresponding to each community, until the modularity cannot be further optimized, forming a multi-level community structure. These detected communities are then submitted to the Large Language Model (LLM), which generates a corresponding community report based on the specific content of each community.
[0076] Benefits of community detection: Community detection within a knowledge graph reveals its inherent structural organizational patterns. By identifying closely connected subsets of entities, we can understand the high degree of correlation within different knowledge domains and gain insight into their distinct connections. Community detection helps uncover hidden connections within knowledge. By breaking down large graphs into smaller, more manageable community units, it simplifies analysis and provides more efficient insights into complex relationships. Community detection deepens our understanding of knowledge structures and empowers intelligent applications.
[0077] S5. Knowledge Graph Embedding. To support downstream machine learning applications, particularly the RAG framework, a text embedding model is used to convert graph nodes and relationships into low-dimensional dense vector representations. This encodes the graph structure and semantic information to support efficient similarity calculation and pattern recognition. Dots represent entities, their colors represent different entity categories, and their size represents their importance. The boxes contain descriptions of the corresponding entities and relationships, edges represent relationships, and gray blocks represent descriptions of the corresponding communities.
[0078] The graph-enhanced knowledge graph retrieval module is used to generate community reports, match entity-text units, entity-relationships, and entity-community reports, and construct context to be sent to the large language model to generate results. The specific steps include:
[0079] S1. Perform entity-text unit retrieval and retrieve the most matching text unit as the subsequent context to be fed to the LLM model;
[0080] Within the Knowledge Graph Enhanced Retrieval and Question Answering (KG-RAG) framework, the core task of the retrieval module begins with the accurate identification of key entities in the user query (query, q). The degree of match between each identified entity e and the corresponding entity in the knowledge base is quantified by the entity match score FinalScore(q,e):
[0081] FinalScore(q,e)=SemanticScore(q,e)×EntityWeight(e)
[0082] The comprehensive semantic similarity of the score is SemanticScore(q,e), and the entity weight is EntityWeight(e). SemanticScore(q,e) is measured by the cosine similarity between the query vector and the entity description embedding; EntityWeight(e) is the count of independent text units associated with entity e, NU(e), which is normalized and weighted. Specifically,
[0083]
[0084] Based on the degree of matching, the best matching text unit is retrieved and fed into the LLM model as the subsequent context.
[0085] S2, perform entity-relationship retrieval, and evaluate the importance of the relationship r connecting different entities in the system. The relationship weight S(r) is calculated by integrating multiple factors:
[0086] S(r)=TypePriority(r)·W type +L(r)·W links +Q(r)
[0087] Among them, Q r Represents the relationship weight, L(r) represents the connectivity of the external relationship, if the relationship r belongs to the internal relationship, then TypePriority(r) is 1; if the relationship r belongs to the external relationship, then TypePriority(r) is 0. Weight W type , W links Ensure that the scoring priorities for internal and external relationships are given in the formula.
[0088] S3. Perform entity-community report retrieval to represent community reports (c) that aggregate broader information. The weight FinalWeight(c) is determined as follows:
[0089]
[0090] Among them, this weight considers the total number of independent text units NU(c) covered by community c (normalized by the maximum number of units reported by all communities), combined with the preset ranking rank(c) of the community.
[0091] S4. Context construction. Based on the above-mentioned scoring system, the system filters text units, several most important relationships, and the most representative community reports that are highly relevant to the user query. These heterogeneous information sources are integrated to construct the input context of the LLM. During the construction process, different types of information, such as text units and community report information, are allocated corresponding proportions according to their importance. For example, text unit information usually occupies a larger proportion, and community report information also occupies a larger share. The generated context explicitly contains the ranking of the selected entities and the importance weights of the relationships, aiming to provide a rich and structured background knowledge environment for the LLM. Finally, the constructed context and the user's query are fed into the large language model, which uses specific prompt words to enable the large model to complete the corresponding task and output the answer.
[0092] The graph-enhanced knowledge graph retrieval algorithm uses DomainKG-RAG, an intelligent framework for the field of port equipment maintenance and support. It relies on a pre-built or continuously improved knowledge graph in the field of port machinery maintenance and support, and implements prompt tuning of large language models to achieve accurate maintenance question and answer based on the knowledge graph. DomainKG-RAG is an intelligent framework designed specifically for the field of port equipment maintenance and support. It relies on a pre-built or continuously improved knowledge graph in the field of port machinery maintenance and support, and implements prompt tuning of large language models to achieve accurate maintenance question and answer based on the graph. The specific steps include:
[0093] S1. Optimization and performance improvement for the port machinery field. Port machinery maintenance DomainKG: Structured professional knowledge bases such as port machinery equipment maintenance plans and maintenance records are the information basis for question and answer. Prompt Tuning is a parameter-efficient LLM fine-tuning technology that guides the pre-trained LLM with frozen parameters to adapt to downstream tasks, such as domain question and answer, by learning a small number of task-specific "soft prompt" embeddings. Prompt Tuning technology significantly reduces computing and storage overhead with its parameter efficiency, and supports the rapid migration of large models to specific tasks. By configuring independent prompts for different tasks, a single model can be flexibly deployed, while effectively alleviating catastrophic forgetting, and often achieving performance comparable to full parameter fine-tuning.
[0094] S2, Prompt-tuning training scheme. In this stage, Prompt Tuning aims to enable large-scale language models to accurately understand complex user queries in the field of port machinery maintenance. The core goal is to guide the model to effectively use the contextual information retrieved from the domain knowledge graph to generate professional, reliable and targeted answers. This fine-tuning process relies on training data with a specific structure. The basic unit of data is the "question-context-answer" triple. Among them, "question" refers to the user's natural language query in the port machinery maintenance scenario; "context" is the relevant knowledge retrieved from the port machinery maintenance DomainKG for the question, such as equipment technical parameters, fault diagnosis knowledge or standard operating procedures; "answer" is a standard and domain-compliant answer to the user's question based on the provided context.
[0095] Example
[0096] Cost indicators include (1) Input Token Number: refers to the number of tokens input into the model; (2) Latency: refers to the time required for the model to process user requests and return results.
[0097] result:
[0098] Simple-RAG HYDE RAG+Rerank KG-RAG DomainKG-RAG Input Token 310 420 327 8547 7739 Latency 4.9s 19.4s 21.0s 23.0s 23.9s
[0099] End-to-end evaluation metrics qualitatively assess the quality of generated answers through human evaluation, with each answer assigned an overall score. Comprehensiveness measures whether the answer adequately covers all aspects and key details of the question, striving for completeness and comprehensiveness while avoiding omissions or redundancy. Diversity assesses whether the answer offers different perspectives, insights, or solutions, reflecting the model's ability to think and reason from multiple angles, and to leverage multiple lines of evidence to support its arguments when appropriate. Empowerment considers whether the answer helps readers gain a deeper understanding of the question and make informed decisions based on it, emphasizing the avoidance of misleading information and the provision of clear explanations and supporting evidence. Directness measures whether the answer directly and clearly responds to the user's question, concisely grasping the core points of the question and avoiding irrelevant information. Therefore, this is an evaluation of the overall model performance, provided by large-scale language model evaluators, based on the aforementioned independent metrics, and not a simple averaging of the scores of the aforementioned individual metrics.
[0100] Since the output of LLM is random, the test is repeated five times for each problem, and the “win rate” is used as the evaluation indicator:
[0101]
[0102] Context-based evaluation metrics include: Fidelity: This metric assesses the consistency between the generated answer content and the retrieved contextual information. It works by first extracting individual statements from the generated answer using a large language model. Then, for each statement, the model verifies whether it can be effectively inferred from the given context, providing an explanation and a yes / no conclusion. The final fidelity score is calculated based on the ratio of the number of supported statements to the total number of statements. Contextual Relevance: This metric assesses the degree of match between the contextual information retrieved by the model and the user's question. Given a question and its retrieved context, the large language model attempts to identify and extract sentences from the context that are crucial for answering the question. If no relevant key sentences are found, or if the model determines that the question cannot be answered based on the current context, an "Insufficient Information" flag is returned. The contextual relevance score is calculated by calculating the ratio of the number of extracted key sentences to the total number of sentences in the context.
[0103] Simple-RAG HYDE RAG+Rerank KG-RAG DomainKG-RAG Faithfulness 0.73 0.64 0.79 0.88 0.88 Context Relevance 0.70 0.75 0.85 0.84 0.86
[0104] Based on the above evaluation results, the DomainKG-RAG model demonstrates significant advantages in end-to-end evaluation, particularly in terms of comprehensiveness, diversity, and empowerment of answers, outperforming baseline models including RAG+Rerank, HYDE, and KG-RAG. This demonstrates that integrating domain-specific knowledge graphs can provide larger language models with broader and deeper contextual knowledge, thereby generating more insightful answers that cover more relevant information points, offer multidimensional perspectives, and are more comprehensive. Although DomainKG-RAG sometimes sacrifices directness in pursuit of comprehensiveness and diversity, performing less directly and concisely than some baseline models, in the overall evaluation, DomainKG-RAG achieved the highest overall score from LLM evaluators, owing to its significant advantages in providing comprehensive, diverse, insightful, and high-quality answers. In the context-based evaluation, DomainKG-RAG also performed well in terms of faithfulness and contextual relevance, tying with KG-RAG for the highest faithfulness score of 0.88 and the highest contextual relevance score of 0.86, indicating that the retrieved information is highly consistent with the query and the generated content is factual and reliable. Although DomainKG-RAG exhibits higher consumption and longer processing time in terms of the number of input tokens (7739 vs. 310) and latency (23.9 seconds vs. 4.9 seconds) compared to Simple-RAG, this is mainly due to complex processes such as knowledge graph query, subgraph construction, and integration. However, this overhead is considered acceptable in scenarios where high-quality answers are prioritized. In the future, we can also consider how to reduce the overhead without affecting the model effect.
[0105] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are protected by the present invention.
Claims
1. A domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance, characterized by: Includes a knowledge graph construction module and a graph-enhanced knowledge graph retrieval module; The knowledge graph construction module is used to extract entities and relationships from multiple source files, optimize the knowledge graph, and detect communities; The graph-enhanced knowledge graph retrieval module is used to generate community reports, match entity-text units, entity-relationships, and entity-community reports, and construct a context to be sent to the large language model to generate results.
2. The domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance according to claim 1 is characterized in that: The problem system uses a knowledge graph construction algorithm to extract entities and relationships from multi-source documents, optimize the knowledge graph, and detect communities. Specifically, the following steps are included: S1. Use customized text segmentation method to separate text units; S2: Automatically read pre-processed text units and input them into a large language model. Using the designed customized prompt words, the large language model automatically recognizes and outputs entity-relationship-entity triples and the corresponding relationship importance scores. S3. The initially extracted entities and relationships form the original graph and are then refined. Entity aggregation effectively merges different nodes pointing to the same real-world entity or the same entity from heterogeneous data sources. S4. After forming the initial knowledge graph, apply the Leiden algorithm to perform community detection; S5. Perform knowledge graph embedding and use the text embedding model to convert the nodes and relationships of the knowledge graph into low-dimensional dense vector representations.
3. The domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance according to claim 2 is characterized in that: In step S1, when there is clearly structured data, it is segmented in units of lines; when it comes to unstructured text data, semantic segmentation is applied to convert text fragments into vector embeddings that can capture their semantic information, and then the best segmentation point is found by calculating the similarity between these vectors.
4. The domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance according to claim 1 is characterized in that: In step S3, the entities and relationships initially extracted constitute the original graph, and the specific steps for performing refinement processing include the following steps: S301, using LLM to automatically aggregate and abstract the description information of each entity in all text fragments, and generate a unified comprehensive description for each node; S302, assigning edge relationship weights: Relationship instances are aggregated into edges, and edge weights are defined as follows: Among them, Q r represents the sum of the overall strength scores of all identified relation links based on entities, I represents the set of all identified relation instances, and w(e i ,e j ,r) represents each specific relation instance (e i ,e j ,r), the strength score of the specific relationship between the entity pair evaluated by the large language model, reflecting the LLM's judgment on the authenticity or significance of the relationship.
5. The domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance according to claim 4 is characterized in that: In step S301, the description information of each entity in all text segments is automatically aggregated and abstracted using LLM to generate a unified comprehensive description for each node, which specifically includes the following steps: S301a, extracting the original information, reviewing the segmented text units one by one, identifying the various entities contained therein, and generating an independent description that is closely related to the current context for each identified entity based on the specific context within the segment; S301b. Perform standardization, analyzing all extracted entity names to identify expressions that have different literal expressions but actually refer to the same real-world object. Through entity linking, the diverse expressions are unified under a standardized name or unique identifier; S301c, for the standardized entity, perform information aggregation, traverse all description information generated in the first part, and collect all context descriptions belonging to the same standardized entity; S301d. A large language model is used again, shifting its task from "extraction" to "synthesis." Specific instructions are given as input a specific entity and all its aggregated descriptions, requiring the model to perform a high-level summarization task. After receiving the instructions, the model performs information fusion, thematic summarization, redundancy elimination, and neutralization, ultimately reconstructing those scattered, independent descriptions into a logically clear, comprehensive, and objectively presented summary. S301e. The comprehensive description newly generated by the language model is established as the standard attribute of the entity node and is formally stored in the final constructed knowledge graph.
6. The domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance according to claim 1 is characterized in that: In step S4, the Leiden algorithm identifies communities by optimizing the modularity Q index: Among them, m is the total weight of the edge, A ij is the weight of edge (i, j), k i is the weighted degree of node i, c i is the q community of node i, δ(·) is the Kronecker function with resolution parameter γ = 1; the Leiden algorithm iteratively optimizes Q through local movement, refinement, and aggregation steps; The Leiden algorithm is applied in a hierarchical manner. First, the top-level communities are detected on the entire graph. Then, sub-communities are recursively detected on the sub-graphs corresponding to each community until the modularity cannot be further optimized. A multi-level community structure is formed. The detected communities are submitted to the large language model, which generates corresponding community reports based on the specific content of each community.
7. The domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance according to claim 1 is characterized in that: The question system uses a graph-enhanced knowledge graph retrieval algorithm to generate community reports, matches entity-text units, entity-relationships, and entity-community reports, and constructs a context that is sent to the large language model to generate results. Specifically, the following steps are included: S1. Perform entity-text unit retrieval and retrieve the most matching text unit as the subsequent context to be fed to the LLM model; S2. Perform entity-relationship retrieval and calculate the relationship weight S(r) by integrating multiple factors: S(r)=TypePriority(r)·W type +L(r)·W links +Q(r) Among them, Q r Represents the relationship weight, L(r) represents the connectivity of the external relationship. If the relationship r belongs to the internal relationship, then TypePriority(r) is 1; if the relationship r belongs to the external relationship, then TypePriority(r) is 0, and the weight W type , W links Ensure that the scoring priorities of the two different situations of internal and external relationships are given in the formula; S3. Perform entity-community report retrieval to represent community reports that aggregate broader information. The weight FinalWeight (c) is determined as follows: Among them, this weight considers the total number of independent text units NU(c) covered by community c, combined with the preset ranking rank(c) of the community; S4. Context construction: Filter text units that are highly relevant to user queries, the most important relationships, and the most representative community reports. Integrate heterogeneous information sources to build the input context of the LLM. Different types of information are assigned corresponding proportions based on their importance. The generated context clearly includes the ranking of the selected entities and the importance weights of the relationships. The constructed context and the user's query are fed into the large language model. Specific prompt words are used to enable the large model to complete the corresponding task and output the answer.
8. The domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance according to claim 7 is characterized in that: In step S1, the core task of the retrieval module begins with the accurate identification of the key entities of the user query (query, q). The matching degree between the identified entity e and the corresponding entity in the knowledge base is quantified by the entity matching degree FinalScore(q, e): FinalScore(q,e)=SemanticScore(q,e)×EntityWeight(e) Among them, the comprehensive semantic similarity of the score is SemanticScore(q,e), and the entity weight is EntityWeight(e). SemanticScore(q,e) is measured by the cosine similarity between the query vector and the entity description embedding; EntityWeight(e) is the independent text unit count NU(e) associated with entity e, which is given a weight after normalization. Specifically, Based on the degree of matching, the best matching text unit is retrieved and fed into the LLM model as the subsequent context.
9. The domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance according to claim 7 is characterized in that: The graph-enhanced knowledge graph retrieval algorithm adopts the intelligent framework of DomainKG-RAG in the field of port equipment maintenance and support, relies on pre-built or continuously improved knowledge graphs in the field of port machinery maintenance, and performs prompt tuning on large language models.
10. The domain knowledge graph-enhanced intelligent question-answering system for port equipment maintenance according to claim 9 is characterized in that: The intelligent framework of the DomainKG-RAG in the field of port equipment maintenance and support specifically includes the following steps: S1. Prompt Tuning is performed on large language models. By learning a small number of task-specific "soft prompt" embeddings, the pre-trained LLM with frozen parameters is guided to adapt to downstream tasks and configure independent prompts for different tasks. S2, prompt-tuning training, relies on structured training data. The basic data unit is the "question-context-answer" triple. Here, "question" refers to the user's natural language query in the port machinery maintenance scenario; "context" is the relevant knowledge retrieved from the port machinery maintenance DomainKG for this question; "answer" is a standard and domain-compliant answer to the user's question based on the provided context. The model is guided to generate answers using the contextual information retrieved from the domain knowledge graph.
Citation Information
Cited By
RAG intelligent retrieval question-answering system and method based on enhanced metadata
CN121256007A
Enhanced retrieval generation optimization method fusing knowledge graph
CN121350280A
Ship sound stealth expert model construction method and device based on knowledge graph
CN121480700A