Knowledge graph-based traffic engineering large model intelligent question-answering system and method
By extracting the multidimensional features of natural language queries, dynamically selecting the search path and mixing and collaborative search in the knowledge graph and vector database, the problem of single search paths and inconsistency in the existing system is solved, and efficient and accurate complex query processing and interpretable answer generation are achieved.
Patent Information
- Application Number
- CN202510912996.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-07-03
AI Technical Summary
When handling complex natural language queries, existing intelligent question-and-answer systems are difficult to take into account the comprehensiveness of the search and the integrity of the reasoning chain. They have logical breaks or semantic deviations, and lack the ability to dynamically adapt to complex queries.
By analyzing natural language query statements, extracting the structured degree, semantic ambiguity and context-related features, generating search intention vectors, dynamically selecting the search path, and mixing and collaborative searches in the knowledge graph and vector database, combining entity consistency, semantic similarity and relationship connectivity for two-way verification, building a complete inference chain, and using big models to complete the gap.
It improves the understanding ability and retrieval adaptability of complex natural language queries, ensures the accuracy of answers and the consistency of the reasoning chain, and enhances the interpretability and user trust of the question-and-answer system.
Smart Images

Figure CN120407752A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent question - answering, and particularly relates to an intelligent question - answering system and method for a traffic engineering large model based on a knowledge graph. Background Art
[0002] In the field of intelligent question - answering systems, how to achieve accurate understanding and efficient reasoning of complex natural - language queries has always been a key issue in the research and application of artificial intelligence. With the continuous growth of the information scale, traditional question - answering systems relying on a single data source (such as only based on a knowledge graph or only based on vector retrieval) have gradually revealed limitations such as a single retrieval path, a fragmented reasoning process, and insufficient answer accuracy. Especially when dealing with query statements with varying degrees of structure, high semantic ambiguity, and complex context associations, existing systems often struggle to balance the comprehensiveness of retrieval and the integrity of the reasoning chain, resulting in logical breaks or semantic deviations in the final answers.
[0003] In the prior art, knowledge - graph retrieval is good at processing structured queries and can generate relatively rigorous answers based on entity - relationship reasoning, but has a weak ability to understand fuzzy or non - standard expressions in natural language. The retrieval method based on a vector database relies on deep semantic representations for similarity retrieval. Although it performs well in dealing with open - domain queries, it is prone to lack of interpretability and is difficult to ensure the logical coherence of the reasoning path. Although some studies have attempted to integrate structured knowledge and semantic retrieval, most lack an effective path - selection mechanism and reasoning - chain completion strategy and cannot handle reasoning breaks caused by incomplete knowledge or sparse entity associations during the reasoning process.
[0004] In terms of the retrieval - and - reasoning cooperation mechanism, existing methods usually select retrieval paths based on static strategies and lack the ability to dynamically adjust the retrieval process according to the query intention, resulting in unstable retrieval effects under complex query conditions. At the same time, for key steps such as consistency verification of retrieval results, semantic - similarity evaluation, and relationship - connectivity checking, existing systems generally adopt simple matching or local - feature - based verification methods, which cannot fully guarantee the accuracy of the final answer and the integrity of the reasoning chain. In addition, for the gap problems that occur in reasoning, traditional methods mostly adopt rule - based supplementary strategies and lack an intelligent completion mechanism based on the reasoning ability of large models, which limits the adaptability of the system to complex reasoning requirements.
[0005] Therefore, how to provide an intelligent question - answering system and method for a traffic engineering large model based on a knowledge graph is an urgent problem to be solved by those skilled in the art. Summary of the Invention
[0006] An object of the present invention is to provide an intelligent question-answering system and method for a traffic engineering large model based on a knowledge graph. The present invention analyzes a natural language query statement to extract structured degree features, semantic ambiguity features, and context association features, generates a retrieval intention vector and dynamically selects a retrieval path, constructs a structured query statement and a semantic vector respectively, performs hybrid collaborative retrieval in the knowledge graph and the vector database, performs two-way verification on the screening results based on entity consistency, semantic similarity, and relationship connectivity, further generates a complete inference chain through an inference chain construction and a large model inference gap filling mechanism, and finally outputs an inference-based answer, which has the advantages of high retrieval accuracy, coherent inference chain, strong interpretability of the question-answering process, and excellent ability to adapt to complex natural language queries.
[0007] The intelligent question-answering system and method for a traffic engineering large model based on a knowledge graph according to an embodiment of the present invention include the following steps: S1. Receive a natural language query statement input by a user, and parse the natural language query statement to extract structured degree features, semantic ambiguity features, and context association features as query intention representation features; S2. Generate a retrieval intention vector according to the query intention representation features, and dynamically select a retrieval path through a preset intention classification model; S3. Based on the query intention representation features, construct a structured query statement corresponding to the knowledge graph retrieval path and a semantic vector corresponding to the vector database retrieval path respectively according to the retrieval path requirements; S4. When adopting a hybrid collaborative retrieval path, perform entity linking and relationship reasoning in the knowledge graph based on the structured query statement to obtain a first retrieval result, and perform similarity retrieval in the vector database based on the semantic vector to obtain a second retrieval result; S5. According to entity consistency, semantic similarity, and relationship connectivity indicators, perform two-way verification on the first retrieval result and the second retrieval result, and screen out a candidate result set that passes the two-way verification; S6. Construct an inference chain for the candidate result set. If there is a break in the inference chain, generate relay nodes based on the large model inference gap filling mechanism to form a complete inference chain; S7. Generate a final inference-based answer and output it based on the complete inference chain.
[0008] Optionally, the S2 specifically includes: S21. According to the query intention representation features, adopt a segmented quantization coding method for the structural degree features, map different structural levels to discrete vectors, adopt a normalized numerical coding method for the semantic ambiguity features, normalize the ambiguity values into a standard interval to generate vectors, and adopt a sliding window statistical coding method for the context correlation features to extract context continuity feature vectors, respectively generating a first sub-feature vector, a second sub-feature vector, and a third sub-feature vector; S22. In the order of the structural degree features, semantic ambiguity features, and context correlation features, splice the first sub-feature vector, the second sub-feature vector, and the third sub-feature vector to form a unified multi-dimensional combined feature vector. The vector splicing method is linear splicing in a fixed order according to the feature categories; S23. Perform Min-Max normalization processing on the multi-dimensional combined feature vector, scale each dimension value to the interval [0, 1], and then perform feature transformation on the normalized multi-dimensional combined feature vector by means of linear mapping through a linear feature mapping function to obtain a retrieval intention vector; S24. Input the retrieval intention vector into an intention classification model, classify the retrieval intention vector through the intention classification model, and determine the retrieval path corresponding to the natural language query statement according to the classification result. The retrieval path includes a knowledge graph retrieval path, a vector database retrieval path, and a hybrid collaborative retrieval path.
[0009] Optionally, the intention classification model is a shallow neural network classifier: Receive the retrieval intention vector as input, where the retrieval intention vector retains the structural degree feature value, semantic ambiguity feature value, and context correlation feature score as dimension information; Input the retrieval intention vector into a first linear transformation layer for feature compression, and output a first hidden feature vector; Adopt a ReLU activation function to perform a non-linear transformation on the first hidden feature vector to obtain an activated feature vector; Input the activated feature vector into a second linear transformation layer, perform matrix multiplication with the weight matrix of the second linear transformation layer and superimpose a bias vector, so as to extract the combined features integrating the structural degree features, semantic ambiguity features, and context correlation features, and output a classification feature vector; Perform Softmax normalization processing on the classification feature vector to generate a three-class probability distribution, corresponding to the knowledge graph retrieval path, the vector database retrieval path, and the hybrid collaborative retrieval path respectively; Based on the structural degree feature value, semantic ambiguity feature value, and context correlation feature score retained in the retrieval intention vector, assist in determining the retrieval path according to the following classification criteria: When the structured degree eigenvalue is greater than 0.7 and the semantic ambiguity eigenvalue is less than 0.3, it is classified as a knowledge graph retrieval path; When the structured degree eigenvalue is less than 0.4 and the semantic ambiguity eigenvalue is greater than 0.6, it is classified as a vector database retrieval path; When the structured degree eigenvalue is between 0.4 and 0.7, the semantic ambiguity eigenvalue is between 0.3 and 0.6, and the context association feature score is greater than 0.5, it is classified as a hybrid collaborative retrieval path; When the structured degree eigenvalue, the semantic ambiguity eigenvalue, and the context association feature score do not meet the classification criteria, a prompt of no relevant retrieval content is given.
[0010] Optionally, the specific steps of S3 are as follows: S31. When the retrieval path is a knowledge graph retrieval path, based on the query intention representation feature, parse the natural language query statement, perform entity recognition operations, and extract entity terms with clear semantic pointers in the natural language query statement; S32. For the natural language query statement, identify the relationship phrases between entity terms, and combine with the preset pattern library of the knowledge graph to construct a preliminary triple set of entity-relationship-entity; S33. Perform standardization processing on the preliminary triple set, including performing standardized name mapping on entity nodes and applying synonym relationship extension rules to relationship edges, to form a structured query statement that conforms to the knowledge graph query specification; S34. When the retrieval path is a vector database retrieval path, based on the query intention representation feature, perform BiLSTM-CRF context-aware word segmentation processing on the natural language query statement, remove stop words, and extract a keyword set; S35. Encode the keyword set using a bidirectional context-aware mechanism to generate a preliminary semantic vector that can represent the deep semantic features of the query statement; S36. Perform normalization processing and vector space mapping on the preliminary semantic vector to obtain a semantic vector for vector database retrieval; S37. When the retrieval path is a hybrid collaborative retrieval path, simultaneously execute S31 to S33 to generate a structured query statement, and execute S34 to S36 to generate a semantic vector.
[0011] Optionally, the process of obtaining the first retrieval result is as follows: Receive the structured query statement, parse the query target entity, query condition relationship, and target entity type in the query statement, and use them as the starting point of retrieval reasoning, reasoning path constraint, and target node screening basis; Based on the knowledge graph entity index library, entity linking is performed on the query target entity. By combining entity name similarity matching and entity attribute cross-verification, the corresponding starting entity node in the knowledge graph is determined, and an entity mapping relationship between the query statement and the knowledge graph is established; Taking the successfully linked starting entity node as the starting point, according to the query condition relationship, relationship expansion reasoning is carried out in the knowledge graph starting from the starting entity. Multi-hop expansion is allowed during the reasoning process, and each hop of reasoning needs to meet the requirement of relationship semantic consistency; During the reasoning process, for each extended reasoning path, the path confidence score is calculated. The path confidence comprehensively considers the relationship semantic matching degree, path hop number penalty factor, and node connection weight. The reasoning paths with path confidence scores lower than the preset threshold are dynamically pruned; For the set of end entity nodes of all reasoning paths filtered by confidence, further filtering is performed according to the target entity type requirements, and the entity nodes that do not match the target entity type are excluded; The set of entity nodes after further filtering is used as the first retrieval result.
[0012] Optionally, the process of obtaining the second retrieval result is as follows: Receive the semantic vector generated by the query intention characterization feature as the query vector for vector database retrieval; Input the query vector into the vector database index, and based on the preset vector inverted index mechanism, quickly locate the candidate vector set adjacent to the query vector semantic space; For the query vector and each vector in the candidate vector set, the cosine similarity measurement method is used to calculate the similarity, and the similarity score between each candidate vector in the candidate vector set and the query vector is obtained; Based on the similarity score, the candidate vectors with scores higher than the preset similarity threshold are filtered out to form the first round of similar candidate sets; On the basis of the first round of similar candidate sets, through the context relevance reordering mechanism, weighted sorting is carried out according to the occurrence frequency and association strength of the candidate entities in the original context to generate the final candidate set; The entity nodes or document objects corresponding to the final candidate set are used as the second retrieval result.
[0013] Optionally, S5 specifically includes: S51. Receive the first retrieval result and the second retrieval result, and respectively extract the standardized name, context semantic representation, and knowledge graph entity node identifier of each entity; S52. Based on the standardized name matching, for each entity in the first retrieval result, retrieve the entity nodes in the second retrieval result with the same or semantically approximate standardized names to form a preliminary entity consistency matching pair; S53. For the preliminary entity consistency matching pairs, extract the corresponding context semantic representations. By calculating the cosine similarity between semantic vectors, filter out the matching pairs with similarity scores higher than the first preset threshold, and mark them as those passing the semantic similarity verification. S54. For the matching pairs that pass the semantic similarity verification, perform connectivity verification based on the knowledge graph relationship network, retrieve the shortest path between the two entity nodes. When there is a connected path with the number of hops not exceeding the preset maximum number of hops and the path semantics conforming to the inference relationship constraints, it is determined that the relationship connectivity verification passes. S55. Take the set of entity nodes that pass the entity consistency verification, semantic similarity verification, and relationship connectivity verification as the candidate result set that passes the two-way verification.
[0014] Optionally, the specific content of S6 is as follows: S61. Receive the candidate result set that passes the two-way verification, and extract the starting entity and the ending entity according to the inference target in the query intention as the starting and ending nodes for constructing the inference chain. S62. Based on the existing relationship network of the knowledge graph, starting from the starting entity, along the relationship path that matches the query intention semantics, expand the inference chain hop by hop, and preferentially select the relationship edges with high path confidence, and try to gradually connect to the ending entity. S63. During the expansion of the inference chain, detect the connectivity between adjacent entity nodes in real time. When there is no connection path that satisfies the semantic consistency and hop number limit in a certain expansion step, record this position as an inference gap and pause the expansion of the current inference chain. S64. For each inference gap, extract the context information, existing path information, and inference intention constraint conditions of the entities at both ends of the inference gap as the input of the large model inference gap filling mechanism. S65. Through the large model inference gap filling mechanism, generate relay nodes that can connect the entities at both ends of the inference gap. S66. Insert the selected relay nodes into the inference gap position, update the inference chain structure, and continue the expansion and connection of the inference chain until reaching the ending entity. S67. After the inference chain is completely connected, confirm the complete inference chain based on the confidence score and semantic consistency verification of the overall inference path.
[0015] Optionally, the specific content of the large model inference gap filling mechanism is as follows: Extract the standardized names, entity types, context semantic descriptions of the entities at both ends of the inference gap, and the historical path information of the current inference chain, and combine with the query intention target to form an inference gap filling input data set. Analyze the types of reasoning gaps, and based on the entities at both ends of the reasoning gap and the historical path information, identify whether the reasoning gap belongs to the entity - missing type, relationship - missing type, or path - break type; Dynamically generate reasoning completion prompt content according to the reasoning gap type and the query intention. The completion prompt includes the reasoning start entity, end entity, context relationship requirements, reasoning hop limit, and a description of the expected reasoning goal; Input the completion prompt content into the reasoning engine, limit the reasoning scope to the entity types and relationship categories supported by the current knowledge graph structure, and generate multiple relay node candidates. Each relay node candidate is accompanied by a relationship description path corresponding to the start entity and the end entity; For each relay node candidate, calculate the comprehensive evaluation score through a weighted method based on the confidence score of reasoning rationality, relationship coherence test, entity context consistency analysis, and verification of existing connections in the knowledge graph; Select the relay node with the highest comprehensive evaluation score as the formal filling node in the process of completing the reasoning chain.
[0016] Optionally, an intelligent question - answering system for traffic engineering large - model based on a knowledge graph, characterized by including: A query parsing module for receiving natural - language query statements, extracting structured - degree features, semantic fuzziness features, and context - association features, and generating query - intention representation features; A retrieval path decision - making module for generating a retrieval - intention vector according to the query - intention representation features, and dynamically selecting a knowledge - graph retrieval path, a vector - database retrieval path, or a hybrid collaborative retrieval path through an intention - classification model; A retrieval input construction module for generating a structured query statement based on entity recognition and relationship extraction under the knowledge - graph retrieval path, and generating a semantic vector based on context - aware word segmentation and semantic encoding under the vector - database retrieval path; A hybrid retrieval execution module for, under the hybrid collaborative retrieval path, respectively performing entity linking and relationship reasoning in the knowledge graph based on the structured query statement to obtain a first retrieval result, and performing similarity retrieval in the vector database based on the semantic vector to obtain a second retrieval result; A two - way verification module for, based on entity consistency, semantic similarity, and relationship connectivity indicators, performing two - way verification on the first retrieval result and the second retrieval result, and screening out a candidate result set that passes the two - way verification; A reasoning - chain construction module for constructing a reasoning chain based on the candidate result set that passes the two - way verification, detecting the connectivity of the reasoning chain. If there is a reasoning gap, then call the large - model reasoning - gap completion mechanism to generate relay nodes and insert them into the reasoning - chain gap position to form a complete reasoning chain; The large model inference gap completion module is used to extract the context and historical path information of the entities at both ends of the inference gap, generate completion prompts, call the large model to infer and generate a candidate set of relay nodes, and comprehensively evaluate based on the confidence of inference rationality, relationship coherence, and context consistency, and select the relay node with the highest score to complete the inference chain; The inference-based answer generation module is used to parse the inference path steps based on the complete inference chain, determine the answer focus and style in combination with the query intent, generate a set of inference path descriptions, perform natural language optimization processing, fuse the inference chain information to generate the final inference-based answer text, and attach the interpretable annotation information of the inference chain, and output it to the user interface.
[0017] The beneficial effects of the present invention are: (1) By extracting the structured degree feature, semantic ambiguity feature, and context correlation feature of the natural language query statement, the present invention generates a unified retrieval intent vector, and dynamically selects the knowledge graph retrieval path, vector database retrieval path, or hybrid collaborative retrieval path based on the shallow neural network intent classification model, and adaptively optimizes the retrieval strategy for different types of query requirements. Compared with the traditional method of static path configuration, the present invention can adjust the retrieval direction in real time according to the query characteristics, which not only ensures the inference accuracy in the high-structured query scenario, but also takes into account the coverage breadth and flexibility in the open semantic query scenario, greatly improving the understanding ability and retrieval adaptability of the question-answering system for complex natural language inputs, and solving the problems of single retrieval path selection and lack of dynamic adaptation mechanism in the prior art.
[0018] (2) During the retrieval process, the present invention synchronously constructs a structured query statement and a deep semantic vector, performs retrieval operations in the knowledge graph and the vector database respectively, and conducts two-way cross-screening based on entity consistency verification, semantic similarity verification, and relationship connectivity verification to form a candidate result set with high confidence. Through the multi-dimensional verification mechanism, the system can effectively eliminate low-quality retrieval results caused by semantic deviation or entity mapping errors, ensuring that the information basis in the answer generation stage is highly accurate. Compared with the strategy of only relying on single-feature screening in the existing method, the two-way verification framework of the present invention significantly improves the accuracy and reliability of the retrieval results. Especially in the face of complex query tasks with high semantic ambiguity or sparse entity relationships, it can maintain stable and accurate result output, overcoming the problems of result drift and answer deviation easily generated by the existing question-answering system.
[0019] (3) The present invention proposes an inference chain construction and large model inference gap completion mechanism. Based on the candidate results that pass the two-way verification, an inference chain is constructed according to the query intention target. When the inference chain breaks, relay nodes are dynamically generated for intelligent completion based on the context information of the entities at both ends of the inference gap, the historical path features, and the requirements of the inference intention. By introducing the inference ability of the large model, the system can automatically identify the missing links in the inference logic and reasonably generate supplementary paths within the scope allowed by the knowledge graph, realizing the continuous integrity of the inference chain. Compared with the traditional methods based on fixed rules or manually set completion strategies, the present invention has higher intelligence and adaptability, can effectively solve the problems that the inference chain is prone to break and difficult to connect in a complex knowledge environment, and significantly improves the overall inference coherence, answer integrity, and the ability to handle complex inference tasks of the system.
[0020] (4) Based on the inference chain, the present invention combines the confidence score of the inference path and the semantic consistency verification to dynamically generate an inference-based answer that conforms to the natural language specification, and visually annotates the answering process, enhancing the interpretability and user trust of the question-answering system. The system can not only output the final inference conclusion, but also fully display each entity node, relationship node, and inference step in the inference chain, supporting users to trace back and verify the answer generation process. Compared with the traditional system that only outputs isolated answers and is essentially a black box inference method, the present invention significantly improves the controllability, auditability, and usability of the intelligent question-answering system through the visualization of the inference chain and the transparency of the process, and is particularly suitable for application scenarios with high requirements for inference interpretability such as medical decision-making, legal consultation, and financial analysis, expanding the application depth and industry adaptation ability of the system. Description of the Drawings
[0021] The drawings are used to provide a further understanding of the present invention, and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention, and do not constitute a limitation to the present invention. In the drawings: Figure 1 is the overall flowchart of the intelligent question-answering system and method for traffic engineering large model based on knowledge graph proposed by the present invention; Figure 2 is the schematic diagram of the retrieval intention vector generation and dynamic retrieval path selection process of the intelligent question-answering system and method for traffic engineering large model based on knowledge graph proposed by the present invention; Figure 3 is the processing flowchart of the inference chain construction and large model inference gap completion mechanism of the intelligent question-answering system and method for traffic engineering large model based on knowledge graph proposed by the present invention. Detailed Embodiments
[0022] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are all simplified schematic diagrams, only illustrating the basic structure of the present invention in a schematic manner, so they only show the components related to the present invention.
[0023] Reference Figure 1 , an intelligent question-answering method for a large traffic engineering model based on a knowledge graph, comprising the following steps: S1. Receive a natural language query statement input by a user, parse the natural language query statement, and extract a structured degree feature, a semantic ambiguity feature, and a context association feature as query intention representation features; In a specific embodiment of the present invention, the query parsing module receives a natural language query statement input by a user. First, it performs preliminary word segmentation on the natural language query statement to identify key phrases, entity terms, and grammatical structures therein. Subsequently, based on the dependency syntactic analysis in natural language processing technology, it further analyzes the dependency relationships between entities in the query statement and extracts a tree-like representation of the sentence structure. On this basis, through a set structured degree scoring criterion, it evaluates the proportion of identifiable structured entities and relationships in the query statement to generate a structured degree feature. At the same time, based on a semantic ambiguity detection model, it identifies fuzzy expressions and uncertain words (such as "may", "about", "related", etc.) in the query statement and quantifies them to generate a semantic ambiguity feature. In addition, combined with the context window analysis technology of the query statement, it evaluates the context dependency strength between entities, verbs, and modifiers and extracts a context association feature. Finally, the structured degree feature, the semantic ambiguity feature, and the context association feature are fused and encoded to form a unified query intention representation feature, which is used to guide subsequent retrieval path decision-making and retrieval input construction.
[0024] Through the above embodiments, the present invention can systematically extract multi-dimensional query intention features in the natural language query parsing stage, fully capture key information such as the structured expression degree, semantic ambiguity degree, and context coherence in the query statement, and effectively support the dynamic decision-making of subsequent retrieval paths and the adaptive selection of retrieval modes. Compared with traditional query parsing methods based only on keyword or entity recognition, the present invention can more precisely distinguish different query intention characteristics, realize the accurate switching of knowledge graph retrieval, vector database retrieval, or hybrid retrieval paths, and greatly improve the retrieval accuracy and answer relevance. In addition, the present invention lays a solid foundation for the subsequent construction of the reasoning chain and the generation of reasoning-based answers by introducing context association analysis in the parsing stage, significantly enhancing the overall intelligent reasoning ability and answer interpretability of the system.
[0025] S2. Generate a retrieval intention vector according to the query intention representation features, and dynamically select a retrieval path through a preset intention classification model; In this embodiment, the specific content of S2 includes: S21. According to the query intention representation features, adopt a segmented quantization coding method for the structural degree features, map different structural levels to discrete vectors, adopt a normalized numerical coding method for the semantic ambiguity features, normalize the ambiguity values into a standard interval to generate vectors, and adopt a sliding window statistical coding method for the context association features to extract context continuity feature vectors, and respectively generate a first sub-feature vector, a second sub-feature vector and a third sub-feature vector; S22. In the order of the structural degree features, semantic ambiguity features, and context association features, splice the first sub-feature vector, the second sub-feature vector and the third sub-feature vector to form a unified multi-dimensional combined feature vector, and the vector splicing method is linear splicing in a fixed order according to the feature categories; S23. Perform Min-Max normalization processing on the multi-dimensional combined feature vector, scale each dimension value to the interval [0,1], and then perform feature transformation on the normalized multi-dimensional combined feature vector by means of linear mapping through a linear feature mapping function to obtain a retrieval intention vector; S24. Input the retrieval intention vector into an intention classification model, classify the retrieval intention vector through the intention classification model, and determine the retrieval path corresponding to the natural language query statement according to the classification result. The retrieval path includes a knowledge graph retrieval path, a vector database retrieval path, and a hybrid collaborative retrieval path.
[0026] The intention classification model is a shallow neural network classifier: Receive the retrieval intention vector as input, where the retrieval intention vector retains the structural degree feature value, the semantic ambiguity feature value and the context association feature score as dimension information; Input the retrieval intention vector into the first linear transformation layer for feature compression, and output the first hidden feature vector; Adopt the ReLU activation function to perform non-linear transformation on the first hidden feature vector to obtain the activated feature vector; Input the activated feature vector into the second linear transformation layer, perform matrix multiplication operation with the weight matrix of the second linear transformation layer and superimpose the bias vector, so as to extract the combined features integrating the structural degree features, semantic ambiguity features and context association features, and output the classification feature vector; Perform Softmax normalization processing on the classification feature vector to generate a three-class probability distribution, which respectively correspond to the knowledge graph retrieval path, the vector database retrieval path and the hybrid collaborative retrieval path; Based on the structural degree feature value, semantic ambiguity feature value and context association feature score retained in the retrieval intention vector, assist in determining the retrieval path according to the following classification criteria: When the structural degree eigenvalue is greater than 0.7 and the semantic ambiguity eigenvalue is less than 0.3, it is classified as a knowledge graph retrieval path; When the structural degree eigenvalue is less than 0.4 and the semantic ambiguity eigenvalue is greater than 0.6, it is classified as a vector database retrieval path; When the structural degree eigenvalue is between 0.4 and 0.7, the semantic ambiguity eigenvalue is between 0.3 and 0.6, and the context association feature score is greater than 0.5, it is classified as a hybrid collaborative retrieval path; When the structural degree eigenvalue, the semantic ambiguity eigenvalue, and the context association feature score do not meet the classification criteria, it is prompted that there is no relevant retrieval content.
[0027] The present invention can fully extract multi-dimensional feature information of structural degree, semantic ambiguity, and context relevance in natural language query statements based on query intention representation features, and form a retrieval intention vector with standardized and multi-dimensional representation. Compared with traditional intention parsing methods that rely on manual feature selection or simple entity extraction, the present invention adopts standardized quantization coding and normalization processing to achieve the consistent fusion and unified expression of different types of feature data, providing a high-precision and low-deviation input basis for subsequent intelligent retrieval path decision-making, and significantly improving the accuracy and generalization ability of retrieval intention modeling.
[0028] The present invention introduces a shallow neural network intention classification model to perform deep feature transformation and classification attribution determination on the retrieval intention vector, and can automatically distinguish suitable knowledge graph retrieval paths, vector database retrieval paths, or hybrid collaborative retrieval paths according to the characteristics of the query intention. Compared with the existing method of relying on fixed rules or manual experience for path selection, the present invention dynamically determines the retrieval path through the trained classification model, taking into account both retrieval efficiency and answer accuracy, and can adaptively adjust the retrieval strategy according to the structural and semantic complexity of different query statements, greatly improving the processing ability and answer quality of intelligent question answering systems for complex, ambiguous, and cross-domain questions.
[0029] S3. Based on the query intention representation features, according to the retrieval path requirements, respectively construct a structured query statement corresponding to the knowledge graph retrieval path and a semantic vector corresponding to the vector database retrieval path; In this embodiment, the S3 specifically includes: S31. When the retrieval path is a knowledge graph retrieval path, based on the query intention representation features, parse the natural language query statement, perform entity recognition operations, and extract entity terms with clear semantic references in the natural language query statement; S32. For the natural language query statement, identify the relationship phrases between entity terms, and combine with the preset pattern library of the knowledge graph to construct a preliminary triple set of entity-relationship-entity; The preset pattern library of the knowledge graph is used to store the standardized definitions of entity types and relationship patterns in the knowledge graph. Specifically, it includes multiple groups of triple pattern templates of entity type - relationship type - entity type. Each pattern template stipulates the legal connection rules between the starting entity type, relationship category, and ending entity type, and at the same time records the semantic meaning, direction attribute, and optional relationship constraint conditions of the relationship. The preset pattern library of the knowledge graph can be generated by domain knowledge experts' annotation, statistical analysis of existing data in the knowledge graph, or automatic induction of high-frequency relationship patterns based on machine learning models. When applied, the system, based on the recognized entity terms and relationship phrases during the parsing of natural language query statements, retrieves the preset pattern library of the knowledge graph to determine the standard triple structure that conforms to the starting entity type and the semantics of the relationship phrase. If there is a match, a structured query statement is constructed based on this standard pattern. If there is no direct match, semantic expansion matching is performed in the pattern library according to the semantic approximation expansion rules of the relationship category to improve the adaptability of natural language parsing to complex expressions of entity relationships and semantic variant expressions, thereby ensuring the consistency between natural language query intentions and the structure of the knowledge graph, and providing a high-quality and standardized triple basis for subsequent entity linking, relationship reasoning, and reasoning chain construction.
[0030] S33. Perform standardization processing on the preliminary triple set, including performing standardized name mapping on entity nodes and applying synonym relationship expansion rules to relationship edges to form a structured query statement that conforms to the query specifications of the knowledge graph. S34. When the retrieval path is the vector database retrieval path, perform BiLSTM-CRF context-aware word segmentation processing on the natural language query statement based on the query intention representation features, remove stop words, and extract a keyword set. S35. Encode the keyword set using a bidirectional context-aware mechanism to generate a preliminary semantic vector that can represent the deep semantic features of the query statement. S36. Perform normalization processing and vector space mapping on the preliminary semantic vector to obtain a semantic vector for vector database retrieval. S37. When the retrieval path is the hybrid collaborative retrieval path, simultaneously execute S31 to S33 to generate a structured query statement, and execute S34 to S36 to generate a semantic vector.
[0031] The present invention can accurately construct a structured query statement corresponding to the knowledge graph retrieval path and a semantic vector corresponding to the vector database retrieval path based on the query intention characterization features and in combination with the requirements of different retrieval paths. Under the knowledge graph retrieval path, the present invention constructs a structured entity-relationship-entity set that conforms to the knowledge graph query specification through entity recognition, relationship recognition, and triple standardization processing, significantly improving the conversion efficiency and accuracy from natural language queries to knowledge graph retrieval languages. In particular, by performing standardized naming mapping on the extracted entity nodes and combining with the existing pattern rules in the knowledge graph for expansion and regularization, the structured query statement better fits the knowledge graph indexing logic, ensuring the accuracy and coherence of subsequent entity linking and relationship reasoning, and reducing the retrieval errors caused by the fuzzy expression of natural language.
[0032] Under the vector database retrieval path, the present invention effectively extracts the key semantic units in the query statement through context-aware word segmentation processing based on the BiLSTM-CRF model, and generates a high-quality semantic vector representation after encoding and normalization processing, which can comprehensively represent the deep semantic features of the query statement. In addition, the present invention also ensures that the generated semantic vector can fully capture the deep semantic association between the query statement and the candidate vectors in the database through multiple rounds of vector screening and re-ranking mechanisms, thereby improving the retrieval recall rate and accuracy in open-ended and fuzzy query scenarios. In summary, the present invention realizes the dynamic adaptation of the structured query statement and the semantic vector generation path in the retrieval input construction stage, effectively supports the accuracy and stability of the subsequent hybrid retrieval and reasoning chain construction, and significantly improves the robustness and scalability of the overall intelligent question-answering system under diverse query requirements.
[0033] S4. When adopting the hybrid collaborative retrieval path, perform entity linking and relationship reasoning in the knowledge graph based on the structured query statement to obtain the first retrieval result, and perform similarity retrieval in the vector database based on the semantic vector to obtain the second retrieval result; In this embodiment, the S4 specifically includes: The process of obtaining the first retrieval result is as follows: Receive the structured query statement, and parse the query target entity, query condition relationship, and target entity type in the query statement as the starting point of retrieval reasoning, reasoning path constraint, and target node screening basis; Based on the knowledge graph entity index library, perform entity linking on the query target entity, and determine the corresponding starting entity node in the knowledge graph by combining entity name similarity matching and entity attribute cross-verification, and establish an entity mapping relationship between the query statement and the knowledge graph; Starting from the successfully linked starting entity node, the relationship expansion reasoning is performed in the knowledge graph according to the query condition relationship, starting from the starting entity. Multi-hop expansion is allowed during the reasoning process, and each hop reasoning must meet the relationship semantic consistency requirements; During the reasoning process, a path confidence score is calculated for each extended reasoning path. The path confidence score comprehensively considers the relationship semantic matching degree, the path hop penalty factor, and the node connection weight. Reasoning paths with a path confidence score below a preset threshold are dynamically pruned. The preset threshold is used to dynamically trim the path confidence during the reasoning chain expansion process to improve the accuracy and rationality of the reasoning path. Specifically, the path confidence comprehensively considers the relationship semantic matching degree, the path jump number penalty factor and the entity node connection weight. The relationship semantic matching degree reflects the degree of consistency between the current expanded relationship and the semantics of the relationship phrase in the query intent. The path jump number penalty factor deducts 0.1 points for each jump based on the number of intermediate nodes passed by the expansion path. The entity node connection weight is increased by 0.05 to 0.2 points based on the node's connectivity in the knowledge graph and the node importance assessment. The path confidence threshold is preset to 0.6, that is, only expansion paths with a comprehensive confidence score higher than 0.6 are retained. When the confidence score of an expansion path is lower than 0.6, it is determined to be an invalid reasoning path and pruning is performed, thereby effectively controlling the correctness and coherence of the reasoning chain extension during the reasoning process, avoiding interference from irrelevant path noise, and ensuring that the reasoning chain can accurately and coherently reach the end entity required by the query intent, while maintaining a reasonable jump range and reasoning logic consistency.
[0034] For all entity nodes at the end of the reasoning path that pass the confidence screening, further screening is performed according to the target entity type requirements to eliminate entity nodes that do not match the target entity type; The entity node set after further screening is used as the first search result.
[0035] The process of obtaining the second search result is: Receive a semantic vector generated by the query intent representation feature as a query vector for vector database retrieval; Input the query vector into the vector database index and quickly locate the set of candidate vectors that are close to the query vector semantic space based on the preset vector inverted index mechanism; The preset vector inverted index mechanism is used to accelerate the approximate nearest neighbor retrieval of the query statement semantic vector in the vector database. Specifically, it includes an inverted file index structure based on vector clustering. The system performs clustering on the entire semantic vector set in the database during the offline phase, assigns semantic vectors to multiple cluster centers according to their feature similarity, and each cluster center corresponds to an inverted list that records all semantic vectors belonging to the cluster center and their index identifiers. During the online retrieval phase, the semantic vector generated by the query statement is first quickly and approximately matched with each cluster center, and several cluster centers with the closest distance to the query vector are selected as candidate clusters. Then, similarity calculation is only performed within the inverted lists corresponding to the candidate clusters, thereby significantly reducing the number of vector comparisons while maintaining a high retrieval recall rate and accuracy. The preset vector inverted index mechanism can significantly reduce the retrieval latency and improve the efficiency of the system in performing semantic approximate nearest neighbor retrieval in a large-scale vector database, supporting the real-time response and efficient retrieval of the present invention under complex query tasks.
[0036] The cosine similarity metric method is used to calculate the similarity between the query vector and each vector in the candidate vector set, and the similarity score between each candidate vector in the candidate vector set and the query vector is obtained. Based on the similarity scores, candidate vectors with scores higher than the preset similarity threshold are selected to form the first-round similar candidate set. The preset similarity threshold is used to filter the first-round candidate set according to the semantic similarity scores between the query vector and each candidate vector in the candidate vector set during the vector database retrieval process. Specifically, the system uses cosine similarity as the similarity metric standard to calculate the similarity between each candidate vector and the query vector, and the calculated similarity score ranges from 0 to 1. The preset similarity threshold is set to 0.7, that is, when the similarity score between the candidate vector and the query vector is greater than or equal to 0.7, it is determined as a valid candidate in the first round. If the similarity score is lower than 0.7, it is regarded as having insufficient relevance and is excluded, thereby effectively filtering out candidate vectors that are irrelevant or weakly associated with the query intent, improving the semantic relevance and accuracy of the retrieval results, while maintaining a high query recall rate and ensuring the quality of the basic data for subsequent inference chain construction.
[0037] Based on the first-round similar candidate set, through the context relevance reordering mechanism, weighted sorting is performed according to the occurrence frequency and association strength of the candidate entities in the original context to generate the final candidate set. The entity nodes or document objects corresponding to the final candidate set are used as the second retrieval result.
[0038] When the retrieval path is selected as hybrid collaborative retrieval, the present invention can respectively execute entity linking and relationship reasoning in the knowledge graph based on a structured query statement to obtain a first retrieval result, and perform similarity retrieval in the vector database based on semantic vectors to obtain a second retrieval result, giving full play to the respective advantages of structured retrieval and semantic retrieval. In the knowledge graph retrieval part, through entity recognition, relationship reasoning, and reasoning path confidence scoring, the present invention can accurately infer a set of entities that meet the query intent in a complex knowledge network, effectively improving the retrieval accuracy rate in the scenario of rule-based reasoning; while in the vector database retrieval part, through cosine similarity calculation and context relevance re-ranking mechanism, the present invention quickly recalls a set of candidate entities that are semantically closest to the query intent, significantly improving the retrieval recall rate and coverage rate in the face of open-ended and ambiguous natural language queries.
[0039] In the hybrid retrieval process of the present invention, it can comprehensively utilize the structured results obtained by knowledge graph reasoning and the semantically related results obtained by vector retrieval to form a basis for two-way complementation and mutual proof verification, providing a high-quality and diverse set of candidate entities for the subsequent two-way verification module. Compared with the retrieval blind area problem caused by single-path retrieval in traditional intelligent question-answering systems, the present invention effectively reduces the probability of retrieval failure caused by incomplete knowledge bases, fuzzy query expressions, or interrupted knowledge reasoning chains through a hybrid retrieval strategy, significantly improving the robustness, retrieval accuracy, and reliability of the final answer of the system in a diverse query environment.
[0040] S5. According to the entity consistency, semantic similarity, and relationship connectivity indicators, perform two-way verification on the first retrieval result and the second retrieval result, and screen out the candidate result set that passes the two-way verification; In this embodiment, the S5 specifically includes: S51. Receive the first retrieval result and the second retrieval result, and respectively extract the standardized name, context semantic representation, and knowledge graph entity node identifier of each entity; S52. Based on the standardized name matching, for each entity in the first retrieval result, retrieve the entity nodes in the second retrieval result that have the same or semantically similar standardized name, and form a preliminary entity consistency matching pair; S53. For the preliminary entity consistency matching pair, extract the corresponding context semantic representation, and by calculating the cosine similarity between the semantic vectors, screen out the matching pairs with a similarity score higher than the first preset threshold, and mark them as passing the semantic similarity verification; The first preset threshold is used to screen out the matching items with highly relevant context semantic representations among the first-round preliminary entity consistency matching pairs during the semantic similarity verification process. Specifically, the system calculates the cosine similarity between entity node pairs based on the context semantic vectors, and the similarity score ranges from 0 to 1. The first preset threshold is set to 0.75. That is, when the context semantic similarity score of the preliminary matching pair is greater than or equal to 0.75, it is determined that the semantic consistency verification passes. If the score is lower than 0.75, it is considered that the semantic relevance is insufficient, and the corresponding entity matching pair is removed, so as to effectively ensure that the finally selected entity node set has high consistency at the semantic level, and improve the coherence of the inference chain and the accuracy of the inference path.
[0041] S54. For the matching pairs that pass the semantic similarity verification, perform connectivity verification based on the knowledge graph relationship network, and retrieve the shortest path between the two entity nodes. When there is a connected path with the number of hops not exceeding the preset maximum number of hops and the path semantics conforming to the inference relationship constraints, it is determined that the relationship connectivity verification passes; The preset maximum number of hops is used to limit the allowable jump range of the connected path between entity nodes during the relationship connectivity verification process, preventing the inference chain from having a decline in inference rationality due to too long a path or cross-domain jumps. Specifically, the system sets the maximum allowable number of hops to 3 hops. That is, when there is a relationship path between two entity nodes with no more than 3 hops (that is, connected through no more than two relay nodes) and the semantics of each hop conform to the semantic consistency requirements, it is determined that the relationship connectivity verification passes. If the number of hops exceeds 3 hops, it is considered that the connectivity is insufficient and is removed, so as to control the complexity of the inference chain while ensuring the coverage ability of the inference chain, and maintain the rationality and interpretability of the inference process.
[0042] S55. The set of entity nodes that pass the entity consistency verification, semantic similarity verification, and relationship connectivity verification is used as the candidate result set that passes the two-way verification.
[0043] The present invention can systematically perform two-way verification and screening based on three indicators of entity consistency, semantic similarity, and relationship connectivity during the fusion stage of the first retrieval result and the second retrieval result, significantly improving the accuracy and reliability of the retrieval result. During the entity consistency verification process, the present invention ensures that entity nodes from different retrieval paths (knowledge graph retrieval and vector retrieval) can achieve consistency at the naming level through a standardized name matching strategy, reducing the entity recognition error rate caused by entity aliases, synonyms, etc.; during the semantic similarity verification process, the present invention further eliminates matching items that are superficially consistent but lack sufficient semantic relevance through context semantic vector similarity calculation, significantly improving the semantic consistency screening effect; during the relationship connectivity verification process, the present invention verifies the rationality of the logical path between entity pairs based on the actual connection relationship of the knowledge graph, effectively avoiding the generation of incorrect inference chains where there is no actual association or excessive jump between entity pairs.
[0044] Through comprehensive screening by the triple verification mechanism, the present invention ensures that the final candidate entity set not only has high consistency at the name and semantic levels but also has high connectivity on the knowledge graph inference path, greatly improving the coherence and accuracy of subsequent inference chain construction. Compared with the traditional retrieval fusion method that simply relies on similarity scoring or manual rule screening, the two-way verification process proposed by the present invention is systematic, meticulous, and standardized, and can significantly reduce noise interference when dealing with complex, open-ended, multi-hop inference queries, improving the correctness, interpretability, and user trust of the final answer of the intelligent question-answering system.
[0045] S6. Construct an inference chain for the candidate result set. If there is a break in the inference chain, generate relay nodes based on the large model inference gap filling mechanism to form a complete inference chain; In this embodiment, the S6 specifically includes: S61. Receive the candidate result set that has passed two-way verification, and extract the starting entity and the ending entity according to the inference target in the query intention as the starting and ending nodes for constructing the inference chain; S62. Based on the existing relationship network of the knowledge graph, starting from the starting entity, expand the inference chain hop by hop along the relationship path that semantically matches the query intention, and preferentially select the relationship edge with high path confidence to try to gradually connect to the ending entity; S63. During the expansion of the inference chain, continuously detect the connectivity between adjacent entity nodes. When there is no connection path that meets the semantic consistency and hop count limit in a certain expansion step, record this position as an inference gap and pause the current inference chain expansion; S64. For each inference gap, extract the context information, existing path information, and inference intention constraint conditions of the entities at both ends of the inference gap as the input of the large model inference gap filling mechanism; S65. Generate a relay node that can connect the entities at both ends of the reasoning gap through the large model reasoning gap completion mechanism; S66. Insert the selected relay node into the reasoning gap position, update the reasoning chain structure, and continue to expand and connect the reasoning chain until the end entity is reached; S67. After the reasoning chain is completely connected, confirm the complete reasoning chain based on the confidence score and semantic consistency verification of the overall reasoning path.
[0046] The large model reasoning gap completion mechanism specifically includes: Extract the standardized names, entity types, context semantic descriptions of the entities at both ends of the reasoning gap, and the historical path information of the current reasoning chain, and combine with the query intention target to form an input data set for reasoning gap completion; Analyze the type of reasoning gap, and based on the entities at both ends of the reasoning gap and the historical path information, identify whether the reasoning gap belongs to entity missing type, relationship missing type or path break type; Dynamically generate reasoning completion prompt content according to the reasoning gap type and query intention. The completion prompt includes the reasoning start entity, end entity, context relationship requirements, reasoning hop limit, and expected reasoning target description; Input the completion prompt content into the reasoning engine, limit the reasoning scope to the entity types and relationship categories supported by the current knowledge graph structure, generate multiple relay node candidates, and each relay node candidate is attached with a relationship description path corresponding to the start entity and end entity; For each relay node candidate, calculate the comprehensive evaluation score by weighted calculation based on the confidence score of reasoning rationality, relationship coherence test, entity context consistency analysis, and existing connection verification of the knowledge graph; Select the relay node with the highest comprehensive evaluation score as the formal filling node in the process of reasoning chain completion.
[0047] The present invention can construct a complete reasoning chain according to the query intention target for the candidate entity set that passes the two-way verification, and in the process of reasoning chain expansion, it can detect the connectivity between entity nodes in real time. When a reasoning chain break occurs, that is, there is no connection path that meets the hop limit and semantic consistency requirements, the present invention introduces a large model reasoning gap completion mechanism to dynamically generate appropriate relay nodes to insert and complete, realizing the coherent expansion of the reasoning chain. Compared with the existing method that only relies on the existing structure of the knowledge graph to forcibly expand or interrupt the reasoning chain, the present invention can effectively repair the reasoning chain break problem caused by sparse knowledge base, entity naming heterogeneity or missing implicit relationships through reasoning gap completion, significantly improving the connectivity and integrity of the reasoning chain, and ensuring that the intelligent question answering system can complete end-to-end reasoning and answer generation in complex query scenarios.
[0048] During the process of filling the reasoning gap, the present invention dynamically generates reasoning completion prompts by combining the standardized names, context descriptions, and historical path information of the entities at both ends of the reasoning gap, guides the controlled reasoning of the large model, generates multiple candidate relay nodes, and based on the confidence level of reasoning rationality, relationship consistency verification, and entity context matching scores, screens the optimal relay node as the formal completion node. Through this controlled completion and fine screening process, the present invention not only ensures the semantic rationality and reasoning path logic after the repair of the reasoning chain, but also effectively suppresses the reasoning noise caused by the introduction of irrelevant nodes, further improving the interpretability, answer accuracy, and user trust of the system's reasoning process.
[0049] S7. Generate and output the final reasoning-based answer based on the complete reasoning chain.
[0050] In this embodiment, the above-mentioned S7 specifically includes: Receive the complete reasoning chain after bidirectional verification and reasoning gap filling, and extract the entity nodes, the relationships between entity nodes, and the reasoning path confidence information in the complete reasoning chain; According to the starting entity and the ending entity of the complete reasoning chain, combined with the question type and target direction in the query intention, determine the reasoning focus and answer style for answer generation, including whether to focus on the final answer or whether to display the complete reasoning process; Based on the complete reasoning chain, expand the reasoning steps hop by hop in the order of entity nodes and relationship nodes to form a set of reasoning path descriptions. The reasoning path descriptions in the set of reasoning path descriptions include each entity transformation and relationship description; Based on the set of reasoning path descriptions, dynamically construct the structure of the reasoning-based answer, select an appropriate answer template, and fuse the information of the complete reasoning chain to generate a draft reasoning-based answer that conforms to the natural language expression specification; On the basis of the draft reasoning-based answer, perform answer optimization processing, including improving language fluency, adjusting context coherence, verifying logical consistency, and generating visual information annotation of the reasoning process according to the requirements of the query intention; Output the final text of the reasoning-based answer, and attach the interpretability annotation information of the reasoning chain.
[0051] The present invention organizes the reasoning process through reasoning path description fragments and dynamically constructs an inference-based answer structure, which can adaptively select various answer styles such as concise answers, narrative of the reasoning process, or display of detailed reasoning chains according to different query intents. At the same time, during the answer generation process, the present invention performs natural language optimization processing, including improving language fluency, strengthening context coherence, and verifying semantic consistency, ensuring that the generated inference-based answer is not only logically reasonable and clearly expressed but also has a good user reading experience. Finally, the inference-based answer text output by the system is accompanied by complete structured annotation information of the reasoning chain, providing a traceable and verifiable reasoning basis for users, greatly improving the credibility and professionalism of the system's answers, and further enhancing users' trust and satisfaction with the intelligent question-answering system.
[0052] In this embodiment, the intelligent question-answering system for traffic engineering large model based on knowledge graph includes: A query parsing module, configured to receive a natural language query statement, extract structured degree features, semantic ambiguity features, and context correlation features, and generate query intent representation features; A retrieval path decision module, configured to generate a retrieval intent vector according to the query intent representation features, and dynamically select a knowledge graph retrieval path, a vector database retrieval path, or a hybrid collaborative retrieval path through an intent classification model; A retrieval input construction module, configured to generate a structured query statement based on entity recognition and relationship extraction under the knowledge graph retrieval path, and generate a semantic vector based on context-aware word segmentation and semantic encoding under the vector database retrieval path; A hybrid retrieval execution module, configured to, under the hybrid collaborative retrieval path, perform entity linking and relationship reasoning in the knowledge graph based on the structured query statement to obtain a first retrieval result, and perform similarity retrieval in the vector database based on the semantic vector to obtain a second retrieval result; A two-way verification module, configured to perform two-way verification on the first retrieval result and the second retrieval result according to entity consistency, semantic similarity, and relationship connectivity indicators, and filter out a candidate result set that passes the two-way verification; A reasoning chain construction module, configured to construct a reasoning chain based on the candidate result set that passes the two-way verification, detect the connectivity of the reasoning chain, and if there is a reasoning gap, call the large model reasoning gap filling mechanism to generate a relay node and insert it into the reasoning chain gap position to form a complete reasoning chain; A large model reasoning gap filling module, configured to extract the context and historical path information of the entities at both ends of the reasoning gap, generate a filling prompt, call the large model to generate a candidate set of relay nodes, and comprehensively evaluate based on reasoning rationality confidence, relationship coherence, and context consistency, and select the relay node with the highest score for reasoning chain filling; The inferential answer generation module is used to parse the inference path steps based on the complete inference chain, determine the answer focus and style in combination with the query intention, generate a set of inference path descriptions, perform natural language optimization processing, integrate the inference chain information to generate the final inferential answer text, and attach the interpretability annotation information of the inference chain, and output it to the user interface.
[0053] In the retrieval input construction module of the present invention, a structured query statement or a deep semantic vector can be accurately generated according to the retrieval path requirements, and combined with the hybrid retrieval execution module, the complementary advantages of knowledge inference and semantic similarity retrieval are fully utilized, effectively improving the recall rate and accuracy of the retrieval results. Through the bidirectional verification module, the system comprehensively considers the entity consistency, semantic similarity and relationship connectivity indicators, and screens the highly credible candidate entities in the dual-path retrieval results, greatly improving the correctness and stability of the inference chain construction. Aiming at the problem of broken inference chains, the present invention introduces a large model inference gap filling mechanism, which can dynamically generate relay nodes to repair the chain breakpoints, ensuring the coherence and integrity of the inference process. Finally, based on the complete inference chain, the system dynamically generates the inferential answer text and attaches the inference chain structure annotation information, significantly enhancing the interpretability, credibility and user experience of the answer.
[0054] Embodiment 1: To verify the actual application effect of the present invention, the present invention was actually deployed and applied in the integrated transportation data service platform of the Provincial Transportation Planning and Research Institute of Province H (referred to as "H Transportation Planning Institute"). The H Transportation Planning Institute is responsible for urban transportation travel planning, traffic facility layout optimization and traffic information service system construction within the province, and has accumulated a large amount of structured traffic facility data, road network topology data, as well as unstructured travel survey reports, traffic policy documents and historical traffic operation monitoring data. However, due to the complex data types, diverse term expressions and high real-time requirements, traditional question-answering systems based on keyword retrieval or static rule inference generally have problems such as inaccurate retrieval, broken inference chains, and lagging knowledge updates in scenarios such as intelligent travel consultation and traffic planning auxiliary decision-making, and it is difficult to meet the intelligent needs of the current transportation integration construction.
[0055] To address the above problems, the H Transportation Planning Institute introduced the knowledge graph-based intelligent question-answering system for traffic engineering of the present invention into its intelligent transportation question-answering platform. The system is deployed in the provincial data center and is supported by an AI computing cluster composed of 80 GPU nodes. The present invention custom-built a traffic knowledge graph, covering six categories of entities including road nodes, bus stops, rail transit lines, transportation hubs, planning policy documents, and congestion level assessment criteria, established more than 400,000 entity relationships, and constructed a traffic semantic vector database based on the province's travel survey data, trajectory data and traffic operation monitoring reports in the past five years, with the vector entry scale exceeding 6 million.
[0056] In a real-world application scenario, a transportation planner enters a natural language query, such as "Which bus routes should be located near the G107 National Highway expansion and reconstruction section in the next three years?" The system first extracts query intent features through the query parsing module, identifying the question as moderately structured, with moderate semantic ambiguity and high contextual relevance. The search path decision module, based on the intent classification model, determines the appropriate hybrid collaborative search path, triggering both a knowledge graph search and a vector database search. Using "G107 National Highway expansion and reconstruction section" as the starting entity node in the knowledge graph, the system infers associated transportation hub nodes, existing bus route nodes, and planning adjustment policy nodes, establishing a preliminary inference chain linking the road-bus station-route adjustment relationship. The vector database then retrieves transportation planning reports and research materials with high similarity to the keywords "national highway expansion and reconstruction," "bus planning adjustment," and "new bus route demand." The bidirectional verification module selects a set of high-quality candidate entities based on entity consistency, semantic similarity (preset threshold 0.75), and inference chain connectivity (maximum 3 hops). For breaks in the reasoning chain, such as the lack of direct connection between the road reconstruction and expansion section and the newly added bus stops, the system calls the large model reasoning completion mechanism and generates the relay node "Proposal for Reasonable Layout of New Stations 2024 Edition" based on contextual reasoning to complete the reasoning chain closure.
[0057] After the system was launched on the H Traffic Planning Institute platform, it ran continuously for five months, processing a total of 15,800 natural language travel consultation and planning assistance requests. The average response time was reduced from 12.5 seconds on the traditional system to 4.1 seconds, and the search accuracy rate increased to 94.7%. To truly reflect the application's effectiveness, key data is summarized in Table 1 below.
[0058] Table 1 Application effect report of H Traffic Planning Institute's intelligent traffic question-answering system ; As can be seen from Table 1, after the deployment of the present invention, significant improvements have been achieved in core indicators such as the number of consultations, response speed, answer accuracy, and reasoning chain coherence. For example, in a complex actual query "Suggestions for optimizing the traffic organization of the S232 Provincial Road connecting the urban sub-center before 2025?", the system can automatically infer the urban sub-center development plan node, the S232 traffic flow change node, and the future bus expansion plan node, generate a multi-hop reasoning chain, and finally derive traffic optimization suggestions, and attach a reasoning chain structure diagram for expert review. For another example, in the query freely entered by citizens, "How to connect to the bus near the newly built subway station?", the system can recognize the "connection" intention, infer and recommend specific and feasible bus route adjustment plans, and at the same time cite the latest urban transportation special planning documents as supporting evidence.
[0059] During the application of the system, the rationality evaluation criteria for the inference chain (including the weighted average score of path confidence) were dynamically adjusted. Eventually, the average score of each inference chain path reached 0.87, effectively ensuring the logic of the inference process and the authority of the answer output. In the inference-based answer text, the display rate of the inference path reached 100%, greatly enhancing the trust of traffic professionals and the decision-making reference value. By deploying the present invention, H Traffic Planning and Research Institute has achieved remarkable results in the fields of traffic planning auxiliary decision support, intelligent travel information Q&A services, policy analysis and inference applications, etc., providing solid support for the construction of traffic informatization intelligent services.
[0060] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention, according to the technical solution and inventive concept of the present invention, making equivalent substitutions or changes, shall be covered by the protection scope of the present invention.
Claims
1. An intelligent question-answering method for a large traffic engineering model based on a knowledge graph, characterized in that, It includes the following steps: S1. Receive the natural language query statement input by the user, parse the natural language query statement, and extract the structural degree feature, semantic ambiguity feature, and context correlation feature as the query intention representation features; S2. Generate a retrieval intention vector according to the query intention representation features, and dynamically select a retrieval path through a preset intention classification model; S3. Based on the query intention representation features, construct a structured query statement corresponding to the knowledge graph retrieval path and a semantic vector corresponding to the vector database retrieval path respectively according to the retrieval path requirements; S4. When adopting a hybrid collaborative retrieval path, perform entity linking and relationship reasoning in the knowledge graph based on the structured query statement respectively to obtain a first retrieval result, and perform similarity retrieval in the vector database based on the semantic vector to obtain a second retrieval result; S5. According to the entity consistency, semantic similarity, and relationship connectivity indicators, perform two-way verification on the first retrieval result and the second retrieval result, and filter out the candidate result set that passes the two-way verification; S6. Construct an inference chain for the candidate result set. If there is a break in the inference chain, generate relay nodes based on the large model inference gap filling mechanism to form a complete inference chain; S7. Generate a final inference formula answer and output it based on the complete inference chain.
2. The intelligent question-answering method for the traffic engineering large model based on the knowledge graph according to claim 1, wherein The specific content of S2 includes: S21. According to the query intention representation features, adopt a segmented quantization coding method for the structural degree feature, map different structural levels to discrete vectors, adopt a normalized numerical coding method for the semantic ambiguity feature, normalize the ambiguity value to the standard interval to generate a vector, and adopt a sliding window statistical coding method for the context correlation feature to extract the context continuity feature vector, and generate the first sub-feature vector, the second sub-feature vector, and the third sub-feature vector respectively; S22. Concatenate the first sub-feature vector, the second sub-feature vector, and the third sub-feature vector in the order of the structural degree feature, the semantic ambiguity feature, and the context correlation feature to form a unified multi-dimensional combined feature vector. The vector concatenation method is linear concatenation in a fixed order according to the feature category; S23. Perform Min-Max normalization processing on the multi-dimensional combined feature vector, scale each dimension value to the interval [0,1], and then perform feature transformation on the normalized multi-dimensional combined feature vector by means of linear mapping through a linear feature mapping function to obtain a retrieval intention vector; S24. Input the retrieval intention vector into the intention classification model, classify the retrieval intention vector through the intention classification model, and determine the retrieval path corresponding to the natural language query statement according to the classification result. The retrieval path includes a knowledge graph retrieval path, a vector database retrieval path, and a hybrid collaborative retrieval path.
3. The intelligent question-answering method for the traffic engineering large model based on the knowledge graph according to claim 2, wherein The intention classification model is a shallow neural network classifier: Receive the retrieval intention vector as input, where the retrieval intention vector retains the structural degree feature value, the semantic ambiguity feature value, and the context correlation feature score as dimension information; Input the retrieval intention vector into the first linear transformation layer for feature compression, and output the first hidden feature vector; Perform a non-linear transformation on the first hidden feature vector using the ReLU activation function to obtain the activated feature vector; Input the activated feature vector into the second linear transformation layer, and perform matrix multiplication with the weight matrix of the second linear transformation layer and stack the bias vector to extract the combined feature that integrates the structural degree feature, semantic ambiguity feature, and context correlation feature, and output the classification feature vector; Perform Softmax normalization on the classification feature vector to generate a three-class probability distribution, corresponding to the knowledge graph retrieval path, vector database retrieval path, and hybrid collaborative retrieval path respectively; Based on the structural degree feature value, semantic ambiguity feature value, and context correlation feature score retained in the retrieval intention vector, assist in determining the retrieval path according to the following classification criteria: When the structural degree feature value is greater than 0.7 and the semantic ambiguity feature value is less than 0.3, it is classified as the knowledge graph retrieval path; When the structural degree feature value is less than 0.4 and the semantic ambiguity feature value is greater than 0.6, it is classified as the vector database retrieval path; When the structural degree feature value is between 0.4 and 0.7, the semantic ambiguity feature value is between 0.3 and 0.6, and the context correlation feature score is greater than 0.5, it is classified as the hybrid collaborative retrieval path; When the structural degree feature value, semantic ambiguity feature value, and context correlation feature score do not meet the classification criteria, prompt that there is no relevant retrieval content.
4. The intelligent question-answering method for the traffic engineering large model based on the knowledge graph according to claim 1, characterized in that, The specific steps of S3 are as follows: S31. When the retrieval path is the knowledge graph retrieval path, based on the query intention representation feature, parse the natural language query statement, perform entity recognition operations, and extract the entity terms with clear semantic references in the natural language query statement; S32. For the natural language query statement, identify the relationship phrases between entity terms, and combine with the preset pattern library of the knowledge graph to construct a preliminary triple set of entity-relationship-entity; S33. Perform standardization processing on the preliminary triple set, including performing standardized name mapping on entity nodes and applying synonym relationship extension rules to relationship edges to form a structured query statement that conforms to the knowledge graph query specification; S34. When the retrieval path is the vector database retrieval path, based on the query intention representation feature, perform BiLSTM-CRF context-aware word segmentation processing on the natural language query statement, remove stop words, and extract the keyword set; S35. Encode the keyword set using a bidirectional context-aware mechanism to generate a preliminary semantic vector that can represent the deep semantic features of the query statement; S36. Perform normalization processing and vector space mapping on the preliminary semantic vector to obtain the semantic vector for vector database retrieval; S37. When the retrieval path is the hybrid collaborative retrieval path, simultaneously execute S31 to S33 to generate a structured query statement, and execute S34 to S36 to generate a semantic vector.
5. The intelligent question-answering method for the traffic engineering large model based on the knowledge graph according to claim 1, characterized in that, The process of obtaining the first retrieval result is as follows: Receive the structured query statement, parse the query target entity, query condition relationship, and target entity type in the query statement as the starting point of retrieval reasoning, reasoning path constraint, and target node screening basis; Based on the knowledge graph entity index library, entity linking is performed on the query target entity. By combining entity name similarity matching and entity attribute cross-verification, the corresponding starting entity node in the knowledge graph is determined, and the entity mapping relationship between the query statement and the knowledge graph is established; Taking the successfully linked starting entity node as the starting point, according to the query condition relationship, relationship extension reasoning is carried out in the knowledge graph starting from the starting entity. Multi-hop extension is allowed during the reasoning process, and each hop of reasoning needs to meet the requirement of relationship semantic consistency; During the reasoning process, for each extended reasoning path, the path confidence score is calculated. The path confidence comprehensively considers the relationship semantic matching degree, path hop penalty factor, and node connection weight. The reasoning paths with path confidence scores lower than the preset threshold are dynamically pruned; For the set of end entity nodes of all reasoning paths filtered by confidence, further screening is performed according to the target entity type requirements, and the entity nodes that do not match the target entity type are excluded; The set of entity nodes after further screening is used as the first retrieval result.
6. The intelligent question-answering method of the traffic engineering large model based on the knowledge graph according to claim 1, characterized in that The process of obtaining the second retrieval result is as follows: Receive the semantic vector generated by the query intent characterization feature as the query vector for vector database retrieval; Input the query vector into the vector database index, and based on the preset vector inverted index mechanism, quickly locate the candidate vector set adjacent to the query vector semantic space; For the query vector and each vector in the candidate vector set, the cosine similarity measurement method is used to calculate the similarity, and the similarity score between each candidate vector in the candidate vector set and the query vector is obtained; Based on the similarity score, the candidate vectors with scores higher than the preset similarity threshold are screened out to form the first round of similar candidate sets; On the basis of the first round of similar candidate sets, through the context relevance reordering mechanism, weighted sorting is performed according to the occurrence frequency and association strength of the candidate entities in the original context to generate the final candidate set; The entity nodes or document objects corresponding to the final candidate set are used as the second retrieval result.
7. The intelligent question-answering method for the traffic engineering large model based on the knowledge graph according to claim 1, wherein The specific steps of S5 are as follows: S51. Receive the first retrieval result and the second retrieval result, and extract the standardized name, context semantic representation, and knowledge graph entity node identifier of each entity respectively; S52. Based on the standardized name matching, for each entity in the first retrieval result, retrieve the entity nodes in the second retrieval result with the same or semantically similar standardized names to form the preliminary entity consistency matching pairs; S53. For the preliminary entity consistency matching pairs, extract the corresponding context semantic representations, and by calculating the cosine similarity between the semantic vectors, screen out the matching pairs with similarity scores higher than the first preset threshold, and mark them as passed the semantic similarity verification; S54. For the matching pairs that pass the semantic similarity verification, perform connectivity verification based on the knowledge graph relationship network, retrieve the shortest path between the two entity nodes, and when there is a connected path with the number of hops not exceeding the preset maximum number of hops and the path semantics conforming to the reasoning relationship constraints, it is determined that the relationship connectivity verification is passed; S55. Use the set of entity nodes that pass all of the entity consistency verification, semantic similarity verification, and relationship connectivity verification as the candidate result set that passes the two-way verification.
8. The intelligent question-answering method of the traffic engineering large model based on the knowledge graph according to claim 1, characterized in that, The specific steps of S6 are as follows: S61. Receive the candidate result set that passes the two-way verification, and extract the starting entity and the ending entity according to the reasoning goal in the query intent as the starting and ending nodes for constructing the reasoning chain. S62. Based on the existing relationship network of the knowledge graph, starting from the starting entity, expand the reasoning chain hop by hop along the relationship path that matches the query intent semantically, and preferentially select the relationship edges with high path confidence to attempt to gradually connect to the ending entity. S63. During the expansion of the reasoning chain, detect the connectivity between adjacent entity nodes in real time. When there is no connection path that satisfies semantic consistency and hop count limit in a certain expansion step, record this position as the reasoning gap and pause the expansion of the current reasoning chain. S64. For each reasoning gap, extract the context information, existing path information, and reasoning intent constraint conditions of the entities at both ends of the reasoning gap as the input of the large model reasoning gap completion mechanism. S65. Through the large model reasoning gap completion mechanism, generate relay nodes that can connect the entities at both ends of the reasoning gap. S66. Insert the selected relay nodes into the reasoning gap position, update the structure of the reasoning chain, and continue the expansion and connection of the reasoning chain until reaching the ending entity. S67. After the reasoning chain is completely connected, confirm the complete reasoning chain based on the confidence score of the overall reasoning path and the semantic consistency verification.
9. The intelligent question-answering method for the traffic engineering large model based on the knowledge graph according to claim 8, characterized in that, The specific steps of the large model reasoning gap completion mechanism are as follows: Extract the standardized names, entity types, context semantic descriptions of the entities at both ends of the reasoning gap, and the historical path information of the current reasoning chain, and combine with the query intent goal to form the input data set for reasoning gap completion. Analyze the type of the reasoning gap, and based on the entities at both ends of the reasoning gap and the historical path information, identify whether the reasoning gap belongs to the entity missing type, relationship missing type, or path break type. Dynamically generate reasoning completion prompt content according to the reasoning gap type and the query intent. The completion prompt includes the starting entity of the reasoning, the ending entity, the context relationship requirements, the reasoning hop count limit, and the description of the expected reasoning goal. Input the completion prompt content into the reasoning engine, limit the reasoning scope to the entity types and relationship categories supported by the current knowledge graph structure, and generate multiple relay node candidates, each of which is accompanied by the relationship description path corresponding to the starting entity and the ending entity. For each relay node candidate, calculate the comprehensive evaluation score through weighted calculation based on the confidence score of reasoning rationality, relationship coherence test, entity context consistency analysis, and existing connection verification of the knowledge graph. Select the relay node with the highest comprehensive evaluation score as the formal filling node in the process of reasoning chain completion.
10. The intelligent Q&A system of the traffic engineering large model based on the knowledge graph according to any one of claims 1-9, characterized in that, It includes: A query parsing module for receiving natural language query statements, extracting the structural degree feature, semantic ambiguity feature, and context association feature, and generating query intent representation features. The retrieval path decision module is used to generate a retrieval intention vector based on the query intention characterization features, and dynamically select a knowledge graph retrieval path, a vector database retrieval path, or a hybrid collaborative retrieval path through an intention classification model; The retrieval input construction module is used to generate a structured query statement based on entity recognition and relationship extraction under the knowledge graph retrieval path, and generate a semantic vector based on context-aware word segmentation and semantic encoding under the vector database retrieval path; The hybrid retrieval execution module is used to, under the hybrid collaborative retrieval path, perform entity linking and relationship reasoning in the knowledge graph based on the structured query statement to obtain a first retrieval result, and perform similarity retrieval in the vector database based on the semantic vector to obtain a second retrieval result; The bidirectional verification module is used to bidirectionally verify the first retrieval result and the second retrieval result according to the entity consistency, semantic similarity, and relationship connectivity indicators, and screen out a candidate result set that passes the bidirectional verification; The inference chain construction module is used to construct an inference chain based on the candidate result set that passes the bidirectional verification, detect the connectivity of the inference chain. If there is an inference gap, it calls the large model inference gap filling mechanism to generate a relay node and inserts it into the inference chain gap position to form a complete inference chain; The large model inference gap filling module is used to extract the context and historical path information of the entities at both ends of the inference gap, generate a filling prompt, call the large model to infer and generate a candidate set of relay nodes, and comprehensively evaluate based on the inference rationality confidence, relationship coherence, and context consistency, and screen out the relay node with the highest score for inference chain filling; The inference-based answer generation module is used to parse the inference path steps based on the complete inference chain, determine the answer focus and style in combination with the query intention, generate a set of inference path descriptions, perform natural language optimization processing, fuse the inference chain information to generate the final inference-based answer text, and attach the inference chain interpretability annotation information and output it to the user interface.
Citation Information
Patent Citations
Medical auxiliary question and answer method and system based on knowledge calibration and retrieval enhancement
CN117573843A
Intelligent question and answer method and device, electronic equipment and storage medium
CN119357319A
Semantic search method for identifying user intention based on AI and storage medium
CN119621954A
LLM-based NL2API and NL2SQL fused AI question-answering system and method
CN119829727A
Knotarization intelligent question and answer customer service method and system based on knowledge graph
CN119938816A
Cited By
Rainwater condition intelligent interaction service platform based on large language model
CN120596642A
Intelligent agent interpretable retrieval path generation system and verification method
CN120654839A
Knowledge retrieval candidate library generation method and system based on incremental pre-training optimization
CN120670565A
Knowledge-guided large language model causal reasoning method and system
CN120725161A
Resource recommendation method and system based on hybrid retrieval RAG
CN120780916A